Kaydet (Commit) d0119ff7 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Thorsten Behrens

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: 's avatarRegina Henschel <rb.henschel@t-online.de>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 5218ca22
......@@ -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)
{
......
......@@ -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
......
......@@ -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
......
......@@ -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 )
......
......@@ -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();
......
......@@ -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)
......
......@@ -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);
}
}
......
......@@ -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());
......
......@@ -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 )
......
......@@ -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 );
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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);
}
}
......
......@@ -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;
......
......@@ -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());
......
......@@ -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());
......
......@@ -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(
......
......@@ -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));
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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());
......
......@@ -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());
......
......@@ -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(