summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-11-11 18:39:20 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-11-11 18:39:20 +0100
commitd5f93eb47ec4c27e93ad908b0199790c702491a0 (patch)
tree557a89c8833f91e5b370fb72194ce8e974f0e3f4
parent047830de46fc40629dc9bdf1e8b9f427b6648c36 (diff)
Some SvxFontHeightItem clean-up
...and operator= shall probably copy rSize.ePropUnit... Change-Id: I112c02b3a3b2ce23f3d03f03881136e05be29017
-rw-r--r--editeng/source/items/textitem.cxx11
-rw-r--r--forms/source/richtext/rtattributehandler.cxx10
-rw-r--r--include/editeng/fhgtitem.hxx24
3 files changed, 22 insertions, 23 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 4a2bbd8b83a8..56be23996ec6 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -723,7 +723,12 @@ SvxFontHeightItem::SvxFontHeightItem( const sal_uLong nSz,
SetHeight( nSz,nPrp ); // calculate in percentage
}
-
+SvxFontHeightItem::SvxFontHeightItem(
+ sal_uInt16 wid, sal_uInt32 height, sal_uInt16 prop, SfxMapUnit propUnit):
+ SfxPoolItem(wid)
+{
+ SetHeight(height, prop, propUnit);
+}
SfxPoolItem* SvxFontHeightItem::Clone( SfxItemPool * ) const
{
@@ -771,8 +776,8 @@ SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm,
if( FONTHEIGHT_UNIT_VERSION <= nVersion )
rStrm.ReadUInt16( nPropUnit );
- SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() );
- pItem->SetProp( nprop, (SfxMapUnit)nPropUnit );
+ SvxFontHeightItem* pItem = new SvxFontHeightItem(
+ Which(), nsize, nprop, (SfxMapUnit)nPropUnit );
return pItem;
}
diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx
index c9b90c0e5e33..688068c8fc31 100644
--- a/forms/source/richtext/rtattributehandler.cxx
+++ b/forms/source/richtext/rtattributehandler.cxx
@@ -336,8 +336,9 @@ namespace frm
).Height();
}
- SvxFontHeightItem* pNewItem = new SvxFontHeightItem( nHeight, 100, getWhich() );
- pNewItem->SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() );
+ SvxFontHeightItem* pNewItem = new SvxFontHeightItem(
+ getWhich(), nHeight, pFontHeightItem->GetProp(),
+ pFontHeightItem->GetPropUnit() );
aState.setItem( pNewItem );
}
@@ -364,8 +365,9 @@ namespace frm
).Height();
}
- SvxFontHeightItem aNewItem( nHeight, 100, getWhich() );
- aNewItem.SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() );
+ SvxFontHeightItem aNewItem(
+ getWhich(), nHeight, pFontHeightItem->GetProp(),
+ pFontHeightItem->GetPropUnit() );
if ( ( getAttributeId() == SID_ATTR_CHAR_FONTHEIGHT ) && _nForScriptType )
putItemForScript( _rNewAttribs, aNewItem, _nForScriptType );
diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx
index 3ff3e64bd532..a52da1841a0b 100644
--- a/include/editeng/fhgtitem.hxx
+++ b/include/editeng/fhgtitem.hxx
@@ -47,6 +47,10 @@ public:
SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
const sal_uInt16 nId );
+ SvxFontHeightItem(
+ sal_uInt16 wid, sal_uInt32 height, sal_uInt16 prop,
+ SfxMapUnit propUnit);
+
// "pure virtual Methods" from SfxPoolItem
virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
@@ -66,8 +70,10 @@ public:
inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize)
{
- SetHeightValue( rSize.GetHeight() );
- SetProp( rSize.GetProp(), ePropUnit );
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nHeight = rSize.nHeight;
+ nProp = rSize.nProp;
+ ePropUnit = rSize.ePropUnit;
return *this;
}
@@ -79,20 +85,6 @@ public:
sal_uInt32 GetHeight() const { return nHeight; }
- void SetHeightValue( sal_uInt32 nNewHeight )
- {
- DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
- nHeight = nNewHeight;
- }
-
- void SetProp( const sal_uInt16 nNewProp,
- SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE )
- {
- DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
- nProp = nNewProp;
- ePropUnit = eUnit;
- }
-
sal_uInt16 GetProp() const { return nProp; }
SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...