summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-17 09:43:45 +0200
committerNoel Grandin <noel@peralex.com>2015-11-17 10:59:48 +0200
commitedc264d1da7d4240c27c9f98efab09e84d78fff3 (patch)
tree1b5c5904b5f965660c045c5c7e16fd70c96b5c34 /unotools
parent85d7a76aba066553b8ecf385f295b1630d50ab8a (diff)
use unique_ptr for pImpl in unotools/
Change-Id: I4128ca0d4ff18f6e0c3c9f8ecad13b69c38c3157
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/misccfg.cxx34
-rw-r--r--unotools/source/config/searchopt.cxx3
-rw-r--r--unotools/source/misc/eventlisteneradapter.cxx2
3 files changed, 18 insertions, 21 deletions
diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx
index faf8fd7f9e80..527b8eb3e86c 100644
--- a/unotools/source/config/misccfg.cxx
+++ b/unotools/source/config/misccfg.cxx
@@ -32,8 +32,9 @@ using namespace com::sun::star::uno;
namespace utl
{
+class SfxMiscCfg;
-static SfxMiscCfg* pOptions = nullptr;
+static SfxMiscCfg* g_pOptions = nullptr;
static sal_Int32 nRefCount = 0;
class SfxMiscCfg : public utl::ConfigItem
@@ -186,69 +187,68 @@ MiscCfg::MiscCfg( )
{
// Global access, must be guarded (multithreading)
::osl::MutexGuard aGuard( LocalSingleton::get() );
- if ( !pOptions )
+ if ( !g_pOptions )
{
- pOptions = new SfxMiscCfg;
+ g_pOptions = new SfxMiscCfg;
ItemHolder1::holdConfigItem(E_MISCCFG);
}
++nRefCount;
- pImpl = pOptions;
- pImpl->AddListener(this);
+ g_pOptions->AddListener(this);
}
MiscCfg::~MiscCfg( )
{
// Global access, must be guarded (multithreading)
::osl::MutexGuard aGuard( LocalSingleton::get() );
- pImpl->RemoveListener(this);
+ g_pOptions->RemoveListener(this);
if ( !--nRefCount )
{
- if ( pOptions->IsModified() )
- pOptions->Commit();
- DELETEZ( pOptions );
+ if ( g_pOptions->IsModified() )
+ g_pOptions->Commit();
+ DELETEZ( g_pOptions );
}
}
bool MiscCfg::IsNotFoundWarning() const
{
- return pImpl->IsNotFoundWarning();
+ return g_pOptions->IsNotFoundWarning();
}
void MiscCfg::SetNotFoundWarning( bool bSet)
{
- pImpl->SetNotFoundWarning( bSet );
+ g_pOptions->SetNotFoundWarning( bSet );
}
bool MiscCfg::IsPaperSizeWarning() const
{
- return pImpl->IsPaperSizeWarning();
+ return g_pOptions->IsPaperSizeWarning();
}
void MiscCfg::SetPaperSizeWarning(bool bSet)
{
- pImpl->SetPaperSizeWarning( bSet );
+ g_pOptions->SetPaperSizeWarning( bSet );
}
bool MiscCfg::IsPaperOrientationWarning() const
{
- return pImpl->IsPaperOrientationWarning();
+ return g_pOptions->IsPaperOrientationWarning();
}
void MiscCfg::SetPaperOrientationWarning( bool bSet)
{
- pImpl->SetPaperOrientationWarning( bSet );
+ g_pOptions->SetPaperOrientationWarning( bSet );
}
sal_Int32 MiscCfg::GetYear2000() const
{
- return pImpl->GetYear2000();
+ return g_pOptions->GetYear2000();
}
void MiscCfg::SetYear2000( sal_Int32 nSet )
{
- pImpl->SetYear2000( nSet );
+ g_pOptions->SetYear2000( nSet );
}
}
diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx
index b1bec8b9a846..5f8cda2be5b9 100644
--- a/unotools/source/config/searchopt.cxx
+++ b/unotools/source/config/searchopt.cxx
@@ -240,13 +240,12 @@ bool SvtSearchOptions_Impl::Save()
}
SvtSearchOptions::SvtSearchOptions()
+ : pImpl( new SvtSearchOptions_Impl )
{
- pImpl = new SvtSearchOptions_Impl;
}
SvtSearchOptions::~SvtSearchOptions()
{
- delete pImpl;
}
void SvtSearchOptions::Commit()
diff --git a/unotools/source/misc/eventlisteneradapter.cxx b/unotools/source/misc/eventlisteneradapter.cxx
index c8f726b24ed3..ef825eab2ad3 100644
--- a/unotools/source/misc/eventlisteneradapter.cxx
+++ b/unotools/source/misc/eventlisteneradapter.cxx
@@ -105,8 +105,6 @@ namespace utl
OEventListenerAdapter::~OEventListenerAdapter()
{
stopAllComponentListening( );
- delete m_pImpl;
- m_pImpl = nullptr;
}
void OEventListenerAdapter::stopComponentListening( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComp )