[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 382 commits - accessibility/inc accessibility/source android/source basctl/source basegfx/CppunitTest_basegfx.mk basegfx/source basegfx/test basic/source bin/find-can-be-private-symbols.functions.results bin/find-german-comments bin/oss-fuzz-setup.sh bin/ui-rules-enforcer.py bridges/source chart2/qa chart2/source comphelper/source compilerplugins/clang configure.ac connectivity/source cui/source cui/uiconfig dbaccess/qa dbaccess/source dbaccess/uiconfig desktop/qa desktop/source download.lst drawinglayer/Library_drawinglayer.mk drawinglayer/source editeng/source emfio/source external/cairo external/frozen external/mdds external/Module_external.mk external/python3 filter/CppunitTest_filter_pdfimporter_test.mk filter/Library_pdfimporter.mk filter/Module_filter.mk filter/qa filter/source formula/source fpicker/source framework/source .git-hooks/commit-msg helpcontent2 i18nlangtag/source include/basegfx include/comphelper include/dr awinglayer include/editeng include/filter include/formula include/i18nlangtag include/o3tl include/oox include/sfx2 include/svl include/svx include/toolkit include/tools include/vcl include/xmloff libreofficekit/qa lotuswordpro/source Makefile.fetch odk/config offapi/com offapi/UnoApi_offapi.mk officecfg/registry oox/source osx/soffice.xcodeproj pyuno/qa qadevOOo/runner qadevOOo/tests readlicense_oo/license reportdesign/inc reportdesign/source RepositoryExternal.mk Repository.mk sal/osl sc/inc sc/Library_sc.mk sc/qa sc/source sc/uiconfig sdext/source sd/inc sd/qa sd/source setup_native/source sfx2/source sfx2/uiconfig slideshow/CppunitTest_slideshow_engine.mk slideshow/Library_slideshow.mk slideshow/Module_slideshow.mk slideshow/qa slideshow/source solenv/clang-format solenv/gbuild solenv/gdb starmath/source starmath/util svgio/Library_svgio.mk svgio/source svl/source svtools/source svx/inc svx/qa svx/source svx/uiconfig sw/CppunitTest_sw_core_layout.mk sw/CppunitTest_sw_filter_html .mk sw/inc sw/layoutwriter_setup.mk sw/Module_sw.mk sw/qa sw/source sw/uiconfig sw/UITest_sw_ui_misc.mk test/source toolkit/inc toolkit/qa toolkit/source toolkit/test translations tsan-suppress.txt uitest/libreoffice vcl/backendtest vcl/CppunitTest_vcl_cjk.mk vcl/CppunitTest_vcl_pdfexport.mk vcl/Executable_benchmark.mk vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/Module_vcl.mk vcl/osx vcl/qa vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/uiconfig vcl/unx vcl/win vcl/workben winaccessibility/inc winaccessibility/Library_uacccom.mk winaccessibility/source writerfilter/CppunitTest_writerfilter_rtftok.mk writerfilter/qa writerfilter/source xmloff/source xmlsecurity/CppunitTest_xmlsecurity_signing.mk

Sat, 10 Sep 2022 03:16:11 -0700

Rebased ref, commits from common ancestor:
commit 7e8a09ee156a3c03f8d924c2d2c3fad0d5686540
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Sep 2 08:39:38 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Sat Sep 10 09:04:46 2022 +0200

    svx: change SdrPage size to use gfx::Length
    
    Change-Id: I9c9367b668302ced1b2b255a23e875951d7109bf

diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 306555489df5..3874307900d0 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -215,12 +215,13 @@ DlgEditor::DlgEditor (
     aMarkIdle.SetInvokeHandler( LINK( this, DlgEditor, MarkTimeout ) );
 
     rWindow.SetMapMode( MapMode( MapUnit::Map100thMM ) );
-    pDlgEdPage->SetSize( rWindow.PixelToLogic( Size(DLGED_PAGE_WIDTH_MIN, 
DLGED_PAGE_HEIGHT_MIN) ) );
+    Size aPageSize = rWindow.PixelToLogic(Size(DLGED_PAGE_WIDTH_MIN, 
DLGED_PAGE_HEIGHT_MIN));
+    pDlgEdPage->setSize({ gfx::Length::hmm(aPageSize.Width()), 
gfx::Length::hmm(aPageSize.Height()) });
 
     pDlgEdView->ShowSdrPage(pDlgEdView->GetModel()->GetPage(0));
     pDlgEdView->SetLayerVisible( "HiddenLayer", false );
     pDlgEdView->SetMoveSnapOnlyTopLeft(true);
-    pDlgEdView->SetWorkArea( tools::Rectangle( Point( 0, 0 ), 
pDlgEdPage->GetSize() ) );
+    
pDlgEdView->SetWorkArea(gfx::length::toRectangleHmm(pDlgEdPage->getRectangle()));
 
     Size aGridSize( 100, 100 );  // 100TH_MM
     pDlgEdView->SetGridCoarse( aGridSize );
@@ -266,7 +267,7 @@ void DlgEditor::InitScrollBars()
         return;
 
     Size aOutSize = rWindow.GetOutDev()->GetOutputSize();
-    Size aPgSize  = pDlgEdPage->GetSize();
+    Size aPgSize = gfx::length::toSizeHmm(pDlgEdPage->getSize());
 
     pHScroll->SetRange( Range( 0, aPgSize.Width()  ));
     pVScroll->SetRange( Range( 0, aPgSize.Height() ));
@@ -1216,11 +1217,11 @@ bool DlgEditor::AdjustPageSize()
 
             if ( pDlgEdPage )
             {
-                Size aPageSize = pDlgEdPage->GetSize();
+                Size aPageSize = gfx::length::toSizeHmm(pDlgEdPage->getSize());
                 if ( nNewPageWidth != aPageSize.Width() || nNewPageHeight != 
aPageSize.Height() )
                 {
                     Size aNewPageSize( nNewPageWidth, nNewPageHeight );
-                    pDlgEdPage->SetSize( aNewPageSize );
+                    pDlgEdPage->setSize({ 
gfx::Length::hmm(aNewPageSize.Width()), gfx::Length::hmm(aNewPageSize.Height()) 
});
                     pDlgEdView->SetWorkArea( tools::Rectangle( Point( 0, 0 ), 
aNewPageSize ) );
                     bAdjustedPageSize = true;
                 }
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 3e06307941da..9396553aaeb3 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -418,7 +418,7 @@ void DlgEdObj::PositionAndSizeChange( const 
beans::PropertyChangeEvent& evt )
     DBG_ASSERT( pDlgEdForm, "DlgEdObj::PositionAndSizeChange: no form!" );
     DlgEdPage& rPage = pDlgEdForm->GetDlgEditor().GetPage();
     {
-        Size aPageSize = rPage.GetSize();
+        Size aPageSize = gfx::length::toSizeHmm(rPage.getSize());
         sal_Int32 nPageWidthIn = aPageSize.Width();
         sal_Int32 nPageHeightIn = aPageSize.Height();
         sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight;
@@ -1297,7 +1297,7 @@ void DlgEdForm::PositionAndSizeChange( const 
beans::PropertyChangeEvent& evt )
 
     sal_Int32 nPageXIn = 0;
     sal_Int32 nPageYIn = 0;
-    Size aPageSize = rPage.GetSize();
+    Size aPageSize = gfx::length::toSizeHmm(rPage.getSize());
     sal_Int32 nPageWidthIn = aPageSize.Width();
     sal_Int32 nPageHeightIn = aPageSize.Height();
     sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight;
@@ -1347,7 +1347,7 @@ void DlgEdForm::PositionAndSizeChange( const 
beans::PropertyChangeEvent& evt )
     if ( bAdjustedPageSize )
     {
         rEditor.InitScrollBars();
-        aPageSize = rPage.GetSize();
+        aPageSize = gfx::length::toSizeHmm(rPage.getSize());
         nPageWidthIn = aPageSize.Width();
         nPageHeightIn = aPageSize.Height();
         if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, 
nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) )
diff --git a/basctl/source/dlged/dlgedview.cxx 
b/basctl/source/dlged/dlgedview.cxx
index 81271d38f8bd..bf6a52be6ae7 100644
--- a/basctl/source/dlged/dlgedview.cxx
+++ b/basctl/source/dlged/dlgedview.cxx
@@ -90,7 +90,7 @@ void DlgEdView::MakeVisible( const tools::Rectangle& rRect, 
vcl::Window& rWin )
         nScrollY -= nDeltaY;
 
     // don't scroll beyond the page size
-    Size aPageSize = rDlgEditor.GetPage().GetSize();
+    Size aPageSize = gfx::length::toSizeHmm(rDlgEditor.GetPage().getSize());
     sal_Int32 nPageWidth  = aPageSize.Width();
     sal_Int32 nPageHeight = aPageSize.Height();
 
diff --git a/basegfx/test/LengthUnitTest.cxx b/basegfx/test/LengthUnitTest.cxx
index 421e98934c90..8861a2ade316 100644
--- a/basegfx/test/LengthUnitTest.cxx
+++ b/basegfx/test/LengthUnitTest.cxx
@@ -109,6 +109,39 @@ public:
         gfx::Tuple2DL aTuple(0.5_pt, 1_pt);
         CPPUNIT_ASSERT_EQUAL(6350_emu, aTuple.getX());
         CPPUNIT_ASSERT_EQUAL(12700_emu, aTuple.getY());
+
+        gfx::Tuple2DL aTuple2(0_pt, 0_pt);
+        aTuple2.setX(0.5_pt);
+        aTuple2.setY(1_pt);
+
+        CPPUNIT_ASSERT_EQUAL(6350_emu, aTuple2.getX());
+        CPPUNIT_ASSERT_EQUAL(12700_emu, aTuple2.getY());
+
+        CPPUNIT_ASSERT_EQUAL(true, aTuple == aTuple2);
+        CPPUNIT_ASSERT_EQUAL(true, aTuple != gfx::Tuple2DL(0_emu, 0_emu));
+
+        CPPUNIT_ASSERT_EQUAL(true, aTuple == aTuple - gfx::Tuple2DL(0_emu, 
0_emu));
+        CPPUNIT_ASSERT_EQUAL(true, aTuple == aTuple + gfx::Tuple2DL(0_emu, 
0_emu));
+    }
+
+    void testInSize()
+    {
+        gfx::Size2DL aSize(0.5_pt, 1_pt);
+        CPPUNIT_ASSERT_EQUAL(6350_emu, aSize.getWidth());
+        CPPUNIT_ASSERT_EQUAL(12700_emu, aSize.getHeight());
+
+        gfx::Size2DL aSize2(0_pt, 0_pt);
+        aSize2.setWidth(0.5_pt);
+        aSize2.setHeight(1_pt);
+
+        CPPUNIT_ASSERT_EQUAL(6350_emu, aSize2.getWidth());
+        CPPUNIT_ASSERT_EQUAL(12700_emu, aSize2.getHeight());
+
+        CPPUNIT_ASSERT_EQUAL(true, aSize == aSize2);
+        CPPUNIT_ASSERT_EQUAL(true, aSize != gfx::Size2DL(0_emu, 0_emu));
+
+        CPPUNIT_ASSERT_EQUAL(true, aSize == aSize - gfx::Size2DL(0_emu, 
0_emu));
+        CPPUNIT_ASSERT_EQUAL(true, aSize == aSize + gfx::Size2DL(0_emu, 
0_emu));
     }
 
     void testConversionToRectanle()
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx 
b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index 0b3df1aa22ad..f90c781ee84e 100644
--- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -149,7 +149,7 @@ Graphic ViewElementListProvider::GetSymbolGraphic( 
sal_Int32 nStandardSymbol, co
 
     pModel->GetItemPool().FreezeIdRanges();
     rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
-    pPage->SetSize(Size(1000,1000));
+    pPage->setSize({ 1000_hmm, 1000_hmm });
     pModel->InsertPage( pPage.get(), 0 );
     SdrView aView(*pModel, pVDev);
     aView.hideMarkHandles();
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx 
b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 9d896b75425e..66657a15ed7c 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -424,7 +424,7 @@ rtl::Reference<SdrObject> 
DrawCommandDispatch::createDefaultObject( const sal_uI
             if ( pObj )
             {
                 Size aObjectSize( 4000, 2500 );
-                tools::Rectangle aPageRect( tools::Rectangle( Point( 0, 0 ), 
pPage->GetSize() ) );
+                tools::Rectangle 
aPageRect(gfx::length::toRectangleHmm(pPage->getRectangle()));
                 Point aObjectPos = aPageRect.Center();
                 aObjectPos.AdjustX( -(aObjectSize.Width() / 2) );
                 aObjectPos.AdjustY( -(aObjectSize.Height() / 2) );
diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index 584dfdb5ea72..b9dd2253e439 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1379,7 +1379,7 @@ void ChartView::createShapes()
 
     if (pPage) //it is necessary to use the implementation here as the uno 
page does not provide a propertyset
     {
-        pPage->SetSize(Size(aPageSize.Width,aPageSize.Height));
+        pPage->setSize({ gfx::Length::hmm(aPageSize.Width), 
gfx::Length::hmm(aPageSize.Height) });
     }
     else
     {
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 85efe01a1c2f..9aefabdd808f 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -816,7 +816,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
             new SdrModel(nullptr, nullptr, true));
         pModel->GetItemPool().FreezeIdRanges();
         rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
-        pPage->SetSize(Size(1000,1000));
+        pPage->setSize({ 1_cm, 1_cm });
         pModel->InsertPage( pPage.get(), 0 );
         {
         SdrView aView( *pModel, pVDev );
@@ -1445,7 +1445,7 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, 
weld::Toggleable&, void)
     pModel->GetItemPool().FreezeIdRanges();
     // Page
     rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
-    pPage->SetSize(Size(1000,1000));
+    pPage->setSize({ 1_cm, 1_cm });
     pModel->InsertPage( pPage.get(), 0 );
     {
         // 3D View
diff --git a/filter/source/msfilter/svdfppt.cxx 
b/filter/source/msfilter/svdfppt.cxx
index 4511789b0586..6620f79babcf 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -1246,7 +1246,7 @@ rtl::Reference<SdrObject> SdrEscherImport::ProcessObj( 
SvStream& rSt, DffObjData
     {
         if ( rObjData.nSpFlags & ShapeFlag::Background )
         {
-            pRet->NbcSetSnapRect( tools::Rectangle( Point(), 
rData.pPage.page->GetSize() ) );   // set size
+            
pRet->NbcSetSnapRect(gfx::length::toRectangleHmm(rData.pPage.page->getRectangle()));
 // set size
         }
         if (rPersistEntry.xSolverContainer)
         {
@@ -2681,7 +2681,8 @@ bool SdrPowerPointImport::SeekToShape( SvStream& rSt, 
SvxMSDffClientData* pClien
 rtl::Reference<SdrPage> SdrPowerPointImport::MakeBlankPage( bool bMaster ) 
const
 {
     rtl::Reference<SdrPage> pRet = pSdrModel->AllocPage( bMaster );
-    pRet->SetSize( GetPageSize() );
+    Size const& rSize = GetPageSize();
+    pRet->setSize({ gfx::Length::hmm(rSize.Width()), 
gfx::Length::hmm(rSize.Height()) });
 
     return pRet;
 }
@@ -2823,7 +2824,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, 
const PptSlidePersistEntry*
                             {
                                 case DFF_msofbtSpContainer :
                                 {
-                                    tools::Rectangle aPageSize( Point(), 
pRet->GetSize() );
+                                    tools::Rectangle aPageSize = 
gfx::length::toRectangleHmm(pRet->getRectangle());
                                     if ( rSlidePersist.aSlideAtom.nFlags & 4 ) 
         // follow master background?
                                     {
                                         if ( HasMasterPage( m_nCurrentPageNum, 
m_eCurrentPageKind ) )
@@ -3092,15 +3093,8 @@ rtl::Reference<SdrObject> 
SdrPowerPointImport::ImportPageBackgroundObject( const
         pSet->Put( XFillStyleItem( drawing::FillStyle_NONE ) );
     }
     pSet->Put( XLineStyleItem( drawing::LineStyle_NONE ) );
-    tools::Rectangle aRect(
-        rPage.GetLeftBorder(),
-        rPage.GetUpperBorder(),
-        rPage.GetWidth() - rPage.GetRightBorder(),
-        rPage.GetHeight() - rPage.GetLowerBorder());
-
-    pRet = new SdrRectObj(
-        *pSdrModel,
-        aRect);
+    tools::Rectangle aRect = 
gfx::length::toRectangleHmm(rPage.getInnerRectangle());
+    pRet = new SdrRectObj(*pSdrModel, aRect);
 
     pRet->SetMergedItemSet(*pSet);
     pRet->SetMarkProtect( true );
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 963a9ae2c4d4..60bafd2fa1bb 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -321,7 +321,7 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< 
PropertyValue >& rDescripto
             // in comparison. Use a common scaling factor for hor/ver to not 
get
             // asynchronous border distances, though. All in all this will 
adapt borders
             // nicely and is based on office-defaults for 
standard-page-border-sizes.
-            const Size aPageSize(pTargetSdrPage->GetSize());
+            const Size aPageSize = 
gfx::length::toSizeHmm(pTargetSdrPage->getSize());
             const double fBorderRelation((
                 static_cast< double >(pTargetSdrPage->GetLeftBorder()) / 
aPageSize.Width() +
                 static_cast< double >(pTargetSdrPage->GetRightBorder()) / 
aPageSize.Width() +
diff --git a/include/basegfx/units/Length.hxx b/include/basegfx/units/Length.hxx
index 64fd22260f83..76b9b1bbe9fc 100644
--- a/include/basegfx/units/Length.hxx
+++ b/include/basegfx/units/Length.hxx
@@ -11,6 +11,8 @@
 
 #include <basegfx/units/LengthUnitBase.hxx>
 #include <basegfx/range/Range2D.hxx>
+#include <basegfx/tuple/Size2D.hxx>
+#include <basegfx/range/b2drange.hxx>
 
 #include <tools/gen.hxx>
 
@@ -29,9 +31,24 @@ struct LengthTraits
 
 typedef basegfx::Range2D<gfx::Length, gfx::LengthTraits> Range2DL;
 typedef basegfx::Tuple2D<gfx::Length> Tuple2DL;
+typedef basegfx::Size2D<gfx::Length> Size2DL;
 
 namespace length
 {
+static inline Size2DL fromSizeHmm(Size const& rSize)
+{
+    auto width = Length::hmm(rSize.getWidth());
+    auto height = Length::hmm(rSize.getHeight());
+    return Size2DL(width, height);
+}
+
+static inline Size toSizeHmm(Size2DL const& rTuple)
+{
+    auto width = rTuple.getWidth().as_hmm();
+    auto height = rTuple.getHeight().as_hmm();
+    return Size(width, height);
+}
+
 static inline Range2DL fromRectangleHmm(tools::Rectangle const& rRectangle)
 {
     auto left = Length::hmm(rRectangle.Left());
@@ -41,6 +58,15 @@ static inline Range2DL fromRectangleHmm(tools::Rectangle 
const& rRectangle)
     return Range2DL(left, top, right, bottom);
 }
 
+static inline basegfx::B2DRange toB2DRange2DHmm(Range2DL const& rRange2D)
+{
+    auto left = rRange2D.getMinX().as_hmm();
+    auto top = rRange2D.getMinY().as_hmm();
+    auto right = rRange2D.getMaxX().as_hmm();
+    auto bottom = rRange2D.getMaxY().as_hmm();
+    return basegfx::B2DRange(left, top, right, bottom);
+}
+
 static inline tools::Rectangle toRectangleHmm(Range2DL const& rRange2D)
 {
     auto left = rRange2D.getMinX().as_hmm();
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 5b6a1a434da0..ccb7d581695b 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -32,6 +32,7 @@
 #include <svx/svdobj.hxx>
 #include <svx/ColorSets.hxx>
 #include <unotools/weakref.hxx>
+#include <basegfx/units/Length.hxx>
 #include <memory>
 #include <optional>
 #include <vector>
@@ -414,8 +415,8 @@ private:
     SdrModel&                   mrSdrModelFromSdrPage;
 
 private:
-    tools::Long mnWidth;       // page size
-    tools::Long mnHeight;      // page size
+    gfx::Size2DL maSize;
+
     sal_Int32 mnBorderLeft;  // left page margin
     sal_Int32 mnBorderUpper; // top page margin
     sal_Int32 mnBorderRight; // right page margin
@@ -476,12 +477,35 @@ public:
     void setPageBorderOnlyLeftRight(bool bNew) { mbPageBorderOnlyLeftRight = 
bNew; }
     bool getPageBorderOnlyLeftRight() const { return 
mbPageBorderOnlyLeftRight; }
 
-    virtual void SetSize(const Size& aSiz);
-    Size GetSize() const;
+    virtual void setSize(gfx::Size2DL const& rSize);
+
+    const gfx::Size2DL& getSize() const
+    {
+        return maSize;
+    }
+
+    Size GetSizeHmm() const
+    {
+        return gfx::length::toSizeHmm(maSize);
+    }
+
+    gfx::Range2DL getRectangle() const
+    {
+        return gfx::Range2DL(0_emu, 0_emu, maSize.getWidth(), 
maSize.getHeight());
+    }
+
+    gfx::Range2DL getInnerRectangle() const
+    {
+        auto left = gfx::Length::hmm(mnBorderLeft);
+        auto upper = gfx::Length::hmm(mnBorderUpper);
+        auto right = gfx::Length::hmm(mnBorderRight);
+        auto lower = gfx::Length::hmm(mnBorderLower);
+
+        return gfx::Range2DL(left, upper, maSize.getWidth() - right, 
maSize.getHeight() - lower);
+    }
+
     virtual void SetOrientation(Orientation eOri);
     virtual Orientation GetOrientation() const;
-    tools::Long GetWidth() const;
-    tools::Long GetHeight() const;
     virtual void  SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, 
sal_Int32 Lwr);
     virtual void  SetLeftBorder(sal_Int32 nBorder);
     virtual void  SetUpperBorder(sal_Int32 nBorder);
diff --git a/reportdesign/source/ui/report/ReportSection.cxx 
b/reportdesign/source/ui/report/ReportSection.cxx
index 1d9ccd42c4e9..4986de725d5d 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -220,9 +220,10 @@ void OReportSection::fill()
 //  m_pPage->SetUpperBorder(-10000);
 
     m_pView->SetDesignMode();
-
-    m_pPage->SetSize( Size( 
getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width,5*m_xSection->getHeight())
 );
-    const Size aPageSize = m_pPage->GetSize();
+    auto aWidth = getStyleProperty<awt::Size>(xReportDefinition, 
PROPERTY_PAPERSIZE).Width;
+    auto aHeight = 5 * m_xSection->getHeight();
+    m_pPage->setSize({ gfx::Length::hmm(aWidth), gfx::Length::hmm(aHeight) });
+    const Size aPageSize = m_pPage->GetSizeHmm();
     m_pView->SetWorkArea( tools::Rectangle( Point( nLeftMargin, 0), 
Size(aPageSize.Width() - nLeftMargin - nRightMargin,aPageSize.Height()) ) );
 }
 
@@ -482,12 +483,12 @@ void OReportSection::_propertyChanged(const 
beans::PropertyChangeEvent& _rEvent)
         {
             m_pPage->SetRightBorder(nRightMargin);
         }
-        const Size aOldPageSize = m_pPage->GetSize();
+        const Size aOldPageSize = m_pPage->GetSizeHmm();
         sal_Int32 nNewHeight = 5*m_xSection->getHeight();
         if ( aOldPageSize.Height() != nNewHeight || nPaperWidth != 
aOldPageSize.Width() )
         {
-            m_pPage->SetSize( Size( nPaperWidth,nNewHeight) );
-            const Size aPageSize = m_pPage->GetSize();
+            m_pPage->setSize({ gfx::Length::hmm(nPaperWidth), 
gfx::Length::hmm(nNewHeight) });
+            const Size aPageSize = m_pPage->GetSizeHmm();
             m_pView->SetWorkArea( tools::Rectangle( Point( nLeftMargin, 0), 
Size(aPageSize.Width() - nLeftMargin - nRightMargin,aPageSize.Height()) ) );
         }
         impl_adjustObjectSizePosition(nPaperWidth,nLeftMargin,nRightMargin);
diff --git a/reportdesign/source/ui/report/SectionView.cxx 
b/reportdesign/source/ui/report/SectionView.cxx
index f3da3021e265..3ff149365a94 100644
--- a/reportdesign/source/ui/report/SectionView.cxx
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -86,7 +86,7 @@ void OSectionView::MakeVisible( const tools::Rectangle& 
rRect, vcl::Window& rWin
         const sal_Int32 nVisBottom = aVisRect.Bottom();
 
         // don't scroll beyond the page size
-        Size aPageSize = m_pSectionWindow->getPage()->GetSize();
+        Size aPageSize = m_pSectionWindow->getPage()->GetSizeHmm();
         const sal_Int32 nPageWidth  = aPageSize.Width();
         const sal_Int32 nPageHeight = aPageSize.Height();
 
diff --git a/sc/source/core/data/drawpage.cxx b/sc/source/core/data/drawpage.cxx
index 6b6f029fb205..4bd542bbff3f 100644
--- a/sc/source/core/data/drawpage.cxx
+++ b/sc/source/core/data/drawpage.cxx
@@ -24,8 +24,8 @@
 ScDrawPage::ScDrawPage(ScDrawLayer& rNewModel, bool bMasterPage)
 :   FmFormPage(rNewModel, bMasterPage)
 {
-    SetSize( Size( SAL_MAX_INT32, SAL_MAX_INT32 ) );
-        // largest size supported by sal_Int32 SdrPage::mnWidth/Height
+    setSize({ gfx::Length::hmm(SAL_MAX_INT32), gfx::Length::hmm(SAL_MAX_INT32) 
});
+    // largest size supported by sal_Int32 SdrPage::mnWidth/Height
 }
 
 ScDrawPage::~ScDrawPage()
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 78c32baabea1..2728792ed5f0 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -574,9 +574,9 @@ void ScDrawLayer::SetPageSize(sal_uInt16 nPageNo, const 
Size& rSize, bool bUpdat
     if (!pPage)
         return;
 
-    if ( rSize != pPage->GetSize() )
+    if (rSize != pPage->GetSizeHmm())
     {
-        pPage->SetSize( rSize );
+        pPage->setSize(gfx::length::fromSizeHmm(rSize));
         Broadcast( ScTabSizeChangedHint( static_cast<SCTAB>(nPageNo) ) );   // 
SetWorkArea() on the views
     }
 
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index f33ed9dd6b68..b9a4d013127a 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -395,7 +395,7 @@ void ScCaptionCreator::Initialize()
     mbNegPage = mrDoc.IsNegativePage( maPos.Tab() );
     if( SdrPage* pDrawPage = GetDrawPage() )
     {
-        maPageRect = tools::Rectangle( Point( 0, 0 ), pDrawPage->GetSize() );
+        maPageRect = gfx::length::toRectangleHmm(pDrawPage->getRectangle());
         /*  #i98141# SdrPage::GetSize() returns negative width in RTL mode.
             The call to Rectangle::Adjust() orders left/right coordinate
             accordingly. */
diff --git a/sc/source/filter/rtf/eeimpars.cxx 
b/sc/source/filter/rtf/eeimpars.cxx
index a36af94c2699..c99e5617fd94 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -588,7 +588,7 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, 
SCTAB nTab,
         aLogicSize = pDefaultDev->PixelToLogic( aSizePix, MapMode( 
MapUnit::Map100thMM ) );
 
         // Limit size
-        ::ScLimitSizeOnDrawPage( aLogicSize, aInsertPos, pPage->GetSize() );
+        ::ScLimitSizeOnDrawPage(aLogicSize, aInsertPos, pPage->GetSizeHmm());
 
         if ( pI->pGraphic )
         {
diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx
index 2c7fea5ab376..7baa76aef913 100644
--- a/sc/source/ui/app/client.cxx
+++ b/sc/source/ui/app/client.cxx
@@ -99,7 +99,7 @@ void ScClient::RequestNewObjectArea( tools::Rectangle& 
aLogicRect )
         return;
 
     Point aPos;
-    Size aSize = pPage->GetSize();
+    Size aSize = pPage->GetSizeHmm();
     if ( aSize.Width() < 0 )
     {
         aPos.setX( aSize.Width() + 1 );       // negative
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 9816bdb1e363..6ab0aa7d50a1 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -175,7 +175,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
     if ( rData.GetDocument().IsNegativePage( rData.GetTabNo() ) )
         aInsertPos.AdjustX( -(aLogicSize.Width()) );       // move position to 
left edge
 
-    ScLimitSizeOnDrawPage( aLogicSize, aInsertPos, pPage->GetSize() );
+    ScLimitSizeOnDrawPage( aLogicSize, aInsertPos, pPage->GetSizeHmm() );
 
     tools::Rectangle aRect ( aInsertPos, aLogicSize );
 
@@ -229,7 +229,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, 
bool bApi,
     else
         aSize = Size( 5000, 5000 );
 
-    ScLimitSizeOnDrawPage( aSize, aInsertPos, pPage->GetSize() );
+    ScLimitSizeOnDrawPage( aSize, aInsertPos, pPage->GetSizeHmm() );
 
     if( rData.GetDocument().IsNegativePage( rData.GetTabNo() ) )
         aInsertPos.AdjustX( -(aSize.Width()) );
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 24aec4aa5da2..690c95b887d1 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -265,9 +265,9 @@ void ScDrawView::UpdateWorkArea()
     SdrPage* pPage = GetModel()->GetPage(static_cast<sal_uInt16>(nTab));
     if (pPage)
     {
-        Size aPageSize( pPage->GetSize() );
+        Size aPageSize(pPage->GetSizeHmm());
         tools::Rectangle aNewArea( Point(), aPageSize );
-        if ( aPageSize.Width() < 0 )
+        if (aPageSize.Width() < 0)
         {
             //  RTL: from max.negative (left) to zero (right)
             aNewArea.SetRight( 0 );
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index d42860dad5fc..88ba83d59292 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -56,7 +56,7 @@ static void lcl_AdjustInsertPos( ScViewData& rData, Point& 
rPos, const Size& rSi
 {
     SdrPage* pPage = rData.GetScDrawView()->GetModel()->GetPage( 
static_cast<sal_uInt16>(rData.GetTabNo()) );
     OSL_ENSURE(pPage,"pPage ???");
-    Size aPgSize( pPage->GetSize() );
+    Size aPgSize(pPage->GetSizeHmm());
     if (aPgSize.Width() < 0)
         aPgSize.setWidth( -aPgSize.Width() );
     tools::Long x = aPgSize.Width() - rPos.X() - rSize.Width();
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index 9ba839724bc0..fbb10e68720a 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -155,7 +155,8 @@ public:
 
     virtual rtl::Reference<SdrPage> CloneSdrPage(SdrModel& rTargetModel) const 
override;
 
-    virtual void    SetSize(const Size& aSize) override;
+    virtual void setSize(gfx::Size2DL const& rSize) override;
+
     virtual void    SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, 
sal_Int32 Lwr) override;
     virtual void    SetLeftBorder(sal_Int32 nBorder) override;
     virtual void    SetRightBorder(sal_Int32 nBorder) override;
diff --git a/sd/source/core/CustomAnimationEffect.cxx 
b/sd/source/core/CustomAnimationEffect.cxx
index 52220afe7525..44d6b368ca49 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -1584,7 +1584,7 @@ void CustomAnimationEffect::updateSdrPathObjFromPath( 
SdrPathObj& rPathObj )
             SdrPage* pPage = pObj->getSdrPageFromSdrObject();
             if( pPage )
             {
-                const Size aPageSize( pPage->GetSize() );
+                const Size aPageSize(pPage->GetSizeHmm());
                 
aPolyPoly.transform(basegfx::utils::createScaleB2DHomMatrix(static_cast<double>(aPageSize.Width()),
 static_cast<double>(aPageSize.Height())));
             }
 
@@ -1623,7 +1623,7 @@ void CustomAnimationEffect::updatePathFromSdrPathObj( 
const SdrPathObj& rPathObj
         SdrPage* pPage = pObj->getSdrPageFromSdrObject();
         if( pPage )
         {
-            const Size aPageSize( pPage->GetSize() );
+            const Size aPageSize(pPage->GetSizeHmm());
             aPolyPoly.transform(basegfx::utils::createScaleB2DHomMatrix(
                 1.0 / static_cast<double>(aPageSize.Width()), 1.0 / 
static_cast<double>(aPageSize.Height())));
         }
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 182ffe7f2c30..5b1867f61ae3 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -441,7 +441,7 @@ void SdDrawDocument::AdaptPageSizeForAllPages(
                 new SdPageFormatUndoAction(
                     this,
                     pPage,
-                    pPage->GetSize(),
+                    pPage->GetSizeHmm(),
                     pPage->GetLeftBorder(), pPage->GetRightBorder(),
                     pPage->GetUpperBorder(), pPage->GetLowerBorder(),
                     pPage->GetOrientation(),
@@ -464,7 +464,7 @@ void SdDrawDocument::AdaptPageSizeForAllPages(
 
             if (rNewSize.Width() > 0)
             {
-                pPage->SetSize(rNewSize);
+                pPage->setSize(gfx::length::fromSizeHmm(rNewSize));
             }
         }
 
@@ -496,7 +496,7 @@ void SdDrawDocument::AdaptPageSizeForAllPages(
                 new SdPageFormatUndoAction(
                     this,
                     pPage,
-                    pPage->GetSize(),
+                    pPage->GetSizeHmm(),
                     pPage->GetLeftBorder(), pPage->GetRightBorder(),
                     pPage->GetUpperBorder(), pPage->GetLowerBorder(),
                     pPage->GetOrientation(),
@@ -519,7 +519,7 @@ void SdDrawDocument::AdaptPageSizeForAllPages(
 
             if (rNewSize.Width() > 0)
             {
-                pPage->SetSize(rNewSize);
+                pPage->setSize(gfx::length::fromSizeHmm(rNewSize));
             }
         }
 
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index d0187bab0f8c..5706d143eda8 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -511,12 +511,12 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
 
     if( pRefPage )
     {
-        pHandoutPage->SetSize(pRefPage->GetSize());
+        pHandoutPage->setSize(pRefPage->getSize());
         pHandoutPage->SetBorder( pRefPage->GetLeftBorder(), 
pRefPage->GetUpperBorder(), pRefPage->GetRightBorder(), 
pRefPage->GetLowerBorder() );
     }
     else
     {
-        pHandoutPage->SetSize(aDefSize);
+        pHandoutPage->setSize(gfx::length::fromSizeHmm(aDefSize));
         pHandoutPage->SetBorder(0, 0, 0, 0);
     }
 
@@ -526,7 +526,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 
     // Insert master page and register this with the handout page
     rtl::Reference<SdPage> pHandoutMPage = AllocSdPage(true);
-    pHandoutMPage->SetSize( pHandoutPage->GetSize() );
+    pHandoutMPage->setSize(pHandoutPage->getSize());
     pHandoutMPage->SetPageKind(PageKind::Handout);
     pHandoutMPage->SetBorder( pHandoutPage->GetLeftBorder(),
                               pHandoutPage->GetUpperBorder(),
@@ -550,13 +550,13 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
 
         if( pRefPage )
         {
-            pPage->SetSize( pRefPage->GetSize() );
+            pPage->setSize(pRefPage->getSize());
             pPage->SetBorder( pRefPage->GetLeftBorder(), 
pRefPage->GetUpperBorder(), pRefPage->GetRightBorder(), 
pRefPage->GetLowerBorder() );
         }
         else if (meDocType == DocumentType::Draw)
         {
             // Draw: always use default size with margins
-            pPage->SetSize(aDefSize);
+            pPage->setSize(gfx::length::fromSizeHmm(aDefSize));
 
             SfxPrinter* pPrinter = mpDocSh->GetPrinter(false);
             if (pPrinter && pPrinter->IsValid())
@@ -587,7 +587,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
         {
             // Impress: always use screen format, landscape.
             Size aSz( SvxPaperInfo::GetPaperSize(PAPER_SCREEN_16_9, 
MapUnit::Map100thMM) );
-            pPage->SetSize( Size( aSz.Height(), aSz.Width() ) );
+            pPage->setSize({ gfx::Length::hmm(aSz.Height()), 
gfx::Length::hmm(aSz.Width()) });
             pPage->SetBorder(0, 0, 0, 0);
         }
 
@@ -601,7 +601,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 
     // Insert master page, then register this with the page
     rtl::Reference<SdPage> pMPage = AllocSdPage(true);
-    pMPage->SetSize( pPage->GetSize() );
+    pMPage->setSize(pPage->getSize());
     pMPage->SetBorder( pPage->GetLeftBorder(),
                        pPage->GetUpperBorder(),
                        pPage->GetRightBorder(),
@@ -619,7 +619,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 
     if( pRefPage )
     {
-        pNotesPage->SetSize( pRefPage->GetSize() );
+        pNotesPage->setSize(pRefPage->getSize());
         pNotesPage->SetBorder( pRefPage->GetLeftBorder(), 
pRefPage->GetUpperBorder(), pRefPage->GetRightBorder(), 
pRefPage->GetLowerBorder() );
     }
     else
@@ -627,11 +627,11 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
         // Always use portrait format
         if (aDefSize.Height() >= aDefSize.Width())
         {
-            pNotesPage->SetSize(aDefSize);
+            pNotesPage->setSize(gfx::length::fromSizeHmm(aDefSize));
         }
         else
         {
-            pNotesPage->SetSize( Size(aDefSize.Height(), aDefSize.Width()) );
+            pNotesPage->setSize({ gfx::Length::hmm(aDefSize.Height()), 
gfx::Length::hmm(aDefSize.Width()) });
         }
 
         pNotesPage->SetBorder(0, 0, 0, 0);
@@ -643,7 +643,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 
     // Insert master page, then register this with the notes page
     rtl::Reference<SdPage> pNotesMPage = AllocSdPage(true);
-    pNotesMPage->SetSize( pNotesPage->GetSize() );
+    pNotesMPage->setSize(pNotesPage->getSize());
     pNotesMPage->SetPageKind(PageKind::Notes);
     pNotesMPage->SetBorder( pNotesPage->GetLeftBorder(),
                             pNotesPage->GetUpperBorder(),
@@ -1093,7 +1093,7 @@ void SdDrawDocument::CheckMasterPages()
                 pNewNotesPage->SetPageKind(PageKind::Notes);
                 if( pRefNotesPage )
                 {
-                    pNewNotesPage->SetSize( pRefNotesPage->GetSize() );
+                    pNewNotesPage->setSize(pRefNotesPage->getSize());
                     pNewNotesPage->SetBorder( pRefNotesPage->GetLeftBorder(),
                                             pRefNotesPage->GetUpperBorder(),
                                             pRefNotesPage->GetRightBorder(),
@@ -1163,7 +1163,7 @@ sal_uInt16 SdDrawDocument::CreatePage (
 
     // Set the size here since else the presobj autolayout
     // will be wrong.
-    pStandardPage->SetSize( pPreviousStandardPage->GetSize() );
+    pStandardPage->setSize(pPreviousStandardPage->getSize());
     pStandardPage->SetBorder( pPreviousStandardPage->GetLeftBorder(),
                               pPreviousStandardPage->GetUpperBorder(),
                               pPreviousStandardPage->GetRightBorder(),
@@ -1352,7 +1352,7 @@ void SdDrawDocument::SetupNewPage (
 {
     if (pPreviousPage != nullptr)
     {
-        pPage->SetSize( pPreviousPage->GetSize() );
+        pPage->setSize(pPreviousPage->getSize());
         pPage->SetBorder( pPreviousPage->GetLeftBorder(),
             pPreviousPage->GetUpperBorder(),
             pPreviousPage->GetRightBorder(),
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 137e8b57415a..64aa094b4162 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -409,7 +409,7 @@ bool SdDrawDocument::InsertBookmarkAsPage(
     // before the first page.
     // Note that the pointers are used later on as general page pointers.
     SdPage* pRefPage = GetSdPage(0, PageKind::Standard);
-    Size  aSize(pRefPage->GetSize());
+    Size aSize = pRefPage->GetSizeHmm();
     sal_Int32 nLeft  = pRefPage->GetLeftBorder();
     sal_Int32 nRight = pRefPage->GetRightBorder();
     sal_Int32 nUpper = pRefPage->GetUpperBorder();
@@ -417,7 +417,7 @@ bool SdDrawDocument::InsertBookmarkAsPage(
     Orientation eOrient = pRefPage->GetOrientation();
 
     SdPage* pNPage = GetSdPage(0, PageKind::Notes);
-    Size aNSize(pNPage->GetSize());
+    Size aNSize = pNPage->GetSizeHmm();
     sal_Int32 nNLeft  = pNPage->GetLeftBorder();
     sal_Int32 nNRight = pNPage->GetRightBorder();
     sal_Int32 nNUpper = pNPage->GetUpperBorder();
@@ -447,7 +447,7 @@ bool SdDrawDocument::InsertBookmarkAsPage(
     {
         SdPage* pBMPage = pBookmarkDoc->GetSdPage(0,PageKind::Standard);
 
-        if (pBMPage->GetSize()        != pRefPage->GetSize()         ||
+        if (pBMPage->getSize() != pRefPage->getSize() ||
             pBMPage->GetLeftBorder()   != pRefPage->GetLeftBorder()    ||
             pBMPage->GetRightBorder()   != pRefPage->GetRightBorder()    ||
             pBMPage->GetUpperBorder()   != pRefPage->GetUpperBorder()    ||
@@ -836,7 +836,7 @@ bool SdDrawDocument::InsertBookmarkAsPage(
                 ::tools::Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
                 pRefPage->ScaleObjects(aSize, aBorderRect, true);
             }
-            pRefPage->SetSize(aSize);
+            pRefPage->setSize(gfx::length::fromSizeHmm(aSize));
             pRefPage->SetBorder(nLeft, nUpper, nRight, nLower);
             pRefPage->SetOrientation( eOrient );
 
@@ -856,7 +856,7 @@ bool SdDrawDocument::InsertBookmarkAsPage(
                 pRefPage->ScaleObjects(aNSize, aBorderRect, true);
             }
 
-            pRefPage->SetSize(aNSize);
+            pRefPage->setSize(gfx::length::fromSizeHmm(aNSize));
             pRefPage->SetBorder(nNLeft, nNUpper, nNRight, nNLower);
             pRefPage->SetOrientation( eNOrient );
 
@@ -878,7 +878,7 @@ bool SdDrawDocument::InsertBookmarkAsPage(
                     ::tools::Rectangle aBorderRect(nLeft, nUpper, nRight, 
nLower);
                     pRefPage->ScaleObjects(aSize, aBorderRect, true);
                 }
-                pRefPage->SetSize(aSize);
+                pRefPage->setSize(gfx::length::fromSizeHmm(aNSize));
                 pRefPage->SetBorder(nLeft, nUpper, nRight, nLower);
                 pRefPage->SetOrientation( eOrient );
             }
@@ -889,7 +889,7 @@ bool SdDrawDocument::InsertBookmarkAsPage(
                     ::tools::Rectangle aBorderRect(nNLeft, nNUpper, nNRight, 
nNLower);
                     pRefPage->ScaleObjects(aNSize, aBorderRect, true);
                 }
-                pRefPage->SetSize(aNSize);
+                pRefPage->setSize(gfx::length::fromSizeHmm(aNSize));
                 pRefPage->SetBorder(nNLeft, nNUpper, nNRight, nNLower);
                 pRefPage->SetOrientation( eNOrient );
             }
@@ -1061,7 +1061,7 @@ bool SdDrawDocument::InsertBookmarkAsObject(
         }
         else
         {
-            aObjPos = ::tools::Rectangle(Point(), pPage->GetSize()).Center();
+            aObjPos = ::tools::Rectangle(Point(), 
pPage->GetSizeHmm()).Center();
         }
 
         size_t nCountBefore = 0;
@@ -1696,13 +1696,13 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 
nSdPageNum,
         // Adapt new master pages
         if (pSourceDoc != this)
         {
-            Size aSize(rOldMaster.GetSize());
+            Size aSize = rOldMaster.GetSizeHmm();
             ::tools::Rectangle aBorderRect(rOldMaster.GetLeftBorder(),
                                   rOldMaster.GetUpperBorder(),
                                   rOldMaster.GetRightBorder(),
                                   rOldMaster.GetLowerBorder());
             pMaster->ScaleObjects(aSize, aBorderRect, true);
-            pMaster->SetSize(aSize);
+            pMaster->setSize(rOldMaster.getSize());
             pMaster->SetBorder(rOldMaster.GetLeftBorder(),
                                rOldMaster.GetUpperBorder(),
                                rOldMaster.GetRightBorder(),
@@ -1710,13 +1710,13 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 
nSdPageNum,
             pMaster->SetOrientation( rOldMaster.GetOrientation() );
             pMaster->SetAutoLayout(pMaster->GetAutoLayout());
 
-            aSize = rOldNotesMaster.GetSize();
+            aSize = rOldNotesMaster.GetSizeHmm();
             ::tools::Rectangle 
aNotesBorderRect(rOldNotesMaster.GetLeftBorder(),
                                        rOldNotesMaster.GetUpperBorder(),
                                        rOldNotesMaster.GetRightBorder(),
                                        rOldNotesMaster.GetLowerBorder());
             pNotesMaster->ScaleObjects(aSize, aNotesBorderRect, true);
-            pNotesMaster->SetSize(aSize);
+            pNotesMaster->setSize(rOldNotesMaster.getSize());
             pNotesMaster->SetBorder(rOldNotesMaster.GetLeftBorder(),
                                     rOldNotesMaster.GetUpperBorder(),
                                     rOldNotesMaster.GetRightBorder(),
@@ -1755,7 +1755,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
         }
 
         pMaster = AllocSdPage(true);
-        pMaster->SetSize(pSelectedPage->GetSize());
+        pMaster->setSize(pSelectedPage->getSize());
         pMaster->SetBorder(pSelectedPage->GetLeftBorder(),
                            pSelectedPage->GetUpperBorder(),
                            pSelectedPage->GetRightBorder(),
@@ -1771,7 +1771,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
 
         pNotesMaster = AllocSdPage(true);
         pNotesMaster->SetPageKind(PageKind::Notes);
-        pNotesMaster->SetSize(pNotes->GetSize());
+        pNotesMaster->setSize(pNotes->getSize());
         pNotesMaster->SetBorder(pNotes->GetLeftBorder(),
                                 pNotes->GetUpperBorder(),
                                 pNotes->GetRightBorder(),
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 6c99ed6ba6e6..6c13ff2f6774 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -998,7 +998,7 @@ rtl::Reference<SdrObject> 
SdPage::CreateDefaultPresObj(PresObjKind eObjKind)
             const ::tools::Long nUppBorder = GetUpperBorder();
 
             Point aPos ( nLftBorder, nUppBorder );
-            Size aSize ( GetSize() );
+            Size aSize = GetSizeHmm();
 
             aSize.AdjustWidth( -(nLftBorder + GetRightBorder()) );
             aSize.AdjustHeight( -(nUppBorder + GetLowerBorder()) );
@@ -1023,7 +1023,7 @@ rtl::Reference<SdrObject> 
SdPage::CreateDefaultPresObj(PresObjKind eObjKind)
         else
         {
             // create header&footer objects for handout and notes master
-            Size aPageSize ( GetSize() );
+            Size aPageSize = GetSizeHmm();
             aPageSize.AdjustWidth( -(GetLeftBorder() + GetRightBorder()) );
             aPageSize.AdjustHeight( -(GetUpperBorder() + GetLowerBorder()) );
 
@@ -1087,7 +1087,7 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
         * standard- or note page: title area
         ******************************************************************/
         Point aTitlePos ( GetLeftBorder(), GetUpperBorder() );
-        Size aTitleSize ( GetSize() );
+        Size aTitleSize = GetSizeHmm();
         aTitleSize.AdjustWidth( -(GetLeftBorder() + GetRightBorder()) );
         aTitleSize.AdjustHeight( -(GetUpperBorder() + GetLowerBorder()) );
         const char* sPageKind = PageKindVector[mePageKind];
@@ -1130,15 +1130,15 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
             if ( pRefPage )
             {
                 // scale actually page size into handout rectangle
-                double fH = pRefPage->GetWidth() == 0
-                    ? 0 : static_cast<double>(aPartArea.Width())  / 
pRefPage->GetWidth();
-                double fV = pRefPage->GetHeight() == 0
-                    ? 0 : static_cast<double>(aPartArea.Height()) / 
pRefPage->GetHeight();
+                double fH = pRefPage->GetSizeHmm().getWidth() == 0
+                    ? 0 : static_cast<double>(aPartArea.Width())  / 
pRefPage->GetSizeHmm().getWidth();
+                double fV = pRefPage->GetSizeHmm().getHeight() == 0
+                    ? 0 : static_cast<double>(aPartArea.Height()) / 
pRefPage->GetSizeHmm().getHeight();
 
                 if ( fH > fV )
                     fH = fV;
-                aSize.setWidth( static_cast<::tools::Long>(fH * 
pRefPage->GetWidth()) );
-                aSize.setHeight( static_cast<::tools::Long>(fH * 
pRefPage->GetHeight()) );
+                aSize.setWidth( static_cast<::tools::Long>(fH * 
pRefPage->GetSizeHmm().getWidth()) );
+                aSize.setHeight( static_cast<::tools::Long>(fH * 
pRefPage->GetSizeHmm().getHeight()) );
 
                 aPos.AdjustX((aPartArea.Width() - aSize.Width()) / 2 );
                 aPos.AdjustY((aPartArea.Height()- aSize.Height())/ 2 );
@@ -1169,8 +1169,8 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
     {
         double propvalue[] = {0,0,0,0};
 
-        Point aLayoutPos ( GetLeftBorder(), GetUpperBorder() );
-        Size aLayoutSize ( GetSize() );
+        Point aLayoutPos( GetLeftBorder(), GetUpperBorder() );
+        Size aLayoutSize = GetSizeHmm();
         aLayoutSize.AdjustWidth( -(GetLeftBorder() + GetRightBorder()) );
         aLayoutSize.AdjustHeight( -(GetUpperBorder() + GetLowerBorder()) );
         const char* sPageKind = PageKindVector[mePageKind];
@@ -1745,13 +1745,13 @@ void SdPage::onRemoveObject( SdrObject* pObject )
     }
 }
 
-void SdPage::SetSize(const Size& aSize)
+void SdPage::setSize(gfx::Size2DL const& rSize)
 {
-    Size aOldSize = GetSize();
+    auto const& rOldSize = getSize();
 
-    if (aSize != aOldSize)
+    if (rSize != rOldSize)
     {
-        FmFormPage::SetSize(aSize);
+        FmFormPage::setSize(rSize);
     }
 }
 
@@ -1823,11 +1823,11 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, 
const ::tools::Rectangle& rN
     // -> use up to date values
     if (aNewPageSize.Width() < 0)
     {
-        aNewPageSize.setWidth( GetWidth() );
+        aNewPageSize.setWidth(GetSizeHmm().getWidth());
     }
     if (aNewPageSize.Height() < 0)
     {
-        aNewPageSize.setHeight( GetHeight() );
+        aNewPageSize.setHeight(GetSizeHmm().getHeight());
     }
     if (nLeft < 0)
     {
@@ -1855,8 +1855,8 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const 
::tools::Rectangle& rN
         aNewPageSize = aBackgroundSize;
     }
 
-    ::tools::Long nOldWidth  = GetWidth() - GetLeftBorder() - GetRightBorder();
-    ::tools::Long nOldHeight = GetHeight() - GetUpperBorder() - 
GetLowerBorder();
+    ::tools::Long nOldWidth  = GetSizeHmm().getWidth() - GetLeftBorder() - 
GetRightBorder();
+    ::tools::Long nOldHeight = GetSizeHmm().getHeight() - GetUpperBorder() - 
GetLowerBorder();
 
     Fraction aFractX(aNewPageSize.Width(), nOldWidth);
     Fraction aFractY(aNewPageSize.Height(), nOldHeight);
@@ -2563,15 +2563,10 @@ void SdPage::SetOrientation( Orientation /*eOrient*/)
 
 Orientation SdPage::GetOrientation() const
 {
-    Size aSize = GetSize();
-    if ( aSize.getWidth() > aSize.getHeight() )
-    {
+    auto aSize = getSize();
+    if (aSize.getWidth() > aSize.getHeight())
         return Orientation::Landscape;
-    }
-    else
-    {
-        return Orientation::Portrait;
-    }
+    return Orientation::Portrait;
 }
 
 /*************************************************************************
@@ -2931,7 +2926,7 @@ void SdPage::CalculateHandoutAreas( SdDrawDocument& 
rModel, AutoLayout eLayout,
 
     const sal_uInt16* pOffsets = aOffsets[0];
 
-    Size aArea = rHandoutMaster.GetSize();
+    Size aArea = rHandoutMaster.GetSizeHmm();
     const bool bLandscape = aArea.Width() > aArea.Height();
 
     if( eLayout == AUTOLAYOUT_NONE )
@@ -3064,17 +3059,18 @@ void SdPage::CalculateHandoutAreas( SdDrawDocument& 
rModel, AutoLayout eLayout,
         aPartArea.setHeight( (aArea.Height() - ((nRowCnt-1) * nGapH) ) / 
nRowCnt );
 
         SdrPage* pFirstPage = rModel.GetMasterSdPage(0, PageKind::Standard);
-        if (pFirstPage && pFirstPage->GetWidth() && pFirstPage->GetHeight())
+        if (pFirstPage && pFirstPage->GetSizeHmm().getWidth() && 
pFirstPage->GetSizeHmm().getHeight())
         {
+            Size aFirstPageSize = pFirstPage->GetSizeHmm();
             // scale actual size into handout rect
-            double fScale = static_cast<double>(aPartArea.Width()) / 
static_cast<double>(pFirstPage->GetWidth());
+            double fScale = static_cast<double>(aPartArea.Width()) / 
static_cast<double>(aFirstPageSize.getWidth());
 
-            aSize.setHeight( static_cast<::tools::Long>(fScale * 
pFirstPage->GetHeight() ) );
+            aSize.setHeight( static_cast<::tools::Long>(fScale * 
aFirstPageSize.getHeight() ) );
             if( aSize.Height() > aPartArea.Height() )
             {
-                fScale = static_cast<double>(aPartArea.Height()) / 
static_cast<double>(pFirstPage->GetHeight());
+                fScale = static_cast<double>(aPartArea.Height()) / 
static_cast<double>(aFirstPageSize.getHeight());
                 aSize.setHeight( aPartArea.Height() );
-                aSize.setWidth( static_cast<::tools::Long>(fScale * 
pFirstPage->GetWidth()) );
+                aSize.setWidth( static_cast<::tools::Long>(fScale * 
aFirstPageSize.getWidth()) );
             }
             else
             {
diff --git a/sd/source/filter/grf/sdgrffilter.cxx 
b/sd/source/filter/grf/sdgrffilter.cxx
index 71f9221ab055..fe17956ce027 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -158,7 +158,7 @@ bool SdGRFFilter::Import()
 
         SdPage*     pPage = mrDocument.GetSdPage( 0, PageKind::Standard );
         Point       aPos;
-        Size        aPagSize( pPage->GetSize() );
+        Size        aPagSize(pPage->GetSizeHmm());
         Size        aGrfSize( OutputDevice::LogicToLogic( 
aGraphic.GetPrefSize(),
                                 aGraphic.GetPrefMapMode(), 
MapMode(MapUnit::Map100thMM)));
 
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index da14c6edc98f..d407b6f60805 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -589,8 +589,8 @@ void HtmlExport::InitExportParameters( const Sequence< 
PropertyValue >& rParams
 
     // calculate image sizes
     SdPage* pPage = mpDoc->GetSdPage(0, PageKind::Standard);
-    Size aTmpSize( pPage->GetSize() );
-    double dRatio=static_cast<double>(aTmpSize.Width())/aTmpSize.Height();
+    Size aSize = pPage->GetSizeHmm();
+    double dRatio = double(aSize.Width()) / aSize.Height();
 
     mnHeightPixel = static_cast<sal_uInt16>(mnWidthPixel/dRatio);
 
@@ -1671,8 +1671,7 @@ bool HtmlExport::CreateHtmlForPresPages()
                 Point     aLogPos(aRect.TopLeft());
                 bool      bIsSquare = aRect.GetWidth() == aRect.GetHeight();
 
-                sal_uLong nPageWidth = pPage->GetSize().Width() - 
pPage->GetLeftBorder() -
-                                   pPage->GetRightBorder();
+                sal_Int32 nPageWidth = pPage->GetSizeHmm().Width() - 
pPage->GetLeftBorder() - pPage->GetRightBorder();
 
                 // BoundRect is relative to the physical page origin, not the
                 // origin of ordinates
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx 
b/sd/source/filter/pdf/sdpdffilter.cxx
index 39c6ada55f4e..bce9ab1049c5 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -81,7 +81,7 @@ bool SdPdfFilter::Import()
             return false;
 
         // Make the page size match the rendered image.
-        pPage->SetSize(aSizeHMM);
+        pPage->setSize(gfx::length::fromSizeHmm(aSizeHMM));
 
         rtl::Reference<SdrGrafObj> pSdrGrafObj = new SdrGrafObj(
             pPage->getSdrModelFromSdrPage(), rGraphic, 
tools::Rectangle(Point(), aSizeHMM));
diff --git a/sd/source/ui/annotations/annotationmanager.cxx 
b/sd/source/ui/annotations/annotationmanager.cxx
index 81d6b3c0176b..17ef061ea843 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -449,7 +449,7 @@ void AnnotationManagerImpl::InsertAnnotation(const 
OUString& rText)
     AnnotationVector aAnnotations( pPage->getAnnotations() );
     if( !aAnnotations.empty() )
     {
-        const int page_width = pPage->GetSize().Width();
+        const int page_width = pPage->GetSizeHmm().Width();
         const int width = 1000;
         const int height = 800;
         ::tools::Rectangle aTagRect;
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 58c822c47bc4..cdec8359437d 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -500,7 +500,7 @@ std::optional<SfxItemSet> SdModule::CreateItemSet( 
sal_uInt16 nSlot )
     if( pDocSh )
     {
         SdrPage* pPage = pDoc->GetSdPage(0, PageKind::Standard);
-        Size aSize(pPage->GetSize());
+        Size aSize(pPage->GetSizeHmm());
         nW = aSize.Width();
         nH = aSize.Height();
     }
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index d5a6e3c1fadf..be95ad0b2923 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -289,7 +289,7 @@ void SdTransferable::CreateData()
         SdPage*             pPage = mpSdDrawDocumentIntern->GetSdPage( 0, 
PageKind::Standard );
         OUString            aOldLayoutName( pOldPage->GetLayoutName() );
 
-        pPage->SetSize( pOldPage->GetSize() );
+        pPage->setSize(pOldPage->getSize());
         pPage->SetLayoutName( aOldLayoutName );
         pNewStylePool->CopyGraphicSheets( *pOldStylePool );
         pNewStylePool->CopyCellSheets( *pOldStylePool );
@@ -324,7 +324,7 @@ void SdTransferable::CreateData()
         }
     }
     else
-        maVisArea.SetSize( pPage->GetSize() );
+        maVisArea.SetSize(pPage->GetSizeHmm());
 
     // output is at the zero point
     maVisArea.SetPos( Point() );
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index 1fa8c2dab768..62db945ee393 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -91,7 +91,7 @@ void CopyDlg::Reset()
 {
     // Set Min/Max values
     ::tools::Rectangle aRect = mpView->GetAllMarkedRect();
-    Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSize();
+    Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSizeHmm();
 
     // tdf#125011 draw/impress sizes are in mm_100th already, "normalize" to
     // decimal shift by number of decimal places the widgets are using (2) then
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 0c0786d3eebb..c8bb21af6be0 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -641,7 +641,7 @@ void PresLayoutPreview::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
 void PresLayoutPreview::init( SdPage *pMaster )
 {
     mpMaster = pMaster;
-    maPageSize = pMaster->GetSize();
+    maPageSize = pMaster->GetSizeHmm();
 }
 
 void PresLayoutPreview::update( HeaderFooterSettings const & rSettings )
diff --git a/sd/source/ui/docshell/docshel2.cxx 
b/sd/source/ui/docshell/docshel2.cxx
index 160c64a662eb..d1e76a9ffdef 100644
--- a/sd/source/ui/docshell/docshel2.cxx
+++ b/sd/source/ui/docshell/docshel2.cxx
@@ -124,7 +124,7 @@ void DrawDocShell::Draw(OutputDevice* pOut, const 
JobSetup&, sal_uInt16 nAspect)
     if( ( ASPECT_THUMBNAIL == nAspect ) || ( ASPECT_DOCPRINT == nAspect ) )
     {
         // provide size of first page
-        aVisArea.SetSize(mpDoc->GetSdPage(0, PageKind::Standard)->GetSize());
+        aVisArea.SetSize(mpDoc->GetSdPage(0, 
PageKind::Standard)->GetSizeHmm());
     }
     else
     {
@@ -176,7 +176,7 @@ BitmapEx DrawDocShell::GetPagePreviewBitmap(SdPage* pPage)
 {
     const sal_uInt16 nMaxEdgePixel = 90;
     MapMode         aMapMode( MapUnit::Map100thMM );
-    const Size      aSize( pPage->GetSize() );
+    const Size aSize = pPage->GetSizeHmm();
     const Point     aNullPt;
     ScopedVclPtrInstance< VirtualDevice > pVDev( 
*Application::GetDefaultDevice() );
 
diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx
index 822174ed94b4..45e430a266c7 100644
--- a/sd/source/ui/func/fuexpand.cxx
+++ b/sd/source/ui/func/fuexpand.cxx
@@ -134,7 +134,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
             {
                 // page with title & structuring!
                 rtl::Reference<SdPage> pPage = mpDoc->AllocSdPage(false);
-                pPage->SetSize(pActualPage->GetSize() );
+                pPage->setSize(pActualPage->getSize() );
                 pPage->SetBorder(pActualPage->GetLeftBorder(),
                                  pActualPage->GetUpperBorder(),
                                  pActualPage->GetRightBorder(),
@@ -156,7 +156,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
 
                 // notes-page
                 rtl::Reference<SdPage> pNotesPage = mpDoc->AllocSdPage(false);
-                pNotesPage->SetSize(pActualNotesPage->GetSize());
+                pNotesPage->setSize(pActualNotesPage->getSize());
                 pNotesPage->SetBorder(pActualNotesPage->GetLeftBorder(),
                                       pActualNotesPage->GetUpperBorder(),
                                       pActualNotesPage->GetRightBorder(),
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index a00cb453d6b0..736386fe015f 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -571,7 +571,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
                 {
                     // we create a new OLE object
                     SdrPageView* pPV = mpView->GetSdrPageView();
-                    Size aPageSize = pPV->GetPage()->GetSize();
+                    Size aPageSize = pPV->GetPage()->GetSizeHmm();
 
                     // get the size from the iconified object
                     ::svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index 729652e03c34..53cc91090542 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -434,7 +434,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
     if( nIndex != -1 )
         aLayoutName = aLayoutName.copy(0, nIndex);
 
-    aOutliner.SetPaperSize(pPage->GetSize());
+    aOutliner.SetPaperSize(pPage->GetSizeHmm());
 
     SvStream* pStream = pMedium->GetInStream();
     assert(pStream && "No InStream!");
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 098295758b40..542f2884a66e 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -234,7 +234,7 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* 
pParent, const SfxRequest&
     aNewAttr.Put( aPageItem );
 
     // size
-    maSize = mpPage->GetSize();
+    maSize = mpPage->GetSizeHmm();
     SvxSizeItem aSizeItem( SID_ATTR_PAGE_SIZE, maSize );
     aNewAttr.Put( aSizeItem );
 
@@ -526,7 +526,7 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
     {
         aNewSize = static_cast<const SvxSizeItem*>(pPoolItem)->GetSize();
 
-        if( mpPage->GetSize() != aNewSize )
+        if (mpPage->GetSizeHmm() != aNewSize)
             bSetPageSizeAndBorder = true;
     }
 
@@ -635,7 +635,7 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
     }
 
     // Objects can not be bigger than ViewSize
-    Size aPageSize = mpDoc->GetSdPage(0, ePageKind)->GetSize();
+    Size aPageSize = mpDoc->GetSdPage(0, ePageKind)->GetSizeHmm();
     Size aViewSize(aPageSize.Width() * 3, aPageSize.Height() * 2);
     mpDoc->SetMaxObjSize(aViewSize);
 
diff --git a/sd/source/ui/func/fusumry.cxx b/sd/source/ui/func/fusumry.cxx
index 9b160099cba0..8dff156f654e 100644
--- a/sd/source/ui/func/fusumry.cxx
+++ b/sd/source/ui/func/fusumry.cxx
@@ -119,7 +119,7 @@ void FuSummaryPage::DoExecute( SfxRequest& )
 
                     // page with title & structuring!
                     pSummaryPage = mpDoc->AllocSdPage(false);
-                    pSummaryPage->SetSize(pActualPage->GetSize() );
+                    pSummaryPage->setSize(pActualPage->getSize());
                     pSummaryPage->SetBorder(pActualPage->GetLeftBorder(),
                                      pActualPage->GetUpperBorder(),
                                      pActualPage->GetRightBorder(),
@@ -139,7 +139,7 @@ void FuSummaryPage::DoExecute( SfxRequest& )
 
                     // notes-page
                     rtl::Reference<SdPage> pNotesPage = 
mpDoc->AllocSdPage(false);
-                    pNotesPage->SetSize(pActualNotesPage->GetSize());
+                    pNotesPage->setSize(pActualNotesPage->getSize());
                     pNotesPage->SetBorder(pActualNotesPage->GetLeftBorder(),
                                           pActualNotesPage->GetUpperBorder(),
                                           pActualNotesPage->GetRightBorder(),
diff --git a/sd/source/ui/func/fuzoom.cxx b/sd/source/ui/func/fuzoom.cxx
index bfa01c179d08..0092279def54 100644
--- a/sd/source/ui/func/fuzoom.cxx
+++ b/sd/source/ui/func/fuzoom.cxx
@@ -116,7 +116,7 @@ bool FuZoom::MouseMove(const MouseEvent& rMEvt)
             if (aScroll.X() != 0 || aScroll.Y() != 0)
             {
                 Size aWorkSize = mpView->GetWorkArea().GetSize();
-                Size aPageSize = 
mpView->GetSdrPageView()->GetPage()->GetSize();
+                Size aPageSize = 
mpView->GetSdrPageView()->GetPage()->GetSizeHmm();
                 if (aWorkSize.Width() != 0 && aWorkSize.Height() != 0 &&
                         aPageSize.Width() != 0 && aPageSize.Height() != 0)
                 {
diff --git a/sd/source/ui/func/undopage.cxx b/sd/source/ui/func/undopage.cxx
index 174747bf6c5d..e54b76c35d4c 100644
--- a/sd/source/ui/func/undopage.cxx
+++ b/sd/source/ui/func/undopage.cxx
@@ -29,7 +29,7 @@ void SdPageFormatUndoAction::Undo()
 {
     ::tools::Rectangle aOldBorderRect(mnOldLeft, mnOldUpper, mnOldRight, 
mnOldLower);
     mpPage->ScaleObjects(maOldSize, aOldBorderRect, mbNewScale);
-    mpPage->SetSize(maOldSize);
+    mpPage->setSize(gfx::length::fromSizeHmm(maOldSize));
     mpPage->SetLeftBorder(mnOldLeft);
     mpPage->SetRightBorder(mnOldRight);
     mpPage->SetUpperBorder(mnOldUpper);
@@ -47,7 +47,7 @@ void SdPageFormatUndoAction::Redo()
 {
     ::tools::Rectangle aNewBorderRect(mnNewLeft, mnNewUpper, mnNewRight, 
mnNewLower);
     mpPage->ScaleObjects(maNewSize, aNewBorderRect, mbNewScale);
-    mpPage->SetSize(maNewSize);
+    mpPage->setSize(gfx::length::fromSizeHmm(maNewSize));
     mpPage->SetLeftBorder(mnNewLeft);
     mpPage->SetRightBorder(mnNewRight);
     mpPage->SetUpperBorder(mnNewUpper);
diff --git a/sd/source/ui/presenter/SlideRenderer.cxx 
b/sd/source/ui/presenter/SlideRenderer.cxx
index 1b57b195ac70..ca96b3a3db6f 100644
--- a/sd/source/ui/presenter/SlideRenderer.cxx
+++ b/sd/source/ui/presenter/SlideRenderer.cxx
@@ -134,7 +134,7 @@ BitmapEx SlideRenderer::CreatePreview (
             0);
 
     // Determine the size of the current slide and its aspect ratio.
-    Size aPageSize = pPage->GetSize();
+    Size aPageSize = pPage->GetSizeHmm();
     if (aPageSize.Height() <= 0)
         throw lang::IllegalArgumentException("SlideRenderer::createPreview() 
called with invalid size",
             static_cast<XWeak*>(this),
diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx 
b/sd/source/ui/sidebar/DocumentHelper.cxx
index 20a2511c79b0..c3188d9fc205 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -361,14 +361,15 @@ SdPage* DocumentHelper::AddMasterPage (
 
         // Adapt the size of the new master page to that of the pages in
         // the document.
-        Size aNewSize (rTargetDocument.GetSdPage(0, 
pMasterPage->GetPageKind())->GetSize());
+        auto pPage = rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind());
+        Size aNewSize = pPage->GetSizeHmm();
         ::tools::Rectangle aBorders (
             pClonedMasterPage->GetLeftBorder(),
             pClonedMasterPage->GetUpperBorder(),
             pClonedMasterPage->GetRightBorder(),
             pClonedMasterPage->GetLowerBorder());
         pClonedMasterPage->ScaleObjects(aNewSize, aBorders, true);
-        pClonedMasterPage->SetSize(aNewSize);
+        pClonedMasterPage->setSize(pPage->getSize());
         pClonedMasterPage->CreateTitleAndLayout(true);
     }
 
diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx 
b/sd/source/ui/sidebar/MasterPageContainer.cxx
index 20d8528077a1..5aeb3a6f40f4 100644
--- a/sd/source/ui/sidebar/MasterPageContainer.cxx
+++ b/sd/source/ui/sidebar/MasterPageContainer.cxx
@@ -554,7 +554,7 @@ void 
MasterPageContainer::Implementation::UpdatePreviewSizePixel()
         });
     if (iDescriptor != maContainer.end())
     {
-        Size aPageSize ((*iDescriptor)->mpMasterPage->GetSize());
+        Size aPageSize ((*iDescriptor)->mpMasterPage->GetSizeHmm());
         OSL_ASSERT(!aPageSize.IsEmpty());
         if (aPageSize.Width() > 0)
             nWidth = aPageSize.Width();
diff --git a/sd/source/ui/slideshow/slideshowviewimpl.cxx 
b/sd/source/ui/slideshow/slideshowviewimpl.cxx
index d6addc3f87fe..326d86fdcf1a 100644
--- a/sd/source/ui/slideshow/slideshowviewimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowviewimpl.cxx
@@ -286,7 +286,7 @@ geometry::AffineMatrix2D SAL_CALL 
SlideShowView::getTransformation(  )
     }
 
     SdPage* pP = mpDoc->GetSdPage( 0, PageKind::Standard );
-    Size aPageSize( pP->GetSize() );
+    Size aPageSize(pP->GetSizeHmm());
 
     const double page_ratio = static_cast<double>(aPageSize.Width()) / 
static_cast<double>(aPageSize.Height());
     const double output_ratio = static_cast<double>(aOutputSize.Width()) / 
static_cast<double>(aOutputSize.Height());
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx 
b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
index 6ee20c8dd93c..eb68247d965c 100644
--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -340,7 +340,7 @@ bool ScrollBarManager::TestScrollBarVisibilities (
     bool bRearrangeSuccess (mrSlideSorter.GetView().GetLayouter().Rearrange (
         mrSlideSorter.GetView().GetOrientation(),
         aBrowserSize,
-        rModel.GetPageDescriptor(0)->GetPage()->GetSize(),
+        rModel.GetPageDescriptor(0)->GetPage()->GetSizeHmm(),
         rModel.GetPageCount()));
 
     if (bRearrangeSuccess)
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx 
b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index d15b2137451a..a24b6a454afc 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -294,7 +294,7 @@ void SlideSorterView::Rearrange()
         mpLayouter->Rearrange (
             meOrientation,
             aWindowSize,
-            mrModel.GetPageDescriptor(0)->GetPage()->GetSize(),
+            mrModel.GetPageDescriptor(0)->GetPage()->GetSizeHmm(),
             mrModel.GetPageCount()));
     if (bRearrangeSuccess)
     {
diff --git a/sd/source/ui/table/tablefunction.cxx 
b/sd/source/ui/table/tablefunction.cxx
index f2843311c2b9..e36e5db8b2be 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -109,7 +109,7 @@ static void InsertTableImpl(const DrawViewShell* pShell,
 
         // make sure that the default size of the table fits on the paper and 
is inside the viewing area.
         // if zoomed in close, don't make the table bigger than the viewing 
window.
-        Size aMaxSize = pShell->getCurrentPage()->GetSize();
+        Size aMaxSize = pShell->getCurrentPage()->GetSizeHmm();
 
         if (comphelper::LibreOfficeKit::isActive())
         {
diff --git a/sd/source/ui/tools/PreviewRenderer.cxx 
b/sd/source/ui/tools/PreviewRenderer.cxx
index be5a2737e589..0c845487befe 100644
--- a/sd/source/ui/tools/PreviewRenderer.cxx
+++ b/sd/source/ui/tools/PreviewRenderer.cxx
@@ -87,7 +87,7 @@ Image PreviewRenderer::RenderPage (
 {
     if (pPage != nullptr)
     {
-        const Size aPageModelSize (pPage->GetSize());
+        const Size aPageModelSize(pPage->GetSizeHmm());
         const double nAspectRatio (
             double(aPageModelSize.Width()) / double(aPageModelSize.Height()));
         const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
@@ -272,7 +272,7 @@ void PreviewRenderer::PaintPage (
     const bool bDisplayPresentationObjects)
 {
     // Paint the page.
-    ::tools::Rectangle aPaintRectangle (Point(0,0), pPage->GetSize());
+    ::tools::Rectangle aPaintRectangle = 
gfx::length::toRectangleHmm(pPage->getRectangle());
     vcl::Region aRegion (aPaintRectangle);
 
     // Turn off online spelling and redlining.
@@ -358,7 +358,7 @@ void PreviewRenderer::SetupOutputSize (
     aMapMode.SetMapUnit(MapUnit::MapPixel);
 
     // Adapt it to the desired width.
-    const Size aPageModelSize (rPage.GetSize());
+    const Size aPageModelSize = rPage.GetSizeHmm();
     if (!aPageModelSize.IsEmpty())
     {
         const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 83d8e56dc91f..2facbecd3272 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -465,8 +465,8 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, 
bool bDuplicate )
         // this is only used for clipboard where we only have one page
         pStandardPage = mpDoc->AllocSdPage(false);
 
-        Size aDefSize(21000, 29700);   // A4 portrait orientation
-        pStandardPage->SetSize( aDefSize );
+        gfx::Size2DL aDefSize(210_mm, 297_mm);   // A4 portrait orientation
+        pStandardPage->setSize(aDefSize);
         mpDoc->InsertPage(pStandardPage.get(), 0);
     }
     else
@@ -496,7 +496,7 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, 
bool bDuplicate )
         else
             pStandardPage = mpDoc->AllocSdPage(false);
 
-        pStandardPage->SetSize( pPreviousStandardPage->GetSize() );
+        pStandardPage->setSize(pPreviousStandardPage->getSize());
         pStandardPage->SetBorder( pPreviousStandardPage->GetLeftBorder(),
                                     pPreviousStandardPage->GetUpperBorder(),
                                     pPreviousStandardPage->GetRightBorder(),
@@ -531,7 +531,7 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, 
bool bDuplicate )
         else
             pNotesPage = mpDoc->AllocSdPage(false);
 
-        pNotesPage->SetSize( pPreviousNotesPage->GetSize() );
+        pNotesPage->setSize(pPreviousNotesPage->getSize());
         pNotesPage->SetBorder( pPreviousNotesPage->GetLeftBorder(),
                                 pPreviousNotesPage->GetUpperBorder(),
                                 pPreviousNotesPage->GetRightBorder(),
@@ -1493,7 +1493,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL 
SdXImpressDocument::getRenderer(
         awt::Size aPageSize;
         if ( bExportNotesPages )
         {
-            Size aNotesPageSize = mpDoc->GetSdPage( 0, PageKind::Notes 
)->GetSize();
+            Size aNotesPageSize = mpDoc->GetSdPage(0, PageKind::Notes 
)->GetSizeHmm();
             aPageSize = awt::Size( aNotesPageSize.Width(), 
aNotesPageSize.Height() );
         }
         else
@@ -1613,7 +1613,7 @@ static void ImplPDFExportShapeInteraction( const 
uno::Reference< drawing::XShape
         uno::Reference< beans::XPropertySet > xShapePropSet( xShape, 
uno::UNO_QUERY );
         if( xShapePropSet.is() )
         {
-            Size        aPageSize( rDoc.GetSdPage( 0, PageKind::Standard 
)->GetSize() );
+            Size aPageSize(rDoc.GetSdPage(0, 
PageKind::Standard)->GetSizeHmm());
             Point aPoint( 0, 0 );
             ::tools::Rectangle   aPageRect( aPoint, aPageSize );
 
@@ -1899,7 +1899,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 
nRenderer, const uno::Any& r
         return;
 
     ::sd::ClientView aView( mpDocShell, pOut );
-    ::tools::Rectangle aVisArea( Point(), mpDoc->GetSdPage( 
static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind )->GetSize() );
+    ::tools::Rectangle aVisArea( Point(), mpDoc->GetSdPage( 
static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind )->GetSizeHmm() );
     vcl::Region                       aRegion( aVisArea );
 
     ::sd::ViewShell* pOldViewSh = mpDocShell->GetViewShell();
@@ -2106,7 +2106,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 
nRenderer, const uno::Any& r
                     }
                 }
 
-                Size        aPageSize( mpDoc->GetSdPage( 0, PageKind::Standard 
)->GetSize() );
+                Size aPageSize(mpDoc->GetSdPage( 0, PageKind::Standard 
)->GetSizeHmm());
                 Point aPoint( 0, 0 );
                 ::tools::Rectangle   aPageRect( aPoint, aPageSize );
 
@@ -2513,7 +2513,7 @@ void 
SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
         {
             // get the full page size in pixels
             pWindow->EnableMapMode();
-            Size 
aSize(pWindow->LogicToPixel(pDrawView->GetSdrPageView()->GetPage()->GetSize()));
+            Size 
aSize(pWindow->LogicToPixel(pDrawView->GetSdrPageView()->GetPage()->GetSizeHmm()));
             // Disable map mode, so that it's possible to send mouse event
             // coordinates in logic units
             pWindow->EnableMapMode(false);
@@ -3208,7 +3208,7 @@ uno::Reference< drawing::XDrawPage > SAL_CALL 
SdMasterPagesAccess::insertNewByIn
 
         // create and insert new draw masterpage
         rtl::Reference<SdPage> pMPage = mpModel->mpDoc->AllocSdPage(true);
-        pMPage->SetSize( pPage->GetSize() );
+        pMPage->setSize(pPage->getSize());
         pMPage->SetBorder( pPage->GetLeftBorder(),
                            pPage->GetUpperBorder(),
                            pPage->GetRightBorder(),
@@ -3225,7 +3225,7 @@ uno::Reference< drawing::XDrawPage > SAL_CALL 
SdMasterPagesAccess::insertNewByIn
 
         // create and insert new notes masterpage
         rtl::Reference<SdPage> pMNotesPage = mpModel->mpDoc->AllocSdPage(true);
-        pMNotesPage->SetSize( pRefNotesPage->GetSize() );
+        pMNotesPage->setSize(pRefNotesPage->getSize());
         pMNotesPage->SetPageKind(PageKind::Notes);
         pMNotesPage->SetBorder( pRefNotesPage->GetLeftBorder(),
                                 pRefNotesPage->GetUpperBorder(),
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 4831b29bb53d..20f6843c314d 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -1013,10 +1013,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const 
OUString& PropertyName )
         aAny <<= GetPage()->GetLowerBorder();
         break;
     case WID_PAGE_WIDTH:
-        aAny <<= static_cast<sal_Int32>( GetPage()->GetSize().getWidth() );
+        aAny <<= static_cast<sal_Int32>( GetPage()->GetSizeHmm().getWidth() );
         break;
     case WID_PAGE_HEIGHT:
-        aAny <<= static_cast<sal_Int32>( GetPage()->GetSize().getHeight() );
+        aAny <<= static_cast<sal_Int32>( GetPage()->GetSizeHmm().getHeight() );
         break;
     case WID_PAGE_ORIENT:
         aAny <<=
@@ -1094,7 +1094,7 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const 
OUString& PropertyName )
                 std::shared_ptr<GDIMetaFile> xMetaFile = 
pDocShell->GetPreviewMetaFile();
                 if (xMetaFile)
                 {
-                    Size    aSize( GetPage()->GetSize() );
+                    Size aSize = GetPage()->GetSizeHmm();
                     xMetaFile->AddAction( new MetaFillColorAction( COL_WHITE, 
true ), 0 );
                     xMetaFile->AddAction( new MetaRectAction( 
::tools::Rectangle( Point(), aSize ) ), 1 );
                     xMetaFile->SetPrefMapMode(MapMode(MapUnit::Map100thMM));
@@ -1780,7 +1780,7 @@ static void refreshpage( SdDrawDocument* pDoc, const 
PageKind ePageKind )
     if( auto pDrawViewShell = dynamic_cast<::sd::DrawViewShell* >(pViewSh) )
         pDrawViewShell->ResetActualPage();
 
-    Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize();
+    Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSizeHmm();
     const tools::Long nWidth = aPageSize.Width();
     const tools::Long nHeight = aPageSize.Height();
 
@@ -1796,11 +1796,12 @@ static void refreshpage( SdDrawDocument* pDoc, const 
PageKind ePageKind )
 
 void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
 {
-    Size aSize( GetPage()->GetSize() );
-    if( aSize.getWidth() == nWidth )
+    auto aSize = GetPage()->getSize();
+
+    if (aSize.getWidth().as_hmm() == nWidth)
         return;
 
-    aSize.setWidth( nWidth );
+    aSize.setHeight(gfx::Length::hmm(nWidth));
 
     SdDrawDocument& rDoc(static_cast< SdDrawDocument& 
>(GetPage()->getSdrModelFromSdrPage()));
     const PageKind ePageKind = GetPage()->GetPageKind();
@@ -1809,7 +1810,7 @@ void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
     for (i = 0; i < nPageCnt; i++)
     {
         SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
-        pPage->SetSize(aSize);
+        pPage->setSize(aSize);
     }
 
     nPageCnt = rDoc.GetSdPageCount(ePageKind);
@@ -1817,7 +1818,7 @@ void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
     for (i = 0; i < nPageCnt; i++)
     {
         SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
-        pPage->SetSize(aSize);
+        pPage->setSize(aSize);
     }
 
     refreshpage( &rDoc, ePageKind );
@@ -1825,11 +1826,12 @@ void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
 
 void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
 {
-    Size aSize( GetPage()->GetSize() );
-    if( aSize.getHeight() == nHeight )
+    auto aSize = GetPage()->getSize();
+
+    if (aSize.getHeight().as_hmm() == nHeight)
         return;
 
-    aSize.setHeight( nHeight );
+    aSize.setHeight(gfx::Length::hmm(nHeight));
 
     SdDrawDocument& rDoc(static_cast< SdDrawDocument& 
>(GetPage()->getSdrModelFromSdrPage()));
     const PageKind ePageKind = GetPage()->GetPageKind();
@@ -1838,7 +1840,7 @@ void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
     for (i = 0; i < nPageCnt; i++)
     {
         SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
-        pPage->SetSize(aSize);
+        pPage->setSize(aSize);
     }
 
     nPageCnt = rDoc.GetSdPageCount(ePageKind);
@@ -1846,7 +1848,7 @@ void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
     for (i = 0; i < nPageCnt; i++)
     {
         SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
-        pPage->SetSize(aSize);
+        pPage->setSize(aSize);
     }
 
     refreshpage( &rDoc, ePageKind );
@@ -2354,7 +2356,7 @@ void SAL_CALL SdDrawPage::setMasterPage( const Reference< 
drawing::XDrawPage >&
     
SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLeftBorder(),pSdPage->GetUpperBorder(),
                       pSdPage->GetRightBorder(),pSdPage->GetLowerBorder() );
 
-    SvxFmDrawPage::mpPage->SetSize( pSdPage->GetSize() );
+    SvxFmDrawPage::mpPage->setSize(pSdPage->getSize());
     SvxFmDrawPage::mpPage->SetOrientation( pSdPage->GetOrientation() );
     static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetLayoutName( 
pSdPage->GetLayoutName() );
 
diff --git a/sd/source/ui/view/DocumentRenderer.cxx 
b/sd/source/ui/view/DocumentRenderer.cxx
index 307c0d324bb9..639ba2c0dfa5 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -318,7 +318,7 @@ namespace {
             pView->DrawMarkedObj(rPrinter);
         else
             rPrintView.CompleteRedraw(&rPrinter,
-                    vcl::Region(::tools::Rectangle(Point(0,0), 
rPage.GetSize())));
+                    
vcl::Region(gfx::length::toRectangleHmm(rPage.getRectangle())));
 
         rPrinter.SetMapMode(aOriginalMapMode);
 
@@ -816,7 +816,7 @@ namespace {
                 return;
             MapMode aMap (rPrinter.GetMapMode());
 
-            const Size aPageSize (pPageToPrint->GetSize());
+            const Size aPageSize (pPageToPrint->GetSizeHmm());
             const Size aPrintSize (rPrinter.GetOutputSize());
 
             const sal_Int32 nPageWidth (aPageSize.Width() + mnGap
@@ -1428,7 +1428,7 @@ private:
         // Draw and Notes should usually use specified paper size when printing
         if 
(!mpOptions->IsPrinterPreferred(mrBase.GetDocShell()->GetDocumentType()))
         {
-            aInfo.maPrintSize = mrBase.GetDocument()->GetSdPage(0, 
PageKind::Standard)->GetSize();
+            aInfo.maPrintSize = mrBase.GetDocument()->GetSdPage(0, 
PageKind::Standard)->GetSizeHmm();
             maPrintSize = awt::Size(aInfo.maPrintSize.Width(),
                                     aInfo.maPrintSize.Height());
         }
@@ -1776,7 +1776,7 @@ private:
 
         if ( bScalePage )
         {
-            const Size aPageSize (rHandoutPage.GetSize());
+            const Size aPageSize (rHandoutPage.GetSizeHmm());
             const Size aPrintSize (rInfo.mpPrinter->GetOutputSize());
 
             const double fHorz = static_cast<double>(aPrintSize.Width())    / 
aPageSize.Width();
@@ -1863,7 +1863,7 @@ private:
         if (pDocument->GetSdPageCount(ePageKind) == 0)
             return;
         SdPage* pRefPage = pDocument->GetSdPage(0, ePageKind);
-        rInfo.maPageSize = pRefPage->GetSize();
+        rInfo.maPageSize = pRefPage->GetSizeHmm();
 
         SetupPaperOrientation(ePageKind, rInfo);
 
@@ -1902,7 +1902,7 @@ private:
 
             MapMode aMap (rInfo.maMap);
             // is it possible that the page size changed?
-            const Size aPageSize = pPage->GetSize();
+            const Size aPageSize = pPage->GetSizeHmm();
 
             if (mpOptions->IsPageSize())
             {
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index a44277634698..7ef9027ad5f7 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -532,7 +532,7 @@ public:
             pMasterPage->InsertObject(pObject.get());
 
             // Calculate position
-            ::tools::Rectangle aRectangle(Point(), pMasterPage->GetSize());
+            ::tools::Rectangle aRectangle = 
gfx::length::toRectangleHmm(pMasterPage->getRectangle());
             Point aPosition(aRectangle.Center().X(), aRectangle.Bottom());
 
             aPosition.AdjustX( -(aTextSize.Width() / 2) );
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index e0c0db7b7e48..f0bb60c2847d 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -530,7 +530,7 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
 
     const SfxItemSet* pArgs = rReq.GetArgs();
     const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
-    Size aPageSize = mpActualPage->GetSize();
+    Size aPageSize = mpActualPage->GetSizeHmm();
     Size aViewSize = GetActiveWindow()->GetViewSize();
 
     switch ( rReq.GetSlot() )
@@ -889,7 +889,7 @@ void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
     Size aViewSize = GetActiveWindow()->GetViewSize();
 
     const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
-    Size aPageSize = mpActualPage->GetSize();
+    Size aPageSize = mpActualPage->GetSizeHmm();
 
     ::tools::Rectangle aRect(aPagePos, Point( aViewSize.Width() - 
(aPagePos.X() + aPageSize.Width()),
                                      aViewSize.Height() - (aPagePos.Y() + 
aPageSize.Height())));
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index 9c00365be2c2..5906f5397133 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -341,7 +341,7 @@ void DrawViewShell::WriteFrameViewData()
     if (comphelper::LibreOfficeKit::isActive())
     {
         // aVisArea is nonsensical in the LOK case, use the slide size
-        aVisArea = ::tools::Rectangle(Point(), getCurrentPage()->GetSize());
+        aVisArea = 
gfx::length::toRectangleHmm(getCurrentPage()->getRectangle());
     }
 
     mpFrameView->SetVisArea(aVisArea);
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 4f375dc6a05c..17aebdd0d28d 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1707,7 +1707,7 @@ void DrawViewShell::GetPageProperties( SfxItemSet &rSet )
     SvxPageItem aPageItem(SID_ATTR_PAGE);
     aPageItem.SetLandscape( pPage->GetOrientation() == Orientation::Landscape 
);
 
-    rSet.Put(SvxSizeItem( SID_ATTR_PAGE_SIZE, pPage->GetSize() ));
+    rSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, pPage->GetSizeHmm()));
     rSet.Put(aPageItem);
 
     const SfxItemSet &rPageAttr = pPage->getSdrPageProperties().GetItemSet();
@@ -1880,7 +1880,7 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
     {
         PageKind            ePageKind = GetPageKind();
         const SfxPoolItem*  pPoolItem = nullptr;
-        Size                aNewSize(pPage->GetSize());
+        Size aNewSize = pPage->GetSizeHmm();
         sal_Int32           nLeft  = -1, nRight = -1, nUpper = -1, nLower = -1;
         bool                bScaleAll = true;
         Orientation         eOrientation = pPage->GetOrientation();
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
index 0f2907d424ba..f6c129d1e631 100644
--- a/sd/source/ui/view/drviews8.cxx
+++ b/sd/source/ui/view/drviews8.cxx
@@ -53,7 +53,7 @@ void DrawViewShell::ScannerEvent()
                 {
                     const SolarMutexGuard aGuard;
                     SdrPage*            pPage = 
mpDrawView->GetSdrPageView()->GetPage();
-                    Size                aBmpSize( aScanBmp.GetPrefSize() ), 
aPageSize( pPage->GetSize() );
+                    Size aBmpSize(aScanBmp.GetPrefSize()), 
aPageSize(pPage->GetSizeHmm());
                     const MapMode       aMap100( MapUnit::Map100thMM );
 
                     if( !aBmpSize.Width() || !aBmpSize.Height() )
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index 543d874e7271..ceb14d9ed125 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -92,7 +92,7 @@ void DrawViewShell::ExecGallery(SfxRequest const & rReq)
 
         // constrain size to page size if necessary
         SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage();
-        Size aPageSize = pPage->GetSize();
+        Size aPageSize = pPage->GetSizeHmm();
         aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + 
pPage->GetRightBorder()) );
         aPageSize.AdjustHeight( -(pPage->GetUpperBorder() + 
pPage->GetLowerBorder()) );
 
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index a345af61331b..f6279afe2152 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -240,7 +240,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, 
PageKind eInitialPageKind)
             break;
     }
 
-    Size aPageSize( GetDoc()->GetSdPage(0, mePageKind)->GetSize() );
+    Size aPageSize(GetDoc()->GetSdPage(0, mePageKind)->GetSizeHmm());
     Point aPageOrg( aPageSize.Width(), aPageSize.Height() / 2);
     Size aSize(aPageSize.Width() * 3, aPageSize.Height() * 2);
     InitWindows(aPageOrg, aSize, Point(-1, -1));
@@ -436,7 +436,7 @@ void DrawViewShell::SetupPage (Size const &rSize,
             {
                 ::tools::Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
                 pPage->ScaleObjects(rSize, aBorderRect, bScaleAll);
-                pPage->SetSize(rSize);
+                pPage->setSize({ gfx::Length::hmm(rSize.Width()), 
gfx::Length::hmm(rSize.Height()) });
 
             }
             if( bMargin )
@@ -469,7 +469,7 @@ void DrawViewShell::SetupPage (Size const &rSize,
             {
                 ::tools::Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
                 pPage->ScaleObjects(rSize, aBorderRect, bScaleAll);
-                pPage->SetSize(rSize);
+                pPage->setSize({ gfx::Length::hmm(rSize.Width()), 
gfx::Length::hmm(rSize.Height()) });
             }
             if( bMargin )
             {
@@ -495,8 +495,8 @@ void DrawViewShell::SetupPage (Size const &rSize,
         pHandoutPage->CreateTitleAndLayout(true);
     }
 
-    ::tools::Long nWidth = mpActualPage->GetSize().Width();
-    ::tools::Long nHeight = mpActualPage->GetSize().Height();
+    ::tools::Long nWidth = mpActualPage->GetSizeHmm().Width();
+    ::tools::Long nHeight = mpActualPage->GetSizeHmm().Height();
 
     Point aPageOrg(nWidth, nHeight / 2);
     Size aSize( nWidth * 3, nHeight * 2);
@@ -575,7 +575,7 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
             if( pPageView )
             {
                 Point aPagePos(0, 0);
-                Size aPageSize = pPageView->GetPage()->GetSize();
+                Size aPageSize = pPageView->GetPage()->GetSizeHmm();
 
                 aPagePos.AdjustX(aPageSize.Width()  / 2 );
                 aPageSize.setWidth( 
static_cast<::tools::Long>(aPageSize.Width() * 1.03) );
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 59142ad4bb76..a3ee76b84dc9 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -627,7 +627,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
     if (comphelper::LibreOfficeKit::isActive())
     {
         // aVisArea is nonsensical in the LOK case, use the slide size
-        aVisArea = ::tools::Rectangle(Point(), getCurrentPage()->GetSize());
+        aVisArea = 
gfx::length::toRectangleHmm(getCurrentPage()->getRectangle());
     }
 
     Point aPagePos = aVisArea.Center();
@@ -1140,7 +1140,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
             if ( pPageView )
             {
                 Point aPagePos(0, 0); // = pPageView->GetOffset();
-                Size aPageSize = pPageView->GetPage()->GetSize();
+                Size aPageSize = pPageView->GetPage()->GetSizeHmm();
 
                 aPagePos.AdjustX(aPageSize.Width()  / 2 );
                 aPageSize.setWidth( 
static_cast<::tools::Long>(aPageSize.Width() * 1.03) );
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 5e598de483dc..b3e5dd9d1e91 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -403,7 +403,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* 
pPara )
     pPage->TRG_SetMasterPage(pExample->TRG_GetMasterPage());
 
     // set page size
-    pPage->SetSize(pExample->GetSize());
+    pPage->setSize(pExample->getSize());
     pPage->SetBorder( pExample->GetLeftBorder(),
                       pExample->GetUpperBorder(),
                       pExample->GetRightBorder(),
@@ -442,7 +442,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* 
pPara )
     pNotesPage->TRG_SetMasterPage(pExample->TRG_GetMasterPage());
 
     // set page size, there must be already one page available
-    pNotesPage->SetSize(pExample->GetSize());
+    pNotesPage->setSize(pExample->getSize());
     pNotesPage->SetBorder( pExample->GetLeftBorder(),
                            pExample->GetUpperBorder(),
                            pExample->GetRightBorder(),
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index af76e39afd4b..d363fb1591ed 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -100,7 +100,7 @@ css::uno::Reference< css::datatransfer::XTransferable > 
View::CreateClipboardDat
 
     if( pOldPage )
     {
-        pNewPage->SetSize( pOldPage->GetSize() );
+        pNewPage->setSize(pOldPage->getSize());
         pNewPage->SetLayoutName( pOldPage->GetLayoutName() );
     }
 
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 548e85c5798b..ebd1bc2fdda5 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -221,7 +221,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, 
sal_Int8& rAction,
         else
         {
             SdrPage* pPage = pPV->GetPage();
-            Size aPageSize( pPage->GetSize() );
+            Size aPageSize(pPage->GetSizeHmm());
             aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + 
pPage->GetRightBorder()) );
             aPageSize.AdjustHeight( -(pPage->GetUpperBorder() + 
pPage->GetLowerBorder()) );
             pNewGrafObj->AdjustToMaxRect( ::tools::Rectangle( Point(), 
aPageSize ), true );
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index abb9b5f1db7a..14e4dba63a22 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -500,8 +500,8 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, 
const Size& rNewSize,
     SdPage* pPage(0 != nPageCnt
         ? GetDoc()->GetSdPage(0, ePageKind)
         : GetDoc()->GetMasterSdPage(0, ePageKind));
-    const ::tools::Long nWidth(pPage->GetSize().Width());
-    const ::tools::Long nHeight(pPage->GetSize().Height());
+    const ::tools::Long nWidth(pPage->GetSizeHmm().Width());
+    const ::tools::Long nHeight(pPage->GetSizeHmm().Height());
     const Point aPageOrg(nWidth, nHeight / 2);
     const Size aViewSize(nWidth * 3, nHeight * 2);
     Point aVisAreaPos;
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index f6ca7fd4b09e..fcaa0b883df9 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -274,7 +274,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObject)
     pModel->GetItemPool().FreezeIdRanges();
 
     rtl::Reference<SdrPage> pPage(new SdrPage(*pModel, false));
-    pPage->SetSize(Size(1000, 1000));
+    pPage->setSize({ 1_cm, 1_cm });
     pModel->InsertPage(pPage.get(), 0);
 
     tools::Rectangle aSize(Point(), Size(100, 100));
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index ffad222628eb..fa3dd0d0068b 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -140,7 +140,7 @@ void Svx3DPreviewControl::Resize()
     // size of page
     Size aSize(GetOutputSizePixel());
     aSize = GetDrawingArea()->get_ref_device().PixelToLogic(aSize);
-    mxFmPage->SetSize(aSize);
+    mxFmPage->setSize({ gfx::Length::hmm(aSize.Width()), 
gfx::Length::hmm(aSize.Height()) });
 
     // set size
     Size aObjSize( aSize.Width()*5/6, aSize.Height()*5/6 );
@@ -670,7 +670,7 @@ void Svx3DLightControl::Resize()
 {
     // set size of page
     const Size 
aSize(GetDrawingArea()->get_ref_device().PixelToLogic(GetOutputSizePixel()));
-    mxFmPage->SetSize(aSize);
+    mxFmPage->setSize(gfx::length::fromSizeHmm(aSize));
 
     // set position and size of scene
     mpScene->SetSnapRect(tools::Rectangle(Point(0, 0), aSize));
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 136eae27b52c..23ed146d53b1 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -128,7 +128,7 @@ void GraphCtrl::InitSdrModel()
 
     pPage = new SdrPage( *pModel );
 
-    pPage->SetSize( aGraphSize );
+    pPage->setSize(gfx::length::fromSizeHmm(aGraphSize));
     pPage->SetBorder( 0, 0, 0, 0 );
     pModel->InsertPage( pPage.get() );
     pModel->SetChanged( false );
diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx 
b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
index 20463d0fc2ef..b4def2624384 100644
--- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
+++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
@@ -52,12 +52,10 @@ namespace sdr::contact
             {
                 // direct model data is the page size, get and use it
                 const SdrPage& rOwnerPage = 
GetMasterPageDescriptor().GetOwnerPage();
-                const basegfx::B2DRange aInnerRange(
-                    rOwnerPage.GetLeftBorder(), rOwnerPage.GetUpperBorder(),
-                    rOwnerPage.GetWidth() - rOwnerPage.GetRightBorder(),
-                    rOwnerPage.GetHeight() - rOwnerPage.GetLowerBorder());
-                const basegfx::B2DRange aOuterRange(
-                    0, 0, rOwnerPage.GetWidth(), rOwnerPage.GetHeight());
+
+                const basegfx::B2DRange aInnerRange = 
gfx::length::toB2DRange2DHmm(rOwnerPage.getInnerRectangle());
+                const basegfx::B2DRange aOuterRange = 
gfx::length::toB2DRange2DHmm(rOwnerPage.getRectangle());
+
                 // ??? somehow only the master page's bit is used
                 bool const 
isFullSize(GetMasterPageDescriptor().GetUsedPage().IsBackgroundFullSize());
                 const basegfx::B2DPolygon aFillPolygon(
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx 
b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
index 0f04045815b5..ca032144dbd0 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -103,9 +103,12 @@ void 
ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence(drawingla
 {
     static bool bUseOldPageShadow(false); // loplugin:constvars:ignore
     const SdrPage& rPage = getPage();
+    const double fPageWidth = rPage.getSize().getWidth().as_hmm();
+    const double fPageHeight = rPage.getSize().getHeight().as_hmm();
+
     basegfx::B2DHomMatrix aPageMatrix;
-    aPageMatrix.set(0, 0, static_cast<double>(rPage.GetWidth()));
-    aPageMatrix.set(1, 1, static_cast<double>(rPage.GetHeight()));
+    aPageMatrix.set(0, 0, fPageWidth);
+    aPageMatrix.set(1, 1, fPageHeight);
 
     if(bUseOldPageShadow)
     {
@@ -201,11 +204,9 @@ void 
ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence(drawingla
             if(!aFill.isDefault())
             {
                 // direct model data is the page size, get and use it
-                const basegfx::B2DRange aOuterRange(
-                    0, 0, rPage.GetWidth(), rPage.GetHeight());
-                const basegfx::B2DRange aInnerRange(
-                    rPage.GetLeftBorder(), rPage.GetUpperBorder(),
-                    rPage.GetWidth() - rPage.GetRightBorder(), 
rPage.GetHeight() - rPage.GetLowerBorder());
+                const basegfx::B2DRange aOuterRange = 
gfx::length::toB2DRange2DHmm(rPage.getRectangle());
+                const basegfx::B2DRange aInnerRange = 
gfx::length::toB2DRange2DHmm(rPage.getInnerRectangle());
+
                 bool const isFullSize(rPage.IsBackgroundFullSize());
                 const basegfx::B2DPolygon aFillPolygon(
                     basegfx::utils::createPolygonFromRect(isFullSize ? 
aOuterRange : aInnerRange));
@@ -241,7 +242,7 @@ ViewObjectContact& 
ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(
 void 
ViewContactOfPageFill::createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&
 rVisitor) const
 {
     const SdrPage& rPage = getPage();
-    const basegfx::B2DRange aPageFillRange(0.0, 0.0, 
static_cast<double>(rPage.GetWidth()), static_cast<double>(rPage.GetHeight()));
+    const basegfx::B2DRange aPageFillRange = 
gfx::length::toB2DRange2DHmm(rPage.getInnerRectangle());
     const basegfx::B2DPolygon 
aPageFillPolygon(basegfx::utils::createPolygonFromRect(aPageFillRange));
 
     // We have only the page information, not the view information. Use the
@@ -274,7 +275,7 @@ ViewObjectContact& 
ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectC
 void 
ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&
 rVisitor) const
 {
     const SdrPage& rPage = getPage();
-    const basegfx::B2DRange aPageBorderRange(0.0, 0.0, 
static_cast<double>(rPage.GetWidth()), static_cast<double>(rPage.GetHeight()));
+    const basegfx::B2DRange aPageBorderRange = 
gfx::length::toB2DRange2DHmm(rPage.getRectangle());
 
     // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used.
     // Added old case as fallback for HighContrast.
@@ -330,9 +331,7 @@ ViewObjectContact& 
ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectC
 void 
ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&
 rVisitor) const
 {
     const SdrPage& rPage = getPage();
-    const basegfx::B2DRange aPageBorderRange(
-        static_cast<double>(rPage.GetLeftBorder()), 
static_cast<double>(rPage.GetUpperBorder()),
-        static_cast<double>(rPage.GetWidth() - rPage.GetRightBorder()), 
static_cast<double>(rPage.GetHeight() - rPage.GetLowerBorder()));
+    const basegfx::B2DRange aPageBorderRange = 
gfx::length::toB2DRange2DHmm(rPage.getInnerRectangle());
     basegfx::B2DPolygon 
aPageBorderPolygon(basegfx::utils::createPolygonFromRect(aPageBorderRange));
 
     // We have only the page information, not the view information. Use the
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx 
b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index e2644489d6d1..46242dc01ebf 100644

... etc. - the rest is truncated

Reply via email to