filter/source/svg/svgfilter.cxx                       |   10 +-
 include/svx/svdpage.hxx                               |   78 +++++++++++++---
 include/svx/svdpagv.hxx                               |   10 +-
 sd/source/core/drawdoc.cxx                            |   10 +-
 sd/source/core/drawdoc2.cxx                           |   38 ++------
 sd/source/core/drawdoc3.cxx                           |   79 +++++++---------
 sd/source/core/sdpage.cxx                             |   76 +++++++---------
 sd/source/filter/grf/sdgrffilter.cxx                  |    8 -
 sd/source/filter/html/htmlex.cxx                      |   19 ++--
 sd/source/ui/func/fuexpand.cxx                        |   10 --
 sd/source/ui/func/fupage.cxx                          |   27 +++--
 sd/source/ui/func/fusumry.cxx                         |   10 --
 sd/source/ui/sidebar/DocumentHelper.cxx               |   10 +-
 sd/source/ui/unoidl/unomodel.cxx                      |   20 ----
 sd/source/ui/unoidl/unopage.cxx                       |   21 +---
 sd/source/ui/view/DocumentRenderer.cxx                |   37 +++----
 sd/source/ui/view/drviews3.cxx                        |   25 ++---
 sd/source/ui/view/drviews4.cxx                        |    3 
 sd/source/ui/view/drviews7.cxx                        |   16 +--
 sd/source/ui/view/drviews8.cxx                        |    7 -
 sd/source/ui/view/drviews9.cxx                        |    7 -
 sd/source/ui/view/drviewsa.cxx                        |    3 
 sd/source/ui/view/outlview.cxx                        |   10 --
 sd/source/ui/view/sdview4.cxx                         |    4 
 sd/source/ui/view/viewshe2.cxx                        |    3 
 svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx |   14 +--
 svx/source/svdraw/svdedtv1.cxx                        |    5 -
 svx/source/svdraw/svdpage.cxx                         |   84 ++++++------------
 svx/source/svdraw/svdpagv.cxx                         |   26 +++--
 svx/source/svdraw/svdsnpv.cxx                         |    8 -
 svx/source/unodraw/UnoGraphicExporter.cxx             |    6 -
 31 files changed, 333 insertions(+), 351 deletions(-)

New commits:
commit 4e93875b4a8e0043e41f6bce42b97f3c000b19e9
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Sep 16 13:15:03 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Fri Sep 16 16:36:56 2022 +0200

    svx: change SdrPage left,right,upper,lower border to use gfx::Length
    
    Change-Id: I7cde7bccfe17cab27eb643d851509b68e128842d

diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 60bafd2fa1bb..abf50cf476a0 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -321,12 +321,12 @@ 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 = 
gfx::length::toSizeHmm(pTargetSdrPage->getSize());
+            const gfx::Size2DL aPageSize = pTargetSdrPage->getSize();
             const double fBorderRelation((
-                static_cast< double >(pTargetSdrPage->GetLeftBorder()) / 
aPageSize.Width() +
-                static_cast< double >(pTargetSdrPage->GetRightBorder()) / 
aPageSize.Width() +
-                static_cast< double >(pTargetSdrPage->GetUpperBorder()) / 
aPageSize.Height() +
-                static_cast< double >(pTargetSdrPage->GetLowerBorder()) / 
aPageSize.Height()) / 4.0);
+                pTargetSdrPage->getLeftBorder().as_emu() / 
aPageSize.getWidth().as_emu() +
+                pTargetSdrPage->getRightBorder().as_emu() / 
aPageSize.getWidth().as_emu() +
+                pTargetSdrPage->getUpperBorder().as_emu() / 
aPageSize.getHeight().as_emu() +
+                pTargetSdrPage->getLowerBorder().as_emu() / 
aPageSize.getHeight().as_emu()) / 4.0);
             const tools::Long nAllBorder(basegfx::fround((aGraphicSize.Width() 
+ aGraphicSize.Height()) * fBorderRelation * 0.5));
 
             // Adapt PageSize and Border stuff. To get all MasterPages and 
PresObjs
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index ccb7d581695b..0f101b3e6c63 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -353,6 +353,46 @@ public:
     void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
