diff options
author | Xisco Fauli <anistenis@gmail.com> | 2016-06-01 01:53:19 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-01 07:00:16 +0000 |
commit | 2ba7893243fff5d6fbd0b706368877b7a5123569 (patch) | |
tree | 72f74e40674250f3fef485364812bab22f14960e | |
parent | c8ff6e35d6350dace92c8184a03e0524704327d0 (diff) |
tdf#89329: use unique_ptr for pImpl in objface
Change-Id: Ie4d84a7e9958c5291b3a9db7f9e7e019ff27cfbd
Reviewed-on: https://gerrit.libreoffice.org/25750
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | include/sfx2/objface.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/objface.cxx | 60 |
2 files changed, 30 insertions, 32 deletions
diff --git a/include/sfx2/objface.hxx b/include/sfx2/objface.hxx index 9e30197d312f..0ec0938ad164 100644 --- a/include/sfx2/objface.hxx +++ b/include/sfx2/objface.hxx @@ -41,7 +41,7 @@ friend class SfxSlotPool; sal_uInt16 nCount; // number of slots in SlotMap SfxInterfaceId nClassId; // Id of interface bool bSuperClass; // Whether children inherit its toolbars etc - SfxInterface_Impl* pImpData; + std::unique_ptr<SfxInterface_Impl> pImplData; SfxSlot* operator[]( sal_uInt16 nPos ) const; diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index 38ee27667ee0..be06109248d0 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -109,16 +109,15 @@ SfxInterface::SfxInterface( const char *pClassName, pGenoType(pParent), nClassId(nId), bSuperClass(bUsableSuperClass), - pImpData(nullptr) + pImplData(new SfxInterface_Impl) { - pImpData = new SfxInterface_Impl; SetSlotMap( rSlotMap, nSlotCount ); } void SfxInterface::Register( SfxModule* pMod ) { - pImpData->bRegistered = true; - pImpData->pModule = pMod; + pImplData->bRegistered = true; + pImplData->pModule = pMod; if ( pMod ) pMod->GetSlotPool()->RegisterInterface(*this); else @@ -273,9 +272,8 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) SfxInterface::~SfxInterface() { - SfxModule *pMod = pImpData->pModule; - bool bRegistered = pImpData->bRegistered; - delete pImpData; + SfxModule *pMod = pImplData->pModule; + bool bRegistered = pImplData->bRegistered; assert( bRegistered ); if ( bRegistered ) { @@ -361,7 +359,7 @@ const SfxSlot* SfxInterface::GetRealSlot( sal_uInt16 nSlotId ) const void SfxInterface::RegisterPopupMenu( const OUString& rResourceName ) { - pImpData->aPopupName = rResourceName; + pImplData->aPopupName = rResourceName; } void SfxInterface::RegisterObjectBar(sal_uInt16 nPos, sal_uInt32 nResId) @@ -373,7 +371,7 @@ void SfxInterface::RegisterObjectBar(sal_uInt16 nPos, sal_uInt32 nResId, sal_uIn { SfxObjectUI_Impl* pUI = CreateObjectBarUI_Impl(nPos, nResId, nFeature); if ( pUI ) - pImpData->aObjectBars.push_back(pUI); + pImplData->aObjectBars.push_back(pUI); } SfxObjectUI_Impl* CreateObjectBarUI_Impl(sal_uInt16 nPos, sal_uInt32 nResId, sal_uInt32 nFeature) @@ -398,9 +396,9 @@ sal_uInt32 SfxInterface::GetObjectBarId(sal_uInt16 nNo) const nNo = nNo - nBaseCount; } - assert( nNo<pImpData->aObjectBars.size() ); + assert( nNo<pImplData->aObjectBars.size() ); - return pImpData->aObjectBars[nNo]->nResId; + return pImplData->aObjectBars[nNo]->nResId; } sal_uInt16 SfxInterface::GetObjectBarPos( sal_uInt16 nNo ) const @@ -417,17 +415,17 @@ sal_uInt16 SfxInterface::GetObjectBarPos( sal_uInt16 nNo ) const nNo = nNo - nBaseCount; } - assert( nNo<pImpData->aObjectBars.size() ); + assert( nNo<pImplData->aObjectBars.size() ); - return pImpData->aObjectBars[nNo]->nPos; + return pImplData->aObjectBars[nNo]->nPos; } sal_uInt16 SfxInterface::GetObjectBarCount() const { if (pGenoType && pGenoType->UseAsSuperClass()) - return pImpData->aObjectBars.size() + pGenoType->GetObjectBarCount(); + return pImplData->aObjectBars.size() + pGenoType->GetObjectBarCount(); else - return pImpData->aObjectBars.size(); + return pImplData->aObjectBars.size(); } void SfxInterface::RegisterChildWindow(sal_uInt16 nId, bool bContext) @@ -439,12 +437,12 @@ void SfxInterface::RegisterChildWindow(sal_uInt16 nId, bool bContext, sal_uInt32 { SfxObjectUI_Impl* pUI = new SfxObjectUI_Impl(0, nId, nFeature); pUI->bContext = bContext; - pImpData->aChildWindows.push_back(pUI); + pImplData->aChildWindows.push_back(pUI); } void SfxInterface::RegisterStatusBar(sal_uInt32 nResId) { - pImpData->nStatBarResId = nResId; + pImplData->nStatBarResId = nResId; } sal_uInt32 SfxInterface::GetChildWindowId (sal_uInt16 nNo) const @@ -460,10 +458,10 @@ sal_uInt32 SfxInterface::GetChildWindowId (sal_uInt16 nNo) const nNo = nNo - nBaseCount; } - assert( nNo<pImpData->aChildWindows.size() ); + assert( nNo<pImplData->aChildWindows.size() ); - sal_uInt32 nRet = pImpData->aChildWindows[nNo]->nResId; - if ( pImpData->aChildWindows[nNo]->bContext ) + sal_uInt32 nRet = pImplData->aChildWindows[nNo]->nResId; + if ( pImplData->aChildWindows[nNo]->bContext ) nRet += sal_uInt32( nClassId ) << 16; return nRet; } @@ -481,31 +479,31 @@ sal_uInt32 SfxInterface::GetChildWindowFeature (sal_uInt16 nNo) const nNo = nNo - nBaseCount; } - assert( nNo<pImpData->aChildWindows.size() ); + assert( nNo<pImplData->aChildWindows.size() ); - return pImpData->aChildWindows[nNo]->nFeature; + return pImplData->aChildWindows[nNo]->nFeature; } sal_uInt16 SfxInterface::GetChildWindowCount() const { if (pGenoType) - return pImpData->aChildWindows.size() + pGenoType->GetChildWindowCount(); + return pImplData->aChildWindows.size() + pGenoType->GetChildWindowCount(); else - return pImpData->aChildWindows.size(); + return pImplData->aChildWindows.size(); } const OUString& SfxInterface::GetPopupMenuName() const { - return pImpData->aPopupName; + return pImplData->aPopupName; } sal_uInt32 SfxInterface::GetStatusBarId() const { - if (pImpData->nStatBarResId == 0 && pGenoType) + if (pImplData->nStatBarResId == 0 && pGenoType) return pGenoType->GetStatusBarId(); else - return pImpData->nStatBarResId; + return pImplData->nStatBarResId; } sal_uInt32 SfxInterface::GetObjectBarFeature ( sal_uInt16 nNo ) const @@ -522,9 +520,9 @@ sal_uInt32 SfxInterface::GetObjectBarFeature ( sal_uInt16 nNo ) const nNo = nNo - nBaseCount; } - assert( nNo<pImpData->aObjectBars.size() ); + assert( nNo<pImplData->aObjectBars.size() ); - return pImpData->aObjectBars[nNo]->nFeature; + return pImplData->aObjectBars[nNo]->nFeature; } bool SfxInterface::IsObjectBarVisible(sal_uInt16 nNo) const @@ -541,9 +539,9 @@ bool SfxInterface::IsObjectBarVisible(sal_uInt16 nNo) const nNo = nNo - nBaseCount; } - assert( nNo<pImpData->aObjectBars.size() ); + assert( nNo<pImplData->aObjectBars.size() ); - return pImpData->aObjectBars[nNo]->bVisible; + return pImplData->aObjectBars[nNo]->bVisible; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |