Kaydet (Commit) 82c37453 authored tarafından Noel Grandin's avatar Noel Grandin

SfxItemHandle is only used in one place, so inline it

Change-Id: Ie54e0699312b6c072d2b162a068cffdf960be4d0
üst d26052bd
......@@ -45,7 +45,7 @@ namespace frm
struct AttributeState
{
private:
SfxItemHandle* pItemHandle;
SfxPoolItem *pItemHandleItem;
public:
AttributeCheckState eSimpleState;
......@@ -64,19 +64,19 @@ namespace frm
};
inline AttributeState::AttributeState( )
:pItemHandle( NULL )
:pItemHandleItem ( NULL )
,eSimpleState( eIndetermined )
{
}
inline AttributeState::AttributeState( AttributeCheckState _eCheckState )
:pItemHandle( NULL )
:pItemHandleItem ( NULL )
,eSimpleState( _eCheckState )
{
}
inline AttributeState::AttributeState( const AttributeState& _rSource )
:pItemHandle( NULL )
:pItemHandleItem ( NULL )
,eSimpleState( eIndetermined )
{
operator=( _rSource );
......@@ -84,7 +84,7 @@ namespace frm
inline AttributeState::~AttributeState( )
{
delete(pItemHandle);
// delete(pItemHandle);
}
inline AttributeState& AttributeState::operator=( const AttributeState& _rSource )
......@@ -99,17 +99,17 @@ namespace frm
inline const SfxPoolItem* AttributeState::getItem() const
{
return pItemHandle ? &pItemHandle->GetItem() : NULL;
return pItemHandleItem;
}
inline void AttributeState::setItem( const SfxPoolItem* _pItem )
{
if ( pItemHandle )
delete pItemHandle;
if ( pItemHandleItem )
delete pItemHandleItem;
if ( _pItem )
pItemHandle = new SfxItemHandle( *const_cast< SfxPoolItem* >( _pItem ) );
pItemHandleItem = _pItem->Clone();
else
pItemHandle = NULL;
pItemHandleItem = NULL;
}
inline bool AttributeState::operator==( const AttributeState& _rRHS )
......@@ -117,16 +117,16 @@ namespace frm
if ( eSimpleState != _rRHS.eSimpleState )
return false;
if ( pItemHandle && !_rRHS.pItemHandle )
if ( pItemHandleItem && !_rRHS.pItemHandleItem )
return false;
if ( !pItemHandle && _rRHS.pItemHandle )
if ( !pItemHandleItem && _rRHS.pItemHandleItem )
return false;
if ( !pItemHandle && !_rRHS.pItemHandle )
if ( !pItemHandleItem && !_rRHS.pItemHandleItem )
return true;
return ( pItemHandle->GetItem() == _rRHS.pItemHandle->GetItem() );
return pItemHandleItem == _rRHS.pItemHandleItem;
}
class IMultiAttributeDispatcher
......
......@@ -339,23 +339,6 @@ public:
};
// Handle class for PoolItems
class SVL_DLLPUBLIC SfxItemHandle
{
sal_uInt16 *pRef;
SfxPoolItem *pItem;
public:
explicit SfxItemHandle( SfxPoolItem& );
SfxItemHandle( const SfxItemHandle& );
~SfxItemHandle();
const SfxItemHandle &operator=(const SfxItemHandle &);
const SfxPoolItem &GetItem() const { return *pItem; }
};
DECL_PTRHINT(SVL_DLLPUBLIC, SfxPoolItemHint, SfxPoolItem);
......
......@@ -256,50 +256,6 @@ SfxPoolItem* SfxVoidItem::Clone(SfxItemPool *) const
return new SfxVoidItem(*this);
}
// SfxInvalidItem
SfxItemHandle::SfxItemHandle(SfxPoolItem &rItem):
pRef(new sal_uInt16(1)),
pItem(rItem.Clone())
{
}
SfxItemHandle::SfxItemHandle(const SfxItemHandle &rCopy):
pRef(rCopy.pRef),
pItem(rCopy.pItem)
{
++(*pRef);
}
const SfxItemHandle &SfxItemHandle::operator=(const SfxItemHandle &rCopy)
{
if(&rCopy == this || pItem == rCopy.pItem)
return *this;
--(*pRef);
if(!(*pRef))
{
delete pItem;
pItem = 0;
}
pRef = rCopy.pRef;
++(*pRef);
pItem = rCopy.pItem;
return *this;
}
SfxItemHandle::~SfxItemHandle()
{
--(*pRef);
if(!(*pRef)) {
delete pRef; pRef = 0;
delete pItem; pItem = 0;
}
}
bool SfxPoolItem::ScaleMetrics( long /*lMult*/, long /*lDiv*/ )
{
return false;
......
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