Hi, I have submitted a patch for review:
https://gerrit.libreoffice.org/3359 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/59/3359/1 Convert SfxObjectUIArr_Impl from SfxPtrArr to std::vector Also - remove dead class definition SfxIFConfig_Impl, which was using SfxObjectUIArr_Impl - simplify declaration sites, we don't need to dynamically allocate these arrays Change-Id: I0f7110a324cc37f2eb2567cc066099ea4d86276c --- M sfx2/inc/sfx2/objface.hxx M sfx2/source/control/objface.cxx 2 files changed, 29 insertions(+), 51 deletions(-) diff --git a/sfx2/inc/sfx2/objface.hxx b/sfx2/inc/sfx2/objface.hxx index 90315d0..8e1f772 100644 --- a/sfx2/inc/sfx2/objface.hxx +++ b/sfx2/inc/sfx2/objface.hxx @@ -32,14 +32,11 @@ struct SfxFormalArgument; struct SfxInterface_Impl; class SfxConfigItem; -class SfxIFConfig_Impl; -class SfxObjectUIArr_Impl ; class SfxModule; class SvStream; class SFX2_DLLPUBLIC SfxInterface { -friend class SfxIFConfig_Impl; friend class SfxSlotPool; const char* pName; // Sfx-internal name of interface @@ -122,20 +119,6 @@ { return nPos < nCount? pSlots+nPos: 0; } - -class SfxIFConfig_Impl -{ -friend class SfxInterface; - sal_uInt16 nCount; - SfxObjectUIArr_Impl* pObjectBars; - -public: - SfxIFConfig_Impl(); - ~SfxIFConfig_Impl(); - sal_Bool Store(SvStream&); - void RegisterObjectBar( sal_uInt16, const ResId&, sal_uInt32 nFeature, const String* pST=0 ); - sal_uInt16 GetType(); -}; #endif diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index 90be4b5..8b9e0f9 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -77,16 +77,16 @@ } }; -DECL_PTRARRAY(SfxObjectUIArr_Impl, SfxObjectUI_Impl*, 2, 2) +typedef std::vector<SfxObjectUI_Impl*> SfxObjectUIArr_Impl; struct SfxInterface_Impl { - SfxObjectUIArr_Impl* pObjectBars; // registered ObjectBars - SfxObjectUIArr_Impl* pChildWindows; // registered ChildWindows + SfxObjectUIArr_Impl aObjectBars; // registered ObjectBars + SfxObjectUIArr_Impl aChildWindows; // registered ChildWindows ResId aPopupRes; // registered PopupMenu ResId aStatBarRes; // registered StatusBar SfxModule* pModule; - sal_Bool bRegistered; + sal_Bool bRegistered; SfxInterface_Impl() : aPopupRes(0,*SfxApplication::GetOrCreate()->GetSfxResManager()), @@ -94,20 +94,15 @@ , pModule(NULL) , bRegistered(sal_False) { - pObjectBars = new SfxObjectUIArr_Impl; - pChildWindows = new SfxObjectUIArr_Impl; } ~SfxInterface_Impl() { - sal_uInt16 n; - for (n=0; n<pObjectBars->Count(); n++) - delete (*pObjectBars)[n]; - delete pObjectBars; + for (SfxObjectUIArr_Impl::const_iterator it = aObjectBars.begin(); it != aObjectBars.end(); ++it) + delete *it; - for (n=0; n<pChildWindows->Count(); n++) - delete (*pChildWindows)[n]; - delete pChildWindows; + for (SfxObjectUIArr_Impl::const_iterator it = aChildWindows.begin(); it != aChildWindows.end(); ++it) + delete *it; } }; @@ -404,7 +399,7 @@ { SfxObjectUI_Impl* pUI = CreateObjectBarUI_Impl( nPos, rResId, nFeature, pStr ); if ( pUI ) - pImpData->pObjectBars->Append(pUI); + pImpData->aObjectBars.push_back(pUI); } SfxObjectUI_Impl* CreateObjectBarUI_Impl( sal_uInt16 nPos, const ResId& rResId, sal_uInt32 nFeature, const String *pStr ) @@ -447,10 +442,10 @@ } #ifdef DBG_UTIL - sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); + sal_uInt16 nObjBarCount = pImpData->aObjectBars.size(); DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif - return (*pImpData->pObjectBars)[nNo]->aResId; + return pImpData->aObjectBars[nNo]->aResId; } //-------------------------------------------------------------------- @@ -471,10 +466,10 @@ } #ifdef DBG_UTIL - sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); + sal_uInt16 nObjBarCount = pImpData->aObjectBars.size(); DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif - return (*pImpData->pObjectBars)[nNo]->nPos; + return pImpData->aObjectBars[nNo]->nPos; } //-------------------------------------------------------------------- @@ -483,9 +478,9 @@ sal_uInt16 SfxInterface::GetObjectBarCount() const { if (pGenoType && ! pGenoType->HasName()) - return pImpData->pObjectBars->Count() + pGenoType->GetObjectBarCount(); + return pImpData->aObjectBars.size() + pGenoType->GetObjectBarCount(); else - return pImpData->pObjectBars->Count(); + return pImpData->aObjectBars.size(); } //-------------------------------------------------------------------- @@ -498,7 +493,7 @@ { SfxObjectUI_Impl* pUI = new SfxObjectUI_Impl(0, ResId(nId, *SfxApplication::GetOrCreate()->GetOffResManager_Impl()), sal_True, nFeature); pUI->bContext = bContext; - pImpData->pChildWindows->Append(pUI); + pImpData->aChildWindows.push_back(pUI); } void SfxInterface::RegisterStatusBar(const ResId& rResId) @@ -521,11 +516,11 @@ } #ifdef DBG_UTIL - sal_uInt16 nCWCount = pImpData->pChildWindows->Count(); + sal_uInt16 nCWCount = pImpData->aChildWindows.size(); DBG_ASSERT( nNo<nCWCount,"ChildWindow is unknown!" ); #endif - sal_uInt32 nRet = (*pImpData->pChildWindows)[nNo]->aResId.GetId(); - if ( (*pImpData->pChildWindows)[nNo]->bContext ) + sal_uInt32 nRet = pImpData->aChildWindows[nNo]->aResId.GetId(); + if ( pImpData->aChildWindows[nNo]->bContext ) nRet += sal_uInt32( nClassId ) << 16; return nRet; } @@ -544,10 +539,10 @@ } #ifdef DBG_UTIL - sal_uInt16 nCWCount = pImpData->pChildWindows->Count(); + sal_uInt16 nCWCount = pImpData->aChildWindows.size(); DBG_ASSERT( nNo<nCWCount,"ChildWindow is unknown!" ); #endif - return (*pImpData->pChildWindows)[nNo]->nFeature; + return pImpData->aChildWindows[nNo]->nFeature; } //-------------------------------------------------------------------- @@ -556,9 +551,9 @@ sal_uInt16 SfxInterface::GetChildWindowCount() const { if (pGenoType) - return pImpData->pChildWindows->Count() + pGenoType->GetChildWindowCount(); + return pImpData->aChildWindows.size() + pGenoType->GetChildWindowCount(); else - return pImpData->pChildWindows->Count(); + return pImpData->aChildWindows.size(); } @@ -593,10 +588,10 @@ } #ifdef DBG_UTIL - sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); + sal_uInt16 nObjBarCount = pImpData->aObjectBars.size(); DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif - return (*pImpData->pObjectBars)[nNo]->pName; + return pImpData->aObjectBars[nNo]->pName; } sal_uInt32 SfxInterface::GetObjectBarFeature ( sal_uInt16 nNo ) const @@ -614,10 +609,10 @@ } #ifdef DBG_UTIL - sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); + sal_uInt16 nObjBarCount = pImpData->aObjectBars.size(); DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif - return (*pImpData->pObjectBars)[nNo]->nFeature; + return pImpData->aObjectBars[nNo]->nFeature; } sal_Bool SfxInterface::IsObjectBarVisible(sal_uInt16 nNo) const @@ -635,10 +630,10 @@ } #ifdef DBG_UTIL - sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); + sal_uInt16 nObjBarCount = pImpData->aObjectBars.size(); DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif - return (*pImpData->pObjectBars)[nNo]->bVisible; + return pImpData->aObjectBars[nNo]->bVisible; } const SfxInterface* SfxInterface::GetRealInterfaceForSlot( const SfxSlot *pRealSlot ) const -- To view, visit https://gerrit.libreoffice.org/3359 To unsubscribe, visit https://gerrit.libreoffice.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0f7110a324cc37f2eb2567cc066099ea4d86276c Gerrit-PatchSet: 1 Gerrit-Project: core Gerrit-Branch: master Gerrit-Owner: Noel Grandin <noelgran...@gmail.com> _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice