[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 1055 commits - accessibility/inc accessibility/source android/default-document avmedia/source basctl/inc basctl/source basegfx/CppunitTest_basegfx.mk basegfx/source basegfx/test basic/inc basic/qa basic/source bin/find-can-be-private-symbols.functions.results bin/find-can-be-private-symbols.py bin/gen-iwyu-dummy-lib.awk bin/symstore.sh bridges/source canvas/source chart2/CppunitTest_chart2_dump.mk chart2/CppunitTest_chart2_export3.mk chart2/CppunitTest_chart2_geometry.mk chart2/CppunitTest_chart2_pivot_chart_test.mk chart2/CppunitTest_chart2_trendcalculators.mk chart2/CppunitTest_chart2_xshape.mk chart2/export_setup.mk chart2/import_setup.mk chart2/inc chart2/Module_chart2.mk chart2/qa chart2/source chart2/uiconfig comphelper/inc comphelper/Library_comphelper.mk comphelper/qa comphelper/source compilerplugins/clang config_host/config_eot.h.in config_host/config_wasm_strip.h.in config_host.mk.in configmgr/source configure.ac conn ectivity/inc connectivity/source cppcanvas/source cppu/source cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/qa dbaccess/source dbaccess/uiconfig desktop/inc desktop/qa desktop/source desktop/uiconfig desktop/unx dictionaries download.lst drawinglayer/source editeng/inc editeng/qa editeng/source embeddedobj/qa embeddedobj/source extensions/Module_extensions.mk extensions/source extensions/uiconfig external/boost external/coinmp external/curl external/epoxy external/firebird external/fontconfig external/frozen external/gpgmepp external/liborcus external/libpng external/libwebp external/libxml2 external/Module_external.mk external/more_fonts external/nss external/openssl external/pdfium external/poppler external/postgresql external/python3 external/skia external/zlib extras/CustomTarget_templates.mk extras/CustomTarget_tpldraw.mk extras/CustomTarget_tplofficorr.mk extras/CustomTarget_tploffimisc.mk extras/CustomTarget_tplpersonal.mk extras/CustomTarget _tplpresnt.mk extras/CustomTarget_tpl_styles.mk extras/CustomTarget_tplwizard.mk extras/Module_extras.mk extras/Package_templates.mk extras/Package_tpldraw.mk extras/Package_tplofficorr.mk extras/Package_tploffimisc.mk extras/Package_tplpersonal.mk extras/Package_tpl_styles.mk extras/Package_tplwizagenda.mk extras/Package_tplwizard.mk extras/Package_tplwizfax.mk extras/Package_tplwizletter.mk extras/Package_tplwizreport.mk extras/Package_tplwizstyles.mk extras/source filter/CppunitTest_filter_pdfimporter_test.mk filter/Library_icg.mk filter/Library_pdfimporter.mk filter/Module_filter.mk filter/qa filter/source forms/inc forms/source formula/source fpicker/source framework/inc framework/source helpcontent2 hwpfilter/source i18nlangtag/qa i18nlangtag/source i18npool/source i18nutil/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_dark_svg icon-themes/breeze_svg icon-themes/colibre icon-themes/colibre_dark icon-themes/colibre_dark_svg icon-themes/colibre_svg icon-th emes/elementary icon-themes/elementary_svg icon-themes/karasa_jaga icon-themes/karasa_jaga_svg icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_dark_svg icon-themes/sifr_svg icon-themes/sukapura icon-themes/sukapura_svg include/basegfx include/basic include/comphelper include/connectivity include/cppuhelper include/drawinglayer include/editeng include/filter include/formula include/i18nlangtag include/i18nutil include/IwyuFilter_include.yaml include/LibreOfficeKit include/linguistic include/oox include/osl include/rtl include/sax include/sfx2 include/sot include/svl include/svtools include/svx include/test include/toolkit include/tools include/unotest include/unotools include/vbahelper include/vcl include/xmloff io/source jvmfwk/plugins jvmfwk/source l10ntools/source librelogo/source lingucomponent/source linguistic/Library_lng.mk linguistic/source lotuswordpro/source Makefile.fetch Makefile.in odk/examples odk/Package_examples.mk odk/source offapi/com officecfg/registry oovb aapi/ooo oox/inc oox/qa oox/source package/inc package/source pyuno/source readlicense_oo/license reportdesign/inc reportdesign/source reportdesign/uiconfig RepositoryExternal.mk Repository.mk RepositoryModule_host.mk sal/osl sal/qa sal/rtl sal/textenc sax/source scaddins/inc sccomp/qa schema/libreoffice sc/inc sc/IwyuFilter_sc.yaml sc/Library_sc.mk scp2/source sc/qa scripting/examples scripting/source sc/sdi sc/source sc/uiconfig sd/CppunitTest_sd_filter_eppt.mk sd/CppunitTest_sd_misc_tests.mk sd/CppunitTest_sd_uimpress.mk sdext/Executable_xpdfimport.mk sdext/inc sdext/source sd/import_setup.mk sd/inc sd/IwyuFilter_sd.yaml sd/Library_sdfilt.mk sd/Library_sd.mk sd/Module_sd.mk sd/qa sd/sdi sd/source sd/uiconfig sd/util sfx2/emojiconfig sfx2/inc sfx2/Library_sfx.mk sfx2/Module_sfx2.mk sfx2/Package_emoji.mk sfx2/qa sfx2/sdi sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk sfx2/util shell/source slideshow/inc slideshow/source slideshow/test solenv/bin solenv/clang-format solenv/flatpak-m anifest.in solenv/gbuild solenv/gdb solenv/sanitizers sot/inc sot/source starmath/inc starmath/qa starmath/source starmath/uiconfig static/CustomTarget_emscripten_fs_image.mk stoc/source svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source svl/qa svl/source svtools/inc svtools/Library_svt.mk svtools/source svx/inc svx/Library_svxcore.mk svx/qa svx/sdi svx/source svx/uiconfig sw/CppunitTest_sw_core_accessibilitycheck.mk sw/CppunitTest_sw_core_text.mk sw/CppunitTest_sw_core_view.mk sw/CppunitTest_sw_mailmerge2.mk sw/CppunitTest_sw_odffeatures.mk sw/CppunitTest_sw_uibase_dochdl.mk sw/CppunitTest_sw_uibase_docvw.mk sw/CppunitTest_sw_uibase_frmdlg.mk sw/CppunitTest_sw_uibase_uno.mk sw/CppunitTest_sw_uiwriter6.mk sw/inc sw/Library_sw.mk sw/Library_swui.mk sw/Library_vbaswobj.mk sw/Module_sw.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk sw/UITest_sw_uibase_docvw.mk sw/util sysui/desktop test/source toolkit/source tools/CppunitTest_tools_test.mk tools/source translations uc bhelper/source ucb/source udkapi/com uitest/demo_ui uitest/libreoffice uitest/math_tests uitest/packaging unoidl/source unotest/source unotools/CppunitTest_unotools_configpaths.mk unotools/CppunitTest_unotools_fontcvt.mk unotools/inc unotools/Module_unotools.mk unotools/qa unotools/source unoxml/source uui/inc uui/IwyuFilter_uui.yaml uui/source vbahelper/inc vbahelper/source vcl/backendtest vcl/commonfuzzer.mk vcl/CppunitTest_vcl_app_test.mk vcl/Executable_benchmark.mk vcl/headless vcl/inc vcl/jsdialog vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Module_vcl.mk vcl/osx vcl/qa vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win vcl/workben winaccessibility/source wizards/com wizards/source writerfilter/inc writerfilter/qa writerfilter/source writerperfect/Library_wpftcalc.mk writerperfect/Module_writerperfect.mk writerperfect/qa writerperfect/source xmerge/source xmloff/inc xmloff/Library_xo.mk xmloff/qa xmloff/source xmlscript/qa xmlscript/source xmlsecurity/inc xmlsecurity/q a xmlsecurity/source

Mon, 17 Oct 2022 12:49:56 -0700

Rebased ref, commits from common ancestor:
commit cb4a77073d1448e29ac099c96b53dea47223a937
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Tue Sep 27 22:21:37 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Mon Oct 17 21:48:11 2022 +0200

    Check Textbox Fit To Frame
    
    Change-Id: I4a02658d06b84cd1222713f12adf14a8194b5b93

diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 2a7aa0128423..e5c3abbef0cf 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -409,7 +409,29 @@ public:
     sal_Int32      GetLen() const              { return nLen; }
     void           SetLen( sal_Int32 nL )         { nLen = nL; }
 
-    Size&          GetSize()                   { return aOutSz; }
+    void setWidth(tools::Long nWidth)
+    {
+        aOutSz.setWidth(nWidth);
+    }
+
+    void setHeight(tools::Long nHeight)
+    {
+        aOutSz.setHeight(nHeight);
+    }
+
+    void adjustSize(tools::Long nDeltaX, tools::Long nDeltaY)
+    {
+        if (nDeltaX != 0)
+            aOutSz.AdjustWidth(nDeltaX);
+        if (nDeltaY != 0)
+            aOutSz.AdjustHeight(nDeltaY);
+    }
+
+    void SetSize(const Size& rSize)
+    {
+        aOutSz = rSize;
+    }
+
     const Size&    GetSize() const             { return aOutSz; }
 
     void           SetKind(PortionKind n)      { nKind = n; }
@@ -728,7 +750,7 @@ private:
     rtl::Reference<SfxItemPool> pItemPool;
     Link<LinkParamNone*,void>      aModifyHdl;
 
-    SvxFont         aDefFont;           //faster than ever from the pool!!
+    SvxFont         maDefFont;           //faster than ever from the pool!!
     sal_uInt16      nDefTab;
     bool            bIsVertical:1;
     TextRotation    mnRotation;
@@ -755,7 +777,7 @@ public:
     void            SetModifyHdl( const Link<LinkParamNone*,void>& rLink ) { 
aModifyHdl = rLink; }
 
     void            CreateDefFont( bool bUseStyles );
-    const SvxFont&  GetDefFont() const { return aDefFont; }
+    const SvxFont&  GetDefFont() const { return maDefFont; }
 
     void            SetDefTab( sal_uInt16 nTab )    { nDefTab = nTab ? nTab : 
DEFTAB; }
     sal_uInt16      GetDefTab() const           { return nDefTab; }
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 108230a1666d..3dc739281293 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1988,7 +1988,11 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, 
bool bSearchInParent, S
     if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == 
SfxItemState::SET ) )
         rFont.SetFillColor( rSet.Get( EE_CHAR_BKGCOLOR ).GetValue() );
     if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == 
SfxItemState::SET ) )
-        rFont.SetFontSize( Size( rFont.GetFontSize().Width(), 
static_cast<const SvxFontHeightItem&>(rSet.Get( nWhich_FontHeight ) 
).GetHeight() ) );
+    {
+        auto nHeight = static_cast<const SvxFontHeightItem&>(rSet.Get( 
nWhich_FontHeight ) ).GetHeight();
+        printf ("FONTHEIGHT %ld\n", nHeight);
+        rFont.SetFontSize(Size(rFont.GetFontSize().Width(), nHeight));
+    }
     if ( bSearchInParent || ( rSet.GetItemState( nWhich_Weight ) == 
SfxItemState::SET ) )
         rFont.SetWeight( static_cast<const SvxWeightItem&>(rSet.Get( 
nWhich_Weight )).GetWeight() );
     if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_UNDERLINE ) == 
SfxItemState::SET ) )
@@ -2039,14 +2043,14 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& 
rSet, bool bSearchInParent, S
 void EditDoc::CreateDefFont( bool bUseStyles )
 {
     SfxItemSetFixed<EE_PARA_START, EE_CHAR_END> aTmpSet( GetItemPool() );
-    CreateFont( aDefFont, aTmpSet );
-    aDefFont.SetVertical( IsEffectivelyVertical() );
-    aDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
+    CreateFont(maDefFont, aTmpSet);
+    maDefFont.SetVertical( IsEffectivelyVertical() );
+    maDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
 
     for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ )
     {
         ContentNode* pNode = GetObject( nNode );
-        pNode->GetCharAttribs().GetDefFont() = aDefFont;
+        pNode->GetCharAttribs().GetDefFont() = maDefFont;
         if ( bUseStyles )
             pNode->CreateDefFont();
     }
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 455587bac4a6..61c509e433fd 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3348,6 +3348,7 @@ sal_uInt32 ImpEditEngine::GetTextHeight() const
 
 sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace )
 {
+    printf("ImpEditEngine::CalcTextWidth\n");
     // If still not formatted and not in the process.
     // Will be brought in the formatting for AutoPageSize.
     if ( !IsFormatted() && !IsFormatting() )
@@ -3362,12 +3363,13 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( bool 
bIgnoreExtraSpace )
     {
         nMaxWidth = std::max(nMaxWidth, CalcParaWidth(nPara, 
bIgnoreExtraSpace));
     }
-
+    printf("end ImpEditEngine::CalcTextWidth %d\n", nMaxWidth);
     return nMaxWidth;
 }
 
 sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool 
bIgnoreExtraSpace )
 {
+    printf("ImpEditEngine::CalcParaWidth\n");
     // If still not formatted and not in the process.
     // Will be brought in the formatting for AutoPageSize.
     if ( !IsFormatted() && !IsFormatting() )
@@ -3387,8 +3389,8 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, 
bool bIgnoreExtraSpace
 
         // On the lines of the paragraph ...
 
-        sal_Int32 nLines = pPortion->GetLines().Count();
-        for ( sal_Int32 nLine = 0; nLine < nLines; nLine++ )
+        sal_Int32 nNumberOfLines = pPortion->GetLines().Count();
+        for (sal_Int32 nLine = 0; nLine < nNumberOfLines; nLine++)
         {
             EditLine& rLine = pPortion->GetLines()[nLine];
             // nCurWidth = pLine->GetStartPosX();
@@ -3397,7 +3399,8 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, 
bool bIgnoreExtraSpace
             // to StartPosX, also the right indents have to be taken into
             // account!
             tools::Long nCurWidth = GetXValue( rLRItem.GetTextLeft() + 
nSpaceBeforeAndMinLabelWidth );
-            if ( nLine == 0 )
+            printf ("nCurWidth 1 - %ld\n", nCurWidth);
+            if (nLine == 0)
             {
                 tools::Long nFI = GetXValue( rLRItem.GetTextFirstLineOffset() 
);
                 nCurWidth -= nFI;
@@ -3408,17 +3411,19 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 
nPara, bool bIgnoreExtraSpace
                         nCurWidth = pPortion->GetBulletX();
                 }
             }
-            nCurWidth += GetXValue( rLRItem.GetRight() );
-            nCurWidth += CalcLineWidth( pPortion, &rLine, bIgnoreExtraSpace );
-            if ( nCurWidth > nMaxWidth )
-            {
-                nMaxWidth = nCurWidth;
-            }
+
+            nCurWidth += GetXValue(rLRItem.GetRight());
+            printf ("nCurWidth 2 - %ld\n", nCurWidth);
+            nCurWidth += CalcLineWidth(pPortion, &rLine, bIgnoreExtraSpace);
+            printf ("nCurWidth 3 - %ld\n", nCurWidth);
+
+            nMaxWidth = std::max(nCurWidth, nMaxWidth);
         }
     }
 
     nMaxWidth++; // widen it, because in CreateLines for >= is wrapped.
-    return static_cast<sal_uInt32>(nMaxWidth);
+    printf ("max width: %ld\n", nMaxWidth);
+    return sal_uInt32(nMaxWidth);
 }
 
 sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* 
pLine, bool bIgnoreExtraSpace )
@@ -3452,7 +3457,9 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* 
pPortion, EditLine* pLine,
             {
                 if ( ( eJustification != SvxAdjust::Block ) || ( 
!bIgnoreExtraSpace ) )
                 {
-                    nWidth += rTextPortion.GetSize().Width();
+                    auto width = rTextPortion.GetSize().Width();
+                    printf ("WIDTH: %ld\n", width);
+                    nWidth += width;
                 }
                 else
                 {
@@ -3460,8 +3467,11 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* 
pPortion, EditLine* pLine,
                     SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont );
                     aTmpFont.SetPhysFont(*GetRefDevice());
                     ImplInitDigitMode(*GetRefDevice(), aTmpFont.GetLanguage());
-                    nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(),
+                    auto width = aTmpFont.QuickGetTextSize( GetRefDevice(),
                         pPortion->GetNode()->GetString(), nPos, 
rTextPortion.GetLen(), nullptr ).Width();
+
+                    printf ("WIDTH: %ld\n", width);
+                    nWidth += width;
                 }
             }
             break;
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 6efc74d95cfe..31f80e5e10ce 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -676,6 +676,7 @@ tools::Long ImpEditEngine::GetColumnWidth(const Size& 
rPaperSize) const
 
 bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
 {
+    printf ("ImpEditEngine::CreateLines\n");
     ParaPortion* pParaPortion = GetParaPortions()[nPara];
 
     // sal_Bool: Changes in the height of paragraph Yes / No - 
sal_True/sal_False
@@ -838,7 +839,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
     EditLine aSaveLine( *pLine );
     SvxFont aTmpFont( pNode->GetCharAttribs().GetDefFont() );
 
-    std::vector<sal_Int32> aBuf( pNode->Len() );
+    std::vector<sal_Int32> aCharPositionArray(pNode->Len());
 
     bool bSameLineAgain = false;    // For TextRanger, if the height changes.
     TabInfo aCurrentTab;
@@ -975,6 +976,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
         }
 
         // search for Portion that no longer fits in line...
+
         TextPortion* pPortion = nullptr;
         sal_Int32 nPortionLen = 0;
         bool bContinueLastPortion = false;
@@ -1016,7 +1018,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                     nTmpWidth -= rPrev.GetSize().Width();
                     nTmpPos = nTmpPos - rPrev.GetLen();
                     rPrev.SetLen(rPrev.GetLen() + nTmpLen);
-                    rPrev.GetSize().setWidth( -1 );
+                    rPrev.setWidth(-1);
                 }
 
                 assert( nTmpPortion < pParaPortion->GetTextPortions().Count() 
&& "No more Portions left!" );
@@ -1045,6 +1047,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                 {
                     case EE_FEATURE_TAB:
                     {
+                        printf ("EE_FEATURE_TAB\n");
                         tools::Long nOldTmpWidth = nTmpWidth;
 
                         // Search for Tab-Pos...
@@ -1079,11 +1082,11 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 
                         pPortion->SetKind(PortionKind::TAB);
                         pPortion->SetExtraValue( 
aCurrentTab.aTabStop.GetFill() );
-                        pPortion->GetSize().setWidth( aCurrentTab.nTabPos - 
(nTmpWidth+nStartX) );
+                        pPortion->setWidth( aCurrentTab.nTabPos - 
(nTmpWidth+nStartX) );
 
                         // Height needed...
                         SeekCursor( pNode, nTmpPos+1, aTmpFont );
-                        pPortion->GetSize().setHeight( 
GetRefDevice()->GetTextHeight() );
+                        pPortion->setHeight( GetRefDevice()->GetTextHeight() );
 
                         DBG_ASSERT( pPortion->GetSize().Width() >= 0, "Tab 
incorrectly calculated!" );
 
@@ -1095,7 +1098,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                         {
                             // What now?
                             // make the tab fitting
-                            pPortion->GetSize().setWidth( nXWidth-nOldTmpWidth 
);
+                            pPortion->setWidth( nXWidth-nOldTmpWidth );
                             nTmpWidth = nXWidth-1;
                             bEOL = true;
                             bBrokenLine = true;
@@ -1108,8 +1111,9 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                     break;
                     case EE_FEATURE_LINEBR:
                     {
+                        printf ("EE_FEATURE_LINEBR\n");
                         assert( pPortion );
-                        pPortion->GetSize().setWidth( 0 );
+                        pPortion->setWidth(0);
                         bEOL = true;
                         bLineBreak = true;
                         pPortion->SetKind( PortionKind::LINEBREAK );
@@ -1121,6 +1125,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                     break;
                     case EE_FEATURE_FIELD:
                     {
+                        printf ("EE_FEATURE_FIELD\n");
                         SeekCursor( pNode, nTmpPos+1, aTmpFont );
                         aTmpFont.SetPhysFont(*GetRefDevice());
                         ImplInitDigitMode(*GetRefDevice(), 
aTmpFont.GetLanguage());
@@ -1128,8 +1133,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                         OUString aFieldValue = static_cast<const 
EditCharAttribField*>(pNextFeature)->GetFieldValue();
                         // get size, but also DXArray to allow length 
information in line breaking below
                         std::vector<sal_Int32> aTmpDXArray;
-                        pPortion->GetSize() = 
aTmpFont.QuickGetTextSize(GetRefDevice(),
-                            aFieldValue, 0, aFieldValue.getLength(), 
&aTmpDXArray);
+                        
pPortion->SetSize(aTmpFont.QuickGetTextSize(GetRefDevice(),
+                            aFieldValue, 0, aFieldValue.getLength(), 
&aTmpDXArray));
 
                         // So no scrolling for oversized fields
                         if ( pPortion->GetSize().Width() > nXWidth )
@@ -1234,27 +1239,35 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                 if (bContinueLastPortion)
                 {
                      Size aSize( aTmpFont.QuickGetTextSize( GetRefDevice(),
-                            pParaPortion->GetNode()->GetString(), nTmpPos, 
nPortionLen, &aBuf ));
-                     pPortion->GetSize().AdjustWidth(aSize.Width() );
+                            pParaPortion->GetNode()->GetString(), nTmpPos, 
nPortionLen, &aCharPositionArray ));
+                     pPortion->adjustSize(aSize.Width(), 0);
                      if (pPortion->GetSize().Height() < aSize.Height())
-                         pPortion->GetSize().setHeight( aSize.Height() );
+                         pPortion->setHeight(aSize.Height());
                 }
                 else
                 {
-                    pPortion->GetSize() = aTmpFont.QuickGetTextSize( 
GetRefDevice(),
-                            pParaPortion->GetNode()->GetString(), nTmpPos, 
nPortionLen, &aBuf );
+                    for (auto n : aCharPositionArray)
+                        printf ("%d ", n);
+                    printf ("\n");
+                    //GetRefDevice()->SetText
+                    auto aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), 
pParaPortion->GetNode()->GetString(), nTmpPos, nPortionLen, 
&aCharPositionArray);
+                    pPortion->SetSize(aSize);
+                    printf ("SDDDDD %ld %ld - %ld %ld\n", aSize.Width(), 
aSize.Height(), aTmpFont.GetFontSize().Width(), 
aTmpFont.GetFontSize().Height());
                 }
 
                 // #i9050# Do Kerning also behind portions...
                 if ( ( aTmpFont.GetFixKerning() > 0 ) && ( ( nTmpPos + 
nPortionLen ) < pNode->Len() ) )
-                    pPortion->GetSize().AdjustWidth(aTmpFont.GetFixKerning() );
+                    pPortion->adjustSize(aTmpFont.GetFixKerning(), 0);
                 if ( IsFixedCellHeight() )
-                    pPortion->GetSize().setHeight( 
ImplCalculateFontIndependentLineSpacing( aTmpFont.GetFontHeight() ) );
+                {
+                    printf ("IsFixedCellHeight - true\n");
+                    pPortion->setHeight( 
ImplCalculateFontIndependentLineSpacing( aTmpFont.GetFontHeight() ) );
+                }
                 // The array is  generally flattened at the beginning
                 // => Always simply quick inserts.
                 size_t nPos = nTmpPos - pLine->GetStart();
                 EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
-                rArray.insert( rArray.begin() + nPos, aBuf.data(), aBuf.data() 
+ nPortionLen);
+                rArray.insert( rArray.begin() + nPos, 
aCharPositionArray.data(), aCharPositionArray.data() + nPortionLen);
 
                 // And now check for Compression:
                 if ( !bContinueLastPortion && nPortionLen && 
GetAsianCompressionMode() != CharCompressType::NONE )
@@ -1280,7 +1293,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                     {
                         tools::Long nExtraSpace = 
pPortion->GetSize().Height()/5;
                         nExtraSpace = GetXValue( nExtraSpace );
-                        pPortion->GetSize().AdjustWidth(nExtraSpace );
+                        pPortion->adjustSize(nExtraSpace, 0);
                         nTmpWidth += nExtraSpace;
                     }
                 }
@@ -1326,7 +1339,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                     aCurrentTab.bValid = false;
                 }
                 TextPortion& rTabPortion = 
pParaPortion->GetTextPortions()[aCurrentTab.nTabPortion];
-                rTabPortion.GetSize().setWidth( aCurrentTab.nTabPos - 
aCurrentTab.nStartPosX - nW - nStartX );
+                rTabPortion.setWidth( aCurrentTab.nTabPos - 
aCurrentTab.nStartPosX - nW - nStartX );
                 nTmpWidth = aCurrentTab.nStartPosX + 
rTabPortion.GetSize().Width() + nWidthAfterTab;
             }
 
@@ -1578,7 +1591,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
             {
                 pLine->GetCharPosArray()[ nPosInArray ] = nNewValue;
             }
-            rTP.GetSize().AdjustWidth(n );
+            rTP.adjustSize(n, 0);
         }
 
         pLine->SetTextWidth( aTextSize.Width() );
@@ -1803,9 +1816,9 @@ void ImpEditEngine::CreateAndInsertEmptyLine( 
ParaPortion* pParaPortion )
     aTmpFont.SetPhysFont(*pRefDev);
 
     TextPortion* pDummyPortion = new TextPortion( 0 );
-    pDummyPortion->GetSize() = aTmpFont.GetPhysTxtSize( pRefDev );
+    pDummyPortion->SetSize(aTmpFont.GetPhysTxtSize(pRefDev));
     if ( IsFixedCellHeight() )
-        pDummyPortion->GetSize().setHeight( 
ImplCalculateFontIndependentLineSpacing( aTmpFont.GetFontHeight() ) );
+        pDummyPortion->setHeight( ImplCalculateFontIndependentLineSpacing( 
aTmpFont.GetFontHeight() ) );
     pParaPortion->GetTextPortions().Append(pDummyPortion);
     FormatterFontMetric aFormatterMetrics;
     RecalcFormatterFontMetrics( aFormatterMetrics, aTmpFont );
@@ -2140,7 +2153,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* 
pParaPortion, EditLine* pLine, Te
         DBG_ASSERT( rTP.GetKind() == PortionKind::TEXT, "BlankRubber: No 
TextPortion!" );
         DBG_ASSERT( nBreakPos > pLine->GetStart(), "SplitTextPortion at the 
beginning of the line?" );
         sal_Int32 nPosInArray = nBreakPos - 1 - pLine->GetStart();
-        rTP.GetSize().setWidth( ( nPosInArray && ( rTP.GetLen() > 1 ) ) ? 
pLine->GetCharPosArray()[ nPosInArray-1 ] : 0 );
+        rTP.setWidth( ( nPosInArray && ( rTP.GetLen() > 1 ) ) ? 
pLine->GetCharPosArray()[ nPosInArray-1 ] : 0 );
         if (o3tl::make_unsigned(nPosInArray) < pLine->GetCharPosArray().size())
         {
             pLine->GetCharPosArray()[ nPosInArray ] = rTP.GetSize().Width();
@@ -2159,7 +2172,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* 
pParaPortion, EditLine* pLine, Te
             pHyphPortion->SetLen( nAltDelChar );
             if (cAlternateReplChar && !bAltFullLeft) 
pHyphPortion->SetExtraValue( cAlternateReplChar );
             // Correct width of the portion above:
-            rPrev.GetSize().setWidth(
+            rPrev.setWidth(
                 pLine->GetCharPosArray()[ nBreakPos-1 - pLine->GetStart() - 
nAltDelChar ] );
         }
 
@@ -2167,8 +2180,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* 
pParaPortion, EditLine* pLine, Te
         SvxFont aFont;
         SeekCursor( pParaPortion->GetNode(), nBreakPos, aFont );
         aFont.SetPhysFont(*GetRefDevice());
-        pHyphPortion->GetSize().setHeight( GetRefDevice()->GetTextHeight() );
-        pHyphPortion->GetSize().setWidth( GetRefDevice()->GetTextWidth( 
CH_HYPH ) );
+        pHyphPortion->SetSize(Size(GetRefDevice()->GetTextHeight(), 
GetRefDevice()->GetTextWidth(CH_HYPH)));
 
         pParaPortion->GetTextPortions().Insert(++nEndPortion, pHyphPortion);
     }
@@ -2251,7 +2263,7 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* 
pParaPortion, EditLine* pLine,
             // For the last character the portion must stop behind the blank
             // => Simplify correction:
             DBG_ASSERT( ( nPortionStart + rLastPortion.GetLen() ) == ( 
nLastChar+1 ), "Blank actually not at the end of the portion!?");
-            rLastPortion.GetSize().AdjustWidth( -nBlankWidth );
+            rLastPortion.adjustSize(-nBlankWidth, 0);
             nRemainingSpace += nBlankWidth;
         }
         pLine->GetCharPosArray()[nLastChar-nFirstChar] -= nBlankWidth;
@@ -2288,9 +2300,11 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* 
pParaPortion, EditLine* pLine,
             TextPortion& rLastPortion = pParaPortion->GetTextPortions()[ 
nPortion ];
 
             // The width of the portion:
-            rLastPortion.GetSize().AdjustWidth(nMore4Everyone );
-            if ( nSomeExtraSpace )
-                rLastPortion.GetSize().AdjustWidth( 1 );
+            rLastPortion.adjustSize(nMore4Everyone, 0);
+            if (nSomeExtraSpace)
+            {
+                rLastPortion.adjustSize(1, 0);
+            }
 
             // Correct positions in array
             sal_Int32 nPortionEnd = nPortionStart + rLastPortion.GetLen();
@@ -2546,7 +2560,7 @@ sal_Int32 ImpEditEngine::SplitTextPortion( ParaPortion* 
pPortion, sal_Int32 nPos
     {
         // No new GetTextSize, instead use values from the Array:
         assert( nPos > pCurLine->GetStart() && "SplitTextPortion at the 
beginning of the line?" );
-        pTextPortion->GetSize().setWidth( pCurLine->GetCharPosArray()[ 
nPos-pCurLine->GetStart()-1 ] );
+        pTextPortion->setWidth(pCurLine->GetCharPosArray()[nPos - 
pCurLine->GetStart() - 1]);
 
         if ( pTextPortion->GetExtraInfos() && 
pTextPortion->GetExtraInfos()->bCompressed )
         {
@@ -2564,7 +2578,7 @@ sal_Int32 ImpEditEngine::SplitTextPortion( ParaPortion* 
pPortion, sal_Int32 nPos
         }
     }
     else
-        pTextPortion->GetSize().setWidth( -1 );
+        pTextPortion->setWidth(-1);
 
     return nSplitPortion;
 }
@@ -2702,7 +2716,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* 
pParaPortion, sal_Int32 nSta
                 FindPortion( nStartPos, nPortionStart );
             TextPortion& rTP = pParaPortion->GetTextPortions()[ nTP ];
             rTP.SetLen( rTP.GetLen() + nNewChars );
-            rTP.GetSize().setWidth( -1 );
+            rTP.setWidth(-1);
         }
     }
     else
@@ -2768,7 +2782,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* 
pParaPortion, sal_Int32 nSta
                     TextPortion& rPrev = 
pParaPortion->GetTextPortions()[nLastPortion - 1];
                     DBG_ASSERT( rPrev.GetKind() == PortionKind::TEXT, 
"Portion?!" );
                     rPrev.SetLen( rPrev.GetLen() + pTP->GetLen() );
-                    rPrev.GetSize().setWidth( -1 );
+                    rPrev.setWidth(-1);
                 }
                 pParaPortion->GetTextPortions().Remove( nLastPortion );
             }
@@ -4743,7 +4757,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* 
pNode,
         if ( bCompressed && ( n100thPercentFromMax == 10000 ) )
             pTextPortion->GetExtraInfos()->nWidthFullCompression = 
nNewPortionWidth;
 
-        pTextPortion->GetSize().setWidth( nNewPortionWidth );
+        pTextPortion->setWidth(nNewPortionWidth);
 
         if ( pTextPortion->GetExtraInfos() && ( n100thPercentFromMax != 10000 
) )
         {
@@ -4753,7 +4767,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* 
pNode,
             nShrink /= 10000;
             tools::Long nNewWidth = pTextPortion->GetExtraInfos()->nOrgWidth - 
nShrink;
             if ( nNewWidth < pTextPortion->GetSize().Width() )
-                pTextPortion->GetSize().setWidth( nNewWidth );
+                pTextPortion->setWidth(nNewWidth);
         }
     }
     return bCompressed;
@@ -4795,7 +4809,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( 
EditLine* pLine, ParaPortion*
     {
         pTP = pTP2;
         pTP->GetExtraInfos()->bCompressed = false;
-        pTP->GetSize().setWidth( pTP->GetExtraInfos()->nOrgWidth );
+        pTP->setWidth(pTP->GetExtraInfos()->nOrgWidth);
         if ( nCompressPercent )
         {
             sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( 
pTP );
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index 9911beec85b0..0f29473d630a 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -477,9 +477,13 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut )
 Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
                          const sal_Int32 nIdx, const sal_Int32 nLen, 
std::vector<sal_Int32>* pDXArray ) const
 {
-    if ( !IsCaseMap() && !IsFixKerning() )
-        return Size( GetTextArray( pOut, rTxt, pDXArray, nIdx, nLen ),
-                     pOut->GetTextHeight() );
+    if (!IsCaseMap() && !IsFixKerning())
+    {
+        printf ("SvxFont TextHeight %ld\n", pOut->GetTextHeight());
+        auto nWidth = GetTextArray(pOut, rTxt, pDXArray, nIdx, nLen);
+        auto nHeight = pOut->GetTextHeight();
+        return Size(nWidth, nHeight);
+    }
 
     std::vector<sal_Int32>  aDXArray;
 
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 53b32ddf28b2..b37dfde6d891 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -199,6 +199,7 @@ SdrTextObj::~SdrTextObj()
 
 void SdrTextObj::FitFrameToTextSize()
 {
+    printf ("FitFrameToTextSize\n");
     ImpJustifyRect(maRect);
 
     SdrText* pText = getActiveText();
@@ -866,6 +867,8 @@ std::optional<OutlinerParaObject> 
SdrTextObj::CreateEditOutlinerParaObject() con
 
 void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& 
rTextSize, const Size& rShapeSize, Fraction& rFitXCorrection)
 {
+    printf ("SdrTextObj::ImpSetCharStretching\n");
+
     OutputDevice* pOut = rOutliner.GetRefDevice();
     bool bNoStretching(false);
 
commit a5af83c18580e03cbe534d9b65e632b87d70d36f
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Thu Oct 13 10:12:27 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Mon Oct 17 21:48:11 2022 +0200

    add division of length units to LengthUnitBase
    
    Reult of division of 2 length units is a ratio (double).
    
    Change-Id: I3d0e605492ca0af93580de138b5bc0c3e7877fa5

diff --git a/basegfx/test/LengthUnitTest.cxx b/basegfx/test/LengthUnitTest.cxx
index 8861a2ade316..11095f3222b5 100644
--- a/basegfx/test/LengthUnitTest.cxx
+++ b/basegfx/test/LengthUnitTest.cxx
@@ -32,11 +32,6 @@ public:
         CPPUNIT_ASSERT_EQUAL(sal_Int64(34200000000), cm3.raw());
         CPPUNIT_ASSERT_DOUBLES_EQUAL(95000.0, cm3.as_cm(), 1e-4);
 
-        gfx::Length cm4(1_cm);
-        cm4 /= 2;
-        CPPUNIT_ASSERT_EQUAL(sal_Int64(180000), cm4.raw());
-        CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5, cm4.as_cm(), 1e-4);
-
         // (635 * 20) + 3 * (635 * 15) = 41275EMU
         gfx::Length pt = 1_pt + 3_px;
         CPPUNIT_ASSERT_DOUBLES_EQUAL(3.25, pt.as_pt(), 1e-4);
@@ -92,6 +87,23 @@ public:
         CPPUNIT_ASSERT_EQUAL(sal_Int64(3636), bb.raw());
     }
 
+    void testDivision()
+    {
+        gfx::Length cm(1_cm);
+        cm /= 2;
+        CPPUNIT_ASSERT_EQUAL(sal_Int64(180000), cm.raw());
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5, cm.as_cm(), 1e-4);
+
+        gfx::Length cm4(1_cm);
+        cm4 /= 2.0;
+        CPPUNIT_ASSERT_EQUAL(sal_Int64(180000), cm4.raw());
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5, cm4.as_cm(), 1e-4);
+
+        // with division of 2 length units you get a ratio
+        double aRatio = gfx::Length::hmm(10) / gfx::Length::hmm(20);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5, aRatio, 1e-9);
+    }
+
     void testInRange()
     {
         gfx::Range2DL aRange(1_cm, 2_cm, 2_cm, 30_mm);
@@ -159,6 +171,7 @@ public:
 
     CPPUNIT_TEST_SUITE(LengthTest);
     CPPUNIT_TEST(testBasic);
+    CPPUNIT_TEST(testDivision);
     CPPUNIT_TEST(testInRange);
     CPPUNIT_TEST(testInTuple);
     CPPUNIT_TEST(testConversionToRectanle);
diff --git a/include/basegfx/units/LengthUnitBase.hxx 
b/include/basegfx/units/LengthUnitBase.hxx
index c1d8a8e8e431..30daccef8015 100644
--- a/include/basegfx/units/LengthUnitBase.hxx
+++ b/include/basegfx/units/LengthUnitBase.hxx
@@ -173,14 +173,25 @@ inline LengthUnitBase<T> operator-(LengthUnitBase<T> lhs, 
const LengthUnitBase<T
     return lhs -= rhs;
 }
 
+/// Multiplication of a length unit with a scalar value.
+/// example 1cm * 2 = 2cm
 template <typename T> inline LengthUnitBase<T> operator*(LengthUnitBase<T> 
lhs, const long rhs)
 {
     return lhs *= rhs;
 }
 
+/// Division of a length unit with a scalar value.
+/// example 1cm / 2 = 0.5cm
 template <typename T> inline LengthUnitBase<T> operator/(LengthUnitBase<T> 
lhs, const long rhs)
 {
     return lhs /= rhs;
 }
 
+/// Division of 2 length units, which results in a ratio.
+/// example 1cm / 2cm = 0.5
+template <typename T> inline double operator/(LengthUnitBase<T> lhs, const 
LengthUnitBase<T> rhs)
+{
+    return lhs.raw() / double(rhs.raw());
+}
+
 } // end namespace gfx
commit 6503ed67696754feaf3ba88f9992347aeae67410
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: Mon Oct 17 21:48:11 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 1aaed9622fa3..565996518874 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -444,8 +444,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(),
@@ -499,8 +499,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 83033715d2b4..c97952c239c2 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 c7dd8a0cfa30..1a1ac33217ac 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 fe5bfdb3fba5..39ebdf0afbc6 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(),

... etc. - the rest is truncated

Reply via email to