summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Heinemann <stefan.heinemann@codedump.ch>2015-03-11 15:10:04 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-31 12:33:02 +0200
commit33f1e29cb91f70e52c1af6ae33491c667b5225a6 (patch)
treef479bd5faeedf0e6d153a9ace89c924d63ea7bb9
parentbc1e32d6b8f5df9cf55a110bfcf3331a6756673e (diff)
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
-rw-r--r--cui/source/options/optinet2.cxx120
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs6
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Security.xcs12
-rw-r--r--sw/source/uibase/app/docsh2.cxx4
4 files changed, 110 insertions, 32 deletions
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index b7903817c635..782523d50f61 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -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
{
friend class SvxEMailTabPage;
@@ -938,7 +1026,6 @@ class MailerProgramCfg_Impl : public utl::ConfigItem
OUString sProgram;
// readonly states
bool bROProgram;
- bool bHidden;
const Sequence<OUString> GetPropertyNames();
@@ -974,12 +1061,6 @@ MailerProgramCfg_Impl::MailerProgramCfg_Impl() :
bROProgram = pROStates[nProp];
}
break;
- case 1 :
- {
- pValues[nProp] >>= bHidden;;
-
- }
- break;
}
}
}
@@ -995,10 +1076,9 @@ MailerProgramCfg_Impl::~MailerProgramCfg_Impl()
const Sequence<OUString> MailerProgramCfg_Impl::GetPropertyNames()
{
- Sequence<OUString> aRet(2);
+ Sequence<OUString> aRet(1);
OUString* pRet = aRet.getArray();
pRet[0] = "Program";
- pRet[1] = "Hidden";
return aRet;
}
@@ -1027,13 +1107,6 @@ void MailerProgramCfg_Impl::ImplCommit()
}
}
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
struct SvxEMailTabPage_Impl
{
MailerProgramCfg_Impl aMailConfig;
+ RemoveHiddenContentCfg_Impl aHiddenContentConfig;
};
SvxEMailTabPage::SvxEMailTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
@@ -1085,15 +1159,17 @@ SfxTabPage* SvxEMailTabPage::Create( vcl::Window* pParent, const SfxItemSet* rA
bool SvxEMailTabPage::FillItemSet( SfxItemSet* )
{
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.bHidden = m_pSuppressHidden->GetState();
bMailModified = true;
}
if ( bMailModified )
pImpl->aMailConfig.Commit();
+ pImpl->aHiddenContentConfig.bHideContent = m_pSuppressHidden->IsChecked();
+ pImpl->aHiddenContentConfig.Commit();
+
return false;
}
@@ -1110,13 +1186,9 @@ void SvxEMailTabPage::Reset( const SfxItemSet* )
m_pMailerURLED->SetText(pImpl->aMailConfig.sProgram);
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_pSuppressHidden->Check(pImpl->aHiddenContentConfig.bHideContent);
}
/* -------------------------------------------------------------------------*/
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index abfa4044442c..b613d3f4d176 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6394,12 +6394,6 @@
</info>
<value/>
</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 oor:name="I18N">
<info>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Security.xcs b/officecfg/registry/schema/org/openoffice/Office/Security.xcs
index 7fe78b9fdcf7..9b4374aa057c 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Security.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Security.xcs
@@ -49,5 +49,17 @@
</info>
</prop>
</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>
</oor:component-schema>
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 75baf6cb5782..f766cc69d449 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -115,7 +115,7 @@
#include <com/sun/star/script/vba/VBAEventId.hpp>
#include <editeng/acorrcfg.hxx>
#include <SwStyleNameMapper.hxx>
-#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Security.hxx>
#include <sfx2/fcontnr.hxx>
@@ -838,7 +838,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
mpDoc->getIDocumentLinksAdministration().EmbedAllLinks();
mbRemovedInvisibleContent
- = officecfg::Office::Common::ExternalMailer::Hidden::get();
+ = officecfg::Office::Security::HiddenContent::RemoveHiddenContent::get();
if(mbRemovedInvisibleContent)
mpDoc->RemoveInvisibleContent();
if(mpWrtShell)