Kaydet (Commit) 33f1e29c authored tarafından Stefan Heinemann's avatar Stefan Heinemann Kaydeden (comit) Stephan Bergmann

tdf#87441: Adjustable hidden content removal in e-mails

Possibility to adjust the hidden content behaviour in the send e-mail
functionality via option under the e-mail program setting

Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, taking just the parts
that store the configuration property within /org.openoffice.Office/Security
(rather than /org.openoffice.Office/Common/ExternalMailer) and throwing away
the parts overlapping with previously picked
<https://gerrit.libreoffice.org/#/c/14994/> "fdo#87441-Send document as Email
removes invisible content."  Plus making the configuration property
non-nillable, -Werror,-Winconsistent-missing-override, loplugin:salbool, and
removal of trailing whitespace.

Conflicts:
	cui/source/options/optinet2.cxx
	cui/source/options/optinet2.hxx
	cui/uiconfig/ui/optemailpage.ui
	sw/source/uibase/app/docsh2.cxx

Change-Id: I1fb70418c5fe8011a86a379c2e75eae9ad3e18c3
üst bc1e32d6
...@@ -931,6 +931,94 @@ void SvxSecurityTabPage::Reset( const SfxItemSet* ) ...@@ -931,6 +931,94 @@ void SvxSecurityTabPage::Reset( const SfxItemSet* )
{ {
} }
/*--------------------------------------------------------------------*/
class RemoveHiddenContentCfg_Impl : public utl::ConfigItem
{
friend class SvxEMailTabPage;
bool bHideContent;
const Sequence<OUString> GetPropertyNames();
virtual void ImplCommit() SAL_OVERRIDE;
public:
RemoveHiddenContentCfg_Impl();
virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames) SAL_OVERRIDE;
};
/* -------------------------------------------------------------------------*/
RemoveHiddenContentCfg_Impl::RemoveHiddenContentCfg_Impl() :
utl::ConfigItem("Office.Security/HiddenContent"),
bHideContent(true)
{
const Sequence< OUString > aNames = GetPropertyNames();
const Sequence< Any > aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
for(sal_Int32 nProp = 0; nProp < aValues.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
{
switch(nProp)
{
case 0:
{
pValues[nProp] >>= bHideContent;
}
break;
}
}
}
}
/* -------------------------------------------------------------------------*/
const Sequence<OUString> RemoveHiddenContentCfg_Impl::GetPropertyNames() {
Sequence<OUString> aRet(1);
OUString* pRet = aRet.getArray();
pRet[0] = "RemoveHiddenContent";
return aRet;
}
/* -------------------------------------------------------------------------*/
void RemoveHiddenContentCfg_Impl::ImplCommit()
{
const Sequence< OUString > aOrgNames = GetPropertyNames();
sal_Int32 nOrgCount = aOrgNames.getLength();
Sequence< OUString > aNames(nOrgCount);
Sequence< Any > aValues(nOrgCount);
sal_Int32 nRealCount = 0;
for(int nProp = 0; nProp < nOrgCount; nProp++)
{
switch(nProp)
{
case 0:
{
aNames[nRealCount] = aOrgNames[nProp];
aValues[nRealCount] <<= bHideContent;
++nRealCount;
}
break;
}
}
aNames.realloc(nRealCount);
aValues.realloc(nRealCount);
PutProperties(aNames, aValues);
}
/* -------------------------------------------------------------------------*/
void RemoveHiddenContentCfg_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
{
}
class MailerProgramCfg_Impl : public utl::ConfigItem class MailerProgramCfg_Impl : public utl::ConfigItem
{ {
friend class SvxEMailTabPage; friend class SvxEMailTabPage;
...@@ -938,7 +1026,6 @@ class MailerProgramCfg_Impl : public utl::ConfigItem ...@@ -938,7 +1026,6 @@ class MailerProgramCfg_Impl : public utl::ConfigItem
OUString sProgram; OUString sProgram;
// readonly states // readonly states
bool bROProgram; bool bROProgram;
bool bHidden;
const Sequence<OUString> GetPropertyNames(); const Sequence<OUString> GetPropertyNames();
...@@ -974,12 +1061,6 @@ MailerProgramCfg_Impl::MailerProgramCfg_Impl() : ...@@ -974,12 +1061,6 @@ MailerProgramCfg_Impl::MailerProgramCfg_Impl() :
bROProgram = pROStates[nProp]; bROProgram = pROStates[nProp];
} }
break; break;
case 1 :
{
pValues[nProp] >>= bHidden;;
}
break;
} }
} }
} }
...@@ -995,10 +1076,9 @@ MailerProgramCfg_Impl::~MailerProgramCfg_Impl() ...@@ -995,10 +1076,9 @@ MailerProgramCfg_Impl::~MailerProgramCfg_Impl()
const Sequence<OUString> MailerProgramCfg_Impl::GetPropertyNames() const Sequence<OUString> MailerProgramCfg_Impl::GetPropertyNames()
{ {
Sequence<OUString> aRet(2); Sequence<OUString> aRet(1);
OUString* pRet = aRet.getArray(); OUString* pRet = aRet.getArray();
pRet[0] = "Program"; pRet[0] = "Program";
pRet[1] = "Hidden";
return aRet; return aRet;
} }
...@@ -1027,13 +1107,6 @@ void MailerProgramCfg_Impl::ImplCommit() ...@@ -1027,13 +1107,6 @@ void MailerProgramCfg_Impl::ImplCommit()
} }
} }
break; break;
case 1:
{
aNames[nRealCount] = aOrgNames[nProp];
aValues[nRealCount] <<= bHidden;;
++nRealCount;
}
break;
} }
} }
...@@ -1051,6 +1124,7 @@ void MailerProgramCfg_Impl::Notify( const com::sun::star::uno::Sequence< OUStrin ...@@ -1051,6 +1124,7 @@ void MailerProgramCfg_Impl::Notify( const com::sun::star::uno::Sequence< OUStrin
struct SvxEMailTabPage_Impl struct SvxEMailTabPage_Impl
{ {
MailerProgramCfg_Impl aMailConfig; MailerProgramCfg_Impl aMailConfig;
RemoveHiddenContentCfg_Impl aHiddenContentConfig;
}; };
SvxEMailTabPage::SvxEMailTabPage(vcl::Window* pParent, const SfxItemSet& rSet) SvxEMailTabPage::SvxEMailTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
...@@ -1085,15 +1159,17 @@ SfxTabPage* SvxEMailTabPage::Create( vcl::Window* pParent, const SfxItemSet* rA ...@@ -1085,15 +1159,17 @@ SfxTabPage* SvxEMailTabPage::Create( vcl::Window* pParent, const SfxItemSet* rA
bool SvxEMailTabPage::FillItemSet( SfxItemSet* ) bool SvxEMailTabPage::FillItemSet( SfxItemSet* )
{ {
bool bMailModified = false; bool bMailModified = false;
if((!pImpl->aMailConfig.bROProgram && m_pMailerURLED->IsValueChangedFromSaved()) || m_pSuppressHidden->IsValueChangedFromSaved()) if(!pImpl->aMailConfig.bROProgram && m_pMailerURLED->IsValueChangedFromSaved())
{ {
pImpl->aMailConfig.sProgram = m_pMailerURLED->GetText(); pImpl->aMailConfig.sProgram = m_pMailerURLED->GetText();
pImpl->aMailConfig.bHidden = m_pSuppressHidden->GetState();
bMailModified = true; bMailModified = true;
} }
if ( bMailModified ) if ( bMailModified )
pImpl->aMailConfig.Commit(); pImpl->aMailConfig.Commit();
pImpl->aHiddenContentConfig.bHideContent = m_pSuppressHidden->IsChecked();
pImpl->aHiddenContentConfig.Commit();
return false; return false;
} }
...@@ -1110,13 +1186,9 @@ void SvxEMailTabPage::Reset( const SfxItemSet* ) ...@@ -1110,13 +1186,9 @@ void SvxEMailTabPage::Reset( const SfxItemSet* )
m_pMailerURLED->SetText(pImpl->aMailConfig.sProgram); m_pMailerURLED->SetText(pImpl->aMailConfig.sProgram);
m_pMailerURLED->SaveValue(); m_pMailerURLED->SaveValue();
if(pImpl->aMailConfig.bHidden)
m_pSuppressHidden->SetState(TRISTATE_TRUE);
else
m_pSuppressHidden->SetState(TRISTATE_FALSE);
m_pSuppressHidden->SaveValue();
m_pMailContainer->Enable(!pImpl->aMailConfig.bROProgram); m_pMailContainer->Enable(!pImpl->aMailConfig.bROProgram);
m_pSuppressHidden->Check(pImpl->aHiddenContentConfig.bHideContent);
} }
/* -------------------------------------------------------------------------*/ /* -------------------------------------------------------------------------*/
......
...@@ -6394,12 +6394,6 @@ ...@@ -6394,12 +6394,6 @@
</info> </info>
<value/> <value/>
</prop> </prop>
<prop oor:name="Hidden" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specifies whether invisible content should be hidden or not.</desc>
</info>
<value>true</value>
</prop>
</group> </group>
<group oor:name="I18N"> <group oor:name="I18N">
<info> <info>
......
...@@ -49,5 +49,17 @@ ...@@ -49,5 +49,17 @@
</info> </info>
</prop> </prop>
</group> </group>
<group oor:name="HiddenContent">
<info>
<author>SH</author>
<desc>Specifies whether to remove the hidden content when sending the document attached to an e-mail</desc>
</info>
<prop oor:name="RemoveHiddenContent" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specify wheter hidden content should be removed when sending via email</desc>
</info>
<value>true</value>
</prop>
</group>
</component> </component>
</oor:component-schema> </oor:component-schema>
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
#include <com/sun/star/script/vba/VBAEventId.hpp> #include <com/sun/star/script/vba/VBAEventId.hpp>
#include <editeng/acorrcfg.hxx> #include <editeng/acorrcfg.hxx>
#include <SwStyleNameMapper.hxx> #include <SwStyleNameMapper.hxx>
#include <officecfg/Office/Common.hxx> #include <officecfg/Office/Security.hxx>
#include <sfx2/fcontnr.hxx> #include <sfx2/fcontnr.hxx>
...@@ -838,7 +838,7 @@ void SwDocShell::Execute(SfxRequest& rReq) ...@@ -838,7 +838,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
mpDoc->getIDocumentLinksAdministration().EmbedAllLinks(); mpDoc->getIDocumentLinksAdministration().EmbedAllLinks();
mbRemovedInvisibleContent mbRemovedInvisibleContent
= officecfg::Office::Common::ExternalMailer::Hidden::get(); = officecfg::Office::Security::HiddenContent::RemoveHiddenContent::get();
if(mbRemovedInvisibleContent) if(mbRemovedInvisibleContent)
mpDoc->RemoveInvisibleContent(); mpDoc->RemoveInvisibleContent();
if(mpWrtShell) if(mpWrtShell)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment