[Libreoffice-commits] core.git: 3 commits - editeng/source forms/source include/editeng

Stephan Bergmann sbergman at redhat.com
Tue Nov 11 10:51:56 PST 2014


 editeng/source/editeng/eertfpar.cxx          |    5 ++++-
 editeng/source/items/textitem.cxx            |   11 +++--------
 forms/source/richtext/rtattributehandler.cxx |   10 ++++------
 include/editeng/fhgtitem.hxx                 |   12 ++++++++----
 4 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit a237e0838196774cceeffe984d614198dbabd21e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Nov 11 19:37:53 2014 +0100

    Copy the original prop/prop unit
    
    ...instead of scaling the translated nNewHeight once more by the original prop
    
    Change-Id: Iadb53361a79f0b37b3c7c50066e4cfb7d24ed5e8

diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index 641b5b9..4eb6a03 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -315,7 +315,10 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
                 long nNewHeight;
                 nNewHeight = OutputDevice::LogicToLogic( (long)nHeight, eSrcUnit, eDestUnit );
 
-                SvxFontHeightItem aFntHeightItem( nNewHeight, static_cast<const SvxFontHeightItem*>(pItem)->GetProp(), aFntHeightIems[i] );
+                SvxFontHeightItem aFntHeightItem( nNewHeight, 100, aFntHeightIems[i] );
+                aFntHeightItem.SetProp(
+                    static_cast<const SvxFontHeightItem*>(pItem)->GetProp(),
+                    static_cast<const SvxFontHeightItem*>(pItem)->GetPropUnit());
                 rSet.GetAttrSet().Put( aFntHeightItem );
             }
         }
commit 63c48a7e0e3debec16dfc7cd04e7eca4c6fbe0ea
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Nov 11 19:36:27 2014 +0100

    Fix SvxFontHeightItem::operator=
    
    ...and remove thus unused SetHeightValue
    
    Change-Id: I9c8c18614233df6086ff23533e7e7129848f42ef

diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx
index 3ff3e64..2ea466f 100644
--- a/include/editeng/fhgtitem.hxx
+++ b/include/editeng/fhgtitem.hxx
@@ -66,8 +66,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,12 +81,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 )
         {
commit 2a68ed19e8f35909e5dba691f9552099eae3162f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Nov 11 19:18:12 2014 +0100

    Revert "Some SvxFontHeightItem clean-up"
    
    This reverts commit d5f93eb47ec4c27e93ad908b0199790c702491a0,
    SvxFontHeightItem::SetProp was used to override "dummy" 100% nProp/ePropUnit
    values that did not match the computed nHeight value with nProp/ePropUnit values
    that are supposed to match the computed nHeight value.  Yuck.
    
    Change-Id: Ic12e824054b3c5da7aca766b9b3eb076d1837d9a

diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 56be239..4a2bbd8 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -723,12 +723,7 @@ 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
 {
@@ -776,8 +771,8 @@ SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm,
     if( FONTHEIGHT_UNIT_VERSION <= nVersion )
         rStrm.ReadUInt16( nPropUnit );
 
-    SvxFontHeightItem* pItem = new SvxFontHeightItem(
-        Which(), nsize, nprop, (SfxMapUnit)nPropUnit );
+    SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() );
+    pItem->SetProp( nprop, (SfxMapUnit)nPropUnit );
     return pItem;
 }
 
diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx
index 688068c..c9b90c0 100644
--- a/forms/source/richtext/rtattributehandler.cxx
+++ b/forms/source/richtext/rtattributehandler.cxx
@@ -336,9 +336,8 @@ namespace frm
                 ).Height();
             }
 
-            SvxFontHeightItem* pNewItem = new SvxFontHeightItem(
-                getWhich(), nHeight, pFontHeightItem->GetProp(),
-                pFontHeightItem->GetPropUnit() );
+            SvxFontHeightItem* pNewItem = new SvxFontHeightItem( nHeight, 100, getWhich() );
+            pNewItem->SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() );
             aState.setItem( pNewItem );
         }
 
@@ -365,9 +364,8 @@ namespace frm
                 ).Height();
             }
 
-            SvxFontHeightItem aNewItem(
-                getWhich(), nHeight, pFontHeightItem->GetProp(),
-                pFontHeightItem->GetPropUnit() );
+            SvxFontHeightItem aNewItem( nHeight, 100, getWhich() );
+            aNewItem.SetProp( 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 a52da18..3ff3e64 100644
--- a/include/editeng/fhgtitem.hxx
+++ b/include/editeng/fhgtitem.hxx
@@ -47,10 +47,6 @@ 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;
@@ -70,10 +66,8 @@ public:
 
     inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize)
         {
-            DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
-            nHeight = rSize.nHeight;
-            nProp = rSize.nProp;
-            ePropUnit = rSize.ePropUnit;
+            SetHeightValue( rSize.GetHeight() );
+            SetProp( rSize.GetProp(), ePropUnit );
             return *this;
         }
 
@@ -85,6 +79,20 @@ 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, ...


More information about the Libreoffice-commits mailing list