+class Border
+{
+private:
+    gfx::Length maLeft;
+    gfx::Length maRight;
+    gfx::Length maUpper;
+    gfx::Length maLower;
+public:
+    Border()
+        : maLeft(0_emu)
+        , maRight(0_emu)
+        , maUpper(0_emu)
+        , maLower(0_emu)
+    {}
+
+    gfx::Length const& getLeft() const { return maLeft; }
+    gfx::Length const& getRight() const { return maRight; }
+    gfx::Length const& getUpper() const { return maUpper; }
+    gfx::Length const& getLower() const { return maLower; }
+
+    void setLeft(gfx::Length const& rLeft)
+    {
+        maLeft = rLeft;
+    }
+
+    void setRight(gfx::Length const& rRight)
+    {
+        maRight = rRight;
+    }
+
+    void setUpper(gfx::Length const& rUpper)
+    {
+        maUpper = rUpper;
+    }
+
+    void setLower(gfx::Length const& rLower)
+    {
+        maLower = rLower;
+    }
+};
 
 /**
   A SdrPage contains exactly one SdrObjList and a description of the physical
@@ -417,10 +457,8 @@ private:
 private:
     gfx::Size2DL maSize;
 
-    sal_Int32 mnBorderLeft;  // left page margin
-    sal_Int32 mnBorderUpper; // top page margin
-    sal_Int32 mnBorderRight; // right page margin
-    sal_Int32 mnBorderLower; // bottom page margin
+    Border maBorder;
+
     bool mbBackgroundFullSize = false; ///< Background object to represent the 
whole page.
 
     std::unique_ptr<SdrLayerAdmin> mpLayerAdmin;
@@ -496,25 +534,35 @@ public:
 
     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);
+        return gfx::Range2DL(maBorder.getLeft(), maBorder.getUpper(),
+                             maSize.getWidth() - maBorder.getRight(),
+                             maSize.getHeight() - maBorder.getLower());
     }
 
     virtual void SetOrientation(Orientation eOri);
     virtual Orientation GetOrientation() const;
-    virtual void  SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, 
sal_Int32 Lwr);
+
+    virtual Border const& getBorder() const
+    {
+        return maBorder;
+    }
+
+    virtual void setBorder(Border const& rBorder)
+    {
+        maBorder = rBorder;
+    }
+
+    virtual void  SetBorder(sal_Int32 nLeft, sal_Int32 nUpper, sal_Int32 
nRight, sal_Int32 Lower);
     virtual void  SetLeftBorder(sal_Int32 nBorder);
     virtual void  SetUpperBorder(sal_Int32 nBorder);
     virtual void  SetRightBorder(sal_Int32 nBorder);
     virtual void  SetLowerBorder(sal_Int32 nBorder);
-    sal_Int32 GetLeftBorder() const;
-    sal_Int32 GetUpperBorder() const;
-    sal_Int32 GetRightBorder() const;
-    sal_Int32 GetLowerBorder() const;
+
+    gfx::Length getLeftBorder() const { return maBorder.getLeft(); }
+    gfx::Length getUpperBorder() const { return maBorder.getUpper(); }
+    gfx::Length getRightBorder() const { return maBorder.getRight(); }
+    gfx::Length getLowerBorder() const { return maBorder.getLower(); }
+
     void    SetBackgroundFullSize(bool bIn);
     bool    IsBackgroundFullSize() const;
 
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 5b1867f61ae3..3e9c4a6bc683 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -442,8 +442,8 @@ void SdDrawDocument::AdaptPageSizeForAllPages(
                     this,
                     pPage,
                     pPage->GetSizeHmm(),
-                    pPage->GetLeftBorder(), pPage->GetRightBorder(),
-                    pPage->GetUpperBorder(), pPage->GetLowerBorder(),
+                    pPage->getLeftBorder().as_hmm(), 
pPage->getRightBorder().as_hmm(),
+                    pPage->getUpperBorder().as_hmm(), 
pPage->getLowerBorder().as_hmm(),
                     pPage->GetOrientation(),
                     pPage->GetPaperBin(),
                     pPage->IsBackgroundFullSize(),
@@ -497,8 +497,10 @@ void SdDrawDocument::AdaptPageSizeForAllPages(
                     this,
                     pPage,
                     pPage->GetSizeHmm(),
-                    pPage->GetLeftBorder(), pPage->GetRightBorder(),
-                    pPage->GetUpperBorder(), pPage->GetLowerBorder(),
+                    pPage->getLeftBorder().as_hmm(),
+                    pPage->getRightBorder().as_hmm(),
+                    pPage->getUpperBorder().as_hmm(),
+                    pPage->getLowerBorder().as_hmm(),
                     pPage->GetOrientation(),
                     pPage->GetPaperBin(),
                     pPage->IsBackgroundFullSize(),
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 5706d143eda8..54e6b414b995 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -512,7 +512,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
     if( pRefPage )
     {
         pHandoutPage->setSize(pRefPage->getSize());
-        pHandoutPage->SetBorder( pRefPage->GetLeftBorder(), 
pRefPage->GetUpperBorder(), pRefPage->GetRightBorder(), 
pRefPage->GetLowerBorder() );
+        pHandoutPage->setBorder(pRefPage->getBorder());
     }
     else
     {
@@ -528,10 +528,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
     rtl::Reference<SdPage> pHandoutMPage = AllocSdPage(true);
     pHandoutMPage->setSize(pHandoutPage->getSize());
     pHandoutMPage->SetPageKind(PageKind::Handout);
-    pHandoutMPage->SetBorder( pHandoutPage->GetLeftBorder(),
-                              pHandoutPage->GetUpperBorder(),
-                              pHandoutPage->GetRightBorder(),
-                              pHandoutPage->GetLowerBorder() );
+    pHandoutMPage->setBorder(pHandoutPage->getBorder());
     InsertMasterPage(pHandoutMPage.get(), 0);
     pHandoutPage->TRG_SetMasterPage( *pHandoutMPage );
 
@@ -551,7 +548,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
         if( pRefPage )
         {
             pPage->setSize(pRefPage->getSize());
-            pPage->SetBorder( pRefPage->GetLeftBorder(), 
pRefPage->GetUpperBorder(), pRefPage->GetRightBorder(), 
pRefPage->GetLowerBorder() );
+            pPage->setBorder(pRefPage->getBorder());
         }
         else if (meDocType == DocumentType::Draw)
         {
@@ -588,7 +585,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({ gfx::Length::hmm(aSz.Height()), 
gfx::Length::hmm(aSz.Width()) });
-            pPage->SetBorder(0, 0, 0, 0);
+            pPage->setBorder(Border());
         }
 
         InsertPage(pPage.get(), 1);
@@ -602,10 +599,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->SetBorder( pPage->GetLeftBorder(),
-                       pPage->GetUpperBorder(),
-                       pPage->GetRightBorder(),
-                       pPage->GetLowerBorder() );
+    pMPage->setBorder(pPage->getBorder());
     InsertMasterPage(pMPage.get(), 1);
     pPage->TRG_SetMasterPage( *pMPage );
     if( bClipboard )
@@ -620,7 +614,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
     if( pRefPage )
     {
         pNotesPage->setSize(pRefPage->getSize());
-        pNotesPage->SetBorder( pRefPage->GetLeftBorder(), 
pRefPage->GetUpperBorder(), pRefPage->GetRightBorder(), 
pRefPage->GetLowerBorder() );
+        pNotesPage->setBorder(pRefPage->getBorder());
     }
     else
     {
@@ -645,10 +639,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
     rtl::Reference<SdPage> pNotesMPage = AllocSdPage(true);
     pNotesMPage->setSize(pNotesPage->getSize());
     pNotesMPage->SetPageKind(PageKind::Notes);
-    pNotesMPage->SetBorder( pNotesPage->GetLeftBorder(),
-                            pNotesPage->GetUpperBorder(),
-                            pNotesPage->GetRightBorder(),
-                            pNotesPage->GetLowerBorder() );
+    pNotesMPage->setBorder(pNotesPage->getBorder());
     InsertMasterPage(pNotesMPage.get(), 2);
     pNotesPage->TRG_SetMasterPage( *pNotesMPage );
     if( bClipboard )
@@ -1094,10 +1085,7 @@ void SdDrawDocument::CheckMasterPages()
                 if( pRefNotesPage )
                 {
                     pNewNotesPage->setSize(pRefNotesPage->getSize());
-                    pNewNotesPage->SetBorder( pRefNotesPage->GetLeftBorder(),
-                                            pRefNotesPage->GetUpperBorder(),
-                                            pRefNotesPage->GetRightBorder(),
-                                            pRefNotesPage->GetLowerBorder() );
+                    pNewNotesPage->setBorder(pRefNotesPage->getBorder());
                 }
                 InsertMasterPage(pNewNotesPage.get(),  nPage );
                 pNewNotesPage->SetLayoutName( pPage->GetLayoutName() );
@@ -1164,10 +1152,7 @@ sal_uInt16 SdDrawDocument::CreatePage (
     // Set the size here since else the presobj autolayout
     // will be wrong.
     pStandardPage->setSize(pPreviousStandardPage->getSize());
-    pStandardPage->SetBorder( pPreviousStandardPage->GetLeftBorder(),
-                              pPreviousStandardPage->GetUpperBorder(),
-                              pPreviousStandardPage->GetRightBorder(),
-                              pPreviousStandardPage->GetLowerBorder() );
+    pStandardPage->setBorder(pPreviousStandardPage->getBorder());
 
     // Use master page of current page.
     
pStandardPage->TRG_SetMasterPage(pPreviousStandardPage->TRG_GetMasterPage());
@@ -1353,10 +1338,7 @@ void SdDrawDocument::SetupNewPage (
     if (pPreviousPage != nullptr)
     {
         pPage->setSize(pPreviousPage->getSize());
-        pPage->SetBorder( pPreviousPage->GetLeftBorder(),
-            pPreviousPage->GetUpperBorder(),
-            pPreviousPage->GetRightBorder(),
-            pPreviousPage->GetLowerBorder() );
+        pPage->setBorder(pPreviousPage->getBorder());
     }
     pPage->SetName(sPageName);
 
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 64aa094b4162..bb526daad5fd 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -410,18 +410,12 @@ bool SdDrawDocument::InsertBookmarkAsPage(
     // Note that the pointers are used later on as general page pointers.
     SdPage* pRefPage = GetSdPage(0, PageKind::Standard);
     Size aSize = pRefPage->GetSizeHmm();
-    sal_Int32 nLeft  = pRefPage->GetLeftBorder();
-    sal_Int32 nRight = pRefPage->GetRightBorder();
-    sal_Int32 nUpper = pRefPage->GetUpperBorder();
-    sal_Int32 nLower = pRefPage->GetLowerBorder();
+    auto aBorder = pRefPage->getBorder();
     Orientation eOrient = pRefPage->GetOrientation();
 
     SdPage* pNPage = GetSdPage(0, PageKind::Notes);
     Size aNSize = pNPage->GetSizeHmm();
-    sal_Int32 nNLeft  = pNPage->GetLeftBorder();
-    sal_Int32 nNRight = pNPage->GetRightBorder();
-    sal_Int32 nNUpper = pNPage->GetUpperBorder();
-    sal_Int32 nNLower = pNPage->GetLowerBorder();
+    auto aNBorder = pNPage->getBorder();
     Orientation eNOrient = pNPage->GetOrientation();
 
     // Adapt page size and margins to those of the later pages?
@@ -448,10 +442,10 @@ bool SdDrawDocument::InsertBookmarkAsPage(
         SdPage* pBMPage = pBookmarkDoc->GetSdPage(0,PageKind::Standard);
 
         if (pBMPage->getSize() != pRefPage->getSize() ||
-            pBMPage->GetLeftBorder()   != pRefPage->GetLeftBorder()    ||
-            pBMPage->GetRightBorder()   != pRefPage->GetRightBorder()    ||
-            pBMPage->GetUpperBorder()   != pRefPage->GetUpperBorder()    ||
-            pBMPage->GetLowerBorder()   != pRefPage->GetLowerBorder())
+            pBMPage->getBorder().getLeft() != pRefPage->getBorder().getLeft() 
||
+            pBMPage->getBorder().getRight() != 
pRefPage->getBorder().getRight() ||
+            pBMPage->getBorder().getUpper() != 
pRefPage->getBorder().getUpper() ||
+            pBMPage->getBorder().getLower() != 
pRefPage->getBorder().getLower())
         {
             OUString aStr(SdResId(STR_SCALE_OBJECTS));
             std::unique_ptr<weld::MessageDialog> 
xQueryBox(Application::CreateMessageDialog(nullptr,
@@ -833,11 +827,13 @@ bool SdDrawDocument::InsertBookmarkAsPage(
 
             if (bScaleObjects)
             {
-                ::tools::Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
+                ::tools::Rectangle aBorderRect(
+                        aBorder.getLeft().as_hmm(), 
aBorder.getUpper().as_hmm(),
+                        aBorder.getRight().as_hmm(), 
aBorder.getLower().as_hmm());
                 pRefPage->ScaleObjects(aSize, aBorderRect, true);
             }
             pRefPage->setSize(gfx::length::fromSizeHmm(aSize));
-            pRefPage->SetBorder(nLeft, nUpper, nRight, nLower);
+            pRefPage->setBorder(aBorder);
             pRefPage->SetOrientation( eOrient );
 
             if( bRemoveEmptyPresObj )
@@ -852,12 +848,14 @@ bool SdDrawDocument::InsertBookmarkAsPage(
 
             if (bScaleObjects)
             {
-                ::tools::Rectangle aBorderRect(nNLeft, nNUpper, nNRight, 
nNLower);
+                ::tools::Rectangle aBorderRect(
+                        aNBorder.getLeft().as_hmm(), 
aNBorder.getUpper().as_hmm(),
+                        aNBorder.getRight().as_hmm(), 
aNBorder.getLower().as_hmm());
                 pRefPage->ScaleObjects(aNSize, aBorderRect, true);
             }
 
             pRefPage->setSize(gfx::length::fromSizeHmm(aNSize));
-            pRefPage->SetBorder(nNLeft, nNUpper, nNRight, nNLower);
+            pRefPage->setBorder(aNBorder);
             pRefPage->SetOrientation( eNOrient );
 
             if( bRemoveEmptyPresObj )
@@ -875,22 +873,27 @@ bool SdDrawDocument::InsertBookmarkAsPage(
             {
                 if (bScaleObjects)
                 {
-                    ::tools::Rectangle aBorderRect(nLeft, nUpper, nRight, 
nLower);
+                    ::tools::Rectangle aBorderRect(
+                        aBorder.getLeft().as_hmm(), 
aBorder.getUpper().as_hmm(),
+                        aBorder.getRight().as_hmm(), 
aBorder.getLower().as_hmm());
+
                     pRefPage->ScaleObjects(aSize, aBorderRect, true);
                 }
                 pRefPage->setSize(gfx::length::fromSizeHmm(aNSize));
-                pRefPage->SetBorder(nLeft, nUpper, nRight, nLower);
+                pRefPage->setBorder(aBorder);
                 pRefPage->SetOrientation( eOrient );
             }
             else        // Can only be notes
             {
                 if (bScaleObjects)
                 {
-                    ::tools::Rectangle aBorderRect(nNLeft, nNUpper, nNRight, 
nNLower);
+                    ::tools::Rectangle aBorderRect(
+                        aNBorder.getLeft().as_hmm(), 
aNBorder.getUpper().as_hmm(),
+                        aNBorder.getRight().as_hmm(), 
aNBorder.getLower().as_hmm());
                     pRefPage->ScaleObjects(aNSize, aBorderRect, true);
                 }
                 pRefPage->setSize(gfx::length::fromSizeHmm(aNSize));
-                pRefPage->SetBorder(nNLeft, nNUpper, nNRight, nNLower);
+                pRefPage->setBorder(aNBorder);
                 pRefPage->SetOrientation( eNOrient );
             }
 
@@ -1697,30 +1700,24 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 
nSdPageNum,
         if (pSourceDoc != this)
         {
             Size aSize = rOldMaster.GetSizeHmm();
-            ::tools::Rectangle aBorderRect(rOldMaster.GetLeftBorder(),
-                                  rOldMaster.GetUpperBorder(),
-                                  rOldMaster.GetRightBorder(),
-                                  rOldMaster.GetLowerBorder());
+            ::tools::Rectangle aBorderRect(rOldMaster.getLeftBorder().as_hmm(),
+                                  rOldMaster.getUpperBorder().as_hmm(),
+                                  rOldMaster.getRightBorder().as_hmm(),
+                                  rOldMaster.getLowerBorder().as_hmm());
             pMaster->ScaleObjects(aSize, aBorderRect, true);
             pMaster->setSize(rOldMaster.getSize());
-            pMaster->SetBorder(rOldMaster.GetLeftBorder(),
-                               rOldMaster.GetUpperBorder(),
-                               rOldMaster.GetRightBorder(),
-                               rOldMaster.GetLowerBorder());
+            pMaster->setBorder(rOldMaster.getBorder());
             pMaster->SetOrientation( rOldMaster.GetOrientation() );
             pMaster->SetAutoLayout(pMaster->GetAutoLayout());
 
             aSize = rOldNotesMaster.GetSizeHmm();
-            ::tools::Rectangle 
aNotesBorderRect(rOldNotesMaster.GetLeftBorder(),
-                                       rOldNotesMaster.GetUpperBorder(),
-                                       rOldNotesMaster.GetRightBorder(),
-                                       rOldNotesMaster.GetLowerBorder());
+            ::tools::Rectangle 
aNotesBorderRect(rOldNotesMaster.getLeftBorder().as_hmm(),
+                                       
rOldNotesMaster.getUpperBorder().as_hmm(),
+                                       
rOldNotesMaster.getRightBorder().as_hmm(),
+                                       
rOldNotesMaster.getLowerBorder().as_hmm());
             pNotesMaster->ScaleObjects(aSize, aNotesBorderRect, true);
             pNotesMaster->setSize(rOldNotesMaster.getSize());
-            pNotesMaster->SetBorder(rOldNotesMaster.GetLeftBorder(),
-                                    rOldNotesMaster.GetUpperBorder(),
-                                    rOldNotesMaster.GetRightBorder(),
-                                    rOldNotesMaster.GetLowerBorder());
+            pNotesMaster->setBorder(rOldNotesMaster.getBorder());
             pNotesMaster->SetOrientation( rOldNotesMaster.GetOrientation() );
             pNotesMaster->SetAutoLayout(pNotesMaster->GetAutoLayout());
 
@@ -1756,10 +1753,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
 
         pMaster = AllocSdPage(true);
         pMaster->setSize(pSelectedPage->getSize());
-        pMaster->SetBorder(pSelectedPage->GetLeftBorder(),
-                           pSelectedPage->GetUpperBorder(),
-                           pSelectedPage->GetRightBorder(),
-                           pSelectedPage->GetLowerBorder() );
+        pMaster->setBorder(pSelectedPage->getBorder());
         pMaster->SetName(aName);
         pMaster->SetLayoutName(aPageLayoutName);
         InsertMasterPage(pMaster.get());
@@ -1772,10 +1766,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
         pNotesMaster = AllocSdPage(true);
         pNotesMaster->SetPageKind(PageKind::Notes);
         pNotesMaster->setSize(pNotes->getSize());
-        pNotesMaster->SetBorder(pNotes->GetLeftBorder(),
-                                pNotes->GetUpperBorder(),
-                                pNotes->GetRightBorder(),
-                                pNotes->GetLowerBorder() );
+        pNotesMaster->setBorder(pNotes->getBorder());
         pNotesMaster->SetName(aName);
         pNotesMaster->SetLayoutName(aPageLayoutName);
         InsertMasterPage(pNotesMaster.get());
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 6c13ff2f6774..81e51556c46e 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -994,18 +994,14 @@ rtl::Reference<SdrObject> 
SdPage::CreateDefaultPresObj(PresObjKind eObjKind)
         // create footer objects for standard master page
         if( mePageKind == PageKind::Standard )
         {
-            const ::tools::Long nLftBorder = GetLeftBorder();
-            const ::tools::Long nUppBorder = GetUpperBorder();
-
-            Point aPos ( nLftBorder, nUppBorder );
+            Point aPosition(getBorder().getLeft().as_hmm(), 
getBorder().getUpper().as_hmm());
             Size aSize = GetSizeHmm();
-
-            aSize.AdjustWidth( -(nLftBorder + GetRightBorder()) );
-            aSize.AdjustHeight( -(nUppBorder + GetLowerBorder()) );
+            aSize.AdjustWidth(-basegfx::fround((getBorder().getLeft() + 
getBorder().getRight()).as_hmm()));
+            aSize.AdjustHeight(-basegfx::fround((getBorder().getUpper() + 
getBorder().getLower()).as_hmm()));
 
             getPresObjProp( *this, sObjKind, sPageKind, propvalue);
-            aPos.AdjustX(::tools::Long( aSize.Width() * propvalue[2] ) );
-            aPos.AdjustY(::tools::Long( aSize.Height() * propvalue[3] ) );
+            aPosition.AdjustX(::tools::Long( aSize.Width() * propvalue[2] ) );
+            aPosition.AdjustY(::tools::Long( aSize.Height() * propvalue[3] ) );
             aSize.setWidth( ::tools::Long( aSize.Width() * propvalue[1] ) );
             aSize.setHeight( ::tools::Long( aSize.Height() * propvalue[0] ) );
 
@@ -1016,18 +1012,17 @@ rtl::Reference<SdrObject> 
SdPage::CreateDefaultPresObj(PresObjKind eObjKind)
             }
             else
             {
-                ::tools::Rectangle aRect( aPos, aSize );
+                ::tools::Rectangle aRect( aPosition, aSize );
                 return CreatePresObj( eObjKind, false, aRect );
             }
         }
         else
         {
             // create header&footer objects for handout and notes master
+            Point aPosition(getBorder().getLeft().as_hmm(), 
getBorder().getUpper().as_hmm());
             Size aPageSize = GetSizeHmm();
-            aPageSize.AdjustWidth( -(GetLeftBorder() + GetRightBorder()) );
-            aPageSize.AdjustHeight( -(GetUpperBorder() + GetLowerBorder()) );
-
-            Point aPosition ( GetLeftBorder(), GetUpperBorder() );
+            aPageSize.AdjustWidth(-basegfx::fround((getBorder().getLeft() + 
getBorder().getRight()).as_hmm()));
+            aPageSize.AdjustHeight(-basegfx::fround((getBorder().getUpper() + 
getBorder().getLower()).as_hmm()));
 
             getPresObjProp( *this, sObjKind, sPageKind, propvalue);
             int NOTES_HEADER_FOOTER_WIDTH = ::tools::Long(aPageSize.Width() * 
propvalue[1]);
@@ -1086,10 +1081,11 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
         /******************************************************************
         * standard- or note page: title area
         ******************************************************************/
-        Point aTitlePos ( GetLeftBorder(), GetUpperBorder() );
+        Point aTitlePos(getBorder().getLeft().as_hmm(), 
getBorder().getUpper().as_hmm());
         Size aTitleSize = GetSizeHmm();
-        aTitleSize.AdjustWidth( -(GetLeftBorder() + GetRightBorder()) );
-        aTitleSize.AdjustHeight( -(GetUpperBorder() + GetLowerBorder()) );
+        aTitleSize.AdjustWidth(-basegfx::fround((getBorder().getLeft() + 
getBorder().getRight()).as_hmm()));
+        aTitleSize.AdjustHeight(-basegfx::fround((getBorder().getUpper() + 
getBorder().getLower()).as_hmm()));
+
         const char* sPageKind = PageKindVector[mePageKind];
 
         if (mePageKind == PageKind::Standard)
@@ -1169,10 +1165,10 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
     {
         double propvalue[] = {0,0,0,0};
 
-        Point aLayoutPos( GetLeftBorder(), GetUpperBorder() );
+        Point aLayoutPos(getBorder().getLeft().as_hmm(), 
getBorder().getUpper().as_hmm());
         Size aLayoutSize = GetSizeHmm();
-        aLayoutSize.AdjustWidth( -(GetLeftBorder() + GetRightBorder()) );
-        aLayoutSize.AdjustHeight( -(GetUpperBorder() + GetLowerBorder()) );
+        aLayoutSize.AdjustWidth(-basegfx::fround((getBorder().getLeft() + 
getBorder().getRight()).as_hmm()));
+        aLayoutSize.AdjustHeight(-basegfx::fround((getBorder().getUpper() + 
getBorder().getLower()).as_hmm()));
         const char* sPageKind = PageKindVector[mePageKind];
 
         if (mePageKind == PageKind::Standard)
@@ -1755,18 +1751,18 @@ void SdPage::setSize(gfx::Size2DL const& rSize)
     }
 }
 
-void SdPage::SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, 
sal_Int32 nLwr)
+void SdPage::SetBorder(sal_Int32 nLeft, sal_Int32 nUpper, sal_Int32 nRight, 
sal_Int32 nLower)
 {
-    if (nLft != GetLeftBorder() || nUpp != GetUpperBorder() ||
-        nRgt != GetRightBorder() || nLwr != GetLowerBorder() )
+    if (gfx::Length::hmm(nLeft) != getBorder().getLeft() || 
gfx::Length::hmm(nUpper) != getBorder().getUpper() ||
+        gfx::Length::hmm(nRight) != getBorder().getRight() || 
gfx::Length::hmm(nLower) != getBorder().getLower())
     {
-        FmFormPage::SetBorder(nLft, nUpp, nRgt, nLwr);
+        FmFormPage::SetBorder(nLeft, nUpper, nRight, nLower);
     }
 }
 
 void SdPage::SetLeftBorder(sal_Int32 nBorder)
 {
-    if (nBorder != GetLeftBorder() )
+    if (gfx::Length::hmm(nBorder) != getBorder().getLeft())
     {
         FmFormPage::SetLeftBorder(nBorder);
     }
@@ -1774,7 +1770,7 @@ void SdPage::SetLeftBorder(sal_Int32 nBorder)
 
 void SdPage::SetRightBorder(sal_Int32 nBorder)
 {
-    if (nBorder != GetRightBorder() )
+    if (gfx::Length::hmm(nBorder) != getBorder().getRight())
     {
         FmFormPage::SetRightBorder(nBorder);
     }
@@ -1782,7 +1778,7 @@ void SdPage::SetRightBorder(sal_Int32 nBorder)
 
 void SdPage::SetUpperBorder(sal_Int32 nBorder)
 {
-    if (nBorder != GetUpperBorder() )
+    if (gfx::Length::hmm(nBorder) != getBorder().getUpper())
     {
         FmFormPage::SetUpperBorder(nBorder);
     }
@@ -1790,7 +1786,7 @@ void SdPage::SetUpperBorder(sal_Int32 nBorder)
 
 void SdPage::SetLowerBorder(sal_Int32 nBorder)
 {
-    if (nBorder != GetLowerBorder() )
+    if (gfx::Length::hmm(nBorder) != getBorder().getLower())
     {
         FmFormPage::SetLowerBorder(nBorder);
     }
@@ -1831,19 +1827,19 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, 
const ::tools::Rectangle& rN
     }
     if (nLeft < 0)
     {
-        nLeft = GetLeftBorder();
+        nLeft = getBorder().getLeft().as_hmm();
     }
     if (nRight < 0)
     {
-        nRight = GetRightBorder();
+        nRight = getBorder().getRight().as_hmm();
     }
     if (nUpper < 0)
     {
-        nUpper = GetUpperBorder();
+        nUpper = getBorder().getUpper().as_hmm();
     }
     if (nLower < 0)
     {
-        nLower = GetLowerBorder();
+        nLower = getBorder().getLower().as_hmm();
     }
 
     Size aBackgroundSize(aNewPageSize);
@@ -1855,8 +1851,8 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const 
::tools::Rectangle& rN
         aNewPageSize = aBackgroundSize;
     }
 
-    ::tools::Long nOldWidth  = GetSizeHmm().getWidth() - GetLeftBorder() - 
GetRightBorder();
-    ::tools::Long nOldHeight = GetSizeHmm().getHeight() - GetUpperBorder() - 
GetLowerBorder();
+    ::tools::Long nOldWidth  = (getSize().getWidth() - getBorder().getLeft() - 
getBorder().getRight()).as_hmm();
+    ::tools::Long nOldHeight = (getSize().getHeight() - getBorder().getUpper() 
- getBorder().getLower()).as_hmm();
 
     Fraction aFractX(aNewPageSize.Width(), nOldWidth);
     Fraction aFractY(aNewPageSize.Height(), nOldHeight);
@@ -2045,8 +2041,8 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const 
::tools::Rectangle& rN
 
                 // corrected scaling; only distances may be scaled
                 // use aTopLeft as original TopLeft
-                aNewPos.setX( ::tools::Long((aTopLeft.X() - GetLeftBorder()) * 
static_cast<double>(aFractX)) + nLeft );
-                aNewPos.setY( ::tools::Long((aTopLeft.Y() - GetUpperBorder()) 
* static_cast<double>(aFractY)) + nUpper );
+                aNewPos.setX( ::tools::Long((aTopLeft.X() - 
getBorder().getLeft().as_hmm()) * static_cast<double>(aFractX)) + nLeft );
+                aNewPos.setY( ::tools::Long((aTopLeft.Y() - 
getBorder().getUpper().as_hmm()) * static_cast<double>(aFractY)) + nUpper );
 
                 Size aVec(aNewPos.X() - aTopLeft.X(), aNewPos.Y() - 
aTopLeft.Y());
 
@@ -2979,10 +2975,10 @@ void SdPage::CalculateHandoutAreas( SdDrawDocument& 
rModel, AutoLayout eLayout,
         const ::tools::Long nGapW = 1000; // gap is 1cm
         const ::tools::Long nGapH = 1000;
 
-        ::tools::Long nLeftBorder = rHandoutMaster.GetLeftBorder();
-        ::tools::Long nRightBorder = rHandoutMaster.GetRightBorder();
-        ::tools::Long nTopBorder = rHandoutMaster.GetUpperBorder();
-        ::tools::Long nBottomBorder = rHandoutMaster.GetLowerBorder();
+        ::tools::Long nLeftBorder = 
rHandoutMaster.getBorder().getLeft().as_hmm();
+        ::tools::Long nRightBorder = 
rHandoutMaster.getBorder().getRight().as_hmm();
+        ::tools::Long nTopBorder = 
rHandoutMaster.getBorder().getUpper().as_hmm();
+        ::tools::Long nBottomBorder = 
rHandoutMaster.getBorder().getLower().as_hmm();
 
         const ::tools::Long nHeaderFooterHeight = static_cast< ::tools::Long 
>( (aArea.Height() - nTopBorder - nLeftBorder) * 0.05  );
 
diff --git a/sd/source/filter/grf/sdgrffilter.cxx 
b/sd/source/filter/grf/sdgrffilter.cxx
index fe17956ce027..7fd390edc844 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -162,8 +162,8 @@ bool SdGRFFilter::Import()
         Size        aGrfSize( OutputDevice::LogicToLogic( 
aGraphic.GetPrefSize(),
                                 aGraphic.GetPrefMapMode(), 
MapMode(MapUnit::Map100thMM)));
 
-        aPagSize.AdjustWidth( -(pPage->GetLeftBorder() + 
pPage->GetRightBorder()) );
-        aPagSize.AdjustHeight( -(pPage->GetUpperBorder() + 
pPage->GetLowerBorder()) );
+        aPagSize.AdjustWidth(-basegfx::fround((pPage->getBorder().getLeft() + 
pPage->getBorder().getRight()).as_hmm()));
+        aPagSize.AdjustHeight(-basegfx::fround((pPage->getBorder().getUpper() 
+ pPage->getBorder().getLower()).as_hmm()));
 
         // scale to fit page
         if ( ( ( aGrfSize.Height() > aPagSize.Height() ) || ( aGrfSize.Width() 
> aPagSize.Width() ) ) &&
@@ -186,8 +186,8 @@ bool SdGRFFilter::Import()
         }
 
         // set output rectangle for graphic
-        aPos.setX( ( ( aPagSize.Width() - aGrfSize.Width() ) >> 1 ) + 
pPage->GetLeftBorder() );
-        aPos.setY( ( ( aPagSize.Height() - aGrfSize.Height() ) >> 1 )  + 
pPage->GetUpperBorder() );
+        aPos.setX( ( ( aPagSize.Width() - aGrfSize.Width() ) / 2.0 ) + 
pPage->getBorder().getLeft().as_hmm());
+        aPos.setY( ( ( aPagSize.Height() - aGrfSize.Height() ) / 2.0 ) + 
pPage->getBorder().getRight().as_hmm());
 
         pPage->InsertObject(
             new SdrGrafObj(
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index d407b6f60805..a31420a4abdb 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -1671,11 +1671,11 @@ bool HtmlExport::CreateHtmlForPresPages()
                 Point     aLogPos(aRect.TopLeft());
                 bool      bIsSquare = aRect.GetWidth() == aRect.GetHeight();
 
-                sal_Int32 nPageWidth = pPage->GetSizeHmm().Width() - 
pPage->GetLeftBorder() - pPage->GetRightBorder();
+                sal_Int32 nPageWidth = 
basegfx::fround((pPage->getSize().getWidth() - pPage->getBorder().getLeft() - 
pPage->getBorder().getRight()).as_hmm());
 
                 // BoundRect is relative to the physical page origin, not the
                 // origin of ordinates
-                aRect.Move(-pPage->GetLeftBorder(), -pPage->GetUpperBorder());
+                aRect.Move(-pPage->getBorder().getLeft().as_hmm(), 
-pPage->getBorder().getUpper().as_hmm());
 
                 double fLogicToPixel = static_cast<double>(mnWidthPixel) / 
nPageWidth;
                 aRect.SetLeft( static_cast<tools::Long>(aRect.Left() * 
fLogicToPixel) );
@@ -1724,8 +1724,8 @@ bool HtmlExport::CreateHtmlForPresPages()
                                                  GetRectangle(false));
 
                                 // conversion into pixel coordinates
-                                aArea.Move(aLogPos.X() - 
pPage->GetLeftBorder(),
-                                           aLogPos.Y() - 
pPage->GetUpperBorder());
+                                aArea.Move(aLogPos.X() - 
pPage->getBorder().getLeft().as_hmm(),
+                                           aLogPos.Y() - 
pPage->getBorder().getUpper().as_hmm());
                                 aArea.SetLeft( 
static_cast<tools::Long>(aArea.Left() * fLogicToPixel) );
                                 aArea.SetTop( 
static_cast<tools::Long>(aArea.Top() * fLogicToPixel) );
                                 aArea.SetRight( 
static_cast<tools::Long>(aArea.Right() * fLogicToPixel) );
@@ -1739,8 +1739,8 @@ bool HtmlExport::CreateHtmlForPresPages()
                             {
                                 Point 
aCenter(static_cast<IMapCircleObject*>(pArea)->
                                                  GetCenter(false));
-                                aCenter += Point(aLogPos.X() - 
pPage->GetLeftBorder(),
-                                                 aLogPos.Y() - 
pPage->GetUpperBorder());
+                                aCenter += Point(aLogPos.X() - 
pPage->getBorder().getLeft().as_hmm(),
+                                                 aLogPos.Y() - 
pPage->getBorder().getUpper().as_hmm());
                                 aCenter.setX( 
static_cast<tools::Long>(aCenter.X() * fLogicToPixel) );
                                 aCenter.setY( 
static_cast<tools::Long>(aCenter.Y() * fLogicToPixel) );
 
@@ -1757,8 +1757,8 @@ bool HtmlExport::CreateHtmlForPresPages()
                             {
                                 tools::Polygon 
aArea(static_cast<IMapPolygonObject*>(pArea)->GetPolygon(false));
                                 
aStr.append(CreateHTMLPolygonArea(::basegfx::B2DPolyPolygon(aArea.getB2DPolygon()),
-                                                                  
Size(aLogPos.X() - pPage->GetLeftBorder(),
-                                                                       
aLogPos.Y() - pPage->GetUpperBorder()),
+                                                                  
Size(aLogPos.X() - pPage->getBorder().getLeft().as_hmm(),
+                                                                       
aLogPos.Y() - pPage->getBorder().getUpper().as_hmm()),
                                                                   
fLogicToPixel, aURL));
                             }
                             break;
@@ -1861,7 +1861,8 @@ bool HtmlExport::CreateHtmlForPresPages()
                                   pObject->GetObjIdentifier() == 
SdrObjKind::PolyLine ||
                                   pObject->GetObjIdentifier() == 
SdrObjKind::Polygon))
                         {
-                            
aStr.append(CreateHTMLPolygonArea(static_cast<SdrPathObj*>(pObject)->GetPathPoly(),
 Size(-pPage->GetLeftBorder(), -pPage->GetUpperBorder()), fLogicToPixel, 
aHRef));
+                            
aStr.append(CreateHTMLPolygonArea(static_cast<SdrPathObj*>(pObject)->GetPathPoly(),
+                                Size(-pPage->getBorder().getLeft().as_hmm(), 
-pPage->getBorder().getUpper().as_hmm()), fLogicToPixel, aHRef));
                         }
                         // something completely different: use the BoundRect
                         else
diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx
index 45e430a266c7..8c9e69cba710 100644
--- a/sd/source/ui/func/fuexpand.cxx
+++ b/sd/source/ui/func/fuexpand.cxx
@@ -135,10 +135,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
                 // page with title & structuring!
                 rtl::Reference<SdPage> pPage = mpDoc->AllocSdPage(false);
                 pPage->setSize(pActualPage->getSize() );
-                pPage->SetBorder(pActualPage->GetLeftBorder(),
-                                 pActualPage->GetUpperBorder(),
-                                 pActualPage->GetRightBorder(),
-                                 pActualPage->GetLowerBorder() );
+                pPage->setBorder(pActualPage->getBorder());
                 pPage->SetName(OUString());
 
                 // insert page after current page
@@ -157,10 +154,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
                 // notes-page
                 rtl::Reference<SdPage> pNotesPage = mpDoc->AllocSdPage(false);
                 pNotesPage->setSize(pActualNotesPage->getSize());
-                pNotesPage->SetBorder(pActualNotesPage->GetLeftBorder(),
-                                      pActualNotesPage->GetUpperBorder(),
-                                      pActualNotesPage->GetRightBorder(),
-                                      pActualNotesPage->GetLowerBorder() );
+                pNotesPage->setBorder(pActualNotesPage->getBorder());
                 pNotesPage->SetPageKind(PageKind::Notes);
                 pNotesPage->SetName(OUString());
 
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 542f2884a66e..c06f912fbb75 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -246,10 +246,14 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* 
pParent, const SfxRequest&
     SvxPaperBinItem aPaperBinItem( SID_ATTR_PAGE_PAPERBIN, 
static_cast<sal_uInt8>(mpPage->GetPaperBin()) );
     aNewAttr.Put( aPaperBinItem );
 
-    SvxLRSpaceItem aLRSpaceItem( 
static_cast<sal_uInt16>(mpPage->GetLeftBorder()), 
static_cast<sal_uInt16>(mpPage->GetRightBorder()), 0, 0, 
mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE));
+    SvxLRSpaceItem 
aLRSpaceItem(sal_uInt16(mpPage->getBorder().getLeft().as_hmm()),
+                                
sal_uInt16(mpPage->getBorder().getRight().as_hmm()),
+                                0, 0, 
mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE));
     aNewAttr.Put( aLRSpaceItem );
 
-    SvxULSpaceItem aULSpaceItem( 
static_cast<sal_uInt16>(mpPage->GetUpperBorder()), 
static_cast<sal_uInt16>(mpPage->GetLowerBorder()), 
mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE));
+    SvxULSpaceItem 
aULSpaceItem(sal_uInt16(mpPage->getBorder().getUpper().as_hmm()),
+                                
sal_uInt16(mpPage->getBorder().getLower().as_hmm()),
+                                mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE));
     aNewAttr.Put( aULSpaceItem );
 
     // Application
@@ -536,9 +540,11 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
         nLeft = static_cast<const SvxLRSpaceItem*>(pPoolItem)->GetLeft();
         nRight = static_cast<const SvxLRSpaceItem*>(pPoolItem)->GetRight();
 
-        if( mpPage->GetLeftBorder() != nLeft || mpPage->GetRightBorder() != 
nRight )
+        if (mpPage->getBorder().getLeft() != gfx::Length::hmm(nLeft)
+         || mpPage->getBorder().getRight() != gfx::Length::hmm(nRight))
+        {
             bSetPageSizeAndBorder = true;
-
+        }
     }
 
     if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE),
@@ -547,8 +553,11 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
         nUpper = static_cast<const SvxULSpaceItem*>(pPoolItem)->GetUpper();
         nLower = static_cast<const SvxULSpaceItem*>(pPoolItem)->GetLower();
 
-        if( mpPage->GetUpperBorder() != nUpper || mpPage->GetLowerBorder() != 
nLower )
+        if (mpPage->getBorder().getUpper() != gfx::Length::hmm(nUpper)
+         || mpPage->getBorder().getLower() != gfx::Length::hmm(nLower))
+        {
             bSetPageSizeAndBorder = true;
+        }
     }
 
     if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_EXT1), 
