Kaydet (Commit) f14e4cff authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Replace RemoveHiddenContentCfg_Impl with direct configuration access

Change-Id: I422f6f3386419f4ea91c4b3d9c96e759e1361a3a
üst c1a9f443
......@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sal/config.h>
#include <officecfg/Office/Security.hxx>
#include <tools/config.hxx>
#include <vcl/msgbox.hxx>
#include <svl/intitem.hxx>
......@@ -931,94 +934,6 @@ 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;
......@@ -1123,8 +1038,13 @@ void MailerProgramCfg_Impl::Notify( const com::sun::star::uno::Sequence< OUStrin
struct SvxEMailTabPage_Impl
{
SvxEMailTabPage_Impl():
bHideContent(
officecfg::Office::Security::HiddenContent::RemoveHiddenContent::get())
{}
MailerProgramCfg_Impl aMailConfig;
RemoveHiddenContentCfg_Impl aHiddenContentConfig;
bool bHideContent;
};
SvxEMailTabPage::SvxEMailTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
......@@ -1167,8 +1087,15 @@ bool SvxEMailTabPage::FillItemSet( SfxItemSet* )
if ( bMailModified )
pImpl->aMailConfig.Commit();
pImpl->aHiddenContentConfig.bHideContent = m_pSuppressHidden->IsChecked();
pImpl->aHiddenContentConfig.Commit();
if (pImpl->bHideContent != m_pSuppressHidden->IsChecked())
{
pImpl->bHideContent = m_pSuppressHidden->IsChecked();
std::shared_ptr<comphelper::ConfigurationChanges> batch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Security::HiddenContent::RemoveHiddenContent::set(
pImpl->bHideContent, batch);
batch->commit();
}
return false;
}
......@@ -1188,7 +1115,7 @@ void SvxEMailTabPage::Reset( const SfxItemSet* )
m_pMailContainer->Enable(!pImpl->aMailConfig.bROProgram);
m_pSuppressHidden->Check(pImpl->aHiddenContentConfig.bHideContent);
m_pSuppressHidden->Check(pImpl->bHideContent);
}
/* -------------------------------------------------------------------------*/
......
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