summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-01-17 13:12:52 +0200
committerNoel Grandin <noel@peralex.com>2015-03-11 10:16:52 +0200
commit82c37453482e6b8bd6ab7b7e96b1257a1d5b0699 (patch)
tree9620e5eff60e7cc5c3b3792a99793e687d78cd80
parentd26052bdb267f042256c3fac34ebf4697dbc3ceb (diff)
SfxItemHandle is only used in one place, so inline it
Change-Id: Ie54e0699312b6c072d2b162a068cffdf960be4d0
-rw-r--r--forms/source/richtext/rtattributes.hxx28
-rw-r--r--include/svl/poolitem.hxx17
-rw-r--r--svl/source/items/poolitem.cxx44
3 files changed, 14 insertions, 75 deletions
diff --git a/forms/source/richtext/rtattributes.hxx b/forms/source/richtext/rtattributes.hxx
index 4ad754f18344..85f2c742dc76 100644
--- a/forms/source/richtext/rtattributes.hxx
+++ b/forms/source/richtext/rtattributes.hxx
@@ -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
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index 182da1946510..a03794a11fcf 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -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);
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index 3a0e9f8cd9be..0e2a8d93bb2a 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -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;