Kaydet (Commit) 4b3a535a authored tarafından Michael Stahl's avatar Michael Stahl

svl: prefix members of SfxItemSet

Change-Id: I801aaa8ad9a4ff08dedd2f92b09d98c870c725b8
üst e3efae3e
...@@ -39,12 +39,12 @@ public: ...@@ -39,12 +39,12 @@ public:
// falls es diese gibt, returne sie, sonst 0 // falls es diese gibt, returne sie, sonst 0
const SfxPoolItem* FirstItem() const SfxPoolItem* FirstItem()
{ _nAkt = _nStt; { _nAkt = _nStt;
return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; } return _rSet.m_nCount ? *(_rSet.m_pItems+_nAkt) : nullptr; }
const SfxPoolItem* LastItem() const SfxPoolItem* LastItem()
{ _nAkt = _nEnd; { _nAkt = _nEnd;
return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; } return _rSet.m_nCount ? *(_rSet.m_pItems+_nAkt) : nullptr; }
const SfxPoolItem* GetCurItem() const SfxPoolItem* GetCurItem()
{ return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; } { return _rSet.m_nCount ? *(_rSet.m_pItems+_nAkt) : nullptr; }
const SfxPoolItem* NextItem(); const SfxPoolItem* NextItem();
bool IsAtStart() const { return _nAkt == _nStt; } bool IsAtStart() const { return _nAkt == _nStt; }
......
...@@ -41,11 +41,11 @@ class SVL_DLLPUBLIC SfxItemSet ...@@ -41,11 +41,11 @@ class SVL_DLLPUBLIC SfxItemSet
{ {
friend class SfxItemIter; friend class SfxItemIter;
SfxItemPool* _pPool; // pool, which is used SfxItemPool* m_pPool; ///< pool that stores the items
const SfxItemSet* _pParent; // derivation const SfxItemSet* m_pParent; ///< derivation
SfxItemArray _aItems; // field of items SfxItemArray m_pItems; ///< array of items
sal_uInt16* _pWhichRanges; // array of Which Ranges sal_uInt16* m_pWhichRanges; ///< array of Which Ranges
sal_uInt16 _nCount; // number of items sal_uInt16 m_nCount; ///< number of items
friend class SfxItemPoolCache; friend class SfxItemPoolCache;
friend class SfxAllItemSet; friend class SfxAllItemSet;
...@@ -57,7 +57,7 @@ private: ...@@ -57,7 +57,7 @@ private:
SVL_DLLPRIVATE void InitRanges_Impl(sal_uInt16 nWh1, sal_uInt16 nWh2); SVL_DLLPRIVATE void InitRanges_Impl(sal_uInt16 nWh1, sal_uInt16 nWh2);
public: public:
SfxItemArray GetItems_Impl() const { return _aItems; } SfxItemArray GetItems_Impl() const { return m_pItems; }
private: private:
const SfxItemSet& operator=(const SfxItemSet &) SAL_DELETED_FUNCTION; const SfxItemSet& operator=(const SfxItemSet &) SAL_DELETED_FUNCTION;
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
virtual SfxItemSet * Clone(bool bItems = true, SfxItemPool *pToPool = 0) const; virtual SfxItemSet * Clone(bool bItems = true, SfxItemPool *pToPool = 0) const;
// Get number of items // Get number of items
sal_uInt16 Count() const { return _nCount; } sal_uInt16 Count() const { return m_nCount; }
sal_uInt16 TotalCount() const; sal_uInt16 TotalCount() const;
const SfxPoolItem& Get( sal_uInt16 nWhich, bool bSrchInParent = true ) const; const SfxPoolItem& Get( sal_uInt16 nWhich, bool bSrchInParent = true ) const;
...@@ -123,11 +123,11 @@ public: ...@@ -123,11 +123,11 @@ public:
void Differentiate( const SfxItemSet& rSet ); void Differentiate( const SfxItemSet& rSet );
void MergeValue( const SfxPoolItem& rItem, bool bOverwriteDefaults = false ); void MergeValue( const SfxPoolItem& rItem, bool bOverwriteDefaults = false );
SfxItemPool* GetPool() const { return _pPool; } SfxItemPool* GetPool() const { return m_pPool; }
const sal_uInt16* GetRanges() const { return _pWhichRanges; } const sal_uInt16* GetRanges() const { return m_pWhichRanges; }
void SetRanges( const sal_uInt16 *pRanges ); void SetRanges( const sal_uInt16 *pRanges );
void MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo ); void MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo );
const SfxItemSet* GetParent() const { return _pParent; } const SfxItemSet* GetParent() const { return m_pParent; }
SvStream & Load( SvStream &, bool bDirect = false, SvStream & Load( SvStream &, bool bDirect = false,
const SfxItemPool *pRefPool = 0 ); const SfxItemPool *pRefPool = 0 );
...@@ -141,7 +141,7 @@ public: ...@@ -141,7 +141,7 @@ public:
inline void SfxItemSet::SetParent( const SfxItemSet* pNew ) inline void SfxItemSet::SetParent( const SfxItemSet* pNew )
{ {
_pParent = pNew; m_pParent = pNew;
} }
class SVL_DLLPUBLIC SfxAllItemSet: public SfxItemSet class SVL_DLLPUBLIC SfxAllItemSet: public SfxItemSet
......
...@@ -44,7 +44,7 @@ set's SfxItemPool, and for poolable items only a single instance that ...@@ -44,7 +44,7 @@ set's SfxItemPool, and for poolable items only a single instance that
compares equal under the predicate operator== will be stored in the pool, compares equal under the predicate operator== will be stored in the pool,
regardless of how many sets contain it, thus conserving memory. regardless of how many sets contain it, thus conserving memory.
There are members _pWhichRanges for the valid ranges (as pairs of WhichIds), There are members m_pWhichRanges for the valid ranges (as pairs of WhichIds),
_nCount for the number of items contained, and _aItems for the pointers to m_nCount for the number of items contained, and m_pItems for the pointers to
the actual items. the actual items.
...@@ -25,14 +25,14 @@ ...@@ -25,14 +25,14 @@
SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet ) SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet )
: _rSet( rItemSet ) : _rSet( rItemSet )
{ {
if ( !_rSet._nCount ) if (!_rSet.m_nCount)
{ {
_nStt = 1; _nStt = 1;
_nEnd = 0; _nEnd = 0;
} }
else else
{ {
SfxItemArray ppFnd = _rSet._aItems; SfxItemArray ppFnd = _rSet.m_pItems;
// Find the first Item that is set // Find the first Item that is set
for ( _nStt = 0; !*(ppFnd + _nStt ); ++_nStt ) for ( _nStt = 0; !*(ppFnd + _nStt ); ++_nStt )
...@@ -53,7 +53,7 @@ SfxItemIter::~SfxItemIter() ...@@ -53,7 +53,7 @@ SfxItemIter::~SfxItemIter()
const SfxPoolItem* SfxItemIter::NextItem() const SfxPoolItem* SfxItemIter::NextItem()
{ {
SfxItemArray ppFnd = _rSet._aItems; SfxItemArray ppFnd = _rSet.m_pItems;
if( _nAkt < _nEnd ) if( _nAkt < _nEnd )
{ {
......
...@@ -51,7 +51,7 @@ const sal_Char *DbgCheckItemSet( const void* pVoid ) ...@@ -51,7 +51,7 @@ const sal_Char *DbgCheckItemSet( const void* pVoid )
sal_uInt16 nCount = 0, n = 0; sal_uInt16 nCount = 0, n = 0;
for ( sal_uInt16 nWh = aIter.FirstWhich(); nWh; nWh = aIter.NextWhich(), ++n ) for ( sal_uInt16 nWh = aIter.FirstWhich(); nWh; nWh = aIter.NextWhich(), ++n )
{ {
const SfxPoolItem *pItem = pSet->_aItems[n]; const SfxPoolItem *pItem = pSet->m_pItems[n];
if ( pItem ) if ( pItem )
{ {
++nCount; ++nCount;
...@@ -66,7 +66,7 @@ const sal_Char *DbgCheckItemSet( const void* pVoid ) ...@@ -66,7 +66,7 @@ const sal_Char *DbgCheckItemSet( const void* pVoid )
} }
} }
assert(pSet->_nCount == nCount); assert(pSet->m_nCount == nCount);
return 0; return 0;
} }
...@@ -86,9 +86,9 @@ SfxItemSet::SfxItemSet ...@@ -86,9 +86,9 @@ SfxItemSet::SfxItemSet
added to this SfxItemSet */ added to this SfxItemSet */
bool bTotalRanges /* Take over complete pool ranges? */ bool bTotalRanges /* Take over complete pool ranges? */
) )
: _pPool( &rPool ), : m_pPool( &rPool )
_pParent( 0 ), , m_pParent(nullptr)
_nCount( 0 ) , m_nCount(0)
{ {
// DBG_ASSERT( bTotalRanges || abs( &bTotalRanges - this ) < 1000, // DBG_ASSERT( bTotalRanges || abs( &bTotalRanges - this ) < 1000,
// "please use suitable ranges" ); // "please use suitable ranges" );
...@@ -99,22 +99,22 @@ SfxItemSet::SfxItemSet ...@@ -99,22 +99,22 @@ SfxItemSet::SfxItemSet
(void) bTotalRanges; // avoid warnings (void) bTotalRanges; // avoid warnings
#endif #endif
_pWhichRanges = const_cast<sal_uInt16*>(_pPool->GetFrozenIdRanges()); m_pWhichRanges = const_cast<sal_uInt16*>(m_pPool->GetFrozenIdRanges());
assert( _pWhichRanges && "don't create ItemSets with full range before FreezeIdRanges()" ); assert( m_pWhichRanges && "don't create ItemSets with full range before FreezeIdRanges()" );
if ( !_pWhichRanges ) if (!m_pWhichRanges)
_pPool->FillItemIdRanges_Impl( _pWhichRanges ); m_pPool->FillItemIdRanges_Impl( m_pWhichRanges );
const sal_uInt16 nSize = TotalCount(); const sal_uInt16 nSize = TotalCount();
_aItems = new const SfxPoolItem* [ nSize ]; m_pItems = new const SfxPoolItem* [ nSize ];
memset( (void*) _aItems, 0, nSize * sizeof( SfxPoolItem* ) ); memset(static_cast<void*>(m_pItems), 0, nSize * sizeof(SfxPoolItem*));
} }
SfxItemSet::SfxItemSet( SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhich2 ): SfxItemSet::SfxItemSet(SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhich2)
_pPool( &rPool ), : m_pPool( &rPool )
_pParent( 0 ), , m_pParent(nullptr)
_nCount( 0 ) , m_nCount(0)
{ {
assert(nWhich1 <= nWhich2); assert(nWhich1 <= nWhich2);
...@@ -125,32 +125,32 @@ SfxItemSet::SfxItemSet( SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhic ...@@ -125,32 +125,32 @@ SfxItemSet::SfxItemSet( SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhic
void SfxItemSet::InitRanges_Impl(sal_uInt16 nWh1, sal_uInt16 nWh2) void SfxItemSet::InitRanges_Impl(sal_uInt16 nWh1, sal_uInt16 nWh2)
{ {
_pWhichRanges = new sal_uInt16[ 3 ]; m_pWhichRanges = new sal_uInt16[ 3 ];
*(_pWhichRanges+0) = nWh1; *(m_pWhichRanges+0) = nWh1;
*(_pWhichRanges+1) = nWh2; *(m_pWhichRanges+1) = nWh2;
*(_pWhichRanges+2) = 0; *(m_pWhichRanges+2) = 0;
const sal_uInt16 nRg = nWh2 - nWh1 + 1; const sal_uInt16 nRg = nWh2 - nWh1 + 1;
_aItems = new const SfxPoolItem* [ nRg ]; m_pItems = new const SfxPoolItem* [ nRg ];
memset( (void*) _aItems, 0, nRg * sizeof( SfxPoolItem* ) ); memset(static_cast<void*>(m_pItems), 0, nRg * sizeof(SfxPoolItem*));
} }
void SfxItemSet::InitRanges_Impl(va_list pArgs, sal_uInt16 nWh1, sal_uInt16 nWh2, sal_uInt16 nNull) void SfxItemSet::InitRanges_Impl(va_list pArgs, sal_uInt16 nWh1, sal_uInt16 nWh2, sal_uInt16 nNull)
{ {
sal_uInt16 nSize = InitializeRanges_Impl( _pWhichRanges, pArgs, nWh1, nWh2, nNull ); sal_uInt16 nSize = InitializeRanges_Impl(m_pWhichRanges, pArgs, nWh1, nWh2, nNull);
_aItems = new const SfxPoolItem* [ nSize ]; m_pItems = new const SfxPoolItem* [ nSize ];
memset( (void*) _aItems, 0, sizeof( SfxPoolItem* ) * nSize ); memset(static_cast<void*>(m_pItems), 0, sizeof(SfxPoolItem*) * nSize);
} }
SfxItemSet::SfxItemSet( SfxItemPool& rPool, SfxItemSet::SfxItemSet(SfxItemPool& rPool,
USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ... ): USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ...)
_pPool( &rPool ), : m_pPool( &rPool )
_pParent( 0 ), , m_pParent(nullptr)
_pWhichRanges( 0 ), , m_pWhichRanges(nullptr)
_nCount( 0 ) , m_nCount(0)
{ {
assert(nWh1 <= nWh2); assert(nWh1 <= nWh2);
...@@ -181,54 +181,54 @@ void SfxItemSet::InitRanges_Impl(const sal_uInt16 *pWhichPairTable) ...@@ -181,54 +181,54 @@ void SfxItemSet::InitRanges_Impl(const sal_uInt16 *pWhichPairTable)
pPtr += 2; pPtr += 2;
} }
_aItems = new const SfxPoolItem* [ nCnt ]; m_pItems = new const SfxPoolItem* [ nCnt ];
memset( (void*) _aItems, 0, sizeof( SfxPoolItem* ) * nCnt ); memset(static_cast<void*>(m_pItems), 0, sizeof(SfxPoolItem*) * nCnt);
std::ptrdiff_t cnt = pPtr - pWhichPairTable +1; std::ptrdiff_t cnt = pPtr - pWhichPairTable +1;
_pWhichRanges = new sal_uInt16[ cnt ]; m_pWhichRanges = new sal_uInt16[ cnt ];
memcpy( _pWhichRanges, pWhichPairTable, sizeof( sal_uInt16 ) * cnt ); memcpy( m_pWhichRanges, pWhichPairTable, sizeof( sal_uInt16 ) * cnt );
} }
SfxItemSet::SfxItemSet( SfxItemPool& rPool, const sal_uInt16* pWhichPairTable ) SfxItemSet::SfxItemSet( SfxItemPool& rPool, const sal_uInt16* pWhichPairTable )
: _pPool(&rPool) : m_pPool(&rPool)
, _pParent(0) , m_pParent(nullptr)
, _aItems(0) , m_pItems(nullptr)
, _pWhichRanges(0) , m_pWhichRanges(nullptr)
, _nCount(0) , m_nCount(0)
{ {
// pWhichPairTable == 0 ist f"ur das SfxAllEnumItemSet // pWhichPairTable == 0 ist f"ur das SfxAllEnumItemSet
if ( pWhichPairTable ) if ( pWhichPairTable )
InitRanges_Impl(pWhichPairTable); InitRanges_Impl(pWhichPairTable);
} }
SfxItemSet::SfxItemSet( const SfxItemSet& rASet ): SfxItemSet::SfxItemSet( const SfxItemSet& rASet )
_pPool( rASet._pPool ), : m_pPool( rASet.m_pPool )
_pParent( rASet._pParent ), , m_pParent( rASet.m_pParent )
_nCount( rASet._nCount ) , m_nCount( rASet.m_nCount )
{ {
// Calculate the attribute count // Calculate the attribute count
sal_uInt16 nCnt = 0; sal_uInt16 nCnt = 0;
sal_uInt16* pPtr = rASet._pWhichRanges; sal_uInt16* pPtr = rASet.m_pWhichRanges;
while( *pPtr ) while( *pPtr )
{ {
nCnt += ( *(pPtr+1) - *pPtr ) + 1; nCnt += ( *(pPtr+1) - *pPtr ) + 1;
pPtr += 2; pPtr += 2;
} }
_aItems = new const SfxPoolItem* [ nCnt ]; m_pItems = new const SfxPoolItem* [ nCnt ];
// Copy attributes // Copy attributes
SfxItemArray ppDst = _aItems, ppSrc = rASet._aItems; SfxItemArray ppDst = m_pItems, ppSrc = rASet.m_pItems;
for( sal_uInt16 n = nCnt; n; --n, ++ppDst, ++ppSrc ) for( sal_uInt16 n = nCnt; n; --n, ++ppDst, ++ppSrc )
if ( 0 == *ppSrc || // Current Default? if ( 0 == *ppSrc || // Current Default?
IsInvalidItem(*ppSrc) || // DontCare? IsInvalidItem(*ppSrc) || // DontCare?
IsStaticDefaultItem(*ppSrc) ) // Defaults that are not to be pooled? IsStaticDefaultItem(*ppSrc) ) // Defaults that are not to be pooled?
// Just copy the pointer // Just copy the pointer
*ppDst = *ppSrc; *ppDst = *ppSrc;
else if ( _pPool->IsItemFlag( **ppSrc, SFX_ITEM_POOLABLE ) ) else if (m_pPool->IsItemFlag( **ppSrc, SFX_ITEM_POOLABLE ))
{ {
// Just copy the pointer and increase RefCount // Just copy the pointer and increase RefCount
*ppDst = *ppSrc; *ppDst = *ppSrc;
...@@ -238,12 +238,12 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet ): ...@@ -238,12 +238,12 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet ):
*ppDst = (*ppSrc)->Clone(); *ppDst = (*ppSrc)->Clone();
else else
// !IsPoolable() => assign via Pool // !IsPoolable() => assign via Pool
*ppDst = &_pPool->Put( **ppSrc ); *ppDst = &m_pPool->Put( **ppSrc );
// Copy the WhichRanges // Copy the WhichRanges
std::ptrdiff_t cnt = pPtr - rASet._pWhichRanges+1; std::ptrdiff_t cnt = pPtr - rASet.m_pWhichRanges+1;
_pWhichRanges = new sal_uInt16[ cnt ]; m_pWhichRanges = new sal_uInt16[ cnt ];
memcpy( _pWhichRanges, rASet._pWhichRanges, sizeof( sal_uInt16 ) * cnt); memcpy( m_pWhichRanges, rASet.m_pWhichRanges, sizeof( sal_uInt16 ) * cnt);
} }
...@@ -253,7 +253,7 @@ SfxItemSet::~SfxItemSet() ...@@ -253,7 +253,7 @@ SfxItemSet::~SfxItemSet()
sal_uInt16 nCount = TotalCount(); sal_uInt16 nCount = TotalCount();
if( Count() ) if( Count() )
{ {
SfxItemArray ppFnd = _aItems; SfxItemArray ppFnd = m_pItems;
for( sal_uInt16 nCnt = nCount; nCnt; --nCnt, ++ppFnd ) for( sal_uInt16 nCnt = nCount; nCnt; --nCnt, ++ppFnd )
if( *ppFnd && !IsInvalidItem(*ppFnd) ) if( *ppFnd && !IsInvalidItem(*ppFnd) )
{ {
...@@ -266,16 +266,16 @@ SfxItemSet::~SfxItemSet() ...@@ -266,16 +266,16 @@ SfxItemSet::~SfxItemSet()
else else
if ( !IsDefaultItem(*ppFnd) ) if ( !IsDefaultItem(*ppFnd) )
// Delete from Pool // Delete from Pool
_pPool->Remove( **ppFnd ); m_pPool->Remove( **ppFnd );
} }
} }
} }
// FIXME: could be delete[] (SfxPoolItem **)_aItems; // FIXME: could be delete[] (SfxPoolItem **)m_pItems;
delete[] _aItems; delete[] m_pItems;
if ( _pWhichRanges != _pPool->GetFrozenIdRanges() ) if (m_pWhichRanges != m_pPool->GetFrozenIdRanges())
delete[] _pWhichRanges; delete[] m_pWhichRanges;
_pWhichRanges = 0; // for invariant-testing m_pWhichRanges = nullptr; // for invariant-testing
} }
...@@ -288,11 +288,11 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) ...@@ -288,11 +288,11 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
return 0; return 0;
sal_uInt16 nDel = 0; sal_uInt16 nDel = 0;
SfxItemArray ppFnd = _aItems; SfxItemArray ppFnd = m_pItems;
if( nWhich ) if( nWhich )
{ {
const sal_uInt16* pPtr = _pWhichRanges; const sal_uInt16* pPtr = m_pWhichRanges;
while( *pPtr ) while( *pPtr )
{ {
// Within this range? // Within this range?
...@@ -303,7 +303,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) ...@@ -303,7 +303,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
if( *ppFnd ) if( *ppFnd )
{ {
// Due to the assertions in the sub calls, we need to do the following // Due to the assertions in the sub calls, we need to do the following
--_nCount; --m_nCount;
const SfxPoolItem *pItemToClear = *ppFnd; const SfxPoolItem *pItemToClear = *ppFnd;
*ppFnd = 0; *ppFnd = 0;
...@@ -311,14 +311,14 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) ...@@ -311,14 +311,14 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
{ {
if ( nWhich <= SFX_WHICH_MAX ) if ( nWhich <= SFX_WHICH_MAX )
{ {
const SfxPoolItem& rNew = _pParent const SfxPoolItem& rNew = m_pParent
? _pParent->Get( nWhich, true ) ? m_pParent->Get( nWhich, true )
: _pPool->GetDefaultItem( nWhich ); : m_pPool->GetDefaultItem( nWhich );
Changed( *pItemToClear, rNew ); Changed( *pItemToClear, rNew );
} }
if ( pItemToClear->Which() ) if ( pItemToClear->Which() )
_pPool->Remove( *pItemToClear ); m_pPool->Remove( *pItemToClear );
} }
++nDel; ++nDel;
} }
...@@ -332,16 +332,16 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) ...@@ -332,16 +332,16 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
} }
else else
{ {
nDel = _nCount; nDel = m_nCount;
sal_uInt16* pPtr = _pWhichRanges; sal_uInt16* pPtr = m_pWhichRanges;
while( *pPtr ) while( *pPtr )
{ {
for( nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) for( nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
if( *ppFnd ) if( *ppFnd )
{ {
// Due to the assertions in the sub calls, we need to do this // Due to the assertions in the sub calls, we need to do this
--_nCount; --m_nCount;
const SfxPoolItem *pItemToClear = *ppFnd; const SfxPoolItem *pItemToClear = *ppFnd;
*ppFnd = 0; *ppFnd = 0;
...@@ -349,9 +349,9 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) ...@@ -349,9 +349,9 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
{ {
if ( nWhich <= SFX_WHICH_MAX ) if ( nWhich <= SFX_WHICH_MAX )
{ {
const SfxPoolItem& rNew = _pParent const SfxPoolItem& rNew = m_pParent
? _pParent->Get( nWhich, true ) ? m_pParent->Get( nWhich, true )
: _pPool->GetDefaultItem( nWhich ); : m_pPool->GetDefaultItem( nWhich );
Changed( *pItemToClear, rNew ); Changed( *pItemToClear, rNew );
} }
...@@ -366,7 +366,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) ...@@ -366,7 +366,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
else else
{ {
// remove item from pool // remove item from pool
_pPool->Remove( *pItemToClear ); m_pPool->Remove( *pItemToClear );
} }
} }
} }
...@@ -380,14 +380,14 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) ...@@ -380,14 +380,14 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
void SfxItemSet::ClearInvalidItems( bool bHardDefault ) void SfxItemSet::ClearInvalidItems( bool bHardDefault )
{ {
sal_uInt16* pPtr = _pWhichRanges; sal_uInt16* pPtr = m_pWhichRanges;
SfxItemArray ppFnd = _aItems; SfxItemArray ppFnd = m_pItems;
if ( bHardDefault ) if ( bHardDefault )
while( *pPtr ) while( *pPtr )
{ {
for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
if ( IsInvalidItem(*ppFnd) ) if ( IsInvalidItem(*ppFnd) )
*ppFnd = &_pPool->Put( _pPool->GetDefaultItem(nWhich) ); *ppFnd = &m_pPool->Put( m_pPool->GetDefaultItem(nWhich) );
pPtr += 2; pPtr += 2;
} }
else else
...@@ -397,7 +397,7 @@ void SfxItemSet::ClearInvalidItems( bool bHardDefault ) ...@@ -397,7 +397,7 @@ void SfxItemSet::ClearInvalidItems( bool bHardDefault )
if( IsInvalidItem(*ppFnd) ) if( IsInvalidItem(*ppFnd) )
{ {
*ppFnd = 0; *ppFnd = 0;
--_nCount; --m_nCount;
} }
pPtr += 2; pPtr += 2;
} }
...@@ -405,15 +405,16 @@ void SfxItemSet::ClearInvalidItems( bool bHardDefault ) ...@@ -405,15 +405,16 @@ void SfxItemSet::ClearInvalidItems( bool bHardDefault )
void SfxItemSet::InvalidateDefaultItems() void SfxItemSet::InvalidateDefaultItems()
{ {
sal_uInt16* pPtr = _pWhichRanges; sal_uInt16* pPtr = m_pWhichRanges;
SfxItemArray ppFnd = _aItems; SfxItemArray ppFnd = m_pItems;
while( *pPtr ) while( *pPtr )
{ {
for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
if ( *ppFnd && *ppFnd != reinterpret_cast<SfxPoolItem *>(-1) && **ppFnd == _pPool->GetDefaultItem( nWhich ) ) if (*ppFnd && *ppFnd != reinterpret_cast<SfxPoolItem *>(-1)
&& **ppFnd == m_pPool->GetDefaultItem(nWhich))
{ {
_pPool->Remove( **ppFnd ); m_pPool->Remove( **ppFnd );
*ppFnd = reinterpret_cast<SfxPoolItem*>(-1); *ppFnd = reinterpret_cast<SfxPoolItem*>(-1);
} }
pPtr += 2; pPtr += 2;
...@@ -422,9 +423,9 @@ void SfxItemSet::InvalidateDefaultItems() ...@@ -422,9 +423,9 @@ void SfxItemSet::InvalidateDefaultItems()
void SfxItemSet::InvalidateAllItems() void SfxItemSet::InvalidateAllItems()
{ {
assert( !_nCount && "There are still Items set" ); assert( !m_nCount && "There are still Items set" );
m_nCount = TotalCount();
memset( (void*)_aItems, -1, ( _nCount = TotalCount() ) * sizeof( SfxPoolItem*) ); memset(static_cast<void*>(m_pItems), -1, m_nCount * sizeof(SfxPoolItem*));
} }
...@@ -438,8 +439,8 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich, ...@@ -438,8 +439,8 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
SfxItemState eRet = SfxItemState::UNKNOWN; SfxItemState eRet = SfxItemState::UNKNOWN;
do do
{ {
SfxItemArray ppFnd = pAktSet->_aItems; SfxItemArray ppFnd = pAktSet->m_pItems;
const sal_uInt16* pPtr = pAktSet->_pWhichRanges; const sal_uInt16* pPtr = pAktSet->m_pWhichRanges;
if (pPtr) if (pPtr)
{ {
while ( *pPtr ) while ( *pPtr )
...@@ -473,7 +474,7 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich, ...@@ -473,7 +474,7 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
pPtr += 2; pPtr += 2;
} }
} }
} while( bSrchInParent && 0 != ( pAktSet = pAktSet->_pParent )); } while (bSrchInParent && nullptr != (pAktSet = pAktSet->m_pParent));
return eRet; return eRet;
} }
...@@ -492,8 +493,8 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich ...@@ -492,8 +493,8 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
if ( !nWhich ) if ( !nWhich )
return 0; //FIXME: Only because of Outliner bug return 0; //FIXME: Only because of Outliner bug
SfxItemArray ppFnd = _aItems; SfxItemArray ppFnd = m_pItems;
const sal_uInt16* pPtr = _pWhichRanges; const sal_uInt16* pPtr = m_pWhichRanges;
while( *pPtr ) while( *pPtr )
{ {
if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
...@@ -509,14 +510,14 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich ...@@ -509,14 +510,14 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
// Will 'dontcare' or 'disabled' be overwritten with some real value? // Will 'dontcare' or 'disabled' be overwritten with some real value?
if ( rItem.Which() && ( IsInvalidItem(*ppFnd) || !(*ppFnd)->Which() ) ) if ( rItem.Which() && ( IsInvalidItem(*ppFnd) || !(*ppFnd)->Which() ) )
{ {
*ppFnd = &_pPool->Put( rItem, nWhich ); *ppFnd = &m_pPool->Put( rItem, nWhich );
return *ppFnd; return *ppFnd;
} }
// Turns into disabled? // Turns into disabled?
if( !rItem.Which() ) if( !rItem.Which() )
{ {
*ppFnd = rItem.Clone(_pPool); *ppFnd = rItem.Clone(m_pPool);
return 0; return 0;
} }
else else
...@@ -526,32 +527,32 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich ...@@ -526,32 +527,32 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
return 0; return 0;
// Add the new one, remove the old one // Add the new one, remove the old one
const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich ); const SfxPoolItem& rNew = m_pPool->Put( rItem, nWhich );
const SfxPoolItem* pOld = *ppFnd; const SfxPoolItem* pOld = *ppFnd;
*ppFnd = &rNew; *ppFnd = &rNew;
if(nWhich <= SFX_WHICH_MAX) if(nWhich <= SFX_WHICH_MAX)
Changed( *pOld, rNew ); Changed( *pOld, rNew );
_pPool->Remove( *pOld ); m_pPool->Remove( *pOld );
} }
} }
else else
{ {
++_nCount; ++m_nCount;
if( !rItem.Which() ) if( !rItem.Which() )
*ppFnd = rItem.Clone(_pPool); *ppFnd = rItem.Clone(m_pPool);
else { else {
const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich ); const SfxPoolItem& rNew = m_pPool->Put( rItem, nWhich );
*ppFnd = &rNew; *ppFnd = &rNew;
if (nWhich <= SFX_WHICH_MAX ) if (nWhich <= SFX_WHICH_MAX )
{ {
const SfxPoolItem& rOld = _pParent const SfxPoolItem& rOld = m_pParent
? _pParent->Get( nWhich, true ) ? m_pParent->Get( nWhich, true )
: _pPool->GetDefaultItem( nWhich ); : m_pPool->GetDefaultItem( nWhich );
Changed( rOld, rNew ); Changed( rOld, rNew );
} }
} }
} }
SFX_ASSERT( !_pPool->IsItemFlag(nWhich, SFX_ITEM_POOLABLE) || SFX_ASSERT( !m_pPool->IsItemFlag(nWhich, SFX_ITEM_POOLABLE) ||
rItem.ISA(SfxSetItem) || **ppFnd == rItem, rItem.ISA(SfxSetItem) || **ppFnd == rItem,
nWhich, "putted Item unequal" ); nWhich, "putted Item unequal" );
return *ppFnd; return *ppFnd;
...@@ -569,8 +570,8 @@ bool SfxItemSet::Put( const SfxItemSet& rSet, bool bInvalidAsDefault ) ...@@ -569,8 +570,8 @@ bool SfxItemSet::Put( const SfxItemSet& rSet, bool bInvalidAsDefault )
bool bRet = false; bool bRet = false;
if( rSet.Count() ) if( rSet.Count() )
{ {
SfxItemArray ppFnd = rSet._aItems; SfxItemArray ppFnd = rSet.m_pItems;
const sal_uInt16* pPtr = rSet._pWhichRanges; const sal_uInt16* pPtr = rSet.m_pWhichRanges;
while ( *pPtr ) while ( *pPtr )
{ {
for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
...@@ -618,8 +619,8 @@ void SfxItemSet::PutExtended ...@@ -618,8 +619,8 @@ void SfxItemSet::PutExtended
) )
{ {
// don't "optimize" with "if( rSet.Count()" because of dont-care + defaults // don't "optimize" with "if( rSet.Count()" because of dont-care + defaults
SfxItemArray ppFnd = rSet._aItems; SfxItemArray ppFnd = rSet.m_pItems;
const sal_uInt16* pPtr = rSet._pWhichRanges; const sal_uInt16* pPtr = rSet.m_pWhichRanges;
while ( *pPtr ) while ( *pPtr )
{ {
for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
...@@ -688,7 +689,7 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo ) ...@@ -688,7 +689,7 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo )
return; return;
// merge new range // merge new range
SfxUShortRanges aRanges( _pWhichRanges ); SfxUShortRanges aRanges( m_pWhichRanges );
aRanges += SfxUShortRanges( nFrom, nTo ); aRanges += SfxUShortRanges( nFrom, nTo );
SetRanges( aRanges ); SetRanges( aRanges );
} }
...@@ -701,9 +702,9 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo ) ...@@ -701,9 +702,9 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo )
void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges ) void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
{ {
// Identical Ranges? // Identical Ranges?
if ( _pWhichRanges == pNewRanges ) if (m_pWhichRanges == pNewRanges)
return; return;
const sal_uInt16* pOld = _pWhichRanges; const sal_uInt16* pOld = m_pWhichRanges;
const sal_uInt16* pNew = pNewRanges; const sal_uInt16* pNew = pNewRanges;
while ( *pOld == *pNew ) while ( *pOld == *pNew )
{ {
...@@ -716,7 +717,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges ) ...@@ -716,7 +717,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
sal_uLong nSize = Capacity_Impl(pNewRanges); sal_uLong nSize = Capacity_Impl(pNewRanges);
SfxItemArray aNewItems = new const SfxPoolItem* [ nSize ]; SfxItemArray aNewItems = new const SfxPoolItem* [ nSize ];
sal_uInt16 nNewCount = 0; sal_uInt16 nNewCount = 0;
if ( _nCount == 0 ) if (m_nCount == 0)
memset( aNewItems, 0, nSize * sizeof( SfxPoolItem* ) ); memset( aNewItems, 0, nSize * sizeof( SfxPoolItem* ) );
else else
{ {
...@@ -756,29 +757,29 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges ) ...@@ -756,29 +757,29 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
sal_uInt16 nOldTotalCount = TotalCount(); sal_uInt16 nOldTotalCount = TotalCount();
for ( sal_uInt16 nItem = 0; nItem < nOldTotalCount; ++nItem ) for ( sal_uInt16 nItem = 0; nItem < nOldTotalCount; ++nItem )
{ {
const SfxPoolItem *pItem = _aItems[nItem]; const SfxPoolItem *pItem = m_pItems[nItem];
if ( pItem && !IsInvalidItem(pItem) && pItem->Which() ) if ( pItem && !IsInvalidItem(pItem) && pItem->Which() )
_pPool->Remove(*pItem); m_pPool->Remove(*pItem);
} }
} }
// replace old items-array and ranges // replace old items-array and ranges
delete[] _aItems; delete[] m_pItems;
_aItems = aNewItems; m_pItems = aNewItems;
_nCount = nNewCount; m_nCount = nNewCount;
if( pNewRanges == GetPool()->GetFrozenIdRanges() ) if( pNewRanges == GetPool()->GetFrozenIdRanges() )
{ {
delete[] _pWhichRanges; delete[] m_pWhichRanges;
_pWhichRanges = const_cast<sal_uInt16*>(pNewRanges); m_pWhichRanges = const_cast<sal_uInt16*>(pNewRanges);
} }
else else
{ {
sal_uInt16 nCount = Count_Impl(pNewRanges) + 1; sal_uInt16 nCount = Count_Impl(pNewRanges) + 1;
if ( _pWhichRanges != _pPool->GetFrozenIdRanges() ) if (m_pWhichRanges != m_pPool->GetFrozenIdRanges())
delete[] _pWhichRanges; delete[] m_pWhichRanges;
_pWhichRanges = new sal_uInt16[ nCount ]; m_pWhichRanges = new sal_uInt16[ nCount ];
memcpy( _pWhichRanges, pNewRanges, sizeof( sal_uInt16 ) * nCount ); memcpy( m_pWhichRanges, pNewRanges, sizeof( sal_uInt16 ) * nCount );
} }
} }
...@@ -819,7 +820,7 @@ bool SfxItemSet::Set ...@@ -819,7 +820,7 @@ bool SfxItemSet::Set
) )
{ {
bool bRet = false; bool bRet = false;
if ( _nCount ) if (m_nCount)
ClearItem(); ClearItem();
if ( bDeep ) if ( bDeep )
{ {
...@@ -864,7 +865,9 @@ const SfxPoolItem* SfxItemSet::GetItem ...@@ -864,7 +865,9 @@ const SfxPoolItem* SfxItemSet::GetItem
SfxItemState eState = GetItemState( nWhich, bSrchInParent, &pItem ); SfxItemState eState = GetItemState( nWhich, bSrchInParent, &pItem );
if ( bSrchInParent && SfxItemState::DEFAULT == eState && if ( bSrchInParent && SfxItemState::DEFAULT == eState &&
nWhich <= SFX_WHICH_MAX ) nWhich <= SFX_WHICH_MAX )
pItem = &_pPool->GetDefaultItem(nWhich); {
pItem = &m_pPool->GetDefaultItem(nWhich);
}
if ( pItem ) if ( pItem )
{ {
...@@ -891,8 +894,8 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const ...@@ -891,8 +894,8 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
{ {
if( pAktSet->Count() ) if( pAktSet->Count() )
{ {
SfxItemArray ppFnd = pAktSet->_aItems; SfxItemArray ppFnd = pAktSet->m_pItems;
const sal_uInt16* pPtr = pAktSet->_pWhichRanges; const sal_uInt16* pPtr = pAktSet->m_pWhichRanges;
while( *pPtr ) while( *pPtr )
{ {
if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
...@@ -903,10 +906,10 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const ...@@ -903,10 +906,10 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
{ {
if( reinterpret_cast<SfxPoolItem*>(-1) == *ppFnd ) { if( reinterpret_cast<SfxPoolItem*>(-1) == *ppFnd ) {
//FIXME: The following code is duplicated further down //FIXME: The following code is duplicated further down
SFX_ASSERT(_pPool, nWhich, "no Pool, but status is ambiguous"); SFX_ASSERT(m_pPool, nWhich, "no Pool, but status is ambiguous");
//!((SfxAllItemSet *)this)->aDefault.SetWhich(nWhich); //!((SfxAllItemSet *)this)->aDefault.SetWhich(nWhich);
//!return aDefault; //!return aDefault;
return _pPool->GetDefaultItem( nWhich ); return m_pPool->GetDefaultItem( nWhich );
} }
#ifdef DBG_UTIL #ifdef DBG_UTIL
const SfxPoolItem *pItem = *ppFnd; const SfxPoolItem *pItem = *ppFnd;
...@@ -924,11 +927,11 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const ...@@ -924,11 +927,11 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
//TODO: Search until end of Range: What are we supposed to do now? To the Parent or Default?? //TODO: Search until end of Range: What are we supposed to do now? To the Parent or Default??
// if( !*pPtr ) // Until the end of the search Range? // if( !*pPtr ) // Until the end of the search Range?
// break; // break;
} while( bSrchInParent && 0 != ( pAktSet = pAktSet->_pParent )); } while (bSrchInParent && nullptr != (pAktSet = pAktSet->m_pParent));
// Get the Default from the Pool and return // Get the Default from the Pool and return
SFX_ASSERT(_pPool, nWhich, "no Pool, but status is ambiguous"); SFX_ASSERT(m_pPool, nWhich, "no Pool, but status is ambiguous");
const SfxPoolItem *pItem = &_pPool->GetDefaultItem( nWhich ); const SfxPoolItem *pItem = &m_pPool->GetDefaultItem( nWhich );
return *pItem; return *pItem;
} }
...@@ -944,7 +947,7 @@ void SfxItemSet::Changed( const SfxPoolItem&, const SfxPoolItem& ) ...@@ -944,7 +947,7 @@ void SfxItemSet::Changed( const SfxPoolItem&, const SfxPoolItem& )
sal_uInt16 SfxItemSet::TotalCount() const sal_uInt16 SfxItemSet::TotalCount() const
{ {
sal_uInt16 nRet = 0; sal_uInt16 nRet = 0;
sal_uInt16* pPtr = _pWhichRanges; sal_uInt16* pPtr = m_pWhichRanges;
while( *pPtr ) while( *pPtr )
{ {
nRet += ( *(pPtr+1) - *pPtr ) + 1; nRet += ( *(pPtr+1) - *pPtr ) + 1;
...@@ -960,7 +963,7 @@ sal_uInt16 SfxItemSet::TotalCount() const ...@@ -960,7 +963,7 @@ sal_uInt16 SfxItemSet::TotalCount() const
*/ */
void SfxItemSet::Intersect( const SfxItemSet& rSet ) void SfxItemSet::Intersect( const SfxItemSet& rSet )
{ {
assert(_pPool && "Not implemented without Pool"); assert(m_pPool && "Not implemented without Pool");
if( !Count() ) // None set? if( !Count() ) // None set?
return; return;
...@@ -973,8 +976,8 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet ) ...@@ -973,8 +976,8 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
// Test whether the Which Ranges are different // Test whether the Which Ranges are different
bool bEqual = true; bool bEqual = true;
sal_uInt16* pWh1 = _pWhichRanges; sal_uInt16* pWh1 = m_pWhichRanges;
sal_uInt16* pWh2 = rSet._pWhichRanges; sal_uInt16* pWh2 = rSet.m_pWhichRanges;
sal_uInt16 nSize = 0; sal_uInt16 nSize = 0;
for( sal_uInt16 n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n ) for( sal_uInt16 n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n )
...@@ -992,8 +995,8 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet ) ...@@ -992,8 +995,8 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
// If the Ranges are identical, we can easily process it // If the Ranges are identical, we can easily process it
if( bEqual ) if( bEqual )
{ {
SfxItemArray ppFnd1 = _aItems; SfxItemArray ppFnd1 = m_pItems;
SfxItemArray ppFnd2 = rSet._aItems; SfxItemArray ppFnd2 = rSet.m_pItems;
for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 ) for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 )
if( *ppFnd1 && !*ppFnd2 ) if( *ppFnd1 && !*ppFnd2 )
...@@ -1004,16 +1007,16 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet ) ...@@ -1004,16 +1007,16 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
sal_uInt16 nWhich = (*ppFnd1)->Which(); sal_uInt16 nWhich = (*ppFnd1)->Which();
if(nWhich <= SFX_WHICH_MAX) if(nWhich <= SFX_WHICH_MAX)
{ {
const SfxPoolItem& rNew = _pParent const SfxPoolItem& rNew = m_pParent
? _pParent->Get( nWhich, true ) ? m_pParent->Get( nWhich, true )
: _pPool->GetDefaultItem( nWhich ); : m_pPool->GetDefaultItem( nWhich );
Changed( **ppFnd1, rNew ); Changed( **ppFnd1, rNew );
} }
_pPool->Remove( **ppFnd1 ); m_pPool->Remove( **ppFnd1 );
} }
*ppFnd1 = 0; *ppFnd1 = 0;
--_nCount; --m_nCount;
} }
} }
else else
...@@ -1043,8 +1046,8 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet ) ...@@ -1043,8 +1046,8 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
// Test whether the Which Ranges are different // Test whether the Which Ranges are different
bool bEqual = true; bool bEqual = true;
sal_uInt16* pWh1 = _pWhichRanges; sal_uInt16* pWh1 = m_pWhichRanges;
sal_uInt16* pWh2 = rSet._pWhichRanges; sal_uInt16* pWh2 = rSet.m_pWhichRanges;
sal_uInt16 nSize = 0; sal_uInt16 nSize = 0;
for( sal_uInt16 n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n ) for( sal_uInt16 n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n )
...@@ -1062,8 +1065,8 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet ) ...@@ -1062,8 +1065,8 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
// If the Ranges are identical, we can easily process it // If the Ranges are identical, we can easily process it
if( bEqual ) if( bEqual )
{ {
SfxItemArray ppFnd1 = _aItems; SfxItemArray ppFnd1 = m_pItems;
SfxItemArray ppFnd2 = rSet._aItems; SfxItemArray ppFnd2 = rSet.m_pItems;
for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 ) for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 )
if( *ppFnd1 && *ppFnd2 ) if( *ppFnd1 && *ppFnd2 )
...@@ -1074,16 +1077,16 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet ) ...@@ -1074,16 +1077,16 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
sal_uInt16 nWhich = (*ppFnd1)->Which(); sal_uInt16 nWhich = (*ppFnd1)->Which();
if(nWhich <= SFX_WHICH_MAX) if(nWhich <= SFX_WHICH_MAX)
{ {
const SfxPoolItem& rNew = _pParent const SfxPoolItem& rNew = m_pParent
? _pParent->Get( nWhich, true ) ? m_pParent->Get( nWhich, true )
: _pPool->GetDefaultItem( nWhich ); : m_pPool->GetDefaultItem( nWhich );
Changed( **ppFnd1, rNew ); Changed( **ppFnd1, rNew );
} }
_pPool->Remove( **ppFnd1 ); m_pPool->Remove( **ppFnd1 );
} }
*ppFnd1 = 0; *ppFnd1 = 0;
--_nCount; --m_nCount;
} }
} }
else else
...@@ -1256,8 +1259,8 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults ) ...@@ -1256,8 +1259,8 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults )
// Test if the which Ranges are different // Test if the which Ranges are different
bool bEqual = true; bool bEqual = true;
sal_uInt16* pWh1 = _pWhichRanges; sal_uInt16* pWh1 = m_pWhichRanges;
sal_uInt16* pWh2 = rSet._pWhichRanges; sal_uInt16* pWh2 = rSet.m_pWhichRanges;
sal_uInt16 nSize = 0; sal_uInt16 nSize = 0;
for( sal_uInt16 n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n ) for( sal_uInt16 n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n )
...@@ -1275,11 +1278,11 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults ) ...@@ -1275,11 +1278,11 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults )
// If the Ranges match, they are easier to process! // If the Ranges match, they are easier to process!
if( bEqual ) if( bEqual )
{ {
SfxItemArray ppFnd1 = _aItems; SfxItemArray ppFnd1 = m_pItems;
SfxItemArray ppFnd2 = rSet._aItems; SfxItemArray ppFnd2 = rSet.m_pItems;
for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 ) for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 )
MergeItem_Impl( _pPool, _nCount, ppFnd1, *ppFnd2, bIgnoreDefaults ); MergeItem_Impl(m_pPool, m_nCount, ppFnd1, *ppFnd2, bIgnoreDefaults);
} }
else else
{ {
...@@ -1308,8 +1311,8 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults ) ...@@ -1308,8 +1311,8 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults )
void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults ) void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults )
{ {
SfxItemArray ppFnd = _aItems; SfxItemArray ppFnd = m_pItems;
const sal_uInt16* pPtr = _pWhichRanges; const sal_uInt16* pPtr = m_pWhichRanges;
const sal_uInt16 nWhich = rAttr.Which(); const sal_uInt16 nWhich = rAttr.Which();
while( *pPtr ) while( *pPtr )
{ {
...@@ -1317,7 +1320,7 @@ void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults ) ...@@ -1317,7 +1320,7 @@ void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults )
if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
{ {
ppFnd += nWhich - *pPtr; ppFnd += nWhich - *pPtr;
MergeItem_Impl( _pPool, _nCount, ppFnd, &rAttr, bIgnoreDefaults ); MergeItem_Impl(m_pPool, m_nCount, ppFnd, &rAttr, bIgnoreDefaults);
break; break;
} }
ppFnd += *(pPtr+1) - *pPtr + 1; ppFnd += *(pPtr+1) - *pPtr + 1;
...@@ -1329,8 +1332,8 @@ void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults ) ...@@ -1329,8 +1332,8 @@ void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults )
void SfxItemSet::InvalidateItem( sal_uInt16 nWhich ) void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
{ {
SfxItemArray ppFnd = _aItems; SfxItemArray ppFnd = m_pItems;
const sal_uInt16* pPtr = _pWhichRanges; const sal_uInt16* pPtr = m_pWhichRanges;
while( *pPtr ) while( *pPtr )
{ {
if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
...@@ -1342,14 +1345,14 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich ) ...@@ -1342,14 +1345,14 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
{ {
if( reinterpret_cast<SfxPoolItem*>(-1) != *ppFnd ) // Not yet dontcare! if( reinterpret_cast<SfxPoolItem*>(-1) != *ppFnd ) // Not yet dontcare!
{ {
_pPool->Remove( **ppFnd ); m_pPool->Remove( **ppFnd );
*ppFnd = reinterpret_cast<SfxPoolItem*>(-1); *ppFnd = reinterpret_cast<SfxPoolItem*>(-1);
} }
} }
else else
{ {
*ppFnd = reinterpret_cast<SfxPoolItem*>(-1); *ppFnd = reinterpret_cast<SfxPoolItem*>(-1);
++_nCount; ++m_nCount;
} }
break; break;
} }
...@@ -1363,7 +1366,7 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich ) ...@@ -1363,7 +1366,7 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
sal_uInt16 SfxItemSet::GetWhichByPos( sal_uInt16 nPos ) const sal_uInt16 SfxItemSet::GetWhichByPos( sal_uInt16 nPos ) const
{ {
sal_uInt16 n = 0; sal_uInt16 n = 0;
sal_uInt16* pPtr = _pWhichRanges; sal_uInt16* pPtr = m_pWhichRanges;
while( *pPtr ) while( *pPtr )
{ {
n = ( *(pPtr+1) - *pPtr ) + 1; n = ( *(pPtr+1) - *pPtr ) + 1;
...@@ -1383,7 +1386,7 @@ sal_uInt16 SfxItemSet::GetWhichByPos( sal_uInt16 nPos ) const ...@@ -1383,7 +1386,7 @@ sal_uInt16 SfxItemSet::GetWhichByPos( sal_uInt16 nPos ) const
* to the stream in the following way: * to the stream in the following way:
* *
* sal_uInt16 ... Count of the set Items * sal_uInt16 ... Count of the set Items
* Count* _pPool->StoreItem() * Count* m_pPool->StoreItem()
* *
* @see SfxItemPool::StoreItem() const * @see SfxItemPool::StoreItem() const
* @see SfxItemSet::Load(SvStream&,bool,const SfxItemPool*) * @see SfxItemSet::Load(SvStream&,bool,const SfxItemPool*)
...@@ -1395,14 +1398,14 @@ SvStream &SfxItemSet::Store ...@@ -1395,14 +1398,14 @@ SvStream &SfxItemSet::Store
false: Surrogates */ false: Surrogates */
) const ) const
{ {
assert(_pPool); assert(m_pPool);
// Remember position of the count (to be able to correct it, if need be) // Remember position of the count (to be able to correct it, if need be)
sal_uLong nCountPos = rStream.Tell(); sal_uLong nCountPos = rStream.Tell();
rStream.WriteUInt16( _nCount ); rStream.WriteUInt16( m_nCount );
// If there's nothing to save, don't construct an ItemIter // If there's nothing to save, don't construct an ItemIter
if ( _nCount ) if (m_nCount)
{ {
// Keep record of how many Items are really saved // Keep record of how many Items are really saved
sal_uInt16 nWrittenCount = 0; // Count of Items streamed in 'rStream' sal_uInt16 nWrittenCount = 0; // Count of Items streamed in 'rStream'
...@@ -1416,13 +1419,13 @@ SvStream &SfxItemSet::Store ...@@ -1416,13 +1419,13 @@ SvStream &SfxItemSet::Store
// Let Items (if need be as a Surrogate) be saved via Pool // Let Items (if need be as a Surrogate) be saved via Pool
SAL_WARN_IF(IsInvalidItem(pItem), "svl.items", "can't store invalid items"); SAL_WARN_IF(IsInvalidItem(pItem), "svl.items", "can't store invalid items");
if ( !IsInvalidItem(pItem) && if ( !IsInvalidItem(pItem) &&
_pPool->StoreItem( rStream, *pItem, bDirect ) ) m_pPool->StoreItem( rStream, *pItem, bDirect ) )
// Item was streamed in 'rStream' // Item was streamed in 'rStream'
++nWrittenCount; ++nWrittenCount;
} }
// Fewer written than read (e.g. old format) // Fewer written than read (e.g. old format)
if ( nWrittenCount != _nCount ) if (nWrittenCount != m_nCount)
{ {
// Store real count in the stream // Store real count in the stream
sal_uLong nPos = rStream.Tell(); sal_uLong nPos = rStream.Tell();
...@@ -1459,11 +1462,11 @@ SvStream &SfxItemSet::Load ...@@ -1459,11 +1462,11 @@ SvStream &SfxItemSet::Load
(e.g. when inserting documents) */ (e.g. when inserting documents) */
) )
{ {
assert(_pPool); assert(m_pPool);
// No RefPool => Resolve Surrogates with ItemSet's Pool // No RefPool => Resolve Surrogates with ItemSet's Pool
if ( !pRefPool ) if ( !pRefPool )
pRefPool = _pPool; pRefPool = m_pPool;
// Load Item count and as many Items // Load Item count and as many Items
sal_uInt16 nCount = 0; sal_uInt16 nCount = 0;
...@@ -1482,15 +1485,15 @@ SvStream &SfxItemSet::Load ...@@ -1482,15 +1485,15 @@ SvStream &SfxItemSet::Load
{ {
// Load Surrogate/Item and resolve Surrogate // Load Surrogate/Item and resolve Surrogate
const SfxPoolItem *pItem = const SfxPoolItem *pItem =
_pPool->LoadItem( rStream, bDirect, pRefPool ); m_pPool->LoadItem( rStream, bDirect, pRefPool );
// Did we load an Item or resolve a Surrogate? // Did we load an Item or resolve a Surrogate?
if ( pItem ) if ( pItem )
{ {
// Find position for Item pointer in the set // Find position for Item pointer in the set
sal_uInt16 nWhich = pItem->Which(); sal_uInt16 nWhich = pItem->Which();
SfxItemArray ppFnd = _aItems; SfxItemArray ppFnd = m_pItems;
const sal_uInt16* pPtr = _pWhichRanges; const sal_uInt16* pPtr = m_pWhichRanges;
while ( *pPtr ) while ( *pPtr )
{ {
// In this Range?? // In this Range??
...@@ -1500,7 +1503,7 @@ SvStream &SfxItemSet::Load ...@@ -1500,7 +1503,7 @@ SvStream &SfxItemSet::Load
ppFnd += nWhich - *pPtr; ppFnd += nWhich - *pPtr;
SFX_ASSERT( !*ppFnd, nWhich, "Item is present twice"); SFX_ASSERT( !*ppFnd, nWhich, "Item is present twice");
*ppFnd = pItem; *ppFnd = pItem;
++_nCount; ++m_nCount;
break; break;
} }
...@@ -1519,8 +1522,8 @@ SvStream &SfxItemSet::Load ...@@ -1519,8 +1522,8 @@ SvStream &SfxItemSet::Load
bool SfxItemSet::operator==(const SfxItemSet &rCmp) const bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
{ {
// Values we can get quickly need to be the same // Values we can get quickly need to be the same
if ( _pParent != rCmp._pParent || if ( m_pParent != rCmp.m_pParent ||
_pPool != rCmp._pPool || m_pPool != rCmp.m_pPool ||
Count() != rCmp.Count() ) Count() != rCmp.Count() )
return false; return false;
...@@ -1531,9 +1534,10 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const ...@@ -1531,9 +1534,10 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
return false; return false;
// Are the Ranges themselves unequal? // Are the Ranges themselves unequal?
for ( sal_uInt16 nRange = 0; _pWhichRanges[nRange]; nRange += 2 ) for (sal_uInt16 nRange = 0; m_pWhichRanges[nRange]; nRange += 2)
if ( _pWhichRanges[nRange] != rCmp._pWhichRanges[nRange] || {
_pWhichRanges[nRange+1] != rCmp._pWhichRanges[nRange+1] ) if (m_pWhichRanges[nRange] != rCmp.m_pWhichRanges[nRange] ||
m_pWhichRanges[nRange+1] != rCmp.m_pWhichRanges[nRange+1])
{ {
// We must use the slow method then // We must use the slow method then
SfxWhichIter aIter( *this ); SfxWhichIter aIter( *this );
...@@ -1547,21 +1551,22 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const ...@@ -1547,21 +1551,22 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
rCmp.GetItemState( nWh, false, &pItem2 ) || rCmp.GetItemState( nWh, false, &pItem2 ) ||
( pItem1 != pItem2 && ( pItem1 != pItem2 &&
( !pItem1 || IsInvalidItem(pItem1) || ( !pItem1 || IsInvalidItem(pItem1) ||
( _pPool->IsItemFlag(*pItem1, SFX_ITEM_POOLABLE) && (m_pPool->IsItemFlag(*pItem1, SFX_ITEM_POOLABLE) &&
*pItem1 != *pItem2 ) ) ) ) *pItem1 != *pItem2 ) ) ) )
return false; return false;
} }
return true; return true;
} }
}
// Are all pointers the same? // Are all pointers the same?
if ( 0 == memcmp( _aItems, rCmp._aItems, nCount1 * sizeof(_aItems[0]) ) ) if (0 == memcmp( m_pItems, rCmp.m_pItems, nCount1 * sizeof(m_pItems[0]) ))
return true; return true;
// We need to compare each one separately then // We need to compare each one separately then
const SfxPoolItem **ppItem1 = (const SfxPoolItem**) _aItems; const SfxPoolItem **ppItem1 = m_pItems;
const SfxPoolItem **ppItem2 = (const SfxPoolItem**) rCmp._aItems; const SfxPoolItem **ppItem2 = rCmp.m_pItems;
for ( sal_uInt16 nPos = 0; nPos < nCount1; ++nPos ) for ( sal_uInt16 nPos = 0; nPos < nCount1; ++nPos )
{ {
// If the pointers of the poolable Items are not the same, the Items // If the pointers of the poolable Items are not the same, the Items
...@@ -1569,7 +1574,7 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const ...@@ -1569,7 +1574,7 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
if ( *ppItem1 != *ppItem2 && if ( *ppItem1 != *ppItem2 &&
( ( !*ppItem1 || !*ppItem2 ) || ( ( !*ppItem1 || !*ppItem2 ) ||
( IsInvalidItem(*ppItem1) || IsInvalidItem(*ppItem2) ) || ( IsInvalidItem(*ppItem1) || IsInvalidItem(*ppItem2) ) ||
( _pPool->IsItemFlag(**ppItem1, SFX_ITEM_POOLABLE) ) || (m_pPool->IsItemFlag(**ppItem1, SFX_ITEM_POOLABLE)) ||
**ppItem1 != **ppItem2 ) ) **ppItem1 != **ppItem2 ) )
return false; return false;
...@@ -1584,9 +1589,9 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const ...@@ -1584,9 +1589,9 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
SfxItemSet *SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const SfxItemSet *SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
{ {
if ( pToPool && pToPool != _pPool ) if (pToPool && pToPool != m_pPool)
{ {
SfxItemSet *pNewSet = new SfxItemSet( *pToPool, _pWhichRanges ); SfxItemSet *pNewSet = new SfxItemSet(*pToPool, m_pWhichRanges);
if ( bItems ) if ( bItems )
{ {
SfxWhichIter aIter(*pNewSet); SfxWhichIter aIter(*pNewSet);
...@@ -1604,18 +1609,18 @@ SfxItemSet *SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const ...@@ -1604,18 +1609,18 @@ SfxItemSet *SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
else else
return bItems return bItems
? new SfxItemSet(*this) ? new SfxItemSet(*this)
: new SfxItemSet(*_pPool, _pWhichRanges); : new SfxItemSet(*m_pPool, m_pWhichRanges);
} }
int SfxItemSet::PutDirect(const SfxPoolItem &rItem) int SfxItemSet::PutDirect(const SfxPoolItem &rItem)
{ {
SfxItemArray ppFnd = _aItems; SfxItemArray ppFnd = m_pItems;
const sal_uInt16* pPtr = _pWhichRanges; const sal_uInt16* pPtr = m_pWhichRanges;
const sal_uInt16 nWhich = rItem.Which(); const sal_uInt16 nWhich = rItem.Which();
#ifdef DBG_UTIL #ifdef DBG_UTIL
IsPoolDefaultItem(&rItem) || _pPool->GetSurrogate(&rItem); IsPoolDefaultItem(&rItem) || m_pPool->GetSurrogate(&rItem);
// Only cause assertion in the callees // Only cause assertion in the callees
#endif #endif
while( *pPtr ) while( *pPtr )
...@@ -1629,14 +1634,14 @@ int SfxItemSet::PutDirect(const SfxPoolItem &rItem) ...@@ -1629,14 +1634,14 @@ int SfxItemSet::PutDirect(const SfxPoolItem &rItem)
{ {
if( rItem == **ppFnd ) if( rItem == **ppFnd )
return sal_False; // Already present! return sal_False; // Already present!
_pPool->Remove( *pOld ); m_pPool->Remove( *pOld );
} }
else else
++_nCount; ++m_nCount;
// Add the new one // Add the new one
if( IsPoolDefaultItem(&rItem) ) if( IsPoolDefaultItem(&rItem) )
*ppFnd = &_pPool->Put( rItem ); *ppFnd = &m_pPool->Put( rItem );
else else
{ {
*ppFnd = &rItem; *ppFnd = &rItem;
...@@ -1660,11 +1665,11 @@ SfxAllItemSet::SfxAllItemSet( SfxItemPool &rPool ) ...@@ -1660,11 +1665,11 @@ SfxAllItemSet::SfxAllItemSet( SfxItemPool &rPool )
nFree(nInitCount) nFree(nInitCount)
{ {
// Initially no Items // Initially no Items
_aItems = 0; m_pItems = nullptr;
// Allocate nInitCount pairs at USHORTs for Ranges // Allocate nInitCount pairs at USHORTs for Ranges
_pWhichRanges = new sal_uInt16[ nInitCount + 1 ]; m_pWhichRanges = new sal_uInt16[ nInitCount + 1 ];
memset( _pWhichRanges, 0, ( nInitCount + 1 ) * sizeof(sal_uInt16) ); memset( m_pWhichRanges, 0, (nInitCount + 1) * sizeof(sal_uInt16) );
} }
...@@ -1760,11 +1765,11 @@ static SfxItemArray AddItem_Impl(SfxItemArray pItems, sal_uInt16 nOldSize, sal_u ...@@ -1760,11 +1765,11 @@ static SfxItemArray AddItem_Impl(SfxItemArray pItems, sal_uInt16 nOldSize, sal_u
*/ */
const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich ) const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich )
{ {
sal_uInt16 nPos = 0; // Position for 'rItem' in '_aItems' sal_uInt16 nPos = 0; // Position for 'rItem' in 'm_pItems'
const sal_uInt16 nItemCount = TotalCount(); const sal_uInt16 nItemCount = TotalCount();
// Let's see first whether there's a suitable Range already // Let's see first whether there's a suitable Range already
sal_uInt16 *pPtr = _pWhichRanges; sal_uInt16 *pPtr = m_pWhichRanges;
while ( *pPtr ) while ( *pPtr )
{ {
// WhichId is within this Range? // WhichId is within this Range?
...@@ -1775,7 +1780,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi ...@@ -1775,7 +1780,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
break; break;
} }
// Carry over the position of the Item in _aItems // Carry over the position of the Item in m_pItems
nPos += *(pPtr+1) - *pPtr + 1; nPos += *(pPtr+1) - *pPtr + 1;
// To the next Range // To the next Range
...@@ -1786,7 +1791,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi ...@@ -1786,7 +1791,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
if ( !*pPtr ) if ( !*pPtr )
{ {
// Let's see if we can attach it somewhere // Let's see if we can attach it somewhere
pPtr = _pWhichRanges; pPtr = m_pWhichRanges;
nPos = 0; nPos = 0;
while ( *pPtr ) while ( *pPtr )
{ {
...@@ -1797,7 +1802,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi ...@@ -1797,7 +1802,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
(*pPtr)--; (*pPtr)--;
// Make room before first Item of this Range // Make room before first Item of this Range
_aItems = AddItem_Impl(_aItems, nItemCount, nPos); m_pItems = AddItem_Impl(m_pItems, nItemCount, nPos);
break; break;
} }
...@@ -1809,11 +1814,11 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi ...@@ -1809,11 +1814,11 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
// Make room after last Item of this Range // Make room after last Item of this Range
nPos += nWhich - *pPtr; nPos += nWhich - *pPtr;
_aItems = AddItem_Impl(_aItems, nItemCount, nPos); m_pItems = AddItem_Impl(m_pItems, nItemCount, nPos);
break; break;
} }
// Carry over position of the Item in _aItems // Carry over position of the Item in m_pItems
nPos += *(pPtr+1) - *pPtr + 1; nPos += *(pPtr+1) - *pPtr + 1;
// To the next Range // To the next Range
...@@ -1824,54 +1829,56 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi ...@@ -1824,54 +1829,56 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
// No extensible Range found? // No extensible Range found?
if ( !*pPtr ) if ( !*pPtr )
{ {
// No room left in _pWhichRanges? => Expand! // No room left in m_pWhichRanges? => Expand!
std::ptrdiff_t nSize = pPtr - _pWhichRanges; std::ptrdiff_t nSize = pPtr - m_pWhichRanges;
if( !nFree ) if( !nFree )
{ {
_pWhichRanges = AddRanges_Impl(_pWhichRanges, nSize, nInitCount); m_pWhichRanges = AddRanges_Impl(m_pWhichRanges, nSize, nInitCount);
nFree += nInitCount; nFree += nInitCount;
} }
// Attach new WhichRange // Attach new WhichRange
pPtr = _pWhichRanges + nSize; pPtr = m_pWhichRanges + nSize;
*pPtr++ = nWhich; *pPtr++ = nWhich;
*pPtr = nWhich; *pPtr = nWhich;
nFree -= 2; nFree -= 2;
// Expand ItemArray // Expand ItemArray
nPos = nItemCount; nPos = nItemCount;
_aItems = AddItem_Impl(_aItems, nItemCount, nPos); m_pItems = AddItem_Impl(m_pItems, nItemCount, nPos);
} }
// Add new Item to Pool // Add new Item to Pool
const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich ); const SfxPoolItem& rNew = m_pPool->Put( rItem, nWhich );
// Remember old Item // Remember old Item
bool bIncrementCount = false; bool bIncrementCount = false;
const SfxPoolItem* pOld = *( _aItems + nPos ); const SfxPoolItem* pOld = *( m_pItems + nPos );
if ( reinterpret_cast< SfxPoolItem* >( -1 ) == pOld ) // state "dontcare" if ( reinterpret_cast< SfxPoolItem* >( -1 ) == pOld ) // state "dontcare"
pOld = NULL; pOld = NULL;
if ( !pOld ) if ( !pOld )
{ {
bIncrementCount = true; bIncrementCount = true;
pOld = _pParent ? pOld = (m_pParent)
&_pParent->Get( nWhich, true ) ? &m_pParent->Get( nWhich, true )
: nWhich <= SFX_WHICH_MAX ? &_pPool->GetDefaultItem( nWhich ) : 0; : ((nWhich <= SFX_WHICH_MAX)
? &m_pPool->GetDefaultItem(nWhich)
: nullptr);
} }
// Add new Item to ItemSet // Add new Item to ItemSet
*(_aItems + nPos) = &rNew; *(m_pItems + nPos) = &rNew;
// Send Changed Notification // Send Changed Notification
if ( pOld ) if ( pOld )
{ {
Changed( *pOld, rNew ); Changed( *pOld, rNew );
if ( !IsDefaultItem(pOld) ) if ( !IsDefaultItem(pOld) )
_pPool->Remove( *pOld ); m_pPool->Remove( *pOld );
} }
if ( bIncrementCount ) if ( bIncrementCount )
++_nCount; ++m_nCount;
return &rNew; return &rNew;
} }
...@@ -1890,7 +1897,7 @@ void SfxItemSet::DisableItem(sal_uInt16 nWhich) ...@@ -1890,7 +1897,7 @@ void SfxItemSet::DisableItem(sal_uInt16 nWhich)
SfxItemSet *SfxAllItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const SfxItemSet *SfxAllItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
{ {
if ( pToPool && pToPool != _pPool ) if (pToPool && pToPool != m_pPool)
{ {
SfxAllItemSet *pNewSet = new SfxAllItemSet( *pToPool ); SfxAllItemSet *pNewSet = new SfxAllItemSet( *pToPool );
if ( bItems ) if ( bItems )
...@@ -1898,7 +1905,7 @@ SfxItemSet *SfxAllItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const ...@@ -1898,7 +1905,7 @@ SfxItemSet *SfxAllItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
return pNewSet; return pNewSet;
} }
else else
return bItems ? new SfxAllItemSet(*this) : new SfxAllItemSet(*_pPool); return bItems ? new SfxAllItemSet(*this) : new SfxAllItemSet(*m_pPool);
} }
......
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