true, &pPoolItem) == SfxItemState::SET )
@@ -595,14 +604,14 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
     if (nLeft == -1 && nUpper != -1)
     {
         bSetPageSizeAndBorder = true;
-        nLeft  = mpPage->GetLeftBorder();
-        nRight = mpPage->GetRightBorder();
+        nLeft  = mpPage->getBorder().getLeft().as_hmm();
+        nRight = mpPage->getBorder().getRight().as_hmm();
     }
     else if (nLeft != -1 && nUpper == -1)
     {
         bSetPageSizeAndBorder = true;
-        nUpper = mpPage->GetUpperBorder();
-        nLower = mpPage->GetLowerBorder();
+        nUpper = mpPage->getBorder().getUpper().as_hmm();
+        nLower = mpPage->getBorder().getLower().as_hmm();
     }
 
     if( bSetPageSizeAndBorder || !mbMasterPage )
diff --git a/sd/source/ui/func/fusumry.cxx b/sd/source/ui/func/fusumry.cxx
index 8dff156f654e..aeea2505a0b9 100644
--- a/sd/source/ui/func/fusumry.cxx
+++ b/sd/source/ui/func/fusumry.cxx
@@ -120,10 +120,7 @@ void FuSummaryPage::DoExecute( SfxRequest& )
                     // page with title & structuring!
                     pSummaryPage = mpDoc->AllocSdPage(false);
                     pSummaryPage->setSize(pActualPage->getSize());
-                    pSummaryPage->SetBorder(pActualPage->GetLeftBorder(),
-                                     pActualPage->GetUpperBorder(),
-                                     pActualPage->GetRightBorder(),
-                                     pActualPage->GetLowerBorder() );
+                    pSummaryPage->setBorder(pActualPage->getBorder());
 
                     // insert page at the back
                     mpDoc->InsertPage(pSummaryPage.get(), nCount * 2 + 1);
@@ -140,10 +137,7 @@ void FuSummaryPage::DoExecute( SfxRequest& )
                     // notes-page
                     rtl::Reference<SdPage> pNotesPage = 
mpDoc->AllocSdPage(false);
                     pNotesPage->setSize(pActualNotesPage->getSize());
-                    pNotesPage->SetBorder(pActualNotesPage->GetLeftBorder(),
-                                          pActualNotesPage->GetUpperBorder(),
-                                          pActualNotesPage->GetRightBorder(),
-                                          pActualNotesPage->GetLowerBorder() );
+                    pNotesPage->setBorder(pActualNotesPage->getBorder());
                     pNotesPage->SetPageKind(PageKind::Notes);
 
                     // insert page at the back
diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx 
b/sd/source/ui/sidebar/DocumentHelper.cxx
index c3188d9fc205..17aaeeeb38e0 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -363,11 +363,11 @@ SdPage* DocumentHelper::AddMasterPage (
         // the document.
         auto pPage = rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind());
         Size aNewSize = pPage->GetSizeHmm();
-        ::tools::Rectangle aBorders (
-            pClonedMasterPage->GetLeftBorder(),
-            pClonedMasterPage->GetUpperBorder(),
-            pClonedMasterPage->GetRightBorder(),
-            pClonedMasterPage->GetLowerBorder());
+        ::tools::Rectangle aBorders(
+            pClonedMasterPage->getBorder().getLeft().as_hmm(),
+            pClonedMasterPage->getBorder().getUpper().as_hmm(),
+            pClonedMasterPage->getBorder().getRight().as_hmm(),
+            pClonedMasterPage->getBorder().getLower().as_hmm());
         pClonedMasterPage->ScaleObjects(aNewSize, aBorders, true);
         pClonedMasterPage->setSize(pPage->getSize());
         pClonedMasterPage->CreateTitleAndLayout(true);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 2facbecd3272..d5e2432ccaf4 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -497,10 +497,7 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 
nPage, bool bDuplicate )
             pStandardPage = mpDoc->AllocSdPage(false);
 
         pStandardPage->setSize(pPreviousStandardPage->getSize());
-        pStandardPage->SetBorder( pPreviousStandardPage->GetLeftBorder(),
-                                    pPreviousStandardPage->GetUpperBorder(),
-                                    pPreviousStandardPage->GetRightBorder(),
-                                    pPreviousStandardPage->GetLowerBorder() );
+        pStandardPage->setBorder(pPreviousStandardPage->getBorder());
         pStandardPage->SetOrientation( pPreviousStandardPage->GetOrientation() 
);
         pStandardPage->SetName(OUString());
 
@@ -532,10 +529,7 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 
nPage, bool bDuplicate )
             pNotesPage = mpDoc->AllocSdPage(false);
 
         pNotesPage->setSize(pPreviousNotesPage->getSize());
-        pNotesPage->SetBorder( pPreviousNotesPage->GetLeftBorder(),
-                                pPreviousNotesPage->GetUpperBorder(),
-                                pPreviousNotesPage->GetRightBorder(),
-                                pPreviousNotesPage->GetLowerBorder() );
+        pNotesPage->setBorder(pPreviousNotesPage->getBorder());
         pNotesPage->SetOrientation( pPreviousNotesPage->GetOrientation() );
         pNotesPage->SetName(OUString());
         pNotesPage->SetPageKind(PageKind::Notes);
@@ -3209,10 +3203,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->SetBorder( pPage->GetLeftBorder(),
-                           pPage->GetUpperBorder(),
-                           pPage->GetRightBorder(),
-                           pPage->GetLowerBorder() );
+        pMPage->setBorder(pPage->getBorder());
         pMPage->SetLayoutName( aLayoutName );
         pDoc->InsertMasterPage(pMPage.get(),  
static_cast<sal_uInt16>(nInsertPos));
 
@@ -3227,10 +3218,7 @@ uno::Reference< drawing::XDrawPage > SAL_CALL 
SdMasterPagesAccess::insertNewByIn
         rtl::Reference<SdPage> pMNotesPage = mpModel->mpDoc->AllocSdPage(true);
         pMNotesPage->setSize(pRefNotesPage->getSize());
         pMNotesPage->SetPageKind(PageKind::Notes);
-        pMNotesPage->SetBorder( pRefNotesPage->GetLeftBorder(),
-                                pRefNotesPage->GetUpperBorder(),
-                                pRefNotesPage->GetRightBorder(),
-                                pRefNotesPage->GetLowerBorder() );
+        pMNotesPage->setBorder(pRefNotesPage->getBorder());
         pMNotesPage->SetLayoutName( aLayoutName );
         pDoc->InsertMasterPage(pMNotesPage.get(),  
static_cast<sal_uInt16>(nInsertPos) + 1);
         pMNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, true, true);
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 20f6843c314d..4db726afcb14 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -1001,16 +1001,16 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const 
OUString& PropertyName )
         aAny = getNavigationOrder();
         break;
     case WID_PAGE_LEFT:
-        aAny <<= GetPage()->GetLeftBorder();
+        aAny <<= basegfx::fround(GetPage()->getBorder().getLeft().as_hmm());
         break;
     case WID_PAGE_RIGHT:
-        aAny <<= GetPage()->GetRightBorder();
+        aAny <<= basegfx::fround(GetPage()->getBorder().getRight().as_hmm());
         break;
     case WID_PAGE_TOP:
-        aAny <<= GetPage()->GetUpperBorder();
+        aAny <<= basegfx::fround(GetPage()->getBorder().getUpper().as_hmm());
         break;
     case WID_PAGE_BOTTOM:
-        aAny <<= GetPage()->GetLowerBorder();
+        aAny <<= basegfx::fround(GetPage()->getBorder().getLower().as_hmm());
         break;
     case WID_PAGE_WIDTH:
         aAny <<= static_cast<sal_Int32>( GetPage()->GetSizeHmm().getWidth() );
@@ -1672,7 +1672,7 @@ void SAL_CALL SdGenericDrawPage::unbind( const Reference< 
drawing::XShape >& xSh
 
 void SdGenericDrawPage::SetLeftBorder( sal_Int32 nValue )
 {
-    if( nValue == GetPage()->GetLeftBorder() )
+    if (gfx::Length::hmm(nValue) == GetPage()->getBorder().getLeft())
         return;
 
     SdDrawDocument& rDoc(static_cast< SdDrawDocument& 
>(GetPage()->getSdrModelFromSdrPage()));
@@ -1696,7 +1696,7 @@ void SdGenericDrawPage::SetLeftBorder( sal_Int32 nValue )
 
 void SdGenericDrawPage::SetRightBorder( sal_Int32 nValue )
 {
-    if( nValue == GetPage()->GetRightBorder() )
+    if (gfx::Length::hmm(nValue) == GetPage()->getBorder().getRight())
         return;
 
     SdDrawDocument& rDoc(static_cast< SdDrawDocument& 
>(GetPage()->getSdrModelFromSdrPage()));
@@ -1720,7 +1720,7 @@ void SdGenericDrawPage::SetRightBorder( sal_Int32 nValue )
 
 void SdGenericDrawPage::SetUpperBorder( sal_Int32 nValue )
 {
-    if( nValue == GetPage()->GetUpperBorder() )
+    if (gfx::Length::hmm(nValue) == GetPage()->getBorder().getUpper())
         return;
 
     SdDrawDocument& rDoc(static_cast< SdDrawDocument& 
>(GetPage()->getSdrModelFromSdrPage()));
@@ -1744,7 +1744,7 @@ void SdGenericDrawPage::SetUpperBorder( sal_Int32 nValue )
 
 void SdGenericDrawPage::SetLowerBorder( sal_Int32 nValue )
 {
-    if( nValue == GetPage()->GetLowerBorder() )
+    if (gfx::Length::hmm(nValue) == GetPage()->getBorder().getLower())
         return;
 
     SdDrawDocument& rDoc(static_cast< SdDrawDocument& 
>(GetPage()->getSdrModelFromSdrPage()));
@@ -2352,10 +2352,7 @@ void SAL_CALL SdDrawPage::setMasterPage( const 
Reference< drawing::XDrawPage >&
 
     SdPage* pSdPage = static_cast<SdPage*>(pMasterPage->GetSdrPage());
     SvxFmDrawPage::mpPage->TRG_SetMasterPage(*pSdPage);
-
-    
SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLeftBorder(),pSdPage->GetUpperBorder(),
-                      pSdPage->GetRightBorder(),pSdPage->GetLowerBorder() );
-
+    SvxFmDrawPage::mpPage->setBorder(pSdPage->getBorder());
     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 639ba2c0dfa5..8ce03a2d911b 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -816,26 +816,24 @@ namespace {
                 return;
             MapMode aMap (rPrinter.GetMapMode());
 
-            const Size aPageSize (pPageToPrint->GetSizeHmm());
+            const auto aPageSize (pPageToPrint->getSize());
             const Size aPrintSize (rPrinter.GetOutputSize());
 
-            const sal_Int32 nPageWidth (aPageSize.Width() + mnGap
-                - pPageToPrint->GetLeftBorder() - 
pPageToPrint->GetRightBorder());
-            const sal_Int32 nPageHeight (aPageSize.Height() + mnGap
-                - pPageToPrint->GetUpperBorder() - 
pPageToPrint->GetLowerBorder());
-            if (nPageWidth<=0 || nPageHeight<=0)
+            const gfx::Length nPageWidth = aPageSize.getWidth() + mnGap - 
pPageToPrint->getBorder().getLeft() - pPageToPrint->getBorder().getRight();
+            const gfx::Length nPageHeight = aPageSize.getHeight() + mnGap - 
pPageToPrint->getBorder().getUpper() - pPageToPrint->getBorder().getLower();
+            if (nPageWidth <= 0_hmm || nPageHeight <= 0_hmm)
                 return;
 
             // Print at least two rows and columns.  More if the document
             // page fits completely onto the printer page.
             const sal_Int32 nColumnCount (std::max(sal_Int32(2),
-                    sal_Int32(aPrintSize.Width() / nPageWidth)));
+                    sal_Int32(aPrintSize.Width() / nPageWidth.as_hmm())));
             const sal_Int32 nRowCount (std::max(sal_Int32(2),
-                    sal_Int32(aPrintSize.Height() / nPageHeight)));
+                    sal_Int32(aPrintSize.Height() / nPageHeight.as_hmm())));
             for (sal_Int32 nRow=0; nRow<nRowCount; ++nRow)
                 for (sal_Int32 nColumn=0; nColumn<nColumnCount; ++nColumn)
                 {
-                    aMap.SetOrigin(Point(nColumn*nPageWidth,nRow*nPageHeight));
+                    aMap.SetOrigin(Point(nColumn * nPageWidth.as_hmm(), nRow * 
nPageHeight.as_hmm()));
                     rPrinter.SetMapMode(aMap);
                     PrintPage(
                         rPrinter,
@@ -855,7 +853,7 @@ namespace {
 
     private:
         const sal_uInt16 mnPageIndex;
-        static const sal_Int32 mnGap = 500;
+        static const constexpr gfx::Length mnGap = 500_hmm;
     };
 
     /** Print two slides to one printer page so that the resulting pages
@@ -1902,18 +1900,19 @@ private:
 
             MapMode aMap (rInfo.maMap);
             // is it possible that the page size changed?
-            const Size aPageSize = pPage->GetSizeHmm();
+            const auto aPageSize = pPage->getSize();
+            const Size aPageSizeHmm = gfx::length::toSizeHmm(aPageSize);
 
             if (mpOptions->IsPageSize())
             {
-                const double fHorz 
(static_cast<double>(rInfo.maPrintSize.Width())  / aPageSize.Width());
-                const double fVert 
(static_cast<double>(rInfo.maPrintSize.Height()) / aPageSize.Height());
+                const double fHorz 
(static_cast<double>(rInfo.maPrintSize.Width())  / aPageSizeHmm.Width());
+                const double fVert 
(static_cast<double>(rInfo.maPrintSize.Height()) / aPageSizeHmm.Height());
 
                 Fraction aFract;
                 if (fHorz < fVert)
-                    aFract = Fraction(rInfo.maPrintSize.Width(), 
aPageSize.Width());
+                    aFract = Fraction(rInfo.maPrintSize.Width(), 
aPageSizeHmm.Width());
                 else
-                    aFract = Fraction(rInfo.maPrintSize.Height(), 
aPageSize.Height());
+                    aFract = Fraction(rInfo.maPrintSize.Height(), 
aPageSizeHmm.Height());
 
                 aMap.SetScaleX(aFract);
                 aMap.SetScaleY(aFract);
@@ -1928,8 +1927,8 @@ private:
                 rInfo.msPageString.clear();
             rInfo.msPageString += rInfo.msTimeDate;
 
-            ::tools::Long aPageWidth   = aPageSize.Width() - 
pPage->GetLeftBorder() - pPage->GetRightBorder();
-            ::tools::Long aPageHeight  = aPageSize.Height() - 
pPage->GetUpperBorder() - pPage->GetLowerBorder();
+            ::tools::Long aPageWidth = basegfx::fround((aPageSize.getWidth() - 
pPage->getBorder().getLeft() - pPage->getBorder().getRight()).as_hmm());
+            ::tools::Long aPageHeight = basegfx::fround((aPageSize.getHeight() 
- pPage->getBorder().getUpper() - pPage->getBorder().getLower()).as_hmm());
             // Bugfix for 44530:
             // if it was implicitly changed (Landscape/Portrait),
             // this is considered for tiling, respectively for the splitting up
@@ -2162,9 +2161,9 @@ private:
             // keep the page content at its position if it fits, otherwise
             // move it to the printable area
             const ::tools::Long nPageWidth (
-                rInfo.maPageSize.Width() - rPage.GetLeftBorder() - 
rPage.GetRightBorder());
+                rInfo.maPageSize.Width() - 
rPage.getBorder().getLeft().as_hmm() - rPage.getBorder().getRight().as_hmm());
             const ::tools::Long nPageHeight (
-                rInfo.maPageSize.Height() - rPage.GetUpperBorder() - 
rPage.GetLowerBorder());
+                rInfo.maPageSize.Height() - 
rPage.getBorder().getUpper().as_hmm() - rPage.getBorder().getLower().as_hmm());
 
             Point aOrigin ( 0, 0 );
 
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index f0bb60c2847d..bf0f3fceb2fa 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -571,8 +571,8 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                         SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
                         SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
                                                 pPage,
-                                                pPage->GetLeftBorder(),
-                                                pPage->GetRightBorder(),
+                                                
pPage->getBorder().getLeft().as_hmm(),
+                                                
pPage->getBorder().getRight().as_hmm(),
                                                 nLeft, nRight);
                         pUndoGroup->AddAction(pUndo);
                         pPage->SetLeftBorder(nLeft);
@@ -585,8 +585,8 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                         SdPage* pPage = GetDoc()->GetMasterSdPage(i, 
mePageKind);
                         SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
                                                 pPage,
-                                                pPage->GetLeftBorder(),
-                                                pPage->GetRightBorder(),
+                                                
pPage->getBorder().getLeft().as_hmm(),
+                                                
pPage->getBorder().getRight().as_hmm(),
                                                 nLeft, nRight);
                         pUndoGroup->AddAction(pUndo);
                         pPage->SetLeftBorder(nLeft);
@@ -637,8 +637,8 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                         SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
                         SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
                                                 pPage,
-                                                pPage->GetUpperBorder(),
-                                                pPage->GetLowerBorder(),
+                                                
pPage->getBorder().getUpper().as_hmm(),
+                                                
pPage->getBorder().getLower().as_hmm(),
                                                 nUpper, nLower);
                         pUndoGroup->AddAction(pUndo);
                         pPage->SetUpperBorder(nUpper);
@@ -651,8 +651,8 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                         SdPage* pPage = GetDoc()->GetMasterSdPage(i, 
mePageKind);
                         SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
                                                 pPage,
-                                                pPage->GetUpperBorder(),
-                                                pPage->GetLowerBorder(),
+                                                
pPage->getBorder().getUpper().as_hmm(),
+                                                
pPage->getBorder().getLower().as_hmm(),
                                                 nUpper, nLower);
                         pUndoGroup->AddAction(pUndo);
                         pPage->SetUpperBorder(nUpper);
@@ -905,11 +905,12 @@ void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
         rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aRect) );
     }
 
-    SvxLongLRSpaceItem aLRSpace(aPagePos.X() + mpActualPage->GetLeftBorder(),
-                                aRect.Right() + mpActualPage->GetRightBorder(),
+    auto aBorder = mpActualPage->getBorder();
+    SvxLongLRSpaceItem aLRSpace(aPagePos.X() + aBorder.getLeft().as_hmm(),
+                                aRect.Right() + aBorder.getRight().as_hmm(),
                                 SID_ATTR_LONG_LRSPACE);
-    SvxLongULSpaceItem aULSpace(aPagePos.Y() + mpActualPage->GetUpperBorder(),
-                                aRect.Bottom() + 
mpActualPage->GetLowerBorder(),
+    SvxLongULSpaceItem aULSpace(aPagePos.Y() + aBorder.getUpper().as_hmm(),
+                                aRect.Bottom() + aBorder.getLower().as_hmm(),
                                 SID_ATTR_LONG_ULSPACE);
     rSet.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos, aViewSize.Width(),
                                                        aViewSize.Height()));
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index 9a198efae582..41b37ce35d2d 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -484,7 +484,8 @@ void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, 
::sd::Window* pWin)
             {
                 mpDrawView->BrkAction();
                 SdPage* pPage = static_cast<SdPage*>( 
mpDrawView->GetSdrPageView()->GetPage() );
-                Point aOrg(pPage->GetLeftBorder(), pPage->GetUpperBorder());
+                Point aOrg(pPage->getBorder().getLeft().as_hmm(),
+                           pPage->getBorder().getUpper().as_hmm());
                 mpDrawView->GetSdrPageView()->SetPageOrigin(aOrg);
                 
GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
             }
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 17aebdd0d28d..e93e69af1320 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -256,8 +256,8 @@ void DrawViewShell::GetMarginProperties( SfxItemSet &rSet )
             {
                 // const SvxLRSpaceItem aTmpPageLRSpace ( 
rDesc.GetMaster().GetLRSpace() );
                 const SvxLongLRSpaceItem aLongLR(
-                    static_cast<::tools::Long>(pPage->GetLeftBorder()),
-                    static_cast<::tools::Long>(pPage->GetRightBorder()),
+                    ::tools::Long(pPage->getBorder().getLeft().as_hmm()),
+                    ::tools::Long(pPage->getBorder().getRight().as_hmm()),
                     SID_ATTR_PAGE_LRSPACE );
                 rSet.Put( aLongLR );
             }
@@ -267,8 +267,8 @@ void DrawViewShell::GetMarginProperties( SfxItemSet &rSet )
             {
                 // const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
                 SvxLongULSpaceItem aLongUL(
-                    static_cast<::tools::Long>(pPage->GetUpperBorder()),
-                    static_cast<::tools::Long>(pPage->GetLowerBorder()),
+                    ::tools::Long(pPage->getBorder().getUpper().as_hmm()),
+                    ::tools::Long(pPage->getBorder().getLower().as_hmm()),
                     SID_ATTR_PAGE_ULSPACE );
                 rSet.Put( aLongUL );
             }
@@ -1898,8 +1898,8 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
                     nRight = static_cast<const 
SvxLongLRSpaceItem*>(pPoolItem)->GetRight();
                     if (nLeft != -1)
                     {
-                        nUpper  = pPage->GetUpperBorder();
-                        nLower  = pPage->GetLowerBorder();
+                        nUpper  = pPage->getBorder().getUpper().as_hmm();
+                        nLower  = pPage->getBorder().getLower().as_hmm();
                     }
                     SetPageSizeAndBorder(ePageKind, aNewSize, nLeft, nRight, 
nUpper, nLower, bScaleAll, eOrientation, nPaperBin, bFullSize );
                 }
@@ -1913,8 +1913,8 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
                     nLower = static_cast<const 
SvxLongULSpaceItem*>(pPoolItem)->GetLower();
                     if (nUpper != -1)
                     {
-                        nLeft   = pPage->GetLeftBorder();
-                        nRight  = pPage->GetRightBorder();
+                        nLeft   = pPage->getBorder().getLeft().as_hmm();
+                        nRight  = pPage->getBorder().getRight().as_hmm();
                     }
                     SetPageSizeAndBorder(ePageKind, aNewSize, nLeft, nRight, 
nUpper, nLower, bScaleAll, eOrientation, nPaperBin, bFullSize );
                 }
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
index f6c129d1e631..14ec745ee3e5 100644
--- a/sd/source/ui/view/drviews8.cxx
+++ b/sd/source/ui/view/drviews8.cxx
@@ -64,8 +64,8 @@ void DrawViewShell::ScannerEvent()
                     else
                         aBmpSize = OutputDevice::LogicToLogic( aBmpSize, 
aScanBmp.GetPrefMapMode(), aMap100 );
 
-                    aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + 
pPage->GetRightBorder()) );
-                    aPageSize.AdjustHeight( -(pPage->GetUpperBorder() + 
pPage->GetLowerBorder()) );
+                    
aPageSize.AdjustWidth(-basegfx::fround((pPage->getBorder().getLeft() + 
pPage->getBorder().getRight()).as_hmm()) );
+                    
aPageSize.AdjustHeight(-basegfx::fround((pPage->getBorder().getUpper() + 
pPage->getBorder().getLower()).as_hmm()) );
 
                     if( ( ( aBmpSize.Height() > aPageSize.Height() ) || ( 
aBmpSize.Width() > aPageSize.Width() ) ) && aBmpSize.Height() && 
aPageSize.Height() )
                     {
@@ -85,7 +85,8 @@ void DrawViewShell::ScannerEvent()
                     }
 
                     Point aPnt ( ( aPageSize.Width() - aBmpSize.Width() ) >> 
1, ( aPageSize.Height() - aBmpSize.Height() ) >> 1 );
-                    aPnt += Point( pPage->GetLeftBorder(), 
pPage->GetUpperBorder() );
+                    aPnt += Point(pPage->getBorder().getLeft().as_hmm(),
+                                  pPage->getBorder().getUpper().as_hmm());
                     ::tools::Rectangle   aRect( aPnt, aBmpSize );
                     bool        bInsertNewObject = true;
 
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index ceb14d9ed125..b37ce15c5b08 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -93,8 +93,8 @@ void DrawViewShell::ExecGallery(SfxRequest const & rReq)
         // constrain size to page size if necessary
         SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage();
         Size aPageSize = pPage->GetSizeHmm();
-        aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + 
pPage->GetRightBorder()) );
-        aPageSize.AdjustHeight( -(pPage->GetUpperBorder() + 
pPage->GetLowerBorder()) );
+        aPageSize.AdjustWidth(-basegfx::fround((pPage->getBorder().getLeft() + 
pPage->getBorder().getRight()).as_hmm()) );
+        aPageSize.AdjustHeight(-basegfx::fround((pPage->getBorder().getUpper() 
+ pPage->getBorder().getLower()).as_hmm()) );
 
         // If the image is too large we make it fit into the page
         if ( ( ( aSize.Height() > aPageSize.Height() ) || ( aSize.Width()   > 
aPageSize.Width() ) ) &&
@@ -121,7 +121,8 @@ void DrawViewShell::ExecGallery(SfxRequest const & rReq)
         // set output rectangle for graphic
         Point aPnt ((aPageSize.Width()  - aSize.Width())  / 2,
                     (aPageSize.Height() - aSize.Height()) / 2);
-        aPnt += Point(pPage->GetLeftBorder(), pPage->GetUpperBorder());
+        aPnt += Point(pPage->getBorder().getLeft().as_hmm(),
+                      pPage->getBorder().getUpper().as_hmm());
         ::tools::Rectangle aRect (aPnt, aSize);
 
         rtl::Reference<SdrGrafObj> pGrafObj;
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index f6279afe2152..93d2ccf2b467 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -514,7 +514,8 @@ void DrawViewShell::SetupPage (Size const &rSize,
 
     UpdateScrollBars();
 
-    Point aNewOrigin(mpActualPage->GetLeftBorder(), 
mpActualPage->GetUpperBorder());
+    Point aNewOrigin(mpActualPage->getBorder().getLeft().as_hmm(),
+                     mpActualPage->getBorder().getUpper().as_hmm());
     GetView()->GetSdrPageView()->SetPageOrigin(aNewOrigin);
 
     GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index b3e5dd9d1e91..44550f9d1c95 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -404,10 +404,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* 
pPara )
 
     // set page size
     pPage->setSize(pExample->getSize());
-    pPage->SetBorder( pExample->GetLeftBorder(),
-                      pExample->GetUpperBorder(),
-                      pExample->GetRightBorder(),
-                      pExample->GetLowerBorder() );
+    pPage->setBorder(pExample->getBorder());
 
     // create new presentation objects (after <Title> or <Title with subtitle>
     // follows <Title with outline>, otherwise apply the layout of the previous
@@ -443,10 +440,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* 
pPara )
 
     // set page size, there must be already one page available
     pNotesPage->setSize(pExample->getSize());
-    pNotesPage->SetBorder( pExample->GetLeftBorder(),
-                           pExample->GetUpperBorder(),
-                           pExample->GetRightBorder(),
-                           pExample->GetLowerBorder() );
+    pNotesPage->setBorder(pExample->getBorder());
 
     // create presentation objects
     pNotesPage->SetAutoLayout(pExample->GetAutoLayout(), true);
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index ebd1bc2fdda5..cf8082ab97e9 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -222,8 +222,8 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, 
sal_Int8& rAction,
         {
             SdrPage* pPage = pPV->GetPage();
             Size aPageSize(pPage->GetSizeHmm());
-            aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + 
pPage->GetRightBorder()) );
-            aPageSize.AdjustHeight( -(pPage->GetUpperBorder() + 
pPage->GetLowerBorder()) );
+            
aPageSize.AdjustWidth(-basegfx::fround((pPage->getBorder().getLeft() + 
pPage->getBorder().getRight()).as_hmm()) );
+            
aPageSize.AdjustHeight(-basegfx::fround((pPage->getBorder().getUpper() + 
pPage->getBorder().getLower()).as_hmm()) );
             pNewGrafObj->AdjustToMaxRect( ::tools::Rectangle( Point(), 
aPageSize ), true );
         }
 
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 14e4dba63a22..606a7800f088 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -506,7 +506,8 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, 
const Size& rNewSize,
     const Size aViewSize(nWidth * 3, nHeight * 2);
     Point aVisAreaPos;
     ::sd::View* pView(GetView());
-    const Point aNewOrigin(pPage->GetLeftBorder(), pPage->GetUpperBorder());
+    const Point aNewOrigin(pPage->getBorder().getLeft().as_hmm(),
+                           pPage->getBorder().getUpper().as_hmm());
 
     InitWindows(aPageOrg, aViewSize, Point(-1, -1), true);
 
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx 
b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
index a411d829a999..853773ef34aa 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
@@ -338,7 +338,7 @@ bool 
ViewObjectContactOfInnerPageBorder::isPrimitiveVisible(const DisplayInfo& r
 
     const SdrPage& rPage = getPage();
 
-    if(!rPage.GetLeftBorder() && !rPage.GetUpperBorder() && 
!rPage.GetRightBorder() && !rPage.GetLowerBorder())
+    if (rPage.getLeftBorder() == 0_emu && rPage.getUpperBorder() == 0_emu && 
rPage.getRightBorder() == 0_emu && rPage.getLowerBorder() == 0_emu)
     {
         return false;
     }
@@ -425,17 +425,17 @@ void 
ViewObjectContactOfPageGrid::createPrimitive2DSequence(const DisplayInfo& /
         const SdrView& rView = pPageView->GetView();
         const SdrPage& rPage = getPage();
 
-        const double fPageWidth(rPage.getSize().getWidth().as_hmm());
-        const double fPageHeight(rPage.getSize().getHeight().as_hmm());
+        const gfx::Length aPageWidth(rPage.getSize().getWidth());
+        const gfx::Length aPageHeight(rPage.getSize().getHeight());
 
         const Color aGridColor(rView.GetGridColor());
         const basegfx::BColor aRGBGridColor(aGridColor.getBColor());
 
         basegfx::B2DHomMatrix aGridMatrix;
-        aGridMatrix.set(0, 0, static_cast<double>(fPageWidth - 
(rPage.GetRightBorder() + rPage.GetLeftBorder())));
-        aGridMatrix.set(1, 1, static_cast<double>(fPageHeight - 
(rPage.GetLowerBorder() + rPage.GetUpperBorder())));
-        aGridMatrix.set(0, 2, static_cast<double>(rPage.GetLeftBorder()));
-        aGridMatrix.set(1, 2, static_cast<double>(rPage.GetUpperBorder()));
+        aGridMatrix.set(0, 0, (aPageWidth - (rPage.getRightBorder() + 
rPage.getLeftBorder())).as_hmm());
+        aGridMatrix.set(1, 1, (aPageHeight - (rPage.getLowerBorder() + 
rPage.getUpperBorder())).as_hmm());
+        aGridMatrix.set(0, 2, rPage.getLeftBorder().as_hmm());
+        aGridMatrix.set(1, 2, rPage.getUpperBorder().as_hmm());
 
         const Size aRaw(rView.GetGridCoarse());
         const Size aFine(rView.GetGridFine());
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 22a44e6eb008..7ae596d3c4da 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -1553,9 +1553,8 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& 
rAttr, bool addPageMargin
     {
         if (addPageMargin)
         {
-            SdrPage * pPage = GetSdrPageView()->GetPage();
-            Point upperLeft(pPage->GetLeftBorder(), pPage->GetUpperBorder());
-            aRect.Move(upperLeft.getX(), upperLeft.getY());
+            SdrPage* pPage = GetSdrPageView()->GetPage();
+            aRect.Move(pPage->getLeftBorder().as_hmm(), 
pPage->getUpperBorder().as_hmm());
         }
         GetSdrPageView()->LogicToPagePos(aRect);
     }
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 358c66997de0..015aa757c465 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1326,10 +1326,6 @@ void SdrPageProperties::dumpAsXml(xmlTextWriterPtr 
pWriter) const
 SdrPage::SdrPage(SdrModel& rModel, bool bMasterPage)
 :   mrSdrModelFromSdrPage(rModel),
     maSize(10_hmm, 10_hmm),
-    mnBorderLeft(0),
-    mnBorderUpper(0),
-    mnBorderRight(0),
-    mnBorderLower(0),
     mpLayerAdmin(new SdrLayerAdmin(&rModel.GetLayerAdmin())),
     nPageNum(0),
     mbMaster(bMasterPage),
@@ -1387,10 +1383,7 @@ void SdrPage::lateInit(const SdrPage& rSrcPage)
     mbMaster = rSrcPage.mbMaster;
     mbPageBorderOnlyLeftRight = rSrcPage.mbPageBorderOnlyLeftRight;
     maSize = rSrcPage.maSize;
-    mnBorderLeft = rSrcPage.mnBorderLeft;
-    mnBorderUpper = rSrcPage.mnBorderUpper;
-    mnBorderRight = rSrcPage.mnBorderRight;
-    mnBorderLower = rSrcPage.mnBorderLower;
+    maBorder = rSrcPage.maBorder;
     mbBackgroundFullSize = rSrcPage.mbBackgroundFullSize;
     nPageNum = rSrcPage.nPageNum;
 
@@ -1467,96 +1460,83 @@ Orientation SdrPage::GetOrientation() const
 }
 
 
-void  SdrPage::SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, 
sal_Int32 nLwr)
+void  SdrPage::SetBorder(sal_Int32 nLeftHmm, sal_Int32 nUpperHmm, sal_Int32 
nRightHmm, sal_Int32 nLowerHmm)
 {
     bool bChanged(false);
 
-    if(mnBorderLeft != nLft)
+    auto left = gfx::Length::hmm(nLeftHmm);
+    auto upper = gfx::Length::hmm(nUpperHmm);
+    auto right = gfx::Length::hmm(nRightHmm);
+    auto lower = gfx::Length::hmm(nLowerHmm);
+
+    if (maBorder.getLeft() != left)
     {
-        mnBorderLeft = nLft;
+        maBorder.setLeft(left);
         bChanged = true;
     }
 
-    if(mnBorderUpper != nUpp)
+    if (maBorder.getUpper() != upper)
     {
-        mnBorderUpper = nUpp;
+        maBorder.setUpper(upper);
         bChanged = true;
     }
 
-    if(mnBorderRight != nRgt)
+    if (maBorder.getRight() != right)
     {
-        mnBorderRight = nRgt;
+        maBorder.setRight(right);
         bChanged = true;
     }
 
-    if(mnBorderLower != nLwr)
+    if (maBorder.getLower() != lower)
     {
-        mnBorderLower =  nLwr;
+        maBorder.setLower(lower);
         bChanged = true;
     }
 
-    if(bChanged)
-    {
+    if (bChanged)
         SetChanged();
-    }
 }
 
-void  SdrPage::SetLeftBorder(sal_Int32 nBorder)
+void  SdrPage::SetLeftBorder(sal_Int32 nBorderHmm)
 {
-    if(mnBorderLeft != nBorder)
+    auto nBorder = gfx::Length::hmm(nBorderHmm);
+    if (maBorder.getLeft() != nBorder)
     {
-        mnBorderLeft = nBorder;
+        maBorder.setLeft(nBorder);
         SetChanged();
     }
 }
 
-void  SdrPage::SetUpperBorder(sal_Int32 nBorder)
+void  SdrPage::SetUpperBorder(sal_Int32 nBorderHmm)
 {
-    if(mnBorderUpper != nBorder)
+    auto nBorder = gfx::Length::hmm(nBorderHmm);
+    if (maBorder.getUpper() != nBorder)
     {
-        mnBorderUpper = nBorder;
+        maBorder.setUpper(nBorder);
         SetChanged();
     }
 }
 
-void  SdrPage::SetRightBorder(sal_Int32 nBorder)
+void  SdrPage::SetRightBorder(sal_Int32 nBorderHmm)
 {
-    if(mnBorderRight != nBorder)
+    auto nBorder = gfx::Length::hmm(nBorderHmm);
+    if (maBorder.getRight() != nBorder)
     {
-        mnBorderRight=nBorder;
+        maBorder.setRight(nBorder);
         SetChanged();
     }
 }
 
-void  SdrPage::SetLowerBorder(sal_Int32 nBorder)
+void  SdrPage::SetLowerBorder(sal_Int32 nBorderHmm)
 {
-    if(mnBorderLower != nBorder)
+    auto nBorder = gfx::Length::hmm(nBorderHmm);
+    if (maBorder.getLower() != nBorder)
     {
-        mnBorderLower=nBorder;
+        maBorder.setLower(nBorder);
         SetChanged();
     }
 }
 
-sal_Int32 SdrPage::GetLeftBorder() const
-{
-    return mnBorderLeft;
-}
-
-sal_Int32 SdrPage::GetUpperBorder() const
-{
-    return mnBorderUpper;
-}
-
-sal_Int32 SdrPage::GetRightBorder() const
-{
-    return mnBorderRight;
-}
-
-sal_Int32 SdrPage::GetLowerBorder() const
-{
-    return mnBorderLower;
-}
-
 void SdrPage::SetBackgroundFullSize(bool const bIn)
 {
     if (bIn != mbBackgroundFullSize)
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index df1b3fe9ff13..9953e29bfd12 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -96,8 +96,8 @@ SdrPageView::SdrPageView(SdrPage* pPage1, SdrView& rNewView)
 
     if(mpPage)
     {
-        maPageOrigin.setX(mpPage->GetLeftBorder() );
-        maPageOrigin.setY(mpPage->GetUpperBorder() );
+        maPageOrigin.setX(mpPage->getLeftBorder().as_hmm());
+        maPageOrigin.setY(mpPage->getUpperBorder().as_hmm());
     }
     // For example, in the case of charts, there is a LayerAdmin, but it has 
no valid values. Therefore
     // a solution like pLayerAdmin->getVisibleLayersODF(aLayerVisi) is not 
possible. So use the
@@ -452,16 +452,16 @@ void SdrPageView::DrawPageViewGrid(OutputDevice& rOut, 
const tools::Rectangle& r
     auto aPageSize = GetPage()->getSize();
     if (aPageSize.getWidth() < 0_emu) // ScDrawPage of RTL sheet
     {
-        x1 = aPageSize.getWidth().as_hmm() + GetPage()->GetLeftBorder() + 1;
-        x2 = - GetPage()->GetRightBorder() - 1;
+        x1 = (aPageSize.getWidth() + GetPage()->getLeftBorder() + 
1_hmm).as_hmm();
+        x2 = (-GetPage()->getRightBorder() - 1_hmm).as_hmm();
     }
     else
     {
-        x1 = GetPage()->GetLeftBorder() + 1;
-        x2 = aPageSize.getWidth().as_hmm() - GetPage()->GetRightBorder() - 1;
+        x1 = (GetPage()->getLeftBorder() + 1_hmm).as_hmm();
+        x2 = (aPageSize.getWidth() - GetPage()->getRightBorder() - 
1_hmm).as_hmm();
     }
-    tools::Long y1 = GetPage()->GetUpperBorder() + 1;
-    tools::Long y2 = aPageSize.getHeight().as_hmm() - 
GetPage()->GetLowerBorder() - 1;
+    tools::Long y1 = (GetPage()->getUpperBorder() + 1_hmm).as_hmm();
+    tools::Long y2 = (aPageSize.getHeight() - GetPage()->getLowerBorder() - 
1_hmm).as_hmm();
     const SdrPageGridFrameList* 
pFrames=GetPage()->GetGridFrameList(this,nullptr);
 
     sal_uInt16 nGridPaintCnt=1;
diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx
index 001dfe02dc75..99b82cf75b86 100644
--- a/svx/source/svdraw/svdsnpv.cxx
+++ b/svx/source/svdraw/svdsnpv.cxx
@@ -306,10 +306,10 @@ SdrSnap SdrSnapView::SnapPos(Point& rPnt, const 
SdrPageView* pPV) const
         SdrPage* pPage=pPV->GetPage();
         tools::Long xs = pPage->getSize().getWidth().as_hmm();
         tools::Long ys = pPage->getSize().getHeight().as_hmm();
-        tools::Long lft=pPage->GetLeftBorder();
-        tools::Long rgt=pPage->GetRightBorder();
-        tools::Long upp=pPage->GetUpperBorder();
-        tools::Long lwr=pPage->GetLowerBorder();
+        tools::Long lft = pPage->getLeftBorder().as_hmm();
+        tools::Long rgt = pPage->getRightBorder().as_hmm();
+        tools::Long upp = pPage->getUpperBorder().as_hmm();
+        tools::Long lwr = pPage->getLowerBorder().as_hmm();
         tools::Long a;
         a=x- lft    ; if (std::abs(a)<=mx) { dx1=-a; if 
(std::abs(dx1)<std::abs(dx)) dx=dx1; } // left margin
         a=x-(xs-rgt); if (std::abs(a)<=mx) { dx1=-a; if 
(std::abs(dx1)<std::abs(dx)) dx=dx1; } // right margin
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx 
b/svx/source/unodraw/UnoGraphicExporter.cxx
index c410ccbc231f..e1f07df2a874 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -726,9 +726,9 @@ bool GraphicExporter::GetGraphic( ExportSettings const & 
rSettings, Graphic& aGr
                 // PageBackground (formerly 'wiese').
                 pView->SetPagePaintingAllowed(false);
 
-                const Point aNewOrg( pPage->GetLeftBorder(), 
pPage->GetUpperBorder() );
-                aNewSize = Size( aSize.Width() - pPage->GetLeftBorder() - 
pPage->GetRightBorder(),
-                                 aSize.Height() - pPage->GetUpperBorder() - 
pPage->GetLowerBorder() );
+                const Point aNewOrg(pPage->getLeftBorder().as_hmm(), 
pPage->getUpperBorder().as_hmm());
+                aNewSize = Size(aSize.Width() - (pPage->getLeftBorder() - 
pPage->getRightBorder()).as_hmm(),
+                                aSize.Height() - (pPage->getUpperBorder() - 
pPage->getLowerBorder()).as_hmm());
                 const tools::Rectangle aClipRect( aNewOrg, aNewSize );
                 MapMode         aVMap( aMap );
 
commit 7fbd81504afd696783c4a371b527ef6d27719c82
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Sep 16 13:33:09 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Fri Sep 16 16:36:41 2022 +0200

    svx: add prefix m to aPgOrg and rename to aPageOrigin
    
    Change-Id: I1df0c61aca724748680017472cde64832742eb97

diff --git a/include/svx/svdpagv.hxx b/include/svx/svdpagv.hxx
index 2f77dfa6692a..777ca7d9b1b2 100644
--- a/include/svx/svdpagv.hxx
+++ b/include/svx/svdpagv.hxx
@@ -57,7 +57,7 @@ class SVXCORE_DLLPUBLIC SdrPageView
 private:
     SdrView&     mrView;
     SdrPage*     mpPage;
-    Point        aPgOrg;   // The Page's point of origin
+    Point        maPageOrigin;   // The Page's point of origin
 
     tools::Rectangle    aMarkBound;
     tools::Rectangle    aMarkSnap;
@@ -199,12 +199,12 @@ public:
     bool IsReadOnly() const;
 
     /// The Origin always refers to the upper left corner of the Page
-    const Point& GetPageOrigin() const { return aPgOrg; }
+    const Point& GetPageOrigin() const { return maPageOrigin; }
     void SetPageOrigin(const Point& rOrg);
 
-    void LogicToPagePos(Point& rPnt) const { rPnt-=aPgOrg; }
-    void LogicToPagePos(tools::Rectangle& rRect) const { 
rRect.Move(-aPgOrg.X(),-aPgOrg.Y()); }
-    void PagePosToLogic(Point& rPnt) const { rPnt+=aPgOrg; }
+    void LogicToPagePos(Point& rPnt) const { rPnt-=maPageOrigin; }
+    void LogicToPagePos(tools::Rectangle& rRect) const { 
rRect.Move(-maPageOrigin.X(),-maPageOrigin.Y()); }
+    void PagePosToLogic(Point& rPnt) const { rPnt+=maPageOrigin; }
 
     void SetVisibleLayers(const SdrLayerIDSet& rSet) { aLayerVisi=rSet; }
     const SdrLayerIDSet& GetVisibleLayers() const { return aLayerVisi; }
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index b3aad51ab29c..df1b3fe9ff13 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -96,8 +96,8 @@ SdrPageView::SdrPageView(SdrPage* pPage1, SdrView& rNewView)
 
     if(mpPage)
     {
-        aPgOrg.setX(mpPage->GetLeftBorder() );
-        aPgOrg.setY(mpPage->GetUpperBorder() );
+        maPageOrigin.setX(mpPage->GetLeftBorder() );
+        maPageOrigin.setY(mpPage->GetUpperBorder() );
     }
     // For example, in the case of charts, there is a LayerAdmin, but it has 
no valid values. Therefore
     // a solution like pLayerAdmin->getVisibleLayersODF(aLayerVisi) is not 
possible. So use the
@@ -446,7 +446,7 @@ void SdrPageView::DrawPageViewGrid(OutputDevice& rOut, 
const tools::Rectangle& r
 
     tools::Long nWrX=0;
     tools::Long nWrY=0;
-    Point aOrg(aPgOrg);
+    Point aOrg(maPageOrigin);
     tools::Long x1 = 0;
     tools::Long x2 = 0;
     auto aPageSize = GetPage()->getSize();
@@ -647,9 +647,11 @@ bool SdrPageView::IsObjMarkable(SdrObject const * pObj) 
const
 
 void SdrPageView::SetPageOrigin(const Point& rOrg)
 {
-    if (rOrg!=aPgOrg) {
-        aPgOrg=rOrg;
-        if (GetView().IsGridVisible()) {
+    if (rOrg != maPageOrigin)
+    {
+        maPageOrigin = rOrg;
+        if (GetView().IsGridVisible())
+        {
             InvalidateAllWin();
         }
     }

Reply via email to