summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-07-21 09:24:52 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-07-21 11:06:52 +0200
commit94449b59061457cfb4321a2dadaeee15f8b7922b (patch)
tree878e4e6248d8de91233fcf4f46d3b9c6c470c794 /editeng
parent42de48d099d6cb5cf8507385d50328f20034c08e (diff)
Use MapUnit directly here
Change-Id: I745503ca1cae88519ac32e946849302b46e0ccb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119297 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editobj.cxx6
-rw-r--r--editeng/source/editeng/editobj2.hxx11
-rw-r--r--editeng/source/editeng/impedit4.cxx4
3 files changed, 11 insertions, 10 deletions
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;