summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-08-10 08:10:19 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-08-11 06:41:17 +0200
commitfa339b3adb53300ae68913bed87e18caf9f2e262 (patch)
treee3aed1bb38664cfe343a6d7f0803d2312c86c76a /sw/source
parente89404f00b25cfddd4098b4b2cf900d190617221 (diff)
convert some LogicToLogic calls to use o3tl::convert instead
If a LogicToLogic uses fixed units, we can use o3tl::convert instead. We can also do the same for all other cases where LogicToLogic is used, but that needs additional investigation to determine if it is safe to do so. Note: MapUnit::Pixel is converted to o3tl::Length::pt because it assumed 72 PPI for a logical pixel, which corresponds with the conversion rate of a point (72 PPI). Today, 96 PPI is standard, which is also used for o3tl::Length:px. Change-Id: I29126df38bfcfda74b5d83d4cb880a378aecd18b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120230 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx11
-rw-r--r--sw/source/uibase/shells/textsh.cxx3
2 files changed, 7 insertions, 7 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 3dd384b64c9c..338a11b24b84 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1010,7 +1010,8 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
// --> OD #i98753#
// set size of embedded object at the object description structure
- m_aObjDesc.maSize = OutputDevice::LogicToLogic(m_pWrtShell->GetObjSize(), MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+ m_aObjDesc.maSize = o3tl::convert(m_pWrtShell->GetObjSize(), o3tl::Length::twip, o3tl::Length::mm100);
+
// <--
PrepareOLE( m_aObjDesc );
@@ -1158,7 +1159,7 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
//Now adjust it. Thus in GetData the first query can still
//be answered with delayed rendering.
Size aSz( OLESIZE );
- m_aObjDesc.maSize = OutputDevice::LogicToLogic(aSz, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+ m_aObjDesc.maSize = o3tl::convert(aSz, o3tl::Length::twip, o3tl::Length::mm100);
PrepareOLE( m_aObjDesc );
#if HAVE_FEATURE_DESKTOP
@@ -1261,7 +1262,7 @@ bool SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr
//Now adjust it. Thus in GetData the first query can still
//be answered with delayed rendering.
Size aSz( OLESIZE );
- m_aObjDesc.maSize = OutputDevice::LogicToLogic(aSz, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+ m_aObjDesc.maSize = o3tl::convert(aSz, o3tl::Length::twip, o3tl::Length::mm100);
PrepareOLE( m_aObjDesc );
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
@@ -3623,8 +3624,8 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos )
//Now adjust it. Thus in GetData the first query can still
//be answered with delayed rendering.
m_aObjDesc.maDragStartPos = rSttPos;
- m_aObjDesc.maSize = OutputDevice::LogicToLogic( Size( OLESIZE ),
- MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+ m_aObjDesc.maSize = o3tl::convert(Size( OLESIZE ), o3tl::Length::twip, o3tl::Length::mm100);
+
PrepareOLE( m_aObjDesc );
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
}
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index 114ce385e4d3..76be2461935a 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -351,8 +351,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
if(pItem && xObj.is())
{
Size aSize(static_cast<const SvxSizeItem*>(pItem)->GetSize());
- aSize = OutputDevice::LogicToLogic
- ( aSize, MapMode( MapUnit::MapTwip ), MapMode( MapUnit::Map100thMM ) );
+ aSize = o3tl::convert(aSize, o3tl::Length::twip, o3tl::Length::mm100);
if(aSize.Width() > MINLAY&& aSize.Height()> MINLAY)
{