summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2014-09-26 11:59:04 +0900
committerCaolán McNamara <caolanm@redhat.com>2014-09-26 08:20:19 +0000
commitb75b473e2ce6120d58023ee740b41cda35299d00 (patch)
tree0ecae82a867fc2cffb35ccb3c695028a6a7dcb6e
parent22730b9f485fe23266d6d5e789dbc00c4f4cc5e4 (diff)
fdo#75757: remove inheritance to std::vector
from SfxFoundCacheArr_Impl, by typedef'ing it as boost::ptr_vector<SfxFoundCache_Impl>. Change-Id: Id0e50370b440fb53dbb56dabca9743b27a08b90d Reviewed-on: https://gerrit.libreoffice.org/11650 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/sfx2/bindings.hxx21
-rw-r--r--sfx2/source/control/bindings.cxx57
2 files changed, 31 insertions, 47 deletions
diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx
index b1f1f0a21084..0bccd70bb78b 100644
--- a/include/sfx2/bindings.hxx
+++ b/include/sfx2/bindings.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
// some other includes
@@ -50,8 +51,6 @@ class SfxDispatcher;
class SfxBindings;
class SfxBindings_Impl;
class Timer;
-struct SfxFoundCache_Impl;
-class SfxFoundCacheArr_Impl;
class SfxWorkWindow;
class SfxUnoControllerItem;
@@ -74,6 +73,22 @@ enum SfxPopupAction
SFX_POPUP_SHOW
};
+struct SfxFoundCache_Impl
+{
+ sal_uInt16 nSlotId; // the Slot-Id
+ sal_uInt16 nWhichId; // If available: Which-Id, else: nSlotId
+ const SfxSlot* pSlot; // Pointer to <Master-Slot>
+ SfxStateCache* pCache; // Pointer to StatusCache, if possible NULL
+
+ SfxFoundCache_Impl(sal_uInt16 nS, sal_uInt16 nW, const SfxSlot *pS, SfxStateCache *pC ):
+ nSlotId(nS),
+ nWhichId(nW),
+ pSlot(pS),
+ pCache(pC)
+ {}
+};
+
+typedef boost::ptr_vector<SfxFoundCache_Impl> SfxFoundCacheArr_Impl;
class SFX2_DLLPUBLIC SfxBindings: public SfxBroadcaster
@@ -117,7 +132,7 @@ private:
SAL_DLLPRIVATE void Update_Impl( SfxStateCache* pCache );
SAL_DLLPRIVATE void UpdateControllers_Impl(
const SfxInterface* pIF,
- const SfxFoundCache_Impl* pFound,
+ const SfxFoundCache_Impl& rFound,
const SfxPoolItem *pItem,
SfxItemState eItemState );
SAL_DLLPRIVATE SfxStateCache* GetStateCache( sal_uInt16 nId, sal_uInt16 *pPos);
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index 4184c34b10fd..ea6a3299a768 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -146,37 +146,6 @@ public:
InvalidateSlotMap m_aInvalidateSlots; // store slots which are invalidated while in update
};
-
-
-struct SfxFoundCache_Impl
-{
- sal_uInt16 nSlotId; // the Slot-Id
- sal_uInt16 nWhichId; // If available: Which-Id, else: nSlotId
- const SfxSlot* pSlot; // Pointer to <Master-Slot>
- SfxStateCache* pCache; // Pointer to StatusCache, if possible NULL
-
- SfxFoundCache_Impl(sal_uInt16 nS, sal_uInt16 nW, const SfxSlot *pS, SfxStateCache *pC ):
- nSlotId(nS),
- nWhichId(nW),
- pSlot(pS),
- pCache(pC)
- {}
-};
-
-
-
-class SfxFoundCacheArr_Impl : public std::vector<SfxFoundCache_Impl*>
-{
-public:
- ~SfxFoundCacheArr_Impl()
- {
- for(const_iterator it = begin(); it != end(); ++it)
- delete *it;
- }
-};
-
-
-
SfxBindings::SfxBindings()
: pImp(new SfxBindings_Impl),
pDispatcher(0),
@@ -378,8 +347,8 @@ void SfxBindings::Update_Impl
rDispat.GetShell(pMsgServer->GetShellLevel())->GetInterface();
for ( sal_uInt16 nPos = 0; nPos < aFound.size(); ++nPos )
{
- const SfxFoundCache_Impl *pFound = aFound[nPos];
- sal_uInt16 nWhich = pFound->nWhichId;
+ const SfxFoundCache_Impl& rFound = aFound[nPos];
+ sal_uInt16 nWhich = rFound.nWhichId;
const SfxPoolItem *pItem = 0;
SfxItemState eState = pSet->GetItemState(nWhich, true, &pItem);
if ( eState == SfxItemState::DEFAULT && SfxItemPool::IsWhich(nWhich) )
@@ -400,7 +369,7 @@ void SfxBindings::Update_Impl
SfxFoundCache_Impl aFoundCache(
pCache->GetId(), 0,
pRealSlot, pCache );
- UpdateControllers_Impl( 0, &aFoundCache, 0, SfxItemState::DISABLED);
+ UpdateControllers_Impl( 0, aFoundCache, 0, SfxItemState::DISABLED);
}
}
@@ -1390,12 +1359,12 @@ SfxItemSet* SfxBindings::CreateSet_Impl
sal_uInt16 i = 0;
while ( i < rFound.size() )
{
- pRanges[j++] = rFound[i]->nWhichId;
+ pRanges[j++] = rFound[i].nWhichId;
// consecutive numbers
for ( ; i < rFound.size()-1; ++i )
- if ( rFound[i]->nWhichId+1 != rFound[i+1]->nWhichId )
+ if ( rFound[i].nWhichId+1 != rFound[i+1].nWhichId )
break;
- pRanges[j++] = rFound[i++]->nWhichId;
+ pRanges[j++] = rFound[i++].nWhichId;
}
pRanges[j] = 0; // terminating NULL
SfxItemSet *pSet = new SfxItemSet(rPool, pRanges.get());
@@ -1408,16 +1377,16 @@ SfxItemSet* SfxBindings::CreateSet_Impl
void SfxBindings::UpdateControllers_Impl
(
const SfxInterface* pIF, // Id of the current serving Interface
- const SfxFoundCache_Impl* pFound, // Cache, Slot, Which etc.
+ const SfxFoundCache_Impl& rFound, // Cache, Slot, Which etc.
const SfxPoolItem* pItem, // item to send to controller
SfxItemState eState // state of item
)
{
- DBG_ASSERT( !pFound->pSlot || SFX_KIND_ENUM != pFound->pSlot->GetKind(),
+ DBG_ASSERT( !rFound.pSlot || SFX_KIND_ENUM != rFound.pSlot->GetKind(),
"direct update of enum slot isn't allowed" );
- SfxStateCache* pCache = pFound->pCache;
- const SfxSlot* pSlot = pFound->pSlot;
+ SfxStateCache* pCache = rFound.pCache;
+ const SfxSlot* pSlot = rFound.pSlot;
DBG_ASSERT( !pCache || !pSlot || pCache->GetId() == pSlot->GetSlotId(), "SID mismatch" );
// bound until now, the Controller to update the Slot.
@@ -1429,7 +1398,7 @@ void SfxBindings::UpdateControllers_Impl
pCache->SetState( SfxItemState::DONTCARE, (SfxPoolItem *)-1 );
}
else if ( SfxItemState::DEFAULT == eState &&
- pFound->nWhichId > SFX_WHICH_MAX )
+ rFound.nWhichId > SFX_WHICH_MAX )
{
// no Status or Default but without Pool
SfxVoidItem aVoid(0);
@@ -1471,7 +1440,7 @@ void SfxBindings::UpdateControllers_Impl
pEnumCache->Invalidate(false);
// HACK(CONTROL/SELECT Kram) ???
- if ( eState == SfxItemState::DONTCARE && pFound->nWhichId == 10144 )
+ if ( eState == SfxItemState::DONTCARE && rFound.nWhichId == 10144 )
{
SfxVoidItem aVoid(0);
pEnumCache->SetState( SfxItemState::UNKNOWN, &aVoid );
@@ -1491,7 +1460,7 @@ void SfxBindings::UpdateControllers_Impl
{
// Determine enum value
sal_uInt16 nValue = pEnumItem->GetEnumValue();
- SfxBoolItem aBool( pFound->nWhichId, pSlave->GetValue() == nValue );
+ SfxBoolItem aBool( rFound.nWhichId, pSlave->GetValue() == nValue );
pEnumCache->SetState(SfxItemState::DEFAULT, &aBool);
}
else