[Libreoffice-commits] core.git: basctl/source canvas/source cppcanvas/source cui/source drawinglayer/source emfio/source filter/source sc/source slideshow/source svx/source sw/source vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed May 8 10:43:56 UTC 2019


 basctl/source/dlged/dlgedview.cxx                         |    5 -
 canvas/source/vcl/canvashelper_texturefill.cxx            |    5 -
 cppcanvas/source/mtfrenderer/implrenderer.cxx             |   47 ++++++--------
 cppcanvas/source/mtfrenderer/mtftools.cxx                 |    7 --
 cui/source/tabpages/transfrm.cxx                          |   11 +--
 drawinglayer/source/primitive2d/metafileprimitive2d.cxx   |    3 
 drawinglayer/source/primitive2d/textlayoutdevice.cxx      |    5 -
 drawinglayer/source/tools/wmfemfhelper.cxx                |   21 ++----
 emfio/source/reader/mtftools.cxx                          |    6 -
 filter/source/pdf/pdfexport.cxx                           |    5 -
 sc/source/core/data/drwlayer.cxx                          |    3 
 sc/source/ui/view/gridwin.cxx                             |    5 -
 slideshow/source/engine/shapes/gdimtftools.cxx            |    8 +-
 svx/source/dialog/framelinkarray.cxx                      |    5 -
 svx/source/dialog/pagectrl.cxx                            |   13 ---
 svx/source/sdr/contact/objectcontactofpageview.cxx        |    9 --
 svx/source/sdr/contact/viewcontactofgraphic.cxx           |    6 -
 svx/source/sdr/contact/viewcontactofgroup.cxx             |    6 -
 svx/source/sdr/contact/viewcontactofpageobj.cxx           |    3 
 svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx     |    5 -
 svx/source/sdr/contact/viewcontactofsdrcircobj.cxx        |    6 -
 svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx       |    5 -
 svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx |   11 +--
 svx/source/sdr/contact/viewcontactofsdrole2obj.cxx        |    5 -
 svx/source/sdr/contact/viewcontactofsdrpathobj.cxx        |    5 -
 svx/source/sdr/contact/viewcontactofsdrrectobj.cxx        |    5 -
 svx/source/sdr/contact/viewcontactofunocontrol.cxx        |    6 -
 svx/source/sdr/contact/viewobjectcontactofpageobj.cxx     |    5 -
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx  |    8 --
 svx/source/sdr/overlay/overlaymanager.cxx                 |    5 -
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx       |    5 -
 svx/source/svdraw/gradtrns.cxx                            |    5 -
 svx/source/svdraw/svddrgmt.cxx                            |    5 -
 svx/source/svdraw/svdedxv.cxx                             |    9 +-
 svx/source/svdraw/svdfmtf.cxx                             |    7 --
 svx/source/svdraw/svdobj.cxx                              |    7 --
 svx/source/svdraw/svdocapt.cxx                            |    3 
 svx/source/svdraw/svdocirc.cxx                            |    3 
 svx/source/svdraw/svdogrp.cxx                             |    3 
 svx/source/svdraw/svdotxdr.cxx                            |    3 
 svx/source/table/svdotable.cxx                            |    2 
 svx/source/table/tablehandles.cxx                         |    2 
 svx/source/table/viewcontactoftableobj.cxx                |   11 ---
 sw/source/core/draw/dflyobj.cxx                           |    3 
 sw/source/core/view/vdraw.cxx                             |    3 
 sw/source/uibase/docvw/HeaderFooterWin.cxx                |    5 -
 sw/source/uibase/docvw/PageBreakWin.cxx                   |    4 -
 vcl/source/gdi/gdimetafiletools.cxx                       |   17 +----
 vcl/source/gdi/pdfextoutdevdata.cxx                       |    4 -
 vcl/source/gdi/pdfwriter_impl.cxx                         |    3 
 vcl/source/gdi/region.cxx                                 |   11 +--
 vcl/source/helper/canvastools.cxx                         |   22 ++++--
 vcl/source/outdev/bitmap.cxx                              |   15 ++--
 53 files changed, 176 insertions(+), 215 deletions(-)

New commits:
commit d0119ff7f2c68aa05286bd303128f3a69c6bbd6a
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon May 6 11:33:41 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed May 8 12:42:53 2019 +0200

    improve tools::Rectangle->basegfx::B2?Rectangle conversion
    
    Improve the conversion method to do something reasonable with
    empty Rectangle.
    Use the conversion method in more places.
    
    Change-Id: I48c13f3d6dae71f39f03f7939101e545c8125503
    Reviewed-on: https://gerrit.libreoffice.org/71853
    Tested-by: Jenkins
    Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/basctl/source/dlged/dlgedview.cxx b/basctl/source/dlged/dlgedview.cxx
index e8c28ea017df..c098cb0c1cc0 100644
--- a/basctl/source/dlged/dlgedview.cxx
+++ b/basctl/source/dlged/dlgedview.cxx
@@ -23,6 +23,7 @@
 
 #include <svx/svxids.hrc>
 #include <sfx2/viewfrm.hxx>
+#include <vcl/canvastools.hxx>
 
 #include <basidesh.hxx>
 #include <iderdll.hxx>
@@ -150,9 +151,7 @@ static SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, s
 
             if(!aOuterRectangle.IsEmpty())
             {
-                basegfx::B2DRange aOuterRange(
-                    aOuterRectangle.Left(), aOuterRectangle.Top(),
-                    aOuterRectangle.Right(), aOuterRectangle.Bottom());
+                basegfx::B2DRange aOuterRange = vcl::unotools::b2DRectangleFromRectangle(aOuterRectangle);
 
                 if(nTol)
                 {
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index ddedf22ce205..32c125e09541 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -146,7 +146,7 @@ namespace vclcanvas
                                                              aLeftBottom,
                                                              aRightTop,
                                                              aRightBottom,
-                                                             vcl::unotools::b2DRectangleFromRectangle( rBounds ) );
+                                                             vcl::unotools::b2DRectangleFromRectangle(rBounds) );
 
 
             // render gradient
@@ -813,8 +813,7 @@ namespace vclcanvas
                     // start point from it.
                     ::basegfx::B2DRectangle aTextureSpacePolygonRect;
                     ::canvas::tools::calcTransformedRectBounds( aTextureSpacePolygonRect,
-                                                                vcl::unotools::b2DRectangleFromRectangle(
-                                                                    aPolygonDeviceRect ),
+                                                                vcl::unotools::b2DRectangleFromRectangle(aPolygonDeviceRect),
                                                                 aInverseTextureTransform );
 
                     // calc left, top of extended polygon rect in
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 0b618e3ff365..241443aa39a9 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -1080,15 +1080,15 @@ namespace cppcanvas
 
                     // convert rect to polygon beforehand, must revert
                     // to general polygon clipping here.
+                    ::tools::Rectangle aRect = rState.clipRect;
+                    // #121100# VCL rectangular clips always
+                    // include one more pixel to the right
+                    // and the bottom
+                    aRect.AdjustRight(1);
+                    aRect.AdjustBottom(1);
                     rState.clip = ::basegfx::B2DPolyPolygon(
                         ::basegfx::utils::createPolygonFromRect(
-                            // #121100# VCL rectangular clips always
-                            // include one more pixel to the right
-                            // and the bottom
-                            ::basegfx::B2DRectangle( rState.clipRect.Left(),
-                                                     rState.clipRect.Top(),
-                                                     rState.clipRect.Right()+1,
-                                                     rState.clipRect.Bottom()+1 ) ) );
+                            vcl::unotools::b2DRectangleFromRectangle(aRect) ) );
                 }
 
                 // AW: Simplified
@@ -1108,17 +1108,17 @@ namespace cppcanvas
                 }
                 else
                 {
+                    ::tools::Rectangle aRect = rState.clipRect;
+                    // #121100# VCL rectangular clips
+                    // always include one more pixel to
+                    // the right and the bottom
+                    aRect.AdjustRight(1);
+                    aRect.AdjustBottom(1);
                     rState.xClipPoly = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
                         rParms.mrCanvas->getUNOCanvas()->getDevice(),
                         ::basegfx::B2DPolyPolygon(
                             ::basegfx::utils::createPolygonFromRect(
-                                // #121100# VCL rectangular clips
-                                // always include one more pixel to
-                                // the right and the bottom
-                                ::basegfx::B2DRectangle( rState.clipRect.Left(),
-                                                         rState.clipRect.Top(),
-                                                         rState.clipRect.Right()+1,
-                                                         rState.clipRect.Bottom()+1 ) ) ) );
+                                vcl::unotools::b2DRectangleFromRectangle(aRect) ) ) );
                 }
             }
             else
@@ -1165,10 +1165,7 @@ namespace cppcanvas
                 // to general polygon clipping here.
                 ::basegfx::B2DPolyPolygon aClipPoly(
                     ::basegfx::utils::createPolygonFromRect(
-                        ::basegfx::B2DRectangle( rClipRect.Left(),
-                                                 rClipRect.Top(),
-                                                 rClipRect.Right(),
-                                                 rClipRect.Bottom() ) ) );
+                        vcl::unotools::b2DRectangleFromRectangle(rClipRect) ) );
 
                 rState.clipRect.SetEmpty();
 
@@ -1185,17 +1182,17 @@ namespace cppcanvas
                 }
                 else
                 {
+                    // #121100# VCL rectangular clips
+                    // always include one more pixel to
+                    // the right and the bottom
+                    ::tools::Rectangle aRect = rState.clipRect;
+                    aRect.AdjustRight(1);
+                    aRect.AdjustBottom(1);
                     rState.xClipPoly = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
                         rParms.mrCanvas->getUNOCanvas()->getDevice(),
                         ::basegfx::B2DPolyPolygon(
                             ::basegfx::utils::createPolygonFromRect(
-                                // #121100# VCL rectangular clips
-                                // always include one more pixel to
-                                // the right and the bottom
-                                ::basegfx::B2DRectangle( rState.clipRect.Left(),
-                                                         rState.clipRect.Top(),
-                                                         rState.clipRect.Right()+1,
-                                                         rState.clipRect.Bottom()+1 ) ) ) );
+                                vcl::unotools::b2DRectangleFromRectangle(aRect) ) ) );
                 }
             }
             else
diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx
index bd1fac905f3f..1a561631939d 100644
--- a/cppcanvas/source/mtfrenderer/mtftools.cxx
+++ b/cppcanvas/source/mtfrenderer/mtftools.cxx
@@ -28,6 +28,7 @@
 #include <basegfx/range/b2drectangle.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 #include <canvas/canvastools.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/metaact.hxx>
 #include <vcl/virdev.hxx>
@@ -169,11 +170,7 @@ namespace cppcanvas
                     // then transform that
                     ::basegfx::B2DPolygon aLocalClip(
                         ::basegfx::utils::createPolygonFromRect(
-                                ::basegfx::B2DRectangle(
-                                    static_cast<double>(aLocalClipRect.Left()),
-                                    static_cast<double>(aLocalClipRect.Top()),
-                                    static_cast<double>(aLocalClipRect.Right()),
-                                    static_cast<double>(aLocalClipRect.Bottom()) ) ) );
+                                    vcl::unotools::b2DRectangleFromRectangle(aLocalClipRect) ) );
                     ::basegfx::B2DHomMatrix aTransform;
 
                     if( bOffsetting )
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 76d10ee63c5c..9adcea111d85 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -45,6 +45,7 @@
 #include <svl/aeitem.hxx>
 #include <swpossizetabpage.hxx>
 #include <comphelper/lok.hxx>
+#include <vcl/canvastools.hxx>
 
 // static ----------------------------------------------------------------
 
@@ -236,7 +237,7 @@ void SvxAngleTabPage::Construct()
     { // #i75273#
         ::tools::Rectangle aTempRect(pView->GetAllMarkedRect());
         pView->GetSdrPageView()->LogicToPagePos(aTempRect);
-        maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+        maRange = vcl::unotools::b2DRectangleFromRectangle(aTempRect);
     }
 
     // Take anchor into account (Writer)
@@ -857,13 +858,13 @@ void SvxPositionSizeTabPage::Construct()
     { // #i75273#
         ::tools::Rectangle aTempRect(mpView->GetAllMarkedRect());
         mpView->GetSdrPageView()->LogicToPagePos(aTempRect);
-        maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+        maRange = vcl::unotools::b2DRectangleFromRectangle(aTempRect);
     }
 
     { // #i75273#
         ::tools::Rectangle aTempRect(mpView->GetWorkArea());
         mpView->GetSdrPageView()->LogicToPagePos(aTempRect);
-        maWorkRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+        maWorkRange = vcl::unotools::b2DRectangleFromRectangle(aTempRect);
     }
 
     // take anchor into account (Writer)
@@ -958,7 +959,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
             { // #i75273#
                 ::tools::Rectangle aTempRect(mpView->GetAllMarkedRect());
                 mpView->GetSdrPageView()->LogicToPagePos(aTempRect);
-                maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+                maRange = vcl::unotools::b2DRectangleFromRectangle(aTempRect);
             }
 
             // #101581# GetTopLeftPosition(...) needs coordinates after UI scaling, in real PagePositions
@@ -1180,7 +1181,7 @@ void SvxPositionSizeTabPage::ActivatePage( const SfxItemSet& rSet )
     {
         { // #i75273#
             const ::tools::Rectangle aTempRect(pRectItem->GetValue());
-            maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom());
+            maRange = vcl::unotools::b2DRectangleFromRectangle(aTempRect);
         }
 
         SetMinMaxPosition();
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 5b8436c4a813..2fee158baa93 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -24,6 +24,7 @@
 #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
 #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+#include <vcl/canvastools.hxx>
 
 using namespace com::sun::star;
 
@@ -41,7 +42,7 @@ namespace drawinglayer
             {
                 // get target size
                 const ::tools::Rectangle aMtfTarget(getMetaFile().GetPrefMapMode().GetOrigin(), getMetaFile().GetPrefSize());
-                const basegfx::B2DRange aMtfRange(aMtfTarget.Left(), aMtfTarget.Top(), aMtfTarget.Right(), aMtfTarget.Bottom());
+                const basegfx::B2DRange aMtfRange(vcl::unotools::b2DRectangleFromRectangle(aMtfTarget));
 
                 // tdf#113197 get content range and check if we have an overlap with
                 // defined target range (aMtfRange)
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 132b98f0921f..9740469ba304 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -25,6 +25,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/unique_disposing_ptr.hxx>
 #include <tools/gen.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/timer.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/font.hxx>
@@ -303,9 +304,7 @@ namespace drawinglayer
                 // #i104432#, #i102556# take empty results into account
                 if(!aRect.IsEmpty())
                 {
-                    return basegfx::B2DRange(
-                        aRect.Left(), aRect.Top(),
-                        aRect.Right(), aRect.Bottom());
+                    return vcl::unotools::b2DRectangleFromRectangle(aRect);
                 }
             }
 
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index 40ce19383f50..5669202d40cd 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -46,6 +46,7 @@
 #include <sal/log.hxx>
 #include <tools/fract.hxx>
 #include <tools/stream.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/gradient.hxx>
 #include <vcl/hatch.hxx>
 #include <vcl/outdev.hxx>
@@ -1016,9 +1017,7 @@ namespace wmfemfhelper
         // use wallpaper rect if set
         if(rWallpaper.IsRect() && !rWallpaper.GetRect().IsEmpty())
         {
-            aWallpaperRange = basegfx::B2DRange(
-                rWallpaper.GetRect().Left(), rWallpaper.GetRect().Top(),
-                rWallpaper.GetRect().Right(), rWallpaper.GetRect().Bottom());
+            aWallpaperRange = vcl::unotools::b2DRectangleFromRectangle(rWallpaper.GetRect());
         }
 
         drawinglayer::primitive2d::BasePrimitive2D* pBitmapWallpaperFill =
@@ -1611,7 +1610,7 @@ namespace wmfemfhelper
 
                         if(!rRectangle.IsEmpty())
                         {
-                            const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+                            const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(rRectangle);
 
                             if(!aRange.isEmpty())
                             {
@@ -1638,7 +1637,7 @@ namespace wmfemfhelper
 
                         if(!rRectangle.IsEmpty())
                         {
-                            const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+                            const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(rRectangle);
 
                             if(!aRange.isEmpty())
                             {
@@ -1677,7 +1676,7 @@ namespace wmfemfhelper
 
                         if(!rRectangle.IsEmpty())
                         {
-                            const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+                            const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(rRectangle);
 
                             if(!aRange.isEmpty())
                             {
@@ -2118,7 +2117,7 @@ namespace wmfemfhelper
 
                     if(!rRectangle.IsEmpty())
                     {
-                        basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+                        basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(rRectangle);
 
                         if(!aRange.isEmpty())
                         {
@@ -2210,9 +2209,7 @@ namespace wmfemfhelper
                     {
                         const Wallpaper& rWallpaper = pA->GetWallpaper();
                         const WallpaperStyle eWallpaperStyle(rWallpaper.GetStyle());
-                        basegfx::B2DRange aWallpaperRange(
-                            aWallpaperRectangle.Left(), aWallpaperRectangle.Top(),
-                            aWallpaperRectangle.Right(), aWallpaperRectangle.Bottom());
+                        basegfx::B2DRange aWallpaperRange = vcl::unotools::b2DRectangleFromRectangle(aWallpaperRectangle);
 
                         if(WallpaperStyle::NONE != eWallpaperStyle)
                         {
@@ -2290,9 +2287,7 @@ namespace wmfemfhelper
                     else
                     {
                         // create transformed ClipRange
-                        basegfx::B2DRange aClipRange(
-                            rRectangle.Left(), rRectangle.Top(),
-                            rRectangle.Right(), rRectangle.Bottom());
+                        basegfx::B2DRange aClipRange = vcl::unotools::b2DRectangleFromRectangle(rRectangle);
 
                         aClipRange.transform(rPropertyHolders.Current().getTransformation());
 
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 7ffc9c62bafb..b29b0185ff1e 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -73,14 +73,12 @@ namespace emfio
 
     void WinMtfClipPath::intersectClipRect( const tools::Rectangle& rRect )
     {
-        maClip.intersectRange(
-            vcl::unotools::b2DRectangleFromRectangle(rRect));
+        maClip.intersectRange(vcl::unotools::b2DRectangleFromRectangle(rRect));
     }
 
     void WinMtfClipPath::excludeClipRect( const tools::Rectangle& rRect )
     {
-        maClip.subtractRange(
-            vcl::unotools::b2DRectangleFromRectangle(rRect));
+        maClip.subtractRange(vcl::unotools::b2DRectangleFromRectangle(rRect));
     }
 
     void WinMtfClipPath::setClipPath( const tools::PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode )
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 87d07e7d7be5..9753f208b9c4 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -24,6 +24,7 @@
 #include <tools/fract.hxx>
 #include <tools/poly.hxx>
 #include <unotools/resmgr.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/mapmod.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/metaact.hxx>
@@ -1071,8 +1072,8 @@ void PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData&
     aCtx.m_nJPEGQuality             = mnQuality;
 
 
-    basegfx::B2DRectangle aB2DRect( aPageRect.Left(), aPageRect.Top(), aPageRect.Right(), aPageRect.Bottom() );
-    rWriter.SetClipRegion( basegfx::B2DPolyPolygon( basegfx::utils::createPolygonFromRect( aB2DRect ) ) );
+    rWriter.SetClipRegion( basegfx::B2DPolyPolygon(
+        basegfx::utils::createPolygonFromRect( vcl::unotools::b2DRectangleFromRectangle(aPageRect) ) ) );
 
     rWriter.PlayMetafile( aMtf, aCtx, &rPDFExtOutDevData );
 
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 985267b8929d..5e515c80abd9 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -43,6 +43,7 @@
 #include <editeng/scriptspaceitem.hxx>
 #include <sfx2/objsh.hxx>
 #include <svl/itempool.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <tools/globname.hxx>
@@ -761,7 +762,7 @@ void ScDrawLayer::ResizeLastRectFromAnchor(const SdrObject* pObj, ScDrawObjData&
                     aChange.translate(aCurrentCellRect.getX(), aCurrentCellRect.getY());
 
                     // create B2DRange and transform by prepared scale
-                    basegfx::B2DRange aNewRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
+                    basegfx::B2DRange aNewRange = vcl::unotools::b2DRectangleFromRectangle(aRect);
 
                     aNewRange.transform(aChange);
 
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index a35b654f3d73..926a3e2b710e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -40,6 +40,7 @@
 #include <svl/stritem.hxx>
 #include <svl/urlbmk.hxx>
 #include <svl/sharedstringpool.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/cursor.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/hatch.hxx>
@@ -5845,7 +5846,7 @@ void ScGridWindow::UpdateCopySourceOverlay()
         Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
 
         tools::Rectangle aLogic = PixelToLogic(aRect, aDrawMode);
-        ::basegfx::B2DRange aRange(aLogic.Left(), aLogic.Top(), aLogic.Right(), aLogic.Bottom());
+        ::basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aLogic);
         std::unique_ptr<ScOverlayDashedBorder> pDashedBorder(new ScOverlayDashedBorder(aRange, aHighlight));
         xOverlayManager->add(*pDashedBorder);
         mpOOSelectionBorder->append(std::move(pDashedBorder));
@@ -6224,7 +6225,7 @@ void ScGridWindow::UpdateAutoFillOverlay()
                 aHandleColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor;
             std::vector< basegfx::B2DRange > aRanges;
             const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
-            basegfx::B2DRange aRB(aFillRect.Left(), aFillRect.Top(), aFillRect.Right(), aFillRect.Bottom());
+            basegfx::B2DRange aRB = vcl::unotools::b2DRectangleFromRectangle(aFillRect);
 
             aRB.transform(aTransform);
             aRanges.push_back(aRB);
diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx
index f3159a728475..6a535b1e9777 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -414,16 +414,16 @@ bool getRectanglesFromScrollMtf( ::basegfx::B2DRectangle&       o_rScrollRect,
                 if (pAct->GetComment().equalsIgnoreAsciiCase("XTEXT_SCROLLRECT"))
                 {
                     o_rScrollRect = vcl::unotools::b2DRectangleFromRectangle(
-                        *reinterpret_cast<tools::Rectangle const *>(
-                            pAct->GetData() ) );
+                                        *reinterpret_cast<tools::Rectangle const *>(
+                                            pAct->GetData() ));
 
                     bScrollRectSet = true;
                 }
                 else if (pAct->GetComment().equalsIgnoreAsciiCase("XTEXT_PAINTRECT") )
                 {
                     o_rPaintRect = vcl::unotools::b2DRectangleFromRectangle(
-                        *reinterpret_cast<tools::Rectangle const *>(
-                            pAct->GetData() ) );
+                                        *reinterpret_cast<tools::Rectangle const *>(
+                                            pAct->GetData() ));
 
                     bPaintRectSet = true;
                 }
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index 9185e49ecd22..e0a2e93b9376 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -24,6 +24,7 @@
 #include <set>
 #include <algorithm>
 #include <tools/debug.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/outdev.hxx>
 #include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
 #include <svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx>
@@ -872,7 +873,7 @@ basegfx::B2DRange Array::GetCellRange( size_t nCol, size_t nRow, bool bExpandMer
             aRect.AdjustBottom(rCell.mnAddBottom );
         }
 
-        return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
+        return vcl::unotools::b2DRectangleFromRectangle(aRect);
     }
     else
     {
@@ -880,7 +881,7 @@ basegfx::B2DRange Array::GetCellRange( size_t nCol, size_t nRow, bool bExpandMer
         const Size aSize( GetColWidth( nCol, nCol ) + 1, GetRowHeight( nRow, nRow ) + 1 );
         const tools::Rectangle aRect(aPoint, aSize);
 
-        return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
+        return vcl::unotools::b2DRectangleFromRectangle(aRect);
     }
 }
 
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index 56f4216ff298..d7b100253d0a 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -19,6 +19,7 @@
 
 #include <memory>
 #include <vcl/bitmap.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/settings.hxx>
 #include <tools/fract.hxx>
 #include <editeng/frmdiritem.hxx>
@@ -325,21 +326,13 @@ void SvxPageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext,
                                        const tools::Rectangle& rPaintRange,
                                        const tools::Rectangle& rDefineRange)
 {
-    const basegfx::B2DRange aPaintRange(
-        rPaintRange.Left(),
-        rPaintRange.Top(),
-        rPaintRange.Right(),
-        rPaintRange.Bottom());
+    const basegfx::B2DRange aPaintRange = vcl::unotools::b2DRectangleFromRectangle(rPaintRange);
 
     if(!aPaintRange.isEmpty() &&
        !basegfx::fTools::equalZero(aPaintRange.getWidth()) &&
        !basegfx::fTools::equalZero(aPaintRange.getHeight()))
     {
-        const basegfx::B2DRange aDefineRange(
-            rDefineRange.Left(),
-            rDefineRange.Top(),
-            rDefineRange.Right(),
-            rDefineRange.Bottom());
+        const basegfx::B2DRange aDefineRange = vcl::unotools::b2DRectangleFromRectangle(rDefineRange);
 
         // prepare primitive sequence
         drawinglayer::primitive2d::Primitive2DContainer aSequence;
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index 92b0153f072d..3bda11b111f6 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -37,6 +37,7 @@
 #include <drawinglayer/processor2d/processor2dtools.hxx>
 #include <svx/unoapi.hxx>
 #include <unotools/configmgr.hxx>
+#include <vcl/canvastools.hxx>
 #include <comphelper/lok.hxx>
 
 #include <eventhandler.hxx>
@@ -179,9 +180,7 @@ namespace sdr
                     //           export, so why not do it always
                     const tools::Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect());
 
-                    aViewRange = basegfx::B2DRange(
-                        aLogicClipRectangle.Left(), aLogicClipRectangle.Top(),
-                        aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom());
+                    aViewRange = vcl::unotools::b2DRectangleFromRectangle(aLogicClipRectangle);
                 }
             }
             else
@@ -193,9 +192,7 @@ namespace sdr
                 {
                     // get logic clip range and create discrete one
                     const tools::Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect());
-                    basegfx::B2DRange aLogicClipRange(
-                        aLogicClipRectangle.Left(), aLogicClipRectangle.Top(),
-                        aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom());
+                    basegfx::B2DRange aLogicClipRange = vcl::unotools::b2DRectangleFromRectangle(aLogicClipRectangle);
                     basegfx::B2DRange aDiscreteClipRange(aLogicClipRange);
                     aDiscreteClipRange.transform(rTargetOutDev.GetViewTransformation());
 
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 2892b3e63eff..80b575585db9 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -29,6 +29,7 @@
 #include <svx/sdr/contact/objectcontact.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <sdr/primitive2d/sdrgrafprimitive2d.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
@@ -310,10 +311,7 @@ namespace sdr
 
             // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect()
             // which will use the primitive data we just create in the near future
-            const tools::Rectangle aRectangle(GetGrafObject().GetGeoRect());
-            const ::basegfx::B2DRange aObjectRange(
-                aRectangle.Left(), aRectangle.Top(),
-                aRectangle.Right(), aRectangle.Bottom());
+            const ::basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(GetGrafObject().GetGeoRect());
 
             // look for mirroring
             const GeoStat& rGeoStat(GetGrafObject().GetGeoStat());
diff --git a/svx/source/sdr/contact/viewcontactofgroup.cxx b/svx/source/sdr/contact/viewcontactofgroup.cxx
index 3aa1b9302b08..46561001adf7 100644
--- a/svx/source/sdr/contact/viewcontactofgroup.cxx
+++ b/svx/source/sdr/contact/viewcontactofgroup.cxx
@@ -28,6 +28,7 @@
 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
 #include <tools/debug.hxx>
+#include <vcl/canvastools.hxx>
 
 
 namespace sdr
@@ -72,10 +73,7 @@ namespace sdr
             else
             {
                 // append an invisible outline for the cases where no visible content exists
-                const tools::Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect());
-                const basegfx::B2DRange aCurrentRange(
-                    aCurrentBoundRect.Left(), aCurrentBoundRect.Top(),
-                    aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom());
+                const basegfx::B2DRange aCurrentRange = vcl::unotools::b2DRectangleFromRectangle(GetSdrObjGroup().GetLastBoundRect());
 
                 const drawinglayer::primitive2d::Primitive2DReference xReference(
                     drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
diff --git a/svx/source/sdr/contact/viewcontactofpageobj.cxx b/svx/source/sdr/contact/viewcontactofpageobj.cxx
index a79c8e70c073..3032bfdb95a1 100644
--- a/svx/source/sdr/contact/viewcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofpageobj.cxx
@@ -20,6 +20,7 @@
 #include <svx/sdr/contact/viewcontactofpageobj.hxx>
 #include <svx/svdopage.hxx>
 #include <svx/sdr/contact/displayinfo.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/outdev.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/svdpage.hxx>
@@ -70,7 +71,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfPageObj::createView
     // create a replacement graphic visualisation here. Use GetLastBoundRect to access the model data directly
     // which is aOutRect for SdrPageObj.
     const tools::Rectangle aModelRectangle(GetPageObj().GetLastBoundRect());
-    const basegfx::B2DRange aModelRange(aModelRectangle.Left(), aModelRectangle.Top(), aModelRectangle.Right(), aModelRectangle.Bottom());
+    const basegfx::B2DRange aModelRange = vcl::unotools::b2DRectangleFromRectangle(aModelRectangle);
     const basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(aModelRange));
     const basegfx::BColor aYellow(1.0, 1.0, 0.0);
     const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow));
diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
index 8fe42c1fa6de..83aab2dfc687 100644
--- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
@@ -35,6 +35,7 @@
 #include <basegfx/polygon/b2dpolygontools.hxx>
 #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
 #include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <vcl/canvastools.hxx>
 
 using namespace com::sun::star;
 
@@ -64,9 +65,7 @@ namespace sdr
 
             // take unrotated snap rect (direct model data) for position and size
             const tools::Rectangle aRectangle(rCaptionObj.GetGeoRect());
-            const ::basegfx::B2DRange aObjectRange(
-                aRectangle.Left(), aRectangle.Top(),
-                aRectangle.Right(), aRectangle.Bottom());
+            const ::basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aRectangle);
             const GeoStat& rGeoStat(rCaptionObj.GetGeoStat());
 
             // fill object matrix
diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
index 8d796643386d..6b1253d57ee0 100644
--- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
@@ -25,6 +25,7 @@
 #include <svl/itemset.hxx>
 #include <svx/sxciaitm.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <vcl/canvastools.hxx>
 
 
 namespace sdr
@@ -50,10 +51,7 @@ namespace sdr
                     false));
 
             // take unrotated snap rect (direct model data) for position and size
-            const tools::Rectangle aRectangle(GetCircObj().GetGeoRect());
-            const basegfx::B2DRange aObjectRange(
-                aRectangle.Left(), aRectangle.Top(),
-                aRectangle.Right(), aRectangle.Bottom() );
+            const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(GetCircObj().GetGeoRect());
             const GeoStat& rGeoStat(GetCircObj().GetGeoStat());
 
             // fill object matrix
diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
index bda8a934109f..80373d8df122 100644
--- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
@@ -23,6 +23,7 @@
 #include <sdr/contact/viewobjectcontactofsdrmediaobj.hxx>
 #include <drawinglayer/primitive2d/mediaprimitive2d.hxx>
 #include <avmedia/mediawindow.hxx>
+#include <vcl/canvastools.hxx>
 
 namespace sdr { namespace contact {
 
@@ -101,9 +102,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrMediaObj::create
     // create range using the model data directly. This is in SdrTextObj::aRect which i will access using
     // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM.
     const tools::Rectangle aRectangle(GetSdrMediaObj().GetGeoRect());
-    const basegfx::B2DRange aRange(
-        aRectangle.Left(), aRectangle.Top(),
-        aRectangle.Right(), aRectangle.Bottom());
+    const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aRectangle);
 
     // create object transform
     basegfx::B2DHomMatrix aTransform;
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 5c4bb784c515..c4af096a0d13 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -28,6 +28,7 @@
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <svx/obj3d.hxx>
 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <vcl/canvastools.hxx>
 
 
 namespace sdr
@@ -48,10 +49,8 @@ namespace sdr
             const tools::Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
             tools::Rectangle aTextBound(aObjectBound);
             GetCustomShapeObj().GetTextBounds(aTextBound);
-            basegfx::B2DRange aTextRange(aTextBound.Left(), aTextBound.Top(), aTextBound.Right(), aTextBound.Bottom());
-            const basegfx::B2DRange aObjectRange(
-                aObjectBound.Left(), aObjectBound.Top(),
-                aObjectBound.Right(), aObjectBound.Bottom());
+            basegfx::B2DRange aTextRange = vcl::unotools::b2DRectangleFromRectangle(aTextBound);
+            const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aObjectBound);
 
             // no need to correct if no extra text range
             if(aTextRange != aObjectRange)
@@ -151,9 +150,7 @@ namespace sdr
                     // take unrotated snap rect as default, then get the
                     // unrotated text box. Rotation needs to be done centered
                     const tools::Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
-                    const basegfx::B2DRange aObjectRange(
-                        aObjectBound.Left(), aObjectBound.Top(),
-                        aObjectBound.Right(), aObjectBound.Bottom());
+                    const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aObjectBound);
 
                     // #i101684# get the text range unrotated and absolute to the object range
                     const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect());
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
index 6a13aaef8682..fdd64bee1243 100644
--- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -28,6 +28,7 @@
 #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
 #include <svtools/colorcfg.hxx>
 #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/svapp.hxx>
 #include <sdr/primitive2d/sdrolecontentprimitive2d.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -61,9 +62,7 @@ basegfx::B2DHomMatrix ViewContactOfSdrOle2Obj::createObjectTransform() const
 {
     // take unrotated snap rect (direct model data) for position and size
     const tools::Rectangle aRectangle(GetOle2Obj().GetGeoRect());
-    const basegfx::B2DRange aObjectRange(
-        aRectangle.Left(), aRectangle.Top(),
-        aRectangle.Right(), aRectangle.Bottom());
+    const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aRectangle);
 
     // create object matrix
     const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat());
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index 28942f7b04de..082abb6a0e27 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -27,6 +27,7 @@
 #include <sdr/primitive2d/sdrpathprimitive2d.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
+#include <vcl/canvastools.hxx>
 
 namespace sdr
 {
@@ -177,9 +178,7 @@ namespace sdr
 
                     aUnitDefinitionPolyPolygon.append(
                         basegfx::utils::createPolygonFromRect(
-                            basegfx::B2DRange(
-                                rSnapRect.Left(), rSnapRect.Top(),
-                                rSnapRect.Right(), rSnapRect.Bottom())));
+                                vcl::unotools::b2DRectangleFromRectangle(rSnapRect)));
 
                     // use same coordinate system as the shape geometry -> this
                     // makes it relative to shape's unit geometry and thus freely
diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
index 34734f96e1cd..3e51de1ed3c7 100644
--- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
@@ -25,6 +25,7 @@
 #include <sdr/primitive2d/sdrprimitivetools.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <svx/svdmodel.hxx>
+#include <vcl/canvastools.hxx>
 
 namespace sdr { namespace contact {
 
@@ -48,9 +49,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrRectObj::createV
 
     // take unrotated snap rect (direct model data) for position and size
     const tools::Rectangle aRectangle(GetRectObj().GetGeoRect());
-    const ::basegfx::B2DRange aObjectRange(
-        aRectangle.Left(), aRectangle.Top(),
-        aRectangle.Right(), aRectangle.Bottom() );
+    const ::basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aRectangle);
 
     const GeoStat& rGeoStat(GetRectObj().GetGeoStat());
 
diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
index 78bdce4d6c2e..2c34c56a7c07 100644
--- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
@@ -30,6 +30,7 @@
 
 #include <svx/sdrpaintwindow.hxx>
 #include <tools/diagnose_ex.h>
+#include <vcl/canvastools.hxx>
 #include <vcl/pdfextoutdevdata.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <drawinglayer/primitive2d/controlprimitive2d.hxx>
@@ -94,10 +95,7 @@ namespace sdr { namespace contact {
         // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use
         // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj)
         // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything
-        const tools::Rectangle aRectangle(GetSdrUnoObj().GetGeoRect());
-        const basegfx::B2DRange aRange(
-            aRectangle.Left(), aRectangle.Top(),
-            aRectangle.Right(), aRectangle.Bottom());
+        const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(GetSdrUnoObj().GetGeoRect());
 
         // create object transform
         basegfx::B2DHomMatrix aTransform;
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index 9acef8175f33..ef2247a746e0 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -32,6 +32,7 @@
 #include <svx/unoapi.hxx>
 #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <vcl/canvastools.hxx>
 
 using namespace com::sun::star;
 
@@ -192,9 +193,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageObj::crea
     basegfx::B2DHomMatrix aPageObjectTransform;
     {
         const tools::Rectangle aPageObjectModelData(rPageObject.GetLastBoundRect());
-        const basegfx::B2DRange aPageObjectBound(
-            aPageObjectModelData.Left(), aPageObjectModelData.Top(),
-            aPageObjectModelData.Right(), aPageObjectModelData.Bottom());
+        const basegfx::B2DRange aPageObjectBound = vcl::unotools::b2DRectangleFromRectangle(aPageObjectModelData);
 
         aPageObjectTransform.set(0, 0, aPageObjectBound.getWidth());
         aPageObjectTransform.set(1, 1, aPageObjectBound.getHeight());
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index d188ce4d2243..bd22d412cffc 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -45,6 +45,7 @@
 #include <com/sun/star/container/XContainerListener.hpp>
 #include <com/sun/star/container/XContainer.hpp>
 
+#include <vcl/canvastools.hxx>
 #include <vcl/svapp.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/scopeguard.hxx>
@@ -1482,12 +1483,7 @@ namespace sdr { namespace contact {
         // use getBoundRect()/getSnapRect() here; these will use the sequence of
         // primitives themselves in the long run.
         const tools::Rectangle aSdrGeoData( _rVOC.GetSdrUnoObj().GetGeoRect() );
-        const basegfx::B2DRange aRange(
-            aSdrGeoData.Left(),
-            aSdrGeoData.Top(),
-            aSdrGeoData.Right(),
-            aSdrGeoData.Bottom()
-        );
+        const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aSdrGeoData);
 
         _out_Transformation.identity();
         _out_Transformation.set( 0, 0, aRange.getWidth() );
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index b5a9f15cfaf8..d3b3ecb6b676 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -21,6 +21,7 @@
 #include <basegfx/point/b2dpoint.hxx>
 #include <basegfx/range/b2drange.hxx>
 #include <tools/gen.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/outdev.hxx>
 #include <vcl/window.hxx>
 #include <svx/sdr/overlay/overlayobject.hxx>
@@ -241,9 +242,7 @@ namespace sdr
 
                 // paint members
                 const tools::Rectangle aRegionBoundRect(rRegion.GetBoundRect());
-                const basegfx::B2DRange aRegionRange(
-                    aRegionBoundRect.Left(), aRegionBoundRect.Top(),
-                    aRegionBoundRect.Right(), aRegionBoundRect.Bottom());
+                const basegfx::B2DRange aRegionRange = vcl::unotools::b2DRectangleFromRectangle(aRegionBoundRect);
 
                 OutputDevice& rTarget = pPreRenderDevice ? *pPreRenderDevice : getOutputDevice();
                 ImpDrawMembers(aRegionRange, rTarget);
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index cd3e75d57632..37cd10ae1bce 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -35,6 +35,7 @@
 #include <unotools/localedatawrapper.hxx>
 #include <unotools/viewoptions.hxx>
 #include <vcl/button.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/field.hxx>
@@ -1083,11 +1084,11 @@ void PosSizePropertyPanel::SetPosSizeMinMax()
         return;
     tools::Rectangle aTmpRect(mpView->GetAllMarkedRect());
     pPV->LogicToPagePos(aTmpRect);
-    maRect = basegfx::B2DRange(aTmpRect.Left(), aTmpRect.Top(), aTmpRect.Right(), aTmpRect.Bottom());
+    maRect = vcl::unotools::b2DRectangleFromRectangle(aTmpRect);
 
     tools::Rectangle aTmpRect2(mpView->GetWorkArea());
     pPV->LogicToPagePos(aTmpRect2);
-    maWorkArea = basegfx::B2DRange(aTmpRect2.Left(), aTmpRect2.Top(), aTmpRect2.Right(), aTmpRect2.Bottom());
+    maWorkArea = vcl::unotools::b2DRectangleFromRectangle(aTmpRect2);
 
     const Fraction aUIScale(mpView->GetModel()->GetUIScale());
     TransfrmHelper::ScaleRect( maWorkArea, aUIScale );
diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx
index 640636bf44c9..cc36f493a9f2 100644
--- a/svx/source/svdraw/gradtrns.cxx
+++ b/svx/source/svdraw/gradtrns.cxx
@@ -24,6 +24,7 @@
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <tools/helpers.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/outdev.hxx>
 
 
@@ -47,7 +48,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r
 
     // calc the basic positions
     const tools::Rectangle aObjectSnapRectangle(pObj->GetSnapRect());
-    const basegfx::B2DRange aRange(aObjectSnapRectangle.Left(), aObjectSnapRectangle.Top(), aObjectSnapRectangle.Right(), aObjectSnapRectangle.Bottom());
+    const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aObjectSnapRectangle);
     const basegfx::B2DPoint aCenter(aRange.getCenter());
     basegfx::B2DPoint aStartPos, aEndPos;
 
@@ -199,7 +200,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r
 
     // calc the basic positions
     const tools::Rectangle aObjectSnapRectangle(pObj->GetSnapRect());
-    const basegfx::B2DRange aRange(aObjectSnapRectangle.Left(), aObjectSnapRectangle.Top(), aObjectSnapRectangle.Right(), aObjectSnapRectangle.Bottom());
+    const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aObjectSnapRectangle);
     const basegfx::B2DPoint aCenter(aRange.getCenter());
     basegfx::B2DPoint aStartPos(rV.maPositionA);
     basegfx::B2DPoint aEndPos(rV.maPositionB);
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index d96bed18602e..834547fc24ce 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -22,6 +22,7 @@
 
 #include <tools/bigint.hxx>
 #include <o3tl/numeric.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/ptrstyle.hxx>
@@ -468,7 +469,7 @@ void SdrDragMethod::createSdrDragEntries_PolygonDrag()
     if(bNoPolygons)
     {
         const tools::Rectangle aR(getSdrDragView().GetSdrPageView()->MarkSnap());
-        const basegfx::B2DRange aNewRectangle(aR.Left(), aR.Top(), aR.Right(), aR.Bottom());
+        const basegfx::B2DRange aNewRectangle = vcl::unotools::b2DRectangleFromRectangle(aR);
         basegfx::B2DPolygon aNewPolygon(basegfx::utils::createPolygonFromRect(aNewRectangle));
 
         aResult = basegfx::B2DPolyPolygon(basegfx::utils::expandToCurve(aNewPolygon));
@@ -3466,7 +3467,7 @@ void SdrDragDistort::MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
         if(pPV && pPV->HasMarkedObjPageView())
         {
             basegfx::B2DPolyPolygon aDragPolygon(rTarget);
-            const basegfx::B2DRange aOriginalRange(aMarkRect.Left(), aMarkRect.Top(), aMarkRect.Right(), aMarkRect.Bottom());
+            const basegfx::B2DRange aOriginalRange = vcl::unotools::b2DRectangleFromRectangle(aMarkRect);
             const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
             const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
             const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 938a8fce0fae..6d905b3ba63c 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -28,6 +28,7 @@
 #include <svl/whiter.hxx>
 #include <svl/style.hxx>
 #include <editeng/editstat.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/cursor.hxx>
 #include <editeng/unotext.hxx>
 #include <editeng/editdata.hxx>
@@ -525,7 +526,7 @@ namespace
 
         // check current range
         const tools::Rectangle aOutArea(mrOutlinerView.GetOutputArea());
-        basegfx::B2DRange aNewRange(aOutArea.Left(), aOutArea.Top(), aOutArea.Right(), aOutArea.Bottom());
+        basegfx::B2DRange aNewRange = vcl::unotools::b2DRectangleFromRectangle(aOutArea);
         aNewRange.expand(rMinTextEditArea);
 
         if (aNewRange != maRange)
@@ -630,9 +631,7 @@ void SdrObjEditView::EditViewInvalidate(const tools::Rectangle&) const
     if (IsTextEdit())
     {
         // MinTextRange may have changed. Forward it, too
-        const basegfx::B2DRange aMinTextRange(
-            aMinTextEditArea.Left(), aMinTextEditArea.Top(),
-            aMinTextEditArea.Right(), aMinTextEditArea.Bottom());
+        const basegfx::B2DRange aMinTextRange = vcl::unotools::b2DRectangleFromRectangle(aMinTextEditArea);
 
         for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
         {
@@ -753,7 +752,7 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::
         if (xProcessor)
         {
             const bool bMapModeEnabled(rTargetDevice.IsMapModeEnabled());
-            const basegfx::B2DRange aRange(aPixRect.Left(), aPixRect.Top(), aPixRect.Right(), aPixRect.Bottom());
+            const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aPixRect);
             const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
             const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
             const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 2c9c14b1f2c4..fc7223d50ef9 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -40,6 +40,7 @@
 #include <editeng/wrlmitem.hxx>
 #include <editeng/contouritem.hxx>
 #include <editeng/colritem.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/metric.hxx>
 #include <editeng/charscaleitem.hxx>
 #include <svx/xflhtit.hxx>
@@ -1434,7 +1435,7 @@ namespace
 
 void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction const & rAct)
 {
-    basegfx::B2DRange aRange(rAct.GetRect().Left(), rAct.GetRect().Top(), rAct.GetRect().Right(), rAct.GetRect().Bottom());
+    basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(rAct.GetRect());
 
     if(aRange.isEmpty())
         return;
@@ -1548,9 +1549,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct)
     BitmapEx aBitmapEx(
         convertMetafileToBitmapEx(
             rMtf,
-            basegfx::B2DRange(
-                aRect.Left(), aRect.Top(),
-                aRect.Right(), aRect.Bottom()),
+            vcl::unotools::b2DRectangleFromRectangle(aRect),
             125000));
 
     // handle colors
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 977202efdd15..119b046ef95f 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -50,6 +50,7 @@
 #include <tools/helpers.hxx>
 #include <tools/line.hxx>
 #include <unotools/configmgr.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/graphictools.hxx>
 #include <vcl/metaact.hxx>
 #include <vcl/virdev.hxx>
@@ -1077,8 +1078,7 @@ basegfx::B2DPolyPolygon SdrObject::TakeXorPoly() const
 {
     basegfx::B2DPolyPolygon aRetval;
     const tools::Rectangle aR(GetCurrentBoundRect());
-    const basegfx::B2DRange aRange(aR.Left(), aR.Top(), aR.Right(), aR.Bottom());
-    aRetval.append(basegfx::utils::createPolygonFromRect(aRange));
+    aRetval.append(basegfx::utils::createPolygonFromRect(vcl::unotools::b2DRectangleFromRectangle(aR)));
 
     return aRetval;
 }
@@ -1371,8 +1371,7 @@ basegfx::B2DPolyPolygon SdrObject::TakeCreatePoly(const SdrDragStat& rDrag) cons
     aRect1.Justify();
 
     basegfx::B2DPolyPolygon aRetval;
-    const basegfx::B2DRange aRange(aRect1.Left(), aRect1.Top(), aRect1.Right(), aRect1.Bottom());
-    aRetval.append(basegfx::utils::createPolygonFromRect(aRange));
+    aRetval.append(basegfx::utils::createPolygonFromRect(vcl::unotools::b2DRectangleFromRectangle(aRect1)));
     return aRetval;
 }
 
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index fe71700d3568..f31de7302a20 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -58,6 +58,7 @@
 #include <svx/xlnwtit.hxx>
 #include <svx/xpoly.hxx>
 #include <svx/xpool.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/ptrstyle.hxx>
 
 
@@ -581,7 +582,7 @@ void SdrCaptionObj::BrkCreate(SdrDragStat& /*rStat*/)
 basegfx::B2DPolyPolygon SdrCaptionObj::TakeCreatePoly(const SdrDragStat& /*rDrag*/) const
 {
     basegfx::B2DPolyPolygon aRetval;
-    const basegfx::B2DRange aRange(maRect.Left(), maRect.Top(), maRect.Right(), maRect.Bottom());
+    const basegfx::B2DRange aRange =vcl::unotools::b2DRectangleFromRectangle(maRect);
     aRetval.append(basegfx::utils::createPolygonFromRect(aRange));
     aRetval.append(aTailPoly.getB2DPolygon());
     return aRetval;
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 7a01a5742708..c2637ff48e52 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -49,6 +49,7 @@
 #include <svx/xlnstwit.hxx>
 #include <svx/xlnwtit.hxx>
 #include <svx/xpool.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/ptrstyle.hxx>
 
 using namespace com::sun::star;
@@ -214,7 +215,7 @@ bool SdrCircObj::PaintNeedsXPolyCirc() const
 
 basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, const tools::Rectangle& rRect1, long nStart, long nEnd) const
 {
-    const basegfx::B2DRange aRange(rRect1.Left(), rRect1.Top(), rRect1.Right(), rRect1.Bottom());
+    const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(rRect1);
     basegfx::B2DPolygon aCircPolygon;
 
     if(OBJ_CIRC == eCicrleKind)
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index f4c391eab0a3..61bca73c9a37 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -49,6 +49,7 @@
 #include <basegfx/polygon/b2dpolygontools.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <libxml/xmlwriter.h>
+#include <vcl/canvastools.hxx>
 
 // BaseProperties section
 std::unique_ptr<sdr::properties::BaseProperties> SdrObjGroup::CreateObjectSpecificProperties()
@@ -297,7 +298,7 @@ basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
 
     if(!aRetval.count())
     {
-        const basegfx::B2DRange aRange(aOutRect.Left(), aOutRect.Top(), aOutRect.Right(), aOutRect.Bottom());
+        const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aOutRect);
         aRetval.append(basegfx::utils::createPolygonFromRect(aRange));
     }
 
diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx
index ae33a01892f9..a5aae5432817 100644
--- a/svx/source/svdraw/svdotxdr.cxx
+++ b/svx/source/svdraw/svdotxdr.cxx
@@ -29,6 +29,7 @@
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/range/b2drange.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/ptrstyle.hxx>
 
 
@@ -235,7 +236,7 @@ basegfx::B2DPolyPolygon SdrTextObj::TakeCreatePoly(const SdrDragStat& rDrag) con
     aRect1.Justify();
 
     basegfx::B2DPolyPolygon aRetval;
-    const basegfx::B2DRange aRange(aRect1.Left(), aRect1.Top(), aRect1.Right(), aRect1.Bottom());
+    const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aRect1);
     aRetval.append(basegfx::utils::createPolygonFromRect(aRange));
     return aRetval;
 }
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index f186b96f63f0..4717e1b796cd 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -2340,7 +2340,7 @@ basegfx::B2DPolyPolygon SdrTableObj::TakeCreatePoly(const SdrDragStat& rDrag) co
     aRect1.Justify();
 
     basegfx::B2DPolyPolygon aRetval;
-    const basegfx::B2DRange aRange(aRect1.Left(), aRect1.Top(), aRect1.Right(), aRect1.Bottom());
+    const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aRect1);
     aRetval.append(basegfx::utils::createPolygonFromRect(aRange));
     return aRetval;
 }
diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx
index e6ab5304f16d..776768affc53 100644
--- a/svx/source/table/tablehandles.cxx
+++ b/svx/source/table/tablehandles.cxx
@@ -280,7 +280,7 @@ void TableBorderHdl::CreateB2dIAObject()
 
                 if (xManager.is())
                 {
-                    const basegfx::B2DRange aRange(vcl::unotools::b2DRectangleFromRectangle(maRectangle));
+                    const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(maRectangle);
                     const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
                     const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
                     const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 05759f3e3364..10a6173fab56 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -40,6 +40,7 @@
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <svx/framelink.hxx>
 #include <svx/framelinkarray.hxx>
+#include <vcl/canvastools.hxx>
 
 #include <cell.hxx>
 #include "tablelayouter.hxx"
@@ -223,10 +224,7 @@ namespace sdr
 
                     // create range using the model data directly. This is in SdrTextObj::aRect which i will access using
                     // GetGeoRect() to not trigger any calculations. It's the unrotated geometry.
-                    const tools::Rectangle& rObjectRectangle(rTableObj.GetGeoRect());
-                    const basegfx::B2DRange aObjectRange(
-                        rObjectRectangle.Left(), rObjectRectangle.Top(),
-                        rObjectRectangle.Right(), rObjectRectangle.Bottom());
+                    const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(rTableObj.GetGeoRect());
 
                     // To create the CellBorderPrimitives, use the tolling from svx::frame::Array
                     // which is capable of creating the needed visualization. Fill it during the
@@ -392,10 +390,7 @@ namespace sdr
             else
             {
                 // take unrotated snap rect (direct model data) for position and size
-                const tools::Rectangle& rRectangle = rTableObj.GetGeoRect();
-                const basegfx::B2DRange aObjectRange(
-                    rRectangle.Left(), rRectangle.Top(),
-                    rRectangle.Right(), rRectangle.Bottom());
+                const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(rTableObj.GetGeoRect());
 
                 // create object matrix
                 const GeoStat& rGeoStat(rTableObj.GetGeoStat());
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 36b7396f5f74..dd73a1d13df2 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -24,6 +24,7 @@
 #include <editeng/protitem.hxx>
 #include <editeng/opaqitem.hxx>
 #include <svx/svdpage.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/ptrstyle.hxx>
 
@@ -623,7 +624,7 @@ void SwVirtFlyDrawObj::NbcSetLogicRect(const tools::Rectangle& )
 ::basegfx::B2DPolyPolygon SwVirtFlyDrawObj::TakeXorPoly() const
 {
     const tools::Rectangle aSourceRectangle(GetFlyFrame()->getFrameArea().SVRect());
-    const ::basegfx::B2DRange aSourceRange(aSourceRectangle.Left(), aSourceRectangle.Top(), aSourceRectangle.Right(), aSourceRectangle.Bottom());
+    const ::basegfx::B2DRange aSourceRange = vcl::unotools::b2DRectangleFromRectangle(aSourceRectangle);
     ::basegfx::B2DPolyPolygon aRetval;
 
     aRetval.append(::basegfx::utils::createPolygonFromRect(aSourceRange));
diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx
index 58aa93ac2d1e..6c844c74a634 100644
--- a/sw/source/core/view/vdraw.cxx
+++ b/sw/source/core/view/vdraw.cxx
@@ -143,8 +143,7 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
         SdrView &rSdrView = GetPageView()->GetView();
         rSdrView.setHideDraw( !pPrintData->IsPrintDraw() );
     }
-    basegfx::B2IRectangle const pageFrame(
-        vcl::unotools::b2IRectangleFromRectangle(rPageFrame.getFrameArea().SVRect()));
+    basegfx::B2IRectangle const pageFrame = vcl::unotools::b2IRectangleFromRectangle(rPageFrame.getFrameArea().SVRect());
     GetPageView()->DrawLayer(_nLayerID, pOutDev, pRedirector, aPaintRect.SVRect(), &pageFrame);
     pOutDev->Pop();
 
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 0b4ba5b4ddb3..c32a750ddaa6 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -47,6 +47,7 @@
 #include <sfx2/viewfrm.hxx>
 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
 #include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/decoview.hxx>
 #include <vcl/gradient.hxx>
 #include <vcl/metric.hxx>
@@ -119,7 +120,7 @@ namespace
 
         if ( !bOnTop )
         {
-            B2DRectangle aBRect( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() );
+            B2DRectangle aBRect = vcl::unotools::b2DRectangleFromRectangle(rRect);
             B2DHomMatrix aRotation = createRotateAroundPoint(
                    aBRect.getCenterX(), aBRect.getCenterY(), M_PI );
             aPolygon.transform( aRotation );
@@ -151,7 +152,7 @@ void SwFrameButtonPainter::PaintButton(drawinglayer::primitive2d::Primitive2DCon
     }
     else
     {
-        B2DRectangle aGradientRect(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom());
+        B2DRectangle aGradientRect = vcl::unotools::b2DRectangleFromRectangle(rRect);
         double nAngle = M_PI;
         if (bOnTop)
             nAngle = 0;
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index cddb61058f3a..d10ff2b91b2d 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -44,6 +44,7 @@
 #include <sfx2/dispatch.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <svl/stritem.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <memory>
@@ -159,8 +160,7 @@ void SwPageBreakWin::Paint(vcl::RenderContext& rRenderContext, const ::tools::Re
     bool bRtl = AllSettings::GetLayoutRTL();
 
     drawinglayer::primitive2d::Primitive2DContainer aSeq(3);
-    B2DRectangle aBRect(double(aRect.Left()), double(aRect.Top()),
-                        double(aRect.Right()), double(aRect.Bottom()));
+    B2DRectangle aBRect = vcl::unotools::b2DRectangleFromRectangle(aRect);
     B2DPolygon aPolygon = createPolygonFromRect(aBRect, 3.0 / BUTTON_WIDTH, 3.0 / BUTTON_HEIGHT);
 
     // Create the polygon primitives
diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx
index 14a5492e36c3..d545d2f9eba3 100644
--- a/vcl/source/gdi/gdimetafiletools.cxx
+++ b/vcl/source/gdi/gdimetafiletools.cxx
@@ -19,6 +19,7 @@
 
 #include <vcl/gdimetafiletools.hxx>
 #include <vcl/metaact.hxx>
+#include <vcl/canvastools.hxx>
 #include <basegfx/polygon/b2dpolygonclipper.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
@@ -319,9 +320,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource)
 
                 if(!rRect.IsEmpty() && !aClips.empty() && aClips.back().count())
                 {
-                    const basegfx::B2DRange aClipRange(
-                        rRect.Left(), rRect.Top(),
-                        rRect.Right(), rRect.Bottom());
+                    const basegfx::B2DRange aClipRange(vcl::unotools::b2DRectangleFromRectangle(rRect));
 
                     aClips.back() = basegfx::utils::clipPolyPolygonOnRange(
                         aClips.back(),
@@ -516,9 +515,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource)
                             aClips.back(),
                             basegfx::B2DPolyPolygon(
                                 basegfx::utils::createPolygonFromRect(
-                                    basegfx::B2DRange(
-                                        rRect.Left(), rRect.Top(),
-                                        rRect.Right(), rRect.Bottom()))),
+                                        vcl::unotools::b2DRectangleFromRectangle(rRect))),
                             aTarget,
                             false); // stroke
                     }
@@ -538,7 +535,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource)
                     {
                         const sal_uInt32 nHor(pA->GetHorzRound());
                         const sal_uInt32 nVer(pA->GetVertRound());
-                        const basegfx::B2DRange aRange(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom());
+                        const basegfx::B2DRange aRange(vcl::unotools::b2DRectangleFromRectangle(rRect));
                         basegfx::B2DPolygon aOutline;
 
                         if(nHor || nVer)
@@ -575,7 +572,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource)
                     }
                     else
                     {
-                        const basegfx::B2DRange aRange(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom());
+                        const basegfx::B2DRange aRange(vcl::unotools::b2DRectangleFromRectangle(rRect));
 
                         bDone = handleGeometricContent(
                             aClips.back(),
@@ -978,9 +975,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource)
                             aClips.back(),
                             basegfx::B2DPolyPolygon(
                                 basegfx::utils::createPolygonFromRect(
-                                    basegfx::B2DRange(
-                                        rRect.Left(), rRect.Top(),
-                                        rRect.Right(), rRect.Bottom()))),
+                                        vcl::unotools::b2DRectangleFromRectangle(rRect))),
                             pA->GetGradient(),
                             aTarget);
                     }
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index df90d4592c80..8696fd259a0e 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <vcl/canvastools.hxx>
 #include <vcl/pdfextoutdevdata.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/outdev.hxx>
@@ -443,8 +444,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
                         {
                             rWriter.Push();
                             basegfx::B2DPolyPolygon aRect( basegfx::utils::createPolygonFromRect(
-                                basegfx::B2DRectangle( aVisibleOutputRect.Left(), aVisibleOutputRect.Top(),
-                                                       aVisibleOutputRect.Right(), aVisibleOutputRect.Bottom() ) ) );
+                                vcl::unotools::b2DRectangleFromRectangle(aVisibleOutputRect) ) );
                             rWriter.SetClipRegion( aRect);
                         }
 
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 218b65a908b9..79289ba8b39a 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -58,6 +58,7 @@
 #include <svl/cryptosign.hxx>
 #include <vcl/bitmapex.hxx>
 #include <vcl/bitmapaccess.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/cvtgrf.hxx>
 #include <vcl/image.hxx>
 #include <vcl/lineinfo.hxx>
@@ -10000,7 +10001,7 @@ void PDFWriterImpl::moveClipRegion( sal_Int32 nX, sal_Int32 nY )
 void PDFWriterImpl::intersectClipRegion( const tools::Rectangle& rRect )
 {
     basegfx::B2DPolyPolygon aRect( basegfx::utils::createPolygonFromRect(
-        basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) );
+                                    vcl::unotools::b2DRectangleFromRectangle(rRect) ) );
     intersectClipRegion( aRect );
 }
 
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index ff2fbfdf0580..083f89a15395 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -24,6 +24,7 @@
 #include <tools/helpers.hxx>
 #include <osl/diagnose.h>
 #include <sal/log.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/region.hxx>
 #include <regionband.hxx>
 
@@ -539,11 +540,7 @@ void vcl::Region::Union( const tools::Rectangle& rRect )
             // get the other B2DPolyPolygon and use logical Or-Operation
             const basegfx::B2DPolygon aRectPoly(
                 basegfx::utils::createPolygonFromRect(
-                    basegfx::B2DRectangle(
-                        rRect.Left(),
-                        rRect.Top(),
-                        rRect.Right(),
-                        rRect.Bottom())));
+                        vcl::unotools::b2DRectangleFromRectangle(rRect)));
             const basegfx::B2DPolyPolygon aClip(
                 basegfx::utils::solvePolygonOperationOr(
                     aThisPolyPoly,
@@ -716,7 +713,7 @@ void vcl::Region::Exclude( const tools::Rectangle& rRect )
         // get the other B2DPolyPolygon
         const basegfx::B2DPolygon aRectPoly(
             basegfx::utils::createPolygonFromRect(
-                basegfx::B2DRectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom())));
+                vcl::unotools::b2DRectangleFromRectangle(rRect)));
         const basegfx::B2DPolyPolygon aOtherPolyPoly(aRectPoly);
         const basegfx::B2DPolyPolygon aClip = basegfx::utils::solvePolygonOperationDiff(aThisPolyPoly, aOtherPolyPoly);
 
@@ -797,7 +794,7 @@ void vcl::Region::XOr( const tools::Rectangle& rRect )
         // get the other B2DPolyPolygon
         const basegfx::B2DPolygon aRectPoly(
             basegfx::utils::createPolygonFromRect(
-                basegfx::B2DRectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom())));
+                vcl::unotools::b2DRectangleFromRectangle(rRect)));
         const basegfx::B2DPolyPolygon aOtherPolyPoly(aRectPoly);
         const basegfx::B2DPolyPolygon aClip = basegfx::utils::solvePolygonOperationXor(aThisPolyPoly, aOtherPolyPoly);
 
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index c53d800beb14..c3e15b3c697a 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -375,8 +375,14 @@ namespace vcl
 
         basegfx::B2IRectangle b2IRectangleFromRectangle(tools::Rectangle const& rRect)
         {
-            return basegfx::B2IRectangle(rRect.Left(), rRect.Top(),
-                                         rRect.Right(), rRect.Bottom());
+            // although B2IRange internally has separate height/width emptiness, it doesn't
+            // expose any API to let us set them separately, so just do the best we can.
+            if (rRect.IsWidthEmpty() && rRect.IsHeightEmpty())
+                return basegfx::B2IRange( basegfx::B2ITuple( rRect.Left(), rRect.Top() ) );
+            return basegfx::B2IRange( rRect.Left(),
+                                  rRect.Top(),
+                                  rRect.IsWidthEmpty() ? rRect.Left() : rRect.Right(),
+                                  rRect.IsHeightEmpty() ? rRect.Top() : rRect.Bottom() );
         }
 
         basegfx::B2DVector b2DSizeFromSize( const ::Size& rSize )
@@ -393,10 +399,14 @@ namespace vcl
 
         basegfx::B2DRange b2DRectangleFromRectangle( const ::tools::Rectangle& rRect )
         {
-            return basegfx::B2DRange( rRect.Left(),
-                                        rRect.Top(),
-                                        rRect.Right(),
-                                        rRect.Bottom() );
+            // although B2DRange internally has separate heigh/width emptiness, it doesn't
+            // expose any API to let us set them separately, so just do the best we can.
+            if (rRect.IsWidthEmpty() && rRect.IsHeightEmpty())
+                return basegfx::B2DRange( basegfx::B2DTuple( rRect.Left(), rRect.Top() ) );
+            return basegfx::B2DRectangle( rRect.Left(),
+                                  rRect.Top(),
+                                  rRect.IsWidthEmpty() ? rRect.Left() : rRect.Right(),
+                                  rRect.IsHeightEmpty() ? rRect.Top() : rRect.Bottom() );
         }
 
         geometry::IntegerSize2D integerSize2DFromSize( const Size& rSize )
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index d4b99ea5da0f..0e57b2a9f203 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -22,6 +22,7 @@
 #include <vcl/bitmap.hxx>
 #include <vcl/bitmapex.hxx>
 #include <vcl/bitmapaccess.hxx>
+#include <vcl/canvastools.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/metaact.hxx>
 #include <config_features.h>
@@ -1102,14 +1103,12 @@ bool OutputDevice::TransformAndReduceBitmapExToTargetRange(
 
     if(IsClipRegion())
     {
-        const tools::Rectangle aRegionRectangle(GetActiveClipRegion().GetBoundRect());
-
-        aOutPixel.intersect( // caution! Range from rectangle, one too much (!)
-            basegfx::B2DRange(
-                aRegionRectangle.Left(),
-                aRegionRectangle.Top(),
-                aRegionRectangle.Right() + 1,
-                aRegionRectangle.Bottom() + 1));
+        tools::Rectangle aRegionRectangle(GetActiveClipRegion().GetBoundRect());
+
+        // caution! Range from rectangle, one too much (!)
+        aRegionRectangle.AdjustRight(-1);
+        aRegionRectangle.AdjustBottom(-1);
+        aOutPixel.intersect( vcl::unotools::b2DRectangleFromRectangle(aRegionRectangle) );
     }
 
     if(aOutPixel.isEmpty())


More information about the Libreoffice-commits mailing list