editeng/source/editeng/editobj.cxx  |    6 +++---
 editeng/source/editeng/editobj2.hxx |   11 ++++++-----
 editeng/source/editeng/impedit4.cxx |    4 ++--
 3 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 94449b59061457cfb4321a2dadaeee15f8b7922b
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Jul 21 09:24:52 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Jul 21 11:06:52 2021 +0200

    Use MapUnit directly here
    
    Change-Id: I745503ca1cae88519ac32e946849302b46e0ccb4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119297
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 2179b27af7fc..e9654f4d3a38 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -275,7 +275,7 @@ EditTextObjectImpl::EditTextObjectImpl( SfxItemPool* pP )
     : meUserType(OutlinerMode::DontKnow)
     , meScriptType(SvtScriptType::NONE)
     , meRotation(TextRotation::NONE)
-    , mnMetric(0xFFFF)
+    , meMetric(MapUnit::LASTENUMDUMMY)
     , mbVertical(false)
 {
     // #i101239# ensure target is an EditEngineItemPool, else
@@ -301,7 +301,7 @@ EditTextObjectImpl::EditTextObjectImpl( const 
EditTextObjectImpl& r )
     : meUserType(r.meUserType)
     , meScriptType(r.meScriptType)
     , meRotation(r.meRotation)
-    , mnMetric(r.mnMetric)
+    , meMetric(r.meMetric)
     , mbVertical(r.mbVertical)
 {
     // Do not copy PortionInfo
@@ -791,7 +791,7 @@ bool EditTextObjectImpl::Equals( const EditTextObjectImpl& 
rCompare, bool bCompa
         return true;
 
     if(     ( bComparePool && mpPool != rCompare.mpPool ) ||
-            ( mnMetric != rCompare.mnMetric ) ||
+            ( meMetric != rCompare.meMetric ) ||
             ( meUserType!= rCompare.meUserType ) ||
             ( meScriptType != rCompare.meScriptType ) ||
             ( mbVertical != rCompare.mbVertical ) ||
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 2a972a4a9564..66a3517883be 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -26,6 +26,8 @@
 
 #include <svl/sharedstring.hxx>
 #include <svl/languageoptions.hxx>
+#include <tools/long.hxx>
+#include <tools/mapunit.hxx>
 
 #include <memory>
 #include <vector>
@@ -176,8 +178,7 @@ private:
     OutlinerMode            meUserType;
     SvtScriptType           meScriptType;
     TextRotation            meRotation;
-
-    sal_uInt16              mnMetric;
+    MapUnit                 meMetric;
 
     bool                    mbOwnerOfPool;
     bool                    mbVertical;
@@ -251,9 +252,9 @@ public:
 
     virtual editeng::FieldUpdater GetFieldUpdater() override { return 
editeng::FieldUpdater(*this); }
 
-    bool HasMetric() const { return mnMetric != 0xFFFF; }
-    sal_uInt16                  GetMetric() const           { return mnMetric; 
}
-    void                    SetMetric( sal_uInt16 n )       { mnMetric = n; }
+    bool HasMetric() const { return meMetric != MapUnit::LASTENUMDUMMY; }
+    MapUnit                  GetMetric() const           { return meMetric; }
+    void                    SetMetric( MapUnit n )       { meMetric = n; }
 
     bool                    IsOwnerOfPool() const       { return 
mbOwnerOfPool; }
 
diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index 5b11662eda1b..90b89fc3bcc7 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -993,7 +993,7 @@ std::unique_ptr<EditTextObject> 
ImpEditEngine::CreateTextObject( EditSelection a
     pTxtObj->SetVertical( GetDirectVertical() );
     pTxtObj->SetRotation( GetRotation() );
     MapUnit eMapUnit = aEditDoc.GetItemPool().GetMetric( DEF_METRIC );
-    pTxtObj->SetMetric( static_cast<sal_uInt16>(eMapUnit) );
+    pTxtObj->SetMetric( eMapUnit );
     if ( pTxtObj->IsOwnerOfPool() )
         pTxtObj->GetPool()->SetDefaultMetric( eMapUnit );
 
@@ -1191,7 +1191,7 @@ EditSelection ImpEditEngine::InsertTextObject( const 
EditTextObject& rTextObject
     MapUnit eSourceUnit = MapUnit(), eDestUnit = MapUnit();
     if (rTextObjectImpl.HasMetric())
     {
-        eSourceUnit = static_cast<MapUnit>(rTextObjectImpl.GetMetric());
+        eSourceUnit = rTextObjectImpl.GetMetric();
         eDestUnit = aEditDoc.GetItemPool().GetMetric( DEF_METRIC );
         if ( eSourceUnit != eDestUnit )
             bConvertMetricOfItems = true;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to