Rebased ref, commits from common ancestor:
commit 01aca73b815adade6e09b0699148b1553c0798c7
Author: Tomaž Vajngerl <[email protected]>
AuthorDate: Wed Nov 23 11:00:13 2022 +0900
Commit: Tomaž Vajngerl <[email protected]>
CommitDate: Fri Feb 3 16:38:37 2023 +0900
svx: convert SdrTextObj rotate and move to use gfx::Length
Change-Id: I82f10f82db8ac9d5653f4902276ee58fc18c52d6
diff --git a/include/basegfx/utils/RectangleWrapper.hxx
b/include/basegfx/utils/RectangleWrapper.hxx
index 00586d6eae71..4f5dbe851f66 100644
--- a/include/basegfx/utils/RectangleWrapper.hxx
+++ b/include/basegfx/utils/RectangleWrapper.hxx
@@ -55,6 +55,11 @@ public:
m_aRange.setSize(width, height);
}
+ void shift(gfx::Length const& rXDelta, gfx::Length const& rYDelta)
+ {
+ m_aRange.shift(rXDelta, rYDelta);
+ }
+
void move(sal_Int32 nXDelta, sal_Int32 nYDelta)
{
auto deltaX = gfx::Length::hmm(nXDelta);
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index 1055e5dbe3bb..9ccc69709abf 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -40,6 +40,35 @@
using namespace com::sun::star;
+namespace
+{
+gfx::Tuple2DL rotatePoint(gfx::Tuple2DL const& rPoint, gfx::Tuple2DL const&
rReference, double sinAngle, double cosAngle)
+{
+ gfx::Length dx = rPoint.getX() - rReference.getX();
+ gfx::Length dy = rPoint.getY() - rReference.getY();
+
+ auto x = rReference.getX() + gfx::Length::emu(basegfx::fround(dx.raw() *
cosAngle + dy.raw() * sinAngle));
+ auto y = rReference.getY() + gfx::Length::emu(basegfx::fround(dy.raw() *
cosAngle - dx.raw() * sinAngle));
+
+ return gfx::Tuple2DL(x, y);
+}
+
+gfx::Tuple2DL toTuple(Point const& rPointHmm)
+{
+ auto x = gfx::Length::hmm(rPointHmm.X());
+ auto y = gfx::Length::hmm(rPointHmm.Y());
+ return {x, y};
+}
+
+gfx::Size2DL toSize2D(Size const& rSizeHmm)
+{
+ auto x = gfx::Length::hmm(rSizeHmm.Width());
+ auto y = gfx::Length::hmm(rSizeHmm.Height());
+ return {x, y};
+}
+
+} // end anonymous ns
+
void SdrTextObj::NbcSetSnapRect(const tools::Rectangle& rRect)
{
if (maGeo.nRotationAngle || maGeo.nShearAngle)
@@ -92,7 +121,9 @@ Degree100 SdrTextObj::GetShearAngle(bool /*bVertical*/) const
void SdrTextObj::NbcMove(const Size& rSize)
{
- moveRectangle(rSize.Width(), rSize.Height());
+ gfx::Size2DL aSize2D = toSize2D(rSize);
+ maRectangle.shift(aSize2D.getWidth(), aSize2D.getHeight());
+
moveOutRectangle(rSize.Width(), rSize.Height());
maSnapRect.Move(rSize);
SetBoundAndSnapRectsDirty(true);
@@ -183,27 +214,37 @@ void SdrTextObj::NbcResize(const Point& rRef, const
Fraction& xFact, const Fract
SetBoundAndSnapRectsDirty();
}
-void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn,
double cs)
+void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double
sinAngle, double cosAngle)
{
+ auto aReference = toTuple(rRef);
+
SetGlueReallyAbsolute(true);
- tools::Long dx = getRectangle().Right() - getRectangle().Left();
- tools::Long dy = getRectangle().Bottom() - getRectangle().Top();
- Point aPoint1(getRectangle().TopLeft());
- RotatePoint(aPoint1, rRef, sn, cs);
- Point aPoint2(aPoint1.X() + dx, aPoint1.Y() + dy);
- tools::Rectangle aRectangle(aPoint1, aPoint2);
- setRectangle(aRectangle);
+ auto const& rRange = maRectangle.getRange();
+
+ auto nWidth = rRange.getWidth();
+ auto nHeight = rRange.getHeight();
+
+ gfx::Tuple2DL aPoint1(rRange.getMinX(), rRange.getMinY());
+ aPoint1 = rotatePoint(aPoint1, aReference, sinAngle, cosAngle);
- if (maGeo.nRotationAngle==0_deg100) {
- maGeo.nRotationAngle=NormAngle36000(nAngle);
- maGeo.mfSinRotationAngle=sn;
- maGeo.mfCosRotationAngle=cs;
- } else {
- maGeo.nRotationAngle=NormAngle36000(maGeo.nRotationAngle+nAngle);
+ gfx::Tuple2DL aPoint2(aPoint1.getX() + nWidth, aPoint1.getY() + nHeight);
+
+ gfx::Range2DL aRange{aPoint1, aPoint2};
+ maRectangle.setRange(aRange);
+
+ if (maGeo.nRotationAngle == 0_deg100)
+ {
+ maGeo.nRotationAngle = NormAngle36000(nAngle);
+ maGeo.mfSinRotationAngle = sinAngle;
+ maGeo.mfCosRotationAngle = cosAngle;
+ }
+ else
+ {
+ maGeo.nRotationAngle = NormAngle36000(maGeo.nRotationAngle + nAngle);
maGeo.RecalcSinCos();
}
SetBoundAndSnapRectsDirty();
- NbcRotateGluePoints(rRef,nAngle,sn,cs);
+ NbcRotateGluePoints(rRef, nAngle, sinAngle, cosAngle);
SetGlueReallyAbsolute(false);
}
commit 80ebdd107811acaa63c1b3a1d5eb15be7baa54c5
Author: Tomaž Vajngerl <[email protected]>
AuthorDate: Tue Nov 22 13:33:30 2022 +0900
Commit: Tomaž Vajngerl <[email protected]>
CommitDate: Fri Feb 3 16:38:37 2023 +0900
svx: use RectangleWrapper for maRectangle on SdrTextObj
This is needed so we can now transition to use gfx::Length and
gfx::Range2DL to define the object position and size.
Change-Id: Ie683a869ba061f53d437bd1dfbe72fe454011730
diff --git a/include/basegfx/utils/RectangleWrapper.hxx
b/include/basegfx/utils/RectangleWrapper.hxx
new file mode 100644
index 000000000000..00586d6eae71
--- /dev/null
+++ b/include/basegfx/utils/RectangleWrapper.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <basegfx/units/Length.hxx>
+#include <tools/gen.hxx>
+
+namespace gfx
+{
+/**
+ * Wrapps tools::Rectangle and Range2DL, to make it easier to incrementally
+ * transition to use Range2DL.
+ */
+class RectangleWrapper
+{
+private:
+ gfx::Range2DL m_aRange;
+ mutable tools::Rectangle m_aRectangle;
+
+public:
+ RectangleWrapper() = default;
+
+ RectangleWrapper(gfx::Length x1, gfx::Length y1, gfx::Length x2,
gfx::Length y2)
+ : m_aRange(x1, y1, x2, y2)
+ {
+ }
+
+ gfx::Range2DL const& getRange() const { return m_aRange; }
+
+ void setRange(gfx::Range2DL const& rRange) { m_aRange = rRange; }
+
+ tools::Rectangle const& getRectangle() const
+ {
+ m_aRectangle = gfx::length::toRectangleHmm(m_aRange);
+ return m_aRectangle;
+ }
+
+ void setRectangle(tools::Rectangle const& rRectangle)
+ {
+ m_aRange = gfx::length::fromRectangleHmm(rRectangle);
+ }
+
+ void setSize(sal_Int32 nWidth, sal_Int32 nHeight)
+ {
+ auto width = gfx::Length::hmm(nWidth - 1);
+ auto height = gfx::Length::hmm(nHeight - 1);
+
+ m_aRange.setSize(width, height);
+ }
+
+ void move(sal_Int32 nXDelta, sal_Int32 nYDelta)
+ {
+ auto deltaX = gfx::Length::hmm(nXDelta);
+ auto deltaY = gfx::Length::hmm(nYDelta);
+
+ m_aRange.shift(deltaX, deltaY);
+ }
+
+ void setPosition(sal_Int32 nX, sal_Int32 nY)
+ {
+ auto x = gfx::Length::hmm(nX);
+ auto y = gfx::Length::hmm(nY);
+
+ m_aRange.setPosition(x, y);
+ }
+};
+
+} // end namespace gfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index a1cccb0804a4..5ac836e03b6d 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -32,6 +32,7 @@
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <memory>
#include <vector>
+#include <basegfx/utils/RectangleWrapper.hxx>
#include <com/sun/star/drawing/TextFitToSizeType.hpp>
@@ -165,32 +166,17 @@ protected:
// The "aRect" is also the rect of RectObj and CircObj.
// When mbTextFrame=true the text will be formatted into this rect
// When mbTextFrame=false the text will be centered around its middle
- tools::Rectangle maRectangle;
+ gfx::RectangleWrapper maRectangle;
- tools::Rectangle const& getRectangle() const
- {
- return maRectangle;
- }
+ tools::Rectangle const& getRectangle() const;
- void setRectangle(tools::Rectangle const& rRectangle)
- {
- maRectangle = rRectangle;
- }
+ void setRectangle(tools::Rectangle const& rRectangle);
- void setRectangleSize(sal_Int32 nWidth, sal_Int32 nHeight)
- {
- maRectangle.SetSize(Size(nWidth, nHeight));
- }
+ void setRectangleSize(sal_Int32 nWidth, sal_Int32 nHeight);
- void moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
- {
- maRectangle.Move(nXDelta, nYDelta);
- }
+ void moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta);
- void moveRectanglePosition(sal_Int32 nX, sal_Int32 nY)
- {
- maRectangle.SetPos(Point(nX, nY));
- }
+ void moveRectanglePosition(sal_Int32 nX, sal_Int32 nY);
// The GeoStat contains the rotation and shear angles
GeoStat maGeo;
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index ab8bc58ddf85..d8b47be4fbba 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -707,7 +707,6 @@ bool SdrCircObj::MovCreate(SdrDragStat& rStat)
ImpCircUser* pU=static_cast<ImpCircUser*>(rStat.GetUser());
rStat.SetActionRect(pU->aR);
setRectangle(pU->aR); // for ObjName
- ImpJustifyRect(maRectangle);
nStartAngle=pU->nStart;
nEndAngle=pU->nEnd;
SetBoundRectDirty();
@@ -1049,7 +1048,6 @@ void SdrCircObj::NbcSetSnapRect(const tools::Rectangle&
rRect)
NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
} else {
setRectangle(rRect);
- ImpJustifyRect(maRectangle);
}
SetBoundAndSnapRectsDirty();
SetXPolyDirty();
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index d0263a607d2a..e6872ed68ec3 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -70,6 +70,7 @@ std::unique_ptr<sdr::contact::ViewContact>
SdrTextObj::CreateObjectSpecificViewC
SdrTextObj::SdrTextObj(SdrModel& rSdrModel)
: SdrAttrObj(rSdrModel)
+ , maRectangle(0_hmm, 0_hmm, 0_hmm, 0_hmm)
, mpEditingOutliner(nullptr)
, meTextKind(SdrObjKind::Text)
, maTextEditOffset(Point(0, 0))
@@ -87,6 +88,7 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel)
SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrTextObj const & rSource)
: SdrAttrObj(rSdrModel, rSource)
+ , maRectangle(rSource.maRectangle)
, mpEditingOutliner(nullptr)
, meTextKind(rSource.meTextKind)
, maTextEditOffset(Point(0, 0))
@@ -101,7 +103,6 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrTextObj
const & rSource)
// #i25616#
mbSupportTextIndentingOnLineWidthChange = true;
- maRectangle = rSource.maRectangle;
maGeo = rSource.maGeo;
maTextSize = rSource.maTextSize;
@@ -156,6 +157,7 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel, const
tools::Rectangle& rNewRect)
SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrObjKind eNewTextKind)
: SdrAttrObj(rSdrModel)
+ , maRectangle(0_hmm, 0_hmm, 0_hmm, 0_hmm)
, mpEditingOutliner(nullptr)
, meTextKind(eNewTextKind)
, maTextEditOffset(Point(0, 0))
@@ -201,8 +203,6 @@ SdrTextObj::~SdrTextObj()
void SdrTextObj::FitFrameToTextSize()
{
- ImpJustifyRect(maRectangle);
-
SdrText* pText = getActiveText();
if(pText==nullptr || !pText->GetOutlinerParaObject())
return;
@@ -312,6 +312,31 @@ bool SdrTextObj::IsAutoGrowHeight() const
return bRet;
}
+tools::Rectangle const& SdrTextObj::getRectangle() const
+{
+ return maRectangle.getRectangle();
+}
+
+void SdrTextObj::setRectangle(tools::Rectangle const& rRectangle)
+{
+ maRectangle.setRectangle(rRectangle);
+}
+
+void SdrTextObj::setRectangleSize(sal_Int32 nWidth, sal_Int32 nHeight)
+{
+ maRectangle.setSize(nWidth, nHeight);
+}
+
+void SdrTextObj::moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
+{
+ maRectangle.move(nXDelta, nYDelta);
+}
+
+void SdrTextObj::moveRectanglePosition(sal_Int32 nX, sal_Int32 nY)
+{
+ maRectangle.setPosition(nX, nY);
+}
+
bool SdrTextObj::IsAutoGrowWidth() const
{
if (!mbTextFrame)
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index 5c9f28f5115c..1055e5dbe3bb 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -58,7 +58,6 @@ void SdrTextObj::NbcSetSnapRect(const tools::Rectangle& rRect)
// No rotation or shear.
setRectangle(rRect);
- ImpJustifyRect(maRectangle);
AdaptTextMinSize();
@@ -75,7 +74,6 @@ const tools::Rectangle& SdrTextObj::GetLogicRect() const
void SdrTextObj::NbcSetLogicRect(const tools::Rectangle& rRect)
{
setRectangle(rRect);
- ImpJustifyRect(maRectangle);
AdaptTextMinSize();
@@ -126,7 +124,6 @@ void SdrTextObj::NbcResize(const Point& rRef, const
Fraction& xFact, const Fract
setRectangle(aRectangle);
if (bYMirr)
{
- maRectangle.Normalize();
moveRectangle(aRectangle.Right() - aRectangle.Left(),
aRectangle.Bottom() - aRectangle.Top());
maGeo.nRotationAngle=18000_deg100;
maGeo.RecalcSinCos();
@@ -175,8 +172,6 @@ void SdrTextObj::NbcResize(const Point& rRef, const
Fraction& xFact, const Fract
}
}
- ImpJustifyRect(maRectangle);
-
AdaptTextMinSize();
if(mbTextFrame && !getSdrModelFromSdrObject().IsPasteResize())
@@ -226,7 +221,6 @@ void SdrTextObj::NbcShear(const Point& rRef, Degree100
/*nAngle*/, double tn, bo
auto aRectangle = getRectangle();
Poly2Rect(aPol, aRectangle, maGeo);
setRectangle(aRectangle);
- ImpJustifyRect(maRectangle);
if (mbTextFrame) {
NbcAdjustTextFrameWidthAndHeight();
@@ -282,7 +276,6 @@ void SdrTextObj::NbcMirror(const Point& rRef1, const Point&
rRef2)
maGeo.RecalcTan();
}
- ImpJustifyRect(maRectangle);
if (mbTextFrame) {
NbcAdjustTextFrameWidthAndHeight();
}
commit 9b825bc77d4cb6618028c2cfc9f96d76c0fd1133
Author: Tomaž Vajngerl <[email protected]>
AuthorDate: Wed Oct 26 20:21:37 2022 +0200
Commit: Tomaž Vajngerl <[email protected]>
CommitDate: Fri Feb 3 16:38:37 2023 +0900
svx: change PaperInfo to return gfx::Length paper sizes
Change-Id: Ie99a748ab9282893a852278be9793f7379522541
diff --git a/editeng/source/items/paperinf.cxx
b/editeng/source/items/paperinf.cxx
index 86401e63f387..47dd992b4f02 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -39,6 +39,12 @@ Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit
)
: OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM),
MapMode(eUnit));
}
+gfx::Size2DLWrap SvxPaperInfo::getPaperSize(Paper ePaper)
+{
+ PaperInfo aInfo(ePaper);
+ return { gfx::Length::hmm(aInfo.getWidth()),
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
/*------------------------------------------------------------------------
Description: Return the paper size of the printer, aligned to our
own sizes. If no Printer is set in the system, A4 portrait
@@ -108,6 +114,12 @@ Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit )
: OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM),
MapMode(eUnit));
}
+gfx::Size2DLWrap SvxPaperInfo::getDefaultPaperSize()
+{
+ PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
+ return { gfx::Length::hmm(aInfo.getWidth()),
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
/*------------------------------------------------------------------------
Description: String representation for the SV-defines of paper size
------------------------------------------------------------------------*/
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
index 2ccc8fbf96fa..7d73e9a93b5d 100644
--- a/include/editeng/paperinf.hxx
+++ b/include/editeng/paperinf.hxx
@@ -25,6 +25,7 @@
#include <tools/mapunit.hxx>
#include <i18nutil/paper.hxx>
#include <tools/gen.hxx>
+#include <basegfx/units/Length.hxx>
#include <editeng/editengdllapi.h>
// forward ---------------------------------------------------------------
@@ -42,6 +43,9 @@ public:
static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit );
static tools::Long GetSloppyPaperDimension( tools::Long nSize );
static OUString GetName( Paper ePaper );
+
+ static gfx::Size2DLWrap getPaperSize(Paper ePaper);
+ static gfx::Size2DLWrap getDefaultPaperSize();
};
// INLINE -----------------------------------------------------------------
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 203b23179c99..1edb2affaa47 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -374,6 +374,13 @@ public:
, meUnit(eUnit)
{}
+ Border(gfx::Length const& nLeft, gfx::Length const& nUpper, gfx::Length
const& nRight, gfx::Length const& nLower)
+ : maLeft(nLeft)
+ , maRight(nRight)
+ , maUpper(nUpper)
+ , maLower(nLower)
+ {}
+
gfx::Length const& left() const { return maLeft; }
gfx::Length const& right() const { return maRight; }
gfx::Length const& upper() const { return maUpper; }
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 924ed8474472..9ff7288e5be4 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -499,7 +499,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const
* pRefDocument /* =
return;
// #i57181# Paper size depends on Language, like in Writer
- Size aDefSize = SvxPaperInfo::GetDefaultPaperSize( MapUnit::Map100thMM );
+ gfx::Size2DLWrap aDefaultSize = SvxPaperInfo::getDefaultPaperSize();
// Insert handout page
rtl::Reference<SdPage> pHandoutPage = AllocSdPage(false);
@@ -516,8 +516,8 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const
* pRefDocument /* =
}
else
{
- pHandoutPage->setToolsSize(aDefSize);
- pHandoutPage->SetBorder(0, 0, 0, 0);
+ pHandoutPage->setSize(aDefaultSize);
+ pHandoutPage->setBorder(svx::Border());
}
pHandoutPage->SetPageKind(PageKind::Handout);
@@ -553,7 +553,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const
* pRefDocument /* =
else if (meDocType == DocumentType::Draw)
{
// Draw: always use default size with margins
- pPage->setToolsSize(aDefSize);
+ pPage->setSize(aDefaultSize);
SfxPrinter* pPrinter = mpDocSh->GetPrinter(false);
if (pPrinter && pPrinter->IsValid())
@@ -563,12 +563,12 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument
const * pRefDocument /* =
aPageOffset -= pPrinter->PixelToLogic( Point() );
::tools::Long nOffset = !aPageOffset.X() && !aPageOffset.Y() ?
0 : PRINT_OFFSET;
- sal_uLong nTop = aPageOffset.Y();
- sal_uLong nLeft = aPageOffset.X();
- sal_uLong nBottom = std::max(::tools::Long(aDefSize.Height() -
aOutSize.Height() - nTop + nOffset), ::tools::Long(0));
- sal_uLong nRight = std::max(::tools::Long(aDefSize.Width() -
aOutSize.Width() - nLeft + nOffset), ::tools::Long(0));
+ gfx::Length nTop = gfx::Length::hmm(aPageOffset.Y());
+ gfx::Length nLeft = gfx::Length::hmm(aPageOffset.X());
+ gfx::Length nBottom =
gfx::Length::hmm(std::max(::tools::Long(aDefaultSize.getHeight().as_hmm() -
aOutSize.Height() - aPageOffset.Y() + nOffset), tools::Long(0)));
+ gfx::Length nRight =
gfx::Length::hmm(std::max(::tools::Long(aDefaultSize.getWidth().as_hmm() -
aOutSize.Width() - aPageOffset.X() + nOffset), tools::Long(0)));
- pPage->SetBorder(nLeft, nTop, nRight, nBottom);
+ pPage->setBorder(svx::Border(nLeft, nTop, nRight, nBottom));
}
else
{
@@ -577,14 +577,14 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument
const * pRefDocument /* =
// This has to be kept synchronized with the border
// width set in the
// SvxPageDescPage::PaperSizeSelect_Impl callback.
- pPage->SetBorder(1000, 1000, 1000, 1000);
+ pPage->setBorder(svx::Border(1000_hmm, 1000_hmm, 1000_hmm,
1000_hmm));
}
}
else
{
// Impress: always use screen format, landscape.
- Size aSize = SvxPaperInfo::GetPaperSize(PAPER_SCREEN_16_9,
MapUnit::Map100thMM);
- pPage->setToolsSize(Size(aSize.Height(), aSize.Width()));
+ gfx::Size2DLWrap aSize =
SvxPaperInfo::getPaperSize(PAPER_SCREEN_16_9);
+ pPage->setSize({ aSize.getHeight(), aSize.getWidth() });
pPage->setBorder(svx::Border());
}
@@ -619,16 +619,16 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument
const * pRefDocument /* =
else
{
// Always use portrait format
- if (aDefSize.Height() >= aDefSize.Width())
+ if (aDefaultSize.getHeight() >= aDefaultSize.getWidth())
{
- pNotesPage->setToolsSize(aDefSize);
+ pNotesPage->setSize(aDefaultSize);
}
else
{
- pNotesPage->setToolsSize(Size(aDefSize.Height(),
aDefSize.Width()));
+ pNotesPage->setSize({ aDefaultSize.getHeight(),
aDefaultSize.getWidth() });
}
- pNotesPage->SetBorder(0, 0, 0, 0);
+ pNotesPage->setBorder(svx::Border());
}
pNotesPage->SetPageKind(PageKind::Notes);
InsertPage(pNotesPage.get(), 2);
commit b3ee0d3e7bea27cdd8300a0d124ac69f085192ff
Author: Tomaž Vajngerl <[email protected]>
AuthorDate: Tue Oct 25 21:04:27 2022 +0200
Commit: Tomaž Vajngerl <[email protected]>
CommitDate: Fri Feb 3 16:38:36 2023 +0900
svx: SdrTextObj maRect - use getter and add funcs. for manipulation
Change-Id: I0a416fa2ac470650c2ef430dbb91bf8d5a8013cd
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index a2574765ade7..a1cccb0804a4 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -165,7 +165,32 @@ protected:
// The "aRect" is also the rect of RectObj and CircObj.
// When mbTextFrame=true the text will be formatted into this rect
// When mbTextFrame=false the text will be centered around its middle
- tools::Rectangle maRect;
+ tools::Rectangle maRectangle;
+
+ tools::Rectangle const& getRectangle() const
+ {
+ return maRectangle;
+ }
+
+ void setRectangle(tools::Rectangle const& rRectangle)
+ {
+ maRectangle = rRectangle;
+ }
+
+ void setRectangleSize(sal_Int32 nWidth, sal_Int32 nHeight)
+ {
+ maRectangle.SetSize(Size(nWidth, nHeight));
+ }
+
+ void moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
+ {
+ maRectangle.Move(nXDelta, nYDelta);
+ }
+
+ void moveRectanglePosition(sal_Int32 nX, sal_Int32 nY)
+ {
+ maRectangle.SetPos(Point(nX, nY));
+ }
// The GeoStat contains the rotation and shear angles
GeoStat maGeo;
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 44ecb8fefded..a6a56f417e6d 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1397,7 +1397,7 @@ void SdrObjCustomShape::AdaptTextMinSize()
// check if we need to change anything before creating an SfxItemSet,
because that is expensive
const bool
bResizeShapeToFitText(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue());
- tools::Rectangle aTextBound(maRect);
+ tools::Rectangle aTextBound(getRectangle());
bool bChanged(false);
if(bResizeShapeToFitText)
bChanged = true;
@@ -1432,10 +1432,11 @@ void SdrObjCustomShape::AdaptTextMinSize()
SetObjectItemSet(aSet);
}
-void SdrObjCustomShape::NbcSetSnapRect( const tools::Rectangle& rRect )
+void SdrObjCustomShape::NbcSetSnapRect(const tools::Rectangle& rRectangle)
{
- maRect = rRect;
- ImpJustifyRect(maRect);
+ tools::Rectangle aRectangle(rRectangle);
+ ImpJustifyRect(aRectangle);
+ setRectangle(aRectangle);
InvalidateRenderGeometry();
AdaptTextMinSize();
@@ -1455,10 +1456,11 @@ void SdrObjCustomShape::SetSnapRect( const
tools::Rectangle& rRect )
SendUserCall(SdrUserCallType::Resize,aBoundRect0);
}
-void SdrObjCustomShape::NbcSetLogicRect( const tools::Rectangle& rRect )
+void SdrObjCustomShape::NbcSetLogicRect(const tools::Rectangle& rRectangle)
{
- maRect = rRect;
- ImpJustifyRect(maRect);
+ tools::Rectangle aRectangle(rRectangle);
+ ImpJustifyRect(aRectangle);
+ setRectangle(aRectangle);
InvalidateRenderGeometry();
AdaptTextMinSize();
@@ -1515,7 +1517,7 @@ void SdrObjCustomShape::NbcMove( const Size& rSiz )
void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact,
const Fraction& ryFact )
{
// taking care of handles that should not been changed
- tools::Rectangle aOld( maRect );
+ tools::Rectangle aOld(getRectangle());
std::vector< SdrCustomShapeInteraction > aInteractionHandles(
GetInteractionHandles() );
SdrTextObj::NbcResize( rRef, rxFact, ryFact );
@@ -1543,17 +1545,17 @@ void SdrObjCustomShape::NbcResize( const Point& rRef,
const Fraction& rxFact, co
rInteraction.xInteraction->setControllerPosition(
rInteraction.aPosition );
if ( rInteraction.nMode &
CustomShapeHandleModes::RESIZE_ABSOLUTE_X )
{
- sal_Int32 nX = ( rInteraction.aPosition.X - aOld.Left() ) +
maRect.Left();
+ sal_Int32 nX = ( rInteraction.aPosition.X - aOld.Left() ) +
getRectangle().Left();
rInteraction.xInteraction->setControllerPosition(awt::Point(nX,
rInteraction.xInteraction->getPosition().Y));
}
else if ( rInteraction.nMode &
CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX )
{
- sal_Int32 nX = maRect.Right() - (aOld.Right() -
rInteraction.aPosition.X);
+ sal_Int32 nX = getRectangle().Right() - (aOld.Right() -
rInteraction.aPosition.X);
rInteraction.xInteraction->setControllerPosition(awt::Point(nX,
rInteraction.xInteraction->getPosition().Y));
}
if ( rInteraction.nMode &
CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
{
- sal_Int32 nY = ( rInteraction.aPosition.Y - aOld.Top() ) +
maRect.Top();
+ sal_Int32 nY = ( rInteraction.aPosition.Y - aOld.Top() ) +
getRectangle().Top();
rInteraction.xInteraction->setControllerPosition(awt::Point(rInteraction.xInteraction->getPosition().X,
nY));
}
}
@@ -1598,7 +1600,7 @@ void SdrObjCustomShape::NbcRotate( const Point& rRef,
Degree100 nAngle, double s
// the rotation angle for ashapes is stored in fObjectRotation, this
rotation
// has to be applied to the text object (which is internally using
maGeo.nAngle).
- SdrTextObj::NbcRotate( maRect.TopLeft(), -maGeo.nRotationAngle, //
retrieving the unrotated text object
+ SdrTextObj::NbcRotate( getRectangle().TopLeft(), -maGeo.nRotationAngle,
// retrieving the unrotated text object
-maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle );
maGeo.nRotationAngle = 0_deg100;
// resetting aGeo data
@@ -1612,7 +1614,7 @@ void SdrObjCustomShape::NbcRotate( const Point& rRef,
Degree100 nAngle, double s
nW = nW % 36000_deg100;
if ( nW < 0_deg100 )
nW = 36000_deg100 + nW;
- SdrTextObj::NbcRotate( maRect.TopLeft(), nW, //
applying text rotation
+ SdrTextObj::NbcRotate( getRectangle().TopLeft(), nW,
// applying text rotation
sin( toRadians(nW) ),
cos( toRadians(nW) ) );
@@ -1723,14 +1725,18 @@ SdrGluePoint
SdrObjCustomShape::GetVertexGluePoint(sal_uInt16 nPosNum) const
}
Point aPt;
- switch (nPosNum) {
- case 0: aPt=maRect.TopCenter(); aPt.AdjustY( -nWdt ); break;
- case 1: aPt=maRect.RightCenter(); aPt.AdjustX(nWdt ); break;
- case 2: aPt=maRect.BottomCenter(); aPt.AdjustY(nWdt ); break;
- case 3: aPt=maRect.LeftCenter(); aPt.AdjustX( -nWdt ); break;
- }
- if (maGeo.nShearAngle != 0_deg100) ShearPoint(aPt, maRect.TopLeft(),
maGeo.mfTanShearAngle);
- if (maGeo.nRotationAngle != 0_deg100) RotatePoint(aPt, maRect.TopLeft(),
maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
+ auto aRectangle = getRectangle();
+ switch (nPosNum)
+ {
+ case 0: aPt = aRectangle.TopCenter(); aPt.AdjustY( -nWdt ); break;
+ case 1: aPt = aRectangle.RightCenter(); aPt.AdjustX(nWdt ); break;
+ case 2: aPt = aRectangle.BottomCenter(); aPt.AdjustY(nWdt ); break;
+ case 3: aPt = aRectangle.LeftCenter(); aPt.AdjustX( -nWdt ); break;
+ }
+ if (maGeo.nShearAngle != 0_deg100)
+ ShearPoint(aPt, aRectangle.TopLeft(), maGeo.mfTanShearAngle);
+ if (maGeo.nRotationAngle != 0_deg100)
+ RotatePoint(aPt, aRectangle.TopLeft(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
aPt-=GetSnapRect().Center();
SdrGluePoint aGP(aPt);
aGP.SetPercent(false);
@@ -1779,19 +1785,19 @@ void
SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
if (maGeo.nRotationAngle || nShearAngle || bMirroredX || bMirroredY)
{
- tools::Polygon aPoly( maRect );
+ tools::Polygon aPoly(getRectangle());
if( nShearAngle )
{
sal_uInt16 nPointCount=aPoly.GetSize();
for (sal_uInt16 i=0; i<nPointCount; i++)
- ShearPoint(aPoly[i],maRect.Center(), fTan );
+ ShearPoint(aPoly[i], getRectangle().Center(), fTan );
}
if (maGeo.nRotationAngle)
- aPoly.Rotate( maRect.Center(), to<Degree10>(maGeo.nRotationAngle)
);
+ aPoly.Rotate( getRectangle().Center(),
to<Degree10>(maGeo.nRotationAngle) );
tools::Rectangle aBoundRect( aPoly.GetBoundRect() );
- sal_Int32 nXDiff = aBoundRect.Left() - maRect.Left();
- sal_Int32 nYDiff = aBoundRect.Top() - maRect.Top();
+ sal_Int32 nXDiff = aBoundRect.Left() - getRectangle().Left();
+ sal_Int32 nYDiff = aBoundRect.Top() - getRectangle().Top();
if (nShearAngle && bMirroredX != bMirroredY)
{
@@ -1799,7 +1805,7 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
fTan = -fTan;
}
- Point aRef( maRect.GetWidth() / 2, maRect.GetHeight() / 2 );
+ Point aRef( getRectangle().GetWidth() / 2, getRectangle().GetHeight()
/ 2 );
for ( a = 0; a < aNewList.GetCount(); a++ )
{
SdrGluePoint& rPoint = aNewList[ a ];
@@ -1810,9 +1816,9 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
RotatePoint(aGlue, aRef, sin(basegfx::deg2rad(fObjectRotation)),
cos(basegfx::deg2rad(fObjectRotation)));
if ( bMirroredX )
- aGlue.setX( maRect.GetWidth() - aGlue.X() );
+ aGlue.setX( getRectangle().GetWidth() - aGlue.X() );
if ( bMirroredY )
- aGlue.setY( maRect.GetHeight() - aGlue.Y() );
+ aGlue.setY( getRectangle().GetHeight() - aGlue.Y() );
aGlue.AdjustX( -nXDiff );
aGlue.AdjustY( -nYDiff );
rPoint.SetPos( aGlue );
@@ -1937,7 +1943,7 @@ bool SdrObjCustomShape::beginSpecialDrag(SdrDragStat&
rDrag) const
void SdrObjCustomShape::DragResizeCustomShape( const tools::Rectangle&
rNewRect )
{
- tools::Rectangle aOld( maRect );
+ tools::Rectangle aOld(getRectangle());
bool bOldMirroredX( IsMirroredX() );
bool bOldMirroredY( IsMirroredY() );
@@ -1947,7 +1953,7 @@ void SdrObjCustomShape::DragResizeCustomShape( const
tools::Rectangle& rNewRect
std::vector< SdrCustomShapeInteraction > aInteractionHandles(
GetInteractionHandles() );
GeoStat aGeoStat( GetGeoStat() );
- if ( aNewRect.TopLeft()!= maRect.TopLeft() &&
+ if ( aNewRect.TopLeft() != getRectangle().TopLeft() &&
( maGeo.nRotationAngle || maGeo.nShearAngle ) )
{
Point aNewPos( aNewRect.TopLeft() );
@@ -1955,7 +1961,7 @@ void SdrObjCustomShape::DragResizeCustomShape( const
tools::Rectangle& rNewRect
if ( maGeo.nRotationAngle ) RotatePoint(aNewPos, aOld.TopLeft(),
aGeoStat.mfSinRotationAngle, aGeoStat.mfCosRotationAngle );
aNewRect.SetPos( aNewPos );
}
- if ( aNewRect == maRect )
+ if (aNewRect == getRectangle())
return;
SetLogicRect( aNewRect );
@@ -1991,17 +1997,17 @@ void SdrObjCustomShape::DragResizeCustomShape( const
tools::Rectangle& rNewRect
{
nX = ( rInteraction.aPosition.X - aOld.Right() );
if ( rNewRect.Left() > rNewRect.Right() )
- nX = maRect.Left() - nX;
+ nX = getRectangle().Left() - nX;
else
- nX += maRect.Right();
+ nX += getRectangle().Right();
}
else
{
nX = ( rInteraction.aPosition.X - aOld.Left() );
if ( rNewRect.Left() > rNewRect.Right() )
- nX = maRect.Right() - nX;
+ nX = getRectangle().Right() - nX;
else
- nX += maRect.Left();
+ nX += getRectangle().Left();
}
rInteraction.xInteraction->setControllerPosition(awt::Point(nX,
rInteraction.xInteraction->getPosition().Y));
}
@@ -2012,17 +2018,17 @@ void SdrObjCustomShape::DragResizeCustomShape( const
tools::Rectangle& rNewRect
{
nY = ( rInteraction.aPosition.Y - aOld.Bottom() );
if ( rNewRect.Top() > rNewRect.Bottom() )
- nY = maRect.Top() - nY;
+ nY = getRectangle().Top() - nY;
else
- nY += maRect.Bottom();
+ nY += getRectangle().Bottom();
}
else
{
nY = ( rInteraction.aPosition.Y - aOld.Top() );
if ( rNewRect.Top() > rNewRect.Bottom() )
- nY = maRect.Bottom() - nY;
+ nY = getRectangle().Bottom() - nY;
else
- nY += maRect.Top();
+ nY += getRectangle().Top();
}
rInteraction.xInteraction->setControllerPosition(awt::Point(rInteraction.xInteraction->getPosition().X,
nY));
}
@@ -2052,7 +2058,7 @@ void SdrObjCustomShape::DragMoveCustomShapeHdl( const
Point& rDestination,
sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X;
sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y;
- maRect.Move( nXDiff, nYDiff );
+ moveRectangle(nXDiff, nYDiff);
moveOutRectangle(nXDiff, nYDiff);
maSnapRect.Move( nXDiff, nYDiff );
SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
@@ -2134,12 +2140,12 @@ void SdrObjCustomShape::DragCreateObject( SdrDragStat&
rStat )
if ( !aInteractionHandles.empty() )
{
sal_Int32 nHandlePos = aInteractionHandles[
aInteractionHandles.size() - 1 ].xInteraction->getPosition().X;
- aRect1.Move( maRect.Left() - nHandlePos, 0 );
+ aRect1.Move(getRectangle().Left() - nHandlePos, 0);
}
}
ImpJustifyRect( aRect1 );
rStat.SetActionRect( aRect1 );
- maRect = aRect1;
+ setRectangle(aRect1);
SetBoundAndSnapRectsDirty();
for (const auto& rInteraction : aInteractionHandles)
@@ -2446,9 +2452,9 @@ tools::Rectangle
SdrObjCustomShape::ImpCalculateTextFrame( const bool bHgt, cons
{
tools::Rectangle aReturnValue;
- tools::Rectangle aOldTextRect( maRect ); // <- initial text
rectangle
+ tools::Rectangle aOldTextRect(getRectangle()); // <- initial text
rectangle
- tools::Rectangle aNewTextRect( maRect ); // <- new text rectangle
returned from the custom shape renderer,
+ tools::Rectangle aNewTextRect(getRectangle()); // <- new text
rectangle returned from the custom shape renderer,
GetTextBounds( aNewTextRect ); // it depends to the current
logical shape size
tools::Rectangle aAdjustedTextRect( aNewTextRect );
// <- new text rectangle is being tested by AdjustTextFrameWidthAndHeight
to ensure
@@ -2457,7 +2463,7 @@ tools::Rectangle
SdrObjCustomShape::ImpCalculateTextFrame( const bool bHgt, cons
if (aAdjustedTextRect != aNewTextRect && aOldTextRect !=
aAdjustedTextRect &&
aNewTextRect.GetWidth() && aNewTextRect.GetHeight())
{
- aReturnValue = maRect;
+ aReturnValue = getRectangle();
double fXScale = static_cast<double>(aOldTextRect.GetWidth()) /
static_cast<double>(aNewTextRect.GetWidth());
double fYScale = static_cast<double>(aOldTextRect.GetHeight()) /
static_cast<double>(aNewTextRect.GetHeight());
double fRightDiff = static_cast<double>( aAdjustedTextRect.Right()
- aNewTextRect.Right() ) * fXScale;
@@ -2476,7 +2482,7 @@ tools::Rectangle
SdrObjCustomShape::ImpCalculateTextFrame( const bool bHgt, cons
bool SdrObjCustomShape::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
{
tools::Rectangle aNewTextRect = ImpCalculateTextFrame(bHgt, bWdt);
- const bool bRet = !aNewTextRect.IsEmpty() && aNewTextRect != maRect;
+ const bool bRet = !aNewTextRect.IsEmpty() && aNewTextRect !=
getRectangle();
if (bRet && !mbAdjustingTextFrameWidthAndHeight)
{
mbAdjustingTextFrameWidthAndHeight = true;
@@ -2484,7 +2490,7 @@ bool
SdrObjCustomShape::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
// taking care of handles that should not been changed
std::vector< SdrCustomShapeInteraction > aInteractionHandles(
GetInteractionHandles() );
- maRect = aNewTextRect;
+ setRectangle(aNewTextRect);
SetBoundAndSnapRectsDirty();
SetChanged();
@@ -2509,7 +2515,7 @@ bool
SdrObjCustomShape::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight()
{
tools::Rectangle aNewTextRect = ImpCalculateTextFrame( true/*bHgt*/,
true/*bWdt*/ );
- bool bRet = !aNewTextRect.IsEmpty() && ( aNewTextRect != maRect );
+ bool bRet = !aNewTextRect.IsEmpty() && ( aNewTextRect != getRectangle());
if ( bRet )
{
tools::Rectangle aBoundRect0;
@@ -2519,7 +2525,7 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight()
// taking care of handles that should not been changed
std::vector< SdrCustomShapeInteraction > aInteractionHandles(
GetInteractionHandles() );
- maRect = aNewTextRect;
+ setRectangle(aNewTextRect);
SetBoundAndSnapRectsDirty();
for (const auto& rInteraction : aInteractionHandles)
@@ -2887,8 +2893,8 @@ void SdrObjCustomShape::handlePageChange(SdrPage*
pOldPage, SdrPage* pNewPage)
// invalidating rectangles by SetRectsDirty is not sufficient,
// AdjustTextFrameWidthAndHeight() also has to be made, both
// actions are done by NbcSetSnapRect
- tools::Rectangle aTmp( maRect ); //creating temporary rectangle
#i61108#
- NbcSetSnapRect( aTmp );
+ tools::Rectangle aRectangle(getRectangle()); //creating temporary
rectangle #i61108#
+ NbcSetSnapRect(aRectangle);
}
}
@@ -3109,8 +3115,8 @@ bool
SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf
double fRotate = basegfx::deg2rad(fObjectRotation);
double fShearX = toRadians(maGeo.nShearAngle);
- // get aRect, this is the unrotated snaprect
- tools::Rectangle aRectangle(maRect);
+ // get aRectangle, this is the unrotated snaprect
+ tools::Rectangle aRectangle(getRectangle());
bool bMirroredX = IsMirroredX();
bool bMirroredY = IsMirroredY();
@@ -3122,7 +3128,7 @@ bool
SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf
if ( bMirroredX )
{
fShearX = -fShearX;
- tools::Polygon aPol = Rect2Poly(maRect, aNewGeo);
+ tools::Polygon aPol = Rect2Poly(getRectangle(), aNewGeo);
tools::Rectangle aBoundRect( aPol.GetBoundRect() );
Point aRef1( ( aBoundRect.Left() + aBoundRect.Right() ) >> 1,
aBoundRect.Top() );
@@ -3163,7 +3169,7 @@ bool
SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf
aPol[2]=aPol0[3]; // it was *not* wrong even when the reordering
aPol[3]=aPol0[2]; // *seems* to be specific for X-Mirrorings. Oh
aPol[4]=aPol0[1]; // will I be happy when this old stuff is |gone|
with aw080 (!)
- Poly2Rect(aPol,aRectangle,aNewGeo);
+ Poly2Rect(aPol, aRectangle, aNewGeo);
}
}
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 6a886272bad1..14e7678499c7 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -308,7 +308,7 @@ bool SdrCaptionObj::beginSpecialDrag(SdrDragStat& rDrag)
const
return false;
rDrag.SetNoSnap();
- rDrag.SetActionRect(maRect);
+ rDrag.SetActionRect(getRectangle());
Point aHit(rDrag.GetStart());
@@ -341,15 +341,15 @@ bool SdrCaptionObj::applySpecialDrag(SdrDragStat& rDrag)
}
else
{
- Point aDelt(rDrag.GetNow()-rDrag.GetStart());
+ Point aDelta(rDrag.GetNow()-rDrag.GetStart());
if(!pHdl)
{
- maRect.Move(aDelt.X(),aDelt.Y());
+ moveRectangle(aDelta.X(), aDelta.Y());
}
else
{
- aTailPoly[0] += aDelt;
+ aTailPoly[0] += aDelta;
}
ImpRecalcTail();
@@ -408,7 +408,7 @@ void SdrCaptionObj::ImpRecalcTail()
{
ImpCaptParams aPara;
ImpGetCaptParams(aPara);
- ImpCalcTail(aPara, aTailPoly, maRect);
+ ImpCalcTail(aPara, aTailPoly, getRectangle());
SetBoundAndSnapRectsDirty();
SetXPolyDirty();
}
@@ -511,14 +511,15 @@ void SdrCaptionObj::ImpCalcTail(const ImpCaptParams&
rPara, tools::Polygon& rPol
bool SdrCaptionObj::BegCreate(SdrDragStat& rStat)
{
- if (maRect.IsEmpty()) return false; // Create currently only works with
the given Rect
+ if (getRectangle().IsEmpty())
+ return false; // Create currently only works with the given Rect
ImpCaptParams aPara;
ImpGetCaptParams(aPara);
- maRect.SetPos(rStat.GetNow());
+ moveRectanglePosition(rStat.GetNow().X(), rStat.GetNow().Y());
aTailPoly[0]=rStat.GetStart();
- ImpCalcTail(aPara,aTailPoly,maRect);
- rStat.SetActionRect(maRect);
+ ImpCalcTail(aPara,aTailPoly, getRectangle());
+ rStat.SetActionRect(getRectangle());
return true;
}
@@ -526,9 +527,9 @@ bool SdrCaptionObj::MovCreate(SdrDragStat& rStat)
{
ImpCaptParams aPara;
ImpGetCaptParams(aPara);
- maRect.SetPos(rStat.GetNow());
- ImpCalcTail(aPara,aTailPoly,maRect);
- rStat.SetActionRect(maRect);
+ moveRectanglePosition(rStat.GetNow().X(), rStat.GetNow().Y());
+ ImpCalcTail(aPara,aTailPoly, getRectangle());
+ rStat.SetActionRect(getRectangle());
SetBoundRectDirty();
m_bSnapRectDirty=true;
return true;
@@ -538,8 +539,8 @@ bool SdrCaptionObj::EndCreate(SdrDragStat& rStat,
SdrCreateCmd eCmd)
{
ImpCaptParams aPara;
ImpGetCaptParams(aPara);
- maRect.SetPos(rStat.GetNow());
- ImpCalcTail(aPara,aTailPoly,maRect);
+ moveRectanglePosition(rStat.GetNow().X(), rStat.GetNow().Y());
+ ImpCalcTail(aPara,aTailPoly, getRectangle());
SetBoundAndSnapRectsDirty();
return (eCmd==SdrCreateCmd::ForceEnd || rStat.GetPointCount()>=2);
}
@@ -556,7 +557,7 @@ void SdrCaptionObj::BrkCreate(SdrDragStat& /*rStat*/)
basegfx::B2DPolyPolygon SdrCaptionObj::TakeCreatePoly(const SdrDragStat&
/*rDrag*/) const
{
basegfx::B2DPolyPolygon aRetval;
- const basegfx::B2DRange aRange
=vcl::unotools::b2DRectangleFromRectangle(maRect);
+ const basegfx::B2DRange aRange
=vcl::unotools::b2DRectangleFromRectangle(getRectangle());
aRetval.append(basegfx::utils::createPolygonFromRect(aRange));
aRetval.append(aTailPoly.getB2DPolygon());
return aRetval;
@@ -598,7 +599,7 @@ Point SdrCaptionObj::GetRelativePos() const
const tools::Rectangle& SdrCaptionObj::GetLogicRect() const
{
- return maRect;
+ return getRectangle();
}
void SdrCaptionObj::NbcSetLogicRect(const tools::Rectangle& rRect)
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 1207548114bf..ab8bc58ddf85 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -312,14 +312,14 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const
SdrCircKind eCircleKind,
void SdrCircObj::RecalcXPoly()
{
- basegfx::B2DPolygon aPolyCirc(ImpCalcXPolyCirc(meCircleKind, maRect,
nStartAngle, nEndAngle));
+ basegfx::B2DPolygon aPolyCirc(ImpCalcXPolyCirc(meCircleKind,
getRectangle(), nStartAngle, nEndAngle));
mpXPoly = XPolygon(aPolyCirc);
}
OUString SdrCircObj::TakeObjNameSingul() const
{
TranslateId pID=STR_ObjNameSingulCIRC;
- if (maRect.GetWidth() == maRect.GetHeight() && maGeo.nShearAngle==0_deg100)
+ if (getRectangle().GetWidth() == getRectangle().GetHeight() &&
maGeo.nShearAngle == 0_deg100)
{
switch (meCircleKind) {
case SdrCircKind::Full: pID=STR_ObjNameSingulCIRC; break;
@@ -348,7 +348,7 @@ OUString SdrCircObj::TakeObjNameSingul() const
OUString SdrCircObj::TakeObjNamePlural() const
{
TranslateId pID=STR_ObjNamePluralCIRC;
- if (maRect.GetWidth() == maRect.GetHeight() && maGeo.nShearAngle==0_deg100)
+ if (getRectangle().GetWidth() == getRectangle().GetHeight() &&
maGeo.nShearAngle == 0_deg100)
{
switch (meCircleKind) {
case SdrCircKind::Full: pID=STR_ObjNamePluralCIRC; break;
@@ -376,7 +376,7 @@ rtl::Reference<SdrObject>
SdrCircObj::CloneSdrObject(SdrModel& rTargetModel) con
basegfx::B2DPolyPolygon SdrCircObj::TakeXorPoly() const
{
- const basegfx::B2DPolygon aCircPolygon(ImpCalcXPolyCirc(meCircleKind,
maRect, nStartAngle, nEndAngle));
+ const basegfx::B2DPolygon aCircPolygon(ImpCalcXPolyCirc(meCircleKind,
getRectangle(), nStartAngle, nEndAngle));
return basegfx::B2DPolyPolygon(aCircPolygon);
}
@@ -423,61 +423,61 @@ void SdrCircObj::AddToHdlList(SdrHdlList& rHdlList) const
Point aPnt;
SdrHdlKind eLocalKind(SdrHdlKind::Move);
sal_uInt32 nPNum(0);
-
+ tools::Rectangle aRectangle = getRectangle();
switch (nHdlNum)
{
case 0:
- aPnt = GetAnglePnt(maRect,nStartAngle);
+ aPnt = GetAnglePnt(aRectangle, nStartAngle);
eLocalKind = SdrHdlKind::Circle;
nPNum = 1;
break;
case 1:
- aPnt = GetAnglePnt(maRect,nEndAngle);
+ aPnt = GetAnglePnt(aRectangle, nEndAngle);
eLocalKind = SdrHdlKind::Circle;
nPNum = 2;
break;
case 2:
- aPnt = maRect.TopLeft();
+ aPnt = aRectangle.TopLeft();
eLocalKind = SdrHdlKind::UpperLeft;
break;
case 3:
- aPnt = maRect.TopCenter();
+ aPnt = aRectangle.TopCenter();
eLocalKind = SdrHdlKind::Upper;
break;
case 4:
- aPnt = maRect.TopRight();
+ aPnt = aRectangle.TopRight();
eLocalKind = SdrHdlKind::UpperRight;
break;
case 5:
- aPnt = maRect.LeftCenter();
+ aPnt = aRectangle.LeftCenter();
eLocalKind = SdrHdlKind::Left;
break;
case 6:
- aPnt = maRect.RightCenter();
+ aPnt = aRectangle.RightCenter();
eLocalKind = SdrHdlKind::Right;
break;
case 7:
- aPnt = maRect.BottomLeft();
+ aPnt = aRectangle.BottomLeft();
eLocalKind = SdrHdlKind::LowerLeft;
break;
case 8:
- aPnt = maRect.BottomCenter();
+ aPnt = aRectangle.BottomCenter();
eLocalKind = SdrHdlKind::Lower;
break;
case 9:
- aPnt = maRect.BottomRight();
+ aPnt = aRectangle.BottomRight();
eLocalKind = SdrHdlKind::LowerRight;
break;
}
if (maGeo.nShearAngle)
{
- ShearPoint(aPnt, maRect.TopLeft(), maGeo.mfTanShearAngle);
+ ShearPoint(aPnt, aRectangle.TopLeft(), maGeo.mfTanShearAngle);
}
if (maGeo.nRotationAngle)
{
- RotatePoint(aPnt, maRect.TopLeft(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
+ RotatePoint(aPnt, aRectangle.TopLeft(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
}
std::unique_ptr<SdrHdl> pH(new SdrHdl(aPnt,eLocalKind));
@@ -520,15 +520,15 @@ bool SdrCircObj::applySpecialDrag(SdrDragStat& rDrag)
Point aPt(rDrag.GetNow());
if (maGeo.nRotationAngle)
- RotatePoint(aPt,maRect.TopLeft(), -maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
+ RotatePoint(aPt, getRectangle().TopLeft(),
-maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
if (maGeo.nShearAngle)
- ShearPoint(aPt,maRect.TopLeft(), -maGeo.mfTanShearAngle);
+ ShearPoint(aPt, getRectangle().TopLeft(), -maGeo.mfTanShearAngle);
- aPt -= maRect.Center();
+ aPt -= getRectangle().Center();
- tools::Long nWdt = maRect.Right() - maRect.Left();
- tools::Long nHgt = maRect.Bottom() - maRect.Top();
+ tools::Long nWdt = getRectangle().Right() - getRectangle().Left();
+ tools::Long nHgt = getRectangle().Bottom() - getRectangle().Top();
if(nWdt>=nHgt)
{
@@ -696,7 +696,7 @@ bool SdrCircObj::BegCreate(SdrDragStat& rStat)
tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
aRect1.Normalize();
rStat.SetActionRect(aRect1);
- maRect = aRect1;
+ setRectangle(aRect1);
ImpSetCreateParams(rStat);
return true;
}
@@ -706,8 +706,8 @@ bool SdrCircObj::MovCreate(SdrDragStat& rStat)
ImpSetCreateParams(rStat);
ImpCircUser* pU=static_cast<ImpCircUser*>(rStat.GetUser());
rStat.SetActionRect(pU->aR);
- maRect = pU->aR; // for ObjName
- ImpJustifyRect(maRect);
+ setRectangle(pU->aR); // for ObjName
+ ImpJustifyRect(maRectangle);
nStartAngle=pU->nStart;
nEndAngle=pU->nEnd;
SetBoundRectDirty();
@@ -733,16 +733,18 @@ bool SdrCircObj::EndCreate(SdrDragStat& rStat,
SdrCreateCmd eCmd)
if (meCircleKind==SdrCircKind::Full) {
bRet=rStat.GetPointCount()>=2;
if (bRet) {
- maRect = pU->aR;
- ImpJustifyRect(maRect);
+ tools::Rectangle aRectangle(pU->aR);
+ ImpJustifyRect(aRectangle);
+ setRectangle(aRectangle);
}
} else {
rStat.SetNoSnap(rStat.GetPointCount()>=2);
rStat.SetOrtho4Possible(rStat.GetPointCount()<2);
bRet=rStat.GetPointCount()>=4;
if (bRet) {
- maRect = pU->aR;
- ImpJustifyRect(maRect);
+ tools::Rectangle aRectangle(pU->aR);
+ ImpJustifyRect(aRectangle);
+ setRectangle(aRectangle);
nStartAngle=pU->nStart;
nEndAngle=pU->nEnd;
}
@@ -809,7 +811,7 @@ PointerStyle SdrCircObj::GetCreatePointer() const
void SdrCircObj::NbcMove(const Size& aSize)
{
- maRect.Move(aSize);
+ moveRectangle(aSize.Width(), aSize.Height());
moveOutRectangle(aSize.Width(), aSize.Height());
maSnapRect.Move(aSize);
SetXPolyDirty();
@@ -880,9 +882,9 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point&
rRef2)
Point aTmpPt1;
Point aTmpPt2;
if (bFreeMirr) { // some preparations for using an arbitrary axis of
reflection
- Point aCenter(maRect.Center());
- tools::Long nWdt=maRect.GetWidth()-1;
- tools::Long nHgt=maRect.GetHeight()-1;
+ Point aCenter(getRectangle().Center());
+ tools::Long nWdt = getRectangle().GetWidth() - 1;
+ tools::Long nHgt = getRectangle().GetHeight() - 1;
tools::Long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
// starting point
double a = toRadians(nStartAngle);
@@ -898,13 +900,13 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const
Point& rRef2)
aTmpPt2+=aCenter;
if (maGeo.nRotationAngle)
{
- RotatePoint(aTmpPt1, maRect.TopLeft(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
- RotatePoint(aTmpPt2, maRect.TopLeft(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
+ RotatePoint(aTmpPt1, getRectangle().TopLeft(),
maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
+ RotatePoint(aTmpPt2, getRectangle().TopLeft(),
maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
}
if (maGeo.nShearAngle)
{
- ShearPoint(aTmpPt1, maRect.TopLeft(), maGeo.mfTanShearAngle);
- ShearPoint(aTmpPt2, maRect.TopLeft(), maGeo.mfTanShearAngle);
+ ShearPoint(aTmpPt1, getRectangle().TopLeft(),
maGeo.mfTanShearAngle);
+ ShearPoint(aTmpPt2, getRectangle().TopLeft(),
maGeo.mfTanShearAngle);
}
}
SdrTextObj::NbcMirror(rRef1,rRef2);
@@ -914,16 +916,16 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const
Point& rRef2)
// unrotate:
if (maGeo.nRotationAngle)
{
- RotatePoint(aTmpPt1, maRect.TopLeft(), -maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle); // -sin for reversion
- RotatePoint(aTmpPt2, maRect.TopLeft(), -maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle); // -sin for reversion
+ RotatePoint(aTmpPt1, getRectangle().TopLeft(),
-maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); // -sin for reversion
+ RotatePoint(aTmpPt2, getRectangle().TopLeft(),
-maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); // -sin for reversion
}
// unshear:
if (maGeo.nShearAngle)
{
- ShearPoint(aTmpPt1, maRect.TopLeft(), -maGeo.mfTanShearAngle); //
-tan for reversion
- ShearPoint(aTmpPt2, maRect.TopLeft(), -maGeo.mfTanShearAngle); //
-tan for reversion
+ ShearPoint(aTmpPt1, getRectangle().TopLeft(),
-maGeo.mfTanShearAngle); // -tan for reversion
+ ShearPoint(aTmpPt2, getRectangle().TopLeft(),
-maGeo.mfTanShearAngle); // -tan for reversion
}
- Point aCenter(maRect.Center());
+ Point aCenter(getRectangle().Center());
aTmpPt1-=aCenter;
aTmpPt2-=aCenter;
// because it's mirrored, the angles are swapped, too
@@ -971,37 +973,37 @@ static void Union(tools::Rectangle& rR, const Point& rP)
void SdrCircObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const
{
- rRect = maRect;
+ rRect = getRectangle();
if (meCircleKind!=SdrCircKind::Full) {
- const Point aPntStart(GetAnglePnt(maRect,nStartAngle));
- const Point aPntEnd(GetAnglePnt(maRect,nEndAngle));
+ const Point aPntStart(GetAnglePnt(getRectangle(), nStartAngle));
+ const Point aPntEnd(GetAnglePnt(getRectangle(), nEndAngle));
Degree100 a=nStartAngle;
Degree100 e=nEndAngle;
- rRect.SetLeft(maRect.Right() );
- rRect.SetRight(maRect.Left() );
- rRect.SetTop(maRect.Bottom() );
- rRect.SetBottom(maRect.Top() );
+ rRect.SetLeft(getRectangle().Right() );
+ rRect.SetRight(getRectangle().Left() );
+ rRect.SetTop(getRectangle().Bottom() );
+ rRect.SetBottom(getRectangle().Top() );
Union(rRect,aPntStart);
Union(rRect,aPntEnd);
if ((a<=18000_deg100 && e>=18000_deg100) || (a>e && (a<=18000_deg100
|| e>=18000_deg100))) {
- Union(rRect,maRect.LeftCenter());
+ Union(rRect, getRectangle().LeftCenter());
}
if ((a<=27000_deg100 && e>=27000_deg100) || (a>e && (a<=27000_deg100
|| e>=27000_deg100))) {
- Union(rRect,maRect.BottomCenter());
+ Union(rRect, getRectangle().BottomCenter());
}
if (a>e) {
- Union(rRect,maRect.RightCenter());
+ Union(rRect, getRectangle().RightCenter());
}
if ((a<=9000_deg100 && e>=9000_deg100) || (a>e && (a<=9000_deg100 ||
e>=9000_deg100))) {
- Union(rRect,maRect.TopCenter());
+ Union(rRect, getRectangle().TopCenter());
}
if (meCircleKind==SdrCircKind::Section) {
- Union(rRect,maRect.Center());
+ Union(rRect, getRectangle().Center());
}
if (maGeo.nRotationAngle)
{
Point aDst(rRect.TopLeft());
- aDst-=maRect.TopLeft();
+ aDst -= getRectangle().TopLeft();
Point aDst0(aDst);
RotatePoint(aDst,Point(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
aDst-=aDst0;
@@ -1046,8 +1048,8 @@ void SdrCircObj::NbcSetSnapRect(const tools::Rectangle&
rRect)
NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
} else {
- maRect=rRect;
- ImpJustifyRect(maRect);
+ setRectangle(rRect);
+ ImpJustifyRect(maRectangle);
}
SetBoundAndSnapRectsDirty();
SetXPolyDirty();
@@ -1065,10 +1067,11 @@ sal_uInt32 SdrCircObj::GetSnapPointCount() const
Point SdrCircObj::GetSnapPoint(sal_uInt32 i) const
{
- switch (i) {
- case 1 : return GetAnglePnt(maRect,nStartAngle);
- case 2 : return GetAnglePnt(maRect,nEndAngle);
- default: return maRect.Center();
+ switch (i)
+ {
+ case 1 : return GetAnglePnt(getRectangle(), nStartAngle);
+ case 2 : return GetAnglePnt(getRectangle(), nEndAngle);
+ default: return getRectangle().Center();
}
}
@@ -1140,7 +1143,7 @@ void SdrCircObj::ImpSetCircInfoToAttr()
rtl::Reference<SdrObject> SdrCircObj::DoConvertToPolyObj(bool bBezier, bool
bAddText) const
{
const bool bFill(meCircleKind != SdrCircKind::Arc);
- const basegfx::B2DPolygon aCircPolygon(ImpCalcXPolyCirc(meCircleKind,
maRect, nStartAngle, nEndAngle));
+ const basegfx::B2DPolygon aCircPolygon(ImpCalcXPolyCirc(meCircleKind,
getRectangle(), nStartAngle, nEndAngle));
rtl::Reference<SdrObject> pRet =
ImpConvertMakeObj(basegfx::B2DPolyPolygon(aCircPolygon), bFill, bBezier);
if(bAddText)
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index f84ee128a6e0..81bb8bdf79af 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -1718,7 +1718,7 @@ void SdrEdgeObj::SetEdgeTrackPath( const
basegfx::B2DPolyPolygon& rPoly )
// #i110629# also set aRect and maSnapeRect depending on pEdgeTrack
const tools::Rectangle aPolygonBounds(pEdgeTrack->GetBoundRect());
- maRect = aPolygonBounds;
+ setRectangle(aPolygonBounds);
maSnapRect = aPolygonBounds;
}
}
@@ -2273,11 +2273,11 @@ void SdrEdgeObj::NbcSetSnapRect(const tools::Rectangle&
rRect)
if(aOld == rRect)
return;
- if (maRect.IsEmpty() && 0 == pEdgeTrack->GetPointCount())
+ if (getRectangle().IsEmpty() && 0 == pEdgeTrack->GetPointCount())
{
// #i110629# When initializing, do not scale on empty Rectangle; this
// will mirror the underlying text object (!)
- maRect = rRect;
+ setRectangle(rRect);
maSnapRect = rRect;
}
else
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 9ac5536c5716..1424feca674a 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -921,7 +921,7 @@ rtl::Reference<SdrObject>
SdrGrafObj::DoConvertToPolyObj(bool bBezier, bool bAdd
ImpSdrGDIMetaFileImport aFilter(
getSdrModelFromSdrObject(),
GetLayer(),
- maRect);
+ getRectangle());
rtl::Reference<SdrObjGroup> pGrp = new
SdrObjGroup(getSdrModelFromSdrObject());
if(aFilter.DoImport(aMtf, *pGrp->GetSubList(), 0))
@@ -933,13 +933,13 @@ rtl::Reference<SdrObject>
SdrGrafObj::DoConvertToPolyObj(bool bBezier, bool bAdd
if(aGeoStat.nShearAngle)
{
aGeoStat.RecalcTan();
- pGrp->NbcShear(maRect.TopLeft(), aGeoStat.nShearAngle,
aGeoStat.mfTanShearAngle, false);
+ pGrp->NbcShear(getRectangle().TopLeft(),
aGeoStat.nShearAngle, aGeoStat.mfTanShearAngle, false);
}
if(aGeoStat.nRotationAngle)
{
aGeoStat.RecalcSinCos();
- pGrp->NbcRotate(maRect.TopLeft(),
aGeoStat.nRotationAngle, aGeoStat.mfSinRotationAngle,
aGeoStat.mfCosRotationAngle);
+ pGrp->NbcRotate(getRectangle().TopLeft(),
aGeoStat.nRotationAngle, aGeoStat.mfSinRotationAngle,
aGeoStat.mfCosRotationAngle);
}
}
@@ -1105,7 +1105,7 @@ void SdrGrafObj::AdjustToMaxRect( const tools::Rectangle&
rMaxRect, bool bShrink
}
if( bShrinkOnly )
- aPos = maRect.TopLeft();
+ aPos = getRectangle().TopLeft();
aPos.AdjustX( -(aSize.Width() / 2) );
aPos.AdjustY( -(aSize.Height() / 2) );
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 5e402646ef66..ee53dc085b32 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -698,7 +698,7 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(tools::Rectangle&
rRect) const
aTextSize2.AdjustWidth( 1 ); aTextSize2.AdjustHeight( 1 ); // because of
the Rect-Ctor's odd behavior
rRect=tools::Rectangle(aTextPos,aTextSize2);
rRect.Normalize();
- const_cast<SdrMeasureObj*>(this)->maRect=rRect;
+ const_cast<SdrMeasureObj*>(this)->setRectangle(rRect);
if (aMPol.nTextAngle != maGeo.nRotationAngle) {
const_cast<SdrMeasureObj*>(this)->maGeo.nRotationAngle=aMPol.nTextAngle;
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 9b17b7bf278a..e6c179812eae 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -245,7 +245,7 @@ void SdrMediaObj::AdjustToMaxRect( const tools::Rectangle&
rMaxRect, bool bShrin
}
if( bShrinkOnly )
- aPos = maRect.TopLeft();
+ aPos = getRectangle().TopLeft();
aPos.AdjustX( -(aSize.Width() / 2) );
aPos.AdjustY( -(aSize.Height() / 2) );
@@ -483,7 +483,7 @@ void SdrMediaObj::notifyPropertiesForLOKit()
json.put("id", mediaId);
json.put("url", m_xImpl->m_MediaProperties.getTempURL());
- const tools::Rectangle aRect = o3tl::convert(maRect,
o3tl::Length::mm100, o3tl::Length::twip);
+ const tools::Rectangle aRect = o3tl::convert(getRectangle(),
o3tl::Length::mm100, o3tl::Length::twip);
json.put("x", aRect.getX());
json.put("y", aRect.getY());
json.put("w", aRect.getOpenWidth());
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index a5ebed7ce7ce..3661aa260d14 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1476,8 +1476,8 @@ void SdrOle2Obj::ImpSetVisAreaSize()
MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit(
mpImpl->mxObjRef->getMapUnit( GetAspect() ) );
Size aVisSize;
if (sal_Int32(aScaleWidth) != 0 && sal_Int32(aScaleHeight) != 0)
// avoid div by zero
- aVisSize = Size( static_cast<tools::Long>( Fraction(
maRect.GetWidth() ) / aScaleWidth ),
- static_cast<tools::Long>( Fraction(
maRect.GetHeight() ) / aScaleHeight ) );
+ aVisSize = Size( static_cast<tools::Long>( Fraction(
getRectangle().GetWidth() ) / aScaleWidth ),
+ static_cast<tools::Long>( Fraction(
getRectangle().GetHeight() ) / aScaleHeight ) );
aVisSize = OutputDevice::LogicToLogic(
aVisSize,
@@ -1503,18 +1503,15 @@ void SdrOle2Obj::ImpSetVisAreaSize()
// server changed VisArea to its liking and the VisArea is
different than the suggested one
// store the new value as given by the object
MapUnit aNewMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit(
mpImpl->mxObjRef->getMapUnit( GetAspect() ) );
- maRect.SetSize(
- OutputDevice::LogicToLogic(
- aAcceptedVisArea.GetSize(),
- MapMode(aNewMapUnit),
- MapMode(getSdrModelFromSdrObject().GetScaleUnit())));
+ auto aSize =
OutputDevice::LogicToLogic(aAcceptedVisArea.GetSize(), MapMode(aNewMapUnit),
MapMode(getSdrModelFromSdrObject().GetScaleUnit()));
+ setRectangleSize(aSize.Width(), aSize.Height());
}
// make the new object area known to the client
// compared to the "else" branch aRect might have been changed by
the object and no additional scaling was applied
// WHY this -> OSL_ASSERT( pClient );
if( pClient )
- pClient->SetObjArea(maRect);
+ pClient->SetObjArea(getRectangle());
// we need a new replacement image as the object has resized itself
@@ -1535,7 +1532,7 @@ void SdrOle2Obj::ImpSetVisAreaSize()
{
if ( pClient )
{
- tools::Rectangle aScaleRect(maRect.TopLeft(),
aObjAreaSize);
+ tools::Rectangle aScaleRect(getRectangle().TopLeft(),
aObjAreaSize);
pClient->SetObjAreaAndScale( aScaleRect, aScaleWidth,
aScaleHeight);
}
else
@@ -1556,8 +1553,8 @@ void SdrOle2Obj::ImpSetVisAreaSize()
const MapUnit aMapUnit(
VCLUnoHelper::UnoEmbed2VCLMapUnit(
mpImpl->mxObjRef->getMapUnit(GetAspect())));
- const Point aTL( maRect.TopLeft() );
- const Point aBR( maRect.BottomRight() );
+ const Point aTL( getRectangle().TopLeft() );
+ const Point aBR( getRectangle().BottomRight() );
const Point aTL2(
OutputDevice::LogicToLogic(
aTL,
@@ -1868,7 +1865,7 @@ bool SdrOle2Obj::CalculateNewScaling( Fraction&
aScaleWidth, Fraction& aScaleHei
MapMode aMapMode(getSdrModelFromSdrObject().GetScaleUnit());
aObjAreaSize = mpImpl->mxObjRef.GetSize( &aMapMode );
- Size aSize = maRect.GetSize();
+ Size aSize = getRectangle().GetSize();
aScaleWidth = Fraction(aSize.Width(), aObjAreaSize.Width() );
aScaleHeight = Fraction(aSize.Height(), aObjAreaSize.Height() );
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index a4998647c835..78012451b2bd 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -1682,7 +1682,7 @@ void SdrPathObj::ImpForceLineAngle()
maGeo.RecalcTan();
// for SdrTextObj, keep aRect up to date
- maRect = tools::Rectangle::Normalize(aPoint0, aPoint1);
+ setRectangle(tools::Rectangle::Normalize(aPoint0, aPoint1));
}
void SdrPathObj::ImpForceKind()
@@ -1746,7 +1746,7 @@ void SdrPathObj::ImpForceKind()
// #i10659# for SdrTextObj, keep aRect up to date
if(GetPathPoly().count())
{
- maRect = lcl_ImpGetBoundRect(GetPathPoly());
+ setRectangle(lcl_ImpGetBoundRect(GetPathPoly()));
}
}
@@ -2469,7 +2469,7 @@ void SdrPathObj::NbcSetPoint(const Point& rPnt,
sal_uInt32 nHdlNum)
if(GetPathPoly().count())
{
// #i10659# for SdrTextObj, keep aRect up to date
- maRect = lcl_ImpGetBoundRect(GetPathPoly());
+ setRectangle(lcl_ImpGetBoundRect(GetPathPoly()));
}
}
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 989fe0685e6b..a11151fb280d 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -122,14 +122,14 @@ XPolygon SdrRectObj::ImpCalcXPoly(const tools::Rectangle&
rRect1, tools::Long nR
aXPoly=aNewPoly;
// these angles always relate to the top left corner of aRect
- if (maGeo.nShearAngle)
ShearXPoly(aXPoly,maRect.TopLeft(),maGeo.mfTanShearAngle);
- if (maGeo.nRotationAngle)
RotateXPoly(aXPoly,maRect.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
+ if (maGeo.nShearAngle) ShearXPoly(aXPoly, getRectangle().TopLeft(),
maGeo.mfTanShearAngle);
+ if (maGeo.nRotationAngle) RotateXPoly(aXPoly, getRectangle().TopLeft(),
maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
return aXPoly;
}
void SdrRectObj::RecalcXPoly()
{
- mpXPoly = ImpCalcXPoly(maRect,GetEckenradius());
+ mpXPoly = ImpCalcXPoly(getRectangle(), GetEckenradius());
}
const XPolygon& SdrRectObj::GetXPoly() const
@@ -177,11 +177,11 @@ SdrObjKind SdrRectObj::GetObjIdentifier() const
void SdrRectObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const
{
- rRect = maRect;
+ rRect = getRectangle();
if (maGeo.nShearAngle==0_deg100)
return;
- tools::Long nDst=FRound((maRect.Bottom()-maRect.Top()) *
maGeo.mfTanShearAngle);
+ tools::Long nDst=FRound((getRectangle().Bottom()-getRectangle().Top()) *
maGeo.mfTanShearAngle);
if (maGeo.nShearAngle>0_deg100)
{
Point aRef(rRect.TopLeft());
@@ -210,7 +210,7 @@ OUString SdrRectObj::TakeObjNameSingul() const
{
pResId = bRounded ? STR_ObjNameSingulPARALRND :
STR_ObjNameSingulPARAL; // parallelogram or, maybe, rhombus
}
- else if (maRect.GetWidth() == maRect.GetHeight())
+ else if (getRectangle().GetWidth() == getRectangle().GetHeight())
{
pResId = bRounded ? STR_ObjNameSingulQUADRND : STR_ObjNameSingulQUAD;
// square
}
@@ -236,7 +236,7 @@ OUString SdrRectObj::TakeObjNamePlural() const
{
pResId = bRounded ? STR_ObjNamePluralPARALRND :
STR_ObjNamePluralPARAL; // parallelogram or rhombus
}
- else if (maRect.GetWidth() == maRect.GetHeight())
+ else if (getRectangle().GetWidth() == getRectangle().GetHeight())
{
pResId = bRounded ? STR_ObjNamePluralQUADRND : STR_ObjNamePluralQUAD;
// square
}
@@ -252,7 +252,7 @@ rtl::Reference<SdrObject>
SdrRectObj::CloneSdrObject(SdrModel& rTargetModel) con
basegfx::B2DPolyPolygon SdrRectObj::TakeXorPoly() const
{
XPolyPolygon aXPP;
- aXPP.Insert(ImpCalcXPoly(maRect,GetEckenradius()));
+ aXPP.Insert(ImpCalcXPoly(getRectangle(), GetEckenradius()));
return aXPP.getB2DPolyPolygon();
}
@@ -289,7 +289,7 @@ void SdrRectObj::AddToHdlList(SdrHdlList& rHdlList) const
if(IsTextFrame())
{
OSL_ENSURE(!IsTextEditActive(), "Do not use an ImpTextframeHdl for
highlighting text in active text edit, this will collide with EditEngine paints
(!)");
- std::unique_ptr<SdrHdl> pH(new ImpTextframeHdl(maRect));
+ std::unique_ptr<SdrHdl> pH(new ImpTextframeHdl(getRectangle()));
pH->SetObj(const_cast<SdrRectObj*>(this));
pH->SetRotationAngle(maGeo.nRotationAngle);
rHdlList.AddHdl(std::move(pH));
@@ -299,37 +299,37 @@ void SdrRectObj::AddToHdlList(SdrHdlList& rHdlList) const
{
Point aPnt;
SdrHdlKind eKind = SdrHdlKind::Move;
-
+ auto const& rRectangle = getRectangle();
switch(nHdlNum)
{
case 1: // Handle for changing the corner radius
{
tools::Long a = GetEckenradius();
- tools::Long b =
std::max(maRect.GetWidth(),maRect.GetHeight())/2; // rounded up, because
GetWidth() adds 1
+ tools::Long b = std::max(rRectangle.GetWidth(),
rRectangle.GetHeight())/2; // rounded up, because GetWidth() adds 1
if (a>b) a=b;
if (a<0) a=0;
- aPnt=maRect.TopLeft();
+ aPnt = rRectangle.TopLeft();
aPnt.AdjustX(a );
eKind = SdrHdlKind::Circle;
break;
}
- case 2: aPnt=maRect.TopLeft(); eKind = SdrHdlKind::UpperLeft;
break;
- case 3: aPnt=maRect.TopCenter(); eKind = SdrHdlKind::Upper;
break;
- case 4: aPnt=maRect.TopRight(); eKind =
SdrHdlKind::UpperRight; break;
- case 5: aPnt=maRect.LeftCenter(); eKind = SdrHdlKind::Left ;
break;
- case 6: aPnt=maRect.RightCenter(); eKind = SdrHdlKind::Right;
break;
- case 7: aPnt=maRect.BottomLeft(); eKind = SdrHdlKind::LowerLeft;
break;
- case 8: aPnt=maRect.BottomCenter(); eKind = SdrHdlKind::Lower;
break;
- case 9: aPnt=maRect.BottomRight(); eKind =
SdrHdlKind::LowerRight; break;
+ case 2: aPnt = rRectangle.TopLeft(); eKind =
SdrHdlKind::UpperLeft; break;
+ case 3: aPnt = rRectangle.TopCenter(); eKind =
SdrHdlKind::Upper; break;
+ case 4: aPnt = rRectangle.TopRight(); eKind =
SdrHdlKind::UpperRight; break;
+ case 5: aPnt = rRectangle.LeftCenter(); eKind = SdrHdlKind::Left
; break;
+ case 6: aPnt = rRectangle.RightCenter(); eKind =
SdrHdlKind::Right; break;
+ case 7: aPnt = rRectangle.BottomLeft(); eKind =
SdrHdlKind::LowerLeft; break;
+ case 8: aPnt = rRectangle.BottomCenter(); eKind =
SdrHdlKind::Lower; break;
+ case 9: aPnt = rRectangle.BottomRight(); eKind =
SdrHdlKind::LowerRight; break;
}
if (maGeo.nShearAngle)
{
- ShearPoint(aPnt,maRect.TopLeft(),maGeo.mfTanShearAngle);
+ ShearPoint(aPnt,rRectangle.TopLeft(),maGeo.mfTanShearAngle);
}
if (maGeo.nRotationAngle)
{
-
RotatePoint(aPnt,maRect.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
+
RotatePoint(aPnt,rRectangle.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
}
std::unique_ptr<SdrHdl> pH(new SdrHdl(aPnt,eKind));
@@ -367,9 +367,9 @@ bool SdrRectObj::applySpecialDrag(SdrDragStat& rDrag)
Point aPt(rDrag.GetNow());
if (maGeo.nRotationAngle)
- RotatePoint(aPt, maRect.TopLeft(), -maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
+ RotatePoint(aPt, getRectangle().TopLeft(),
-maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
- sal_Int32 nRad(aPt.X() - maRect.Left());
+ sal_Int32 nRad(aPt.X() - getRectangle().Left());
if (nRad < 0)
nRad = 0;
@@ -405,9 +405,9 @@ OUString SdrRectObj::getSpecialDragComment(const
SdrDragStat& rDrag) const
// -sin for reversal
if (maGeo.nRotationAngle)
- RotatePoint(aPt, maRect.TopLeft(), -maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
+ RotatePoint(aPt, getRectangle().TopLeft(),
-maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
- sal_Int32 nRad(aPt.X() - maRect.Left());
+ sal_Int32 nRad(aPt.X() - getRectangle().Left());
if(nRad < 0)
nRad = 0;
@@ -484,14 +484,17 @@ SdrGluePoint SdrRectObj::GetVertexGluePoint(sal_uInt16
nPosNum) const
}
Point aPt;
+ auto const& rRectangle = getRectangle();
switch (nPosNum) {
- case 0: aPt=maRect.TopCenter(); aPt.AdjustY( -nWdt ); break;
- case 1: aPt=maRect.RightCenter(); aPt.AdjustX(nWdt ); break;
- case 2: aPt=maRect.BottomCenter(); aPt.AdjustY(nWdt ); break;
- case 3: aPt=maRect.LeftCenter(); aPt.AdjustX( -nWdt ); break;
+ case 0: aPt = rRectangle.TopCenter(); aPt.AdjustY( -nWdt ); break;
+ case 1: aPt = rRectangle.RightCenter(); aPt.AdjustX(nWdt ); break;
+ case 2: aPt = rRectangle.BottomCenter(); aPt.AdjustY(nWdt ); break;
+ case 3: aPt = rRectangle.LeftCenter(); aPt.AdjustX( -nWdt ); break;
}
- if (maGeo.nShearAngle) ShearPoint(aPt, maRect.TopLeft(),
maGeo.mfTanShearAngle);
- if (maGeo.nRotationAngle) RotatePoint(aPt, maRect.TopLeft(),
maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
+ if (maGeo.nShearAngle)
+ ShearPoint(aPt, rRectangle.TopLeft(), maGeo.mfTanShearAngle);
+ if (maGeo.nRotationAngle)
+ RotatePoint(aPt, rRectangle.TopLeft(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
aPt-=GetSnapRect().Center();
SdrGluePoint aGP(aPt);
aGP.SetPercent(false);
@@ -510,14 +513,17 @@ SdrGluePoint SdrRectObj::GetCornerGluePoint(sal_uInt16
nPosNum) const
}
Point aPt;
+ auto const& rRectangle = getRectangle();
switch (nPosNum) {
- case 0: aPt=maRect.TopLeft(); aPt.AdjustX( -nWdt ); aPt.AdjustY(
-nWdt ); break;
- case 1: aPt=maRect.TopRight(); aPt.AdjustX(nWdt ); aPt.AdjustY(
-nWdt ); break;
- case 2: aPt=maRect.BottomRight(); aPt.AdjustX(nWdt ); aPt.AdjustY(nWdt
); break;
- case 3: aPt=maRect.BottomLeft(); aPt.AdjustX( -nWdt );
aPt.AdjustY(nWdt ); break;
+ case 0: aPt = rRectangle.TopLeft(); aPt.AdjustX( -nWdt );
aPt.AdjustY( -nWdt ); break;
+ case 1: aPt = rRectangle.TopRight(); aPt.AdjustX(nWdt );
aPt.AdjustY( -nWdt ); break;
+ case 2: aPt = rRectangle.BottomRight(); aPt.AdjustX(nWdt );
aPt.AdjustY(nWdt ); break;
+ case 3: aPt = rRectangle.BottomLeft(); aPt.AdjustX( -nWdt );
aPt.AdjustY(nWdt ); break;
}
- if (maGeo.nShearAngle)
ShearPoint(aPt,maRect.TopLeft(),maGeo.mfTanShearAngle);
- if (maGeo.nRotationAngle)
RotatePoint(aPt,maRect.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
+ if (maGeo.nShearAngle)
+ ShearPoint(aPt, rRectangle.TopLeft(),maGeo.mfTanShearAngle);
+ if (maGeo.nRotationAngle)
+ RotatePoint(aPt,
rRectangle.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
aPt-=GetSnapRect().Center();
SdrGluePoint aGP(aPt);
aGP.SetPercent(false);
@@ -526,7 +532,7 @@ SdrGluePoint SdrRectObj::GetCornerGluePoint(sal_uInt16
nPosNum) const
rtl::Reference<SdrObject> SdrRectObj::DoConvertToPolyObj(bool bBezier, bool
bAddText) const
{
- XPolygon aXP(ImpCalcXPoly(maRect,GetEckenradius()));
+ XPolygon aXP(ImpCalcXPoly(getRectangle(), GetEckenradius()));
{ // TODO: this is only for the moment, until we have the new TakeContour()
aXP.Remove(0,1);
aXP[aXP.GetPointCount()-1]=aXP[0];
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index ad27f101c6cb..d0263a607d2a 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -101,7 +101,7 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrTextObj
const & rSource)
// #i25616#
mbSupportTextIndentingOnLineWidthChange = true;
- maRect = rSource.maRect;
+ maRectangle = rSource.maRectangle;
maGeo = rSource.maGeo;
maTextSize = rSource.maTextSize;
@@ -135,7 +135,6 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrTextObj
const & rSource)
SdrTextObj::SdrTextObj(SdrModel& rSdrModel, const tools::Rectangle& rNewRect)
: SdrAttrObj(rSdrModel)
- , maRect(rNewRect)
, mpEditingOutliner(nullptr)
, meTextKind(SdrObjKind::Text)
, maTextEditOffset(Point(0, 0))
@@ -147,7 +146,9 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel, const
tools::Rectangle& rNewRect)
, mbTextAnimationAllowed(true)
, mbInDownScale(false)
{
- ImpJustifyRect(maRect);
+ tools::Rectangle aRectangle(rNewRect);
+ ImpJustifyRect(aRectangle);
+ setRectangle(aRectangle);
// #i25616#
mbSupportTextIndentingOnLineWidthChange = true;
@@ -173,7 +174,6 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrObjKind
eNewTextKind)
SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrObjKind eNewTextKind,
const tools::Rectangle& rNewRect)
: SdrAttrObj(rSdrModel)
- , maRect(rNewRect)
, mpEditingOutliner(nullptr)
, meTextKind(eNewTextKind)
, maTextEditOffset(Point(0, 0))
@@ -185,7 +185,9 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrObjKind
eNewTextKind,
, mbTextAnimationAllowed(true)
, mbInDownScale(false)
{
- ImpJustifyRect(maRect);
+ tools::Rectangle aRectangle(rNewRect);
+ ImpJustifyRect(aRectangle);
+ setRectangle(aRectangle);
// #i25616#
mbSupportTextIndentingOnLineWidthChange = true;
@@ -199,14 +201,14 @@ SdrTextObj::~SdrTextObj()
void SdrTextObj::FitFrameToTextSize()
{
- ImpJustifyRect(maRect);
+ ImpJustifyRect(maRectangle);
SdrText* pText = getActiveText();
if(pText==nullptr || !pText->GetOutlinerParaObject())
return;
SdrOutliner& rOutliner=ImpGetDrawOutliner();
-
rOutliner.SetPaperSize(Size(maRect.Right()-maRect.Left(),maRect.Bottom()-maRect.Top()));
+ rOutliner.SetPaperSize(Size(getRectangle().Right() -
getRectangle().Left(), getRectangle().Bottom() - getRectangle().Top()));
rOutliner.SetUpdateLayout(true);
rOutliner.SetText(*pText->GetOutlinerParaObject());
Size aNewSize(rOutliner.CalcTextSize());
@@ -214,12 +216,12 @@ void SdrTextObj::FitFrameToTextSize()
aNewSize.AdjustWidth( 1 ); // because of possible rounding errors
aNewSize.AdjustWidth(GetTextLeftDistance()+GetTextRightDistance() );
aNewSize.AdjustHeight(GetTextUpperDistance()+GetTextLowerDistance() );
- tools::Rectangle aNewRect(maRect);
+ tools::Rectangle aNewRect(getRectangle());
aNewRect.SetSize(aNewSize);
ImpJustifyRect(aNewRect);
- if (aNewRect!=maRect) {
+
+ if (aNewRect != getRectangle())
SetLogicRect(aNewRect);
- }
}
void SdrTextObj::NbcSetText(const OUString& rStr)
@@ -523,7 +525,7 @@ void SdrTextObj::AdaptTextMinSize()
{
// Set minimum width.
const tools::Long nDist = GetTextLeftDistance() +
GetTextRightDistance();
- const tools::Long nW = std::max<tools::Long>(0, maRect.GetWidth() - 1
- nDist); // text width without margins
+ const tools::Long nW = std::max<tools::Long>(0,
getRectangle().GetWidth() - 1 - nDist); // text width without margins
aSet.Put(makeSdrTextMinFrameWidthItem(nW));
@@ -538,7 +540,7 @@ void SdrTextObj::AdaptTextMinSize()
{
// Set Minimum height.
const tools::Long nDist = GetTextUpperDistance() +
GetTextLowerDistance();
- const tools::Long nH = std::max<tools::Long>(0, maRect.GetHeight() - 1
- nDist); // text height without margins
+ const tools::Long nH = std::max<tools::Long>(0,
getRectangle().GetHeight() - 1 - nDist); // text height without margins
aSet.Put(makeSdrTextMinFrameHeightItem(nH));
@@ -610,7 +612,7 @@ void SdrTextObj::ImpSetContourPolygon( SdrOutliner&
rOutliner, tools::Rectangle
void SdrTextObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const
{
- rRect=maRect;
+ rRect = getRectangle();
}
// See also: <unnamed>::getTextAnchorRange in
svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -649,7 +651,7 @@ void SdrTextObj::AdjustRectToTextDistance(tools::Rectangle&
rAnchorRect) const
void SdrTextObj::TakeTextAnchorRect(tools::Rectangle& rAnchorRect) const
{
- tools::Rectangle aAnkRect(maRect); // the rectangle in which we anchor
+ tools::Rectangle aAnkRect(getRectangle()); // the rectangle in which we
anchor
bool bFrame=IsTextFrame();
if (!bFrame) {
TakeUnrotatedSnapRect(aAnkRect);
@@ -1090,9 +1092,11 @@ rtl::Reference<SdrObject>
SdrTextObj::CloneSdrObject(SdrModel& rTargetModel) con
basegfx::B2DPolyPolygon SdrTextObj::TakeXorPoly() const
{
- tools::Polygon aPol(maRect);
- if (maGeo.nShearAngle)
ShearPoly(aPol,maRect.TopLeft(),maGeo.mfTanShearAngle);
- if (maGeo.nRotationAngle)
RotatePoly(aPol,maRect.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
+ tools::Polygon aPol(getRectangle());
+ if (maGeo.nShearAngle)
+ ShearPoly(aPol, getRectangle().TopLeft(), maGeo.mfTanShearAngle);
+ if (maGeo.nRotationAngle)
+ RotatePoly(aPol, getRectangle().TopLeft(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
basegfx::B2DPolyPolygon aRetval;
aRetval.append(aPol.getB2DPolygon());
@@ -1130,9 +1134,9 @@ void SdrTextObj::RecalcSnapRect()
{
if (maGeo.nRotationAngle || maGeo.nShearAngle)
{
- maSnapRect = Rect2Poly(maRect, maGeo).GetBoundRect();
+ maSnapRect = Rect2Poly(getRectangle(), maGeo).GetBoundRect();
} else {
- maSnapRect = maRect;
+ maSnapRect = getRectangle();
}
}
@@ -1144,15 +1148,18 @@ sal_uInt32 SdrTextObj::GetSnapPointCount() const
Point SdrTextObj::GetSnapPoint(sal_uInt32 i) const
{
Point aP;
+ auto aRectangle = getRectangle();
switch (i) {
- case 0: aP=maRect.TopLeft(); break;
- case 1: aP=maRect.TopRight(); break;
- case 2: aP=maRect.BottomLeft(); break;
- case 3: aP=maRect.BottomRight(); break;
- default: aP=maRect.Center(); break;
- }
- if (maGeo.nShearAngle)
ShearPoint(aP,maRect.TopLeft(),maGeo.mfTanShearAngle);
- if (maGeo.nRotationAngle)
RotatePoint(aP,maRect.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
+ case 0: aP = aRectangle.TopLeft(); break;
+ case 1: aP = aRectangle.TopRight(); break;
+ case 2: aP = aRectangle.BottomLeft(); break;
+ case 3: aP = aRectangle.BottomRight(); break;
+ default: aP = aRectangle.Center(); break;
+ }
+ if (maGeo.nShearAngle)
+ ShearPoint(aP, aRectangle.TopLeft(), maGeo.mfTanShearAngle);
+ if (maGeo.nRotationAngle)
+ RotatePoint(aP, aRectangle.TopLeft(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
return aP;
}
@@ -1432,7 +1439,7 @@ void SdrTextObj::SaveGeoData(SdrObjGeoData& rGeo) const
{
SdrAttrObj::SaveGeoData(rGeo);
SdrTextObjGeoData& rTGeo=static_cast<SdrTextObjGeoData&>(rGeo);
- rTGeo.maRect = maRect;
+ rTGeo.maRect = getRectangle();
rTGeo.maGeo = maGeo;
}
@@ -1457,7 +1464,7 @@ drawing::TextFitToSizeType SdrTextObj::GetFitToSize()
const
const tools::Rectangle& SdrTextObj::GetGeoRect() const
{
- return maRect;
+ return getRectangle();
}
void SdrTextObj::ForceOutlinerParaObject()
@@ -1590,7 +1597,7 @@ bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix&
rMatrix, basegfx::B2DP
double fShearX = toRadians(maGeo.nShearAngle);
// get aRect, this is the unrotated snaprect
- tools::Rectangle aRectangle(maRect);
+ tools::Rectangle aRectangle(getRectangle());
// fill other values
basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx
index 49f7b2e79d2c..be87d5dd7577 100644
--- a/svx/source/svdraw/svdotxat.cxx
+++ b/svx/source/svdraw/svdotxat.cxx
@@ -240,7 +240,9 @@ bool SdrTextObj::AdjustTextFrameWidthAndHeight(
tools::Rectangle& rR, bool bHgt,
bool SdrTextObj::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
{
- bool bRet = AdjustTextFrameWidthAndHeight(maRect,bHgt,bWdt);
+ tools::Rectangle aRectangle(getRectangle());
+ bool bRet = AdjustTextFrameWidthAndHeight(aRectangle, bHgt, bWdt);
+ setRectangle(aRectangle);
if (bRet)
{
SetBoundAndSnapRectsDirty();
@@ -256,11 +258,11 @@ bool SdrTextObj::NbcAdjustTextFrameWidthAndHeight(bool
bHgt, bool bWdt)
bool SdrTextObj::AdjustTextFrameWidthAndHeight()
{
- tools::Rectangle aNewRect(maRect);
- bool bRet=AdjustTextFrameWidthAndHeight(aNewRect);
+ tools::Rectangle aNewRect(getRectangle());
+ bool bRet = AdjustTextFrameWidthAndHeight(aNewRect);
if (bRet) {
tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr)
aBoundRect0=GetLastBoundRect();
- maRect = aNewRect;
+ setRectangle(aNewRect);
SetBoundAndSnapRectsDirty();
if (auto pRectObj = dynamic_cast<SdrRectObj *>(this)) { // this is a
hack
pRectObj->SetXPolyDirty();
diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx
index a64da65dd1e9..c4a9046d0c0e 100644
--- a/svx/source/svdraw/svdotxdr.cxx
+++ b/svx/source/svdraw/svdotxdr.cxx
@@ -44,18 +44,21 @@ void SdrTextObj::AddToHdlList(SdrHdlList& rHdlList) const
{
Point aPnt;
SdrHdlKind eKind = SdrHdlKind::UpperLeft;
+ auto aRectangle = getRectangle();
switch (nHdlNum) {
- case 0: aPnt=maRect.TopLeft(); eKind=SdrHdlKind::UpperLeft;
break;
- case 1: aPnt=maRect.TopCenter(); eKind=SdrHdlKind::Upper; break;
- case 2: aPnt=maRect.TopRight(); eKind=SdrHdlKind::UpperRight;
break;
- case 3: aPnt=maRect.LeftCenter(); eKind=SdrHdlKind::Left ; break;
- case 4: aPnt=maRect.RightCenter(); eKind=SdrHdlKind::Right; break;
- case 5: aPnt=maRect.BottomLeft(); eKind=SdrHdlKind::LowerLeft;
break;
- case 6: aPnt=maRect.BottomCenter(); eKind=SdrHdlKind::Lower; break;
- case 7: aPnt=maRect.BottomRight(); eKind=SdrHdlKind::LowerRight;
break;
+ case 0: aPnt = aRectangle.TopLeft();
eKind=SdrHdlKind::UpperLeft; break;
+ case 1: aPnt = aRectangle.TopCenter(); eKind=SdrHdlKind::Upper;
break;
+ case 2: aPnt = aRectangle.TopRight();
eKind=SdrHdlKind::UpperRight; break;
+ case 3: aPnt = aRectangle.LeftCenter(); eKind=SdrHdlKind::Left ;
break;
+ case 4: aPnt = aRectangle.RightCenter(); eKind=SdrHdlKind::Right;
break;
+ case 5: aPnt = aRectangle.BottomLeft();
eKind=SdrHdlKind::LowerLeft; break;
+ case 6: aPnt = aRectangle.BottomCenter(); eKind=SdrHdlKind::Lower;
break;
+ case 7: aPnt = aRectangle.BottomRight();
eKind=SdrHdlKind::LowerRight; break;
}
- if (maGeo.nShearAngle)
ShearPoint(aPnt,maRect.TopLeft(),maGeo.mfTanShearAngle);
- if (maGeo.nRotationAngle)
RotatePoint(aPnt,maRect.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
+ if (maGeo.nShearAngle)
+ ShearPoint(aPnt, aRectangle.TopLeft(), maGeo.mfTanShearAngle);
+ if (maGeo.nRotationAngle)
+ RotatePoint(aPnt, aRectangle.TopLeft(), maGeo.mfSinRotationAngle,
maGeo.mfCosRotationAngle);
std::unique_ptr<SdrHdl> pH(new SdrHdl(aPnt,eKind));
pH->SetObj(const_cast<SdrTextObj*>(this));
pH->SetRotationAngle(maGeo.nRotationAngle);
@@ -71,7 +74,7 @@ bool SdrTextObj::hasSpecialDrag() const
tools::Rectangle SdrTextObj::ImpDragCalcRect(const SdrDragStat& rDrag) const
{
- tools::Rectangle aTmpRect(maRect);
+ tools::Rectangle aTmpRect(getRectangle());
const SdrHdl* pHdl=rDrag.GetHdl();
SdrHdlKind eHdl=pHdl==nullptr ? SdrHdlKind::Move : pHdl->GetKind();
bool bEcke=(eHdl==SdrHdlKind::UpperLeft || eHdl==SdrHdlKind::UpperRight ||
eHdl==SdrHdlKind::LowerLeft || eHdl==SdrHdlKind::LowerRight);
@@ -92,8 +95,8 @@ tools::Rectangle SdrTextObj::ImpDragCalcRect(const
SdrDragStat& rDrag) const
if (bTop) aTmpRect.SetTop(aPos.Y() );
if (bBtm) aTmpRect.SetBottom(aPos.Y() );
if (bOrtho) { // Ortho
- tools::Long nWdt0=maRect.Right() -maRect.Left();
- tools::Long nHgt0=maRect.Bottom()-maRect.Top();
+ tools::Long nWdt0=getRectangle().Right() - getRectangle().Left();
+ tools::Long nHgt0=getRectangle().Bottom() - getRectangle().Top();
tools::Long nXMul=aTmpRect.Right() -aTmpRect.Left();
tools::Long nYMul=aTmpRect.Bottom()-aTmpRect.Top();
tools::Long nXDiv=nWdt0;
@@ -125,13 +128,13 @@ tools::Rectangle SdrTextObj::ImpDragCalcRect(const
SdrDragStat& rDrag) const
}
} else { // apex handles
if ((bLft || bRgt) && nXDiv!=0) {
- tools::Long nHgt0b=maRect.Bottom()-maRect.Top();
+ tools::Long nHgt0b=getRectangle().Bottom() -
getRectangle().Top();
tools::Long
nNeed=tools::Long(BigInt(nHgt0b)*BigInt(nXMul)/BigInt(nXDiv));
aTmpRect.AdjustTop( -((nNeed-nHgt0b)/2) );
aTmpRect.SetBottom(aTmpRect.Top()+nNeed );
}
if ((bTop || bBtm) && nYDiv!=0) {
- tools::Long nWdt0b=maRect.Right()-maRect.Left();
+ tools::Long nWdt0b=getRectangle().Right() -
getRectangle().Left();
tools::Long
nNeed=tools::Long(BigInt(nWdt0b)*BigInt(nYMul)/BigInt(nYDiv));
aTmpRect.AdjustLeft( -((nNeed-nWdt0b)/2) );
aTmpRect.SetRight(aTmpRect.Left()+nNeed );
@@ -150,20 +153,20 @@ bool SdrTextObj::applySpecialDrag(SdrDragStat& rDrag)
{
tools::Rectangle aNewRect(ImpDragCalcRect(rDrag));
- if(aNewRect.TopLeft() != maRect.TopLeft() && (maGeo.nRotationAngle ||
maGeo.nShearAngle))
+ if(aNewRect.TopLeft() != getRectangle().TopLeft() && (maGeo.nRotationAngle
|| maGeo.nShearAngle))
{
Point aNewPos(aNewRect.TopLeft());
if (maGeo.nShearAngle)
- ShearPoint(aNewPos,maRect.TopLeft(),maGeo.mfTanShearAngle);
+ ShearPoint(aNewPos, getRectangle().TopLeft(),
maGeo.mfTanShearAngle);
if (maGeo.nRotationAngle)
-
RotatePoint(aNewPos,maRect.TopLeft(),maGeo.mfSinRotationAngle,maGeo.mfCosRotationAngle);
+ RotatePoint(aNewPos, getRectangle().TopLeft(),
maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
aNewRect.SetPos(aNewPos);
}
- if (aNewRect != maRect)
+ if (aNewRect != getRectangle())
{
NbcSetLogicRect(aNewRect);
}
@@ -185,7 +188,7 @@ bool SdrTextObj::BegCreate(SdrDragStat& rStat)
tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
aRect1.Normalize();
rStat.SetActionRect(aRect1);
- maRect = aRect1;
+ setRectangle(aRect1);
return true;
}
@@ -195,7 +198,7 @@ bool SdrTextObj::MovCreate(SdrDragStat& rStat)
rStat.TakeCreateRect(aRect1);
ImpJustifyRect(aRect1);
rStat.SetActionRect(aRect1);
- maRect = aRect1; // for ObjName
+ setRectangle(aRect1); // for ObjName
SetBoundRectDirty();
m_bSnapRectDirty=true;
if (auto pRectObj = dynamic_cast<SdrRectObj *>(this)) {
@@ -206,8 +209,10 @@ bool SdrTextObj::MovCreate(SdrDragStat& rStat)
bool SdrTextObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
{
- rStat.TakeCreateRect(maRect);
- ImpJustifyRect(maRect);
+ tools::Rectangle aRectangle(getRectangle());
+ rStat.TakeCreateRect(aRectangle);
+ ImpJustifyRect(aRectangle);
+ setRectangle(aRectangle);
AdaptTextMinSize();
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index ed25418c930d..5c9f28f5115c 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -57,8 +57,8 @@ void SdrTextObj::NbcSetSnapRect(const tools::Rectangle& rRect)
{
// No rotation or shear.
- maRect = rRect;
- ImpJustifyRect(maRect);
+ setRectangle(rRect);
+ ImpJustifyRect(maRectangle);
AdaptTextMinSize();
@@ -69,13 +69,13 @@ void SdrTextObj::NbcSetSnapRect(const tools::Rectangle&
rRect)
const tools::Rectangle& SdrTextObj::GetLogicRect() const
{
- return maRect;
+ return getRectangle();
}
void SdrTextObj::NbcSetLogicRect(const tools::Rectangle& rRect)
{
- maRect = rRect;
- ImpJustifyRect(maRect);
+ setRectangle(rRect);
+ ImpJustifyRect(maRectangle);
AdaptTextMinSize();
@@ -94,7 +94,7 @@ Degree100 SdrTextObj::GetShearAngle(bool /*bVertical*/) const
void SdrTextObj::NbcMove(const Size& rSize)
{
- maRect.Move(rSize);
+ moveRectangle(rSize.Width(), rSize.Height());
moveOutRectangle(rSize.Width(), rSize.Height());
maSnapRect.Move(rSize);
SetBoundAndSnapRectsDirty(true);
@@ -121,17 +121,20 @@ void SdrTextObj::NbcResize(const Point& rRef, const
Fraction& xFact, const Fract
}
if (maGeo.nRotationAngle==0_deg100 && maGeo.nShearAngle==0_deg100) {
- ResizeRect(maRect,rRef,xFact,yFact);
- if (bYMirr) {
- maRect.Normalize();
-
maRect.Move(maRect.Right()-maRect.Left(),maRect.Bottom()-maRect.Top());
+ auto aRectangle = getRectangle();
+ ResizeRect(aRectangle, rRef, xFact, yFact);
+ setRectangle(aRectangle);
+ if (bYMirr)
+ {
+ maRectangle.Normalize();
+ moveRectangle(aRectangle.Right() - aRectangle.Left(),
aRectangle.Bottom() - aRectangle.Top());
maGeo.nRotationAngle=18000_deg100;
maGeo.RecalcSinCos();
}
}
else
{
- tools::Polygon aPol(Rect2Poly(maRect,maGeo));
+ tools::Polygon aPol(Rect2Poly(getRectangle(), maGeo));
for(sal_uInt16 a(0); a < aPol.GetSize(); a++)
{
@@ -149,8 +152,9 @@ void SdrTextObj::NbcResize(const Point& rRef, const
Fraction& xFact, const Fract
aPol[3] = aPol0[2];
aPol[4] = aPol0[1];
}
-
- Poly2Rect(aPol, maRect, maGeo);
+ tools::Rectangle aRectangle(getRectangle());
+ Poly2Rect(aPol, aRectangle, maGeo);
+ setRectangle(aRectangle);
}
if (bRotate90) {
@@ -171,7 +175,7 @@ void SdrTextObj::NbcResize(const Point& rRef, const
Fraction& xFact, const Fract
}
}
- ImpJustifyRect(maRect);
+ ImpJustifyRect(maRectangle);
AdaptTextMinSize();
@@ -187,14 +191,14 @@ void SdrTextObj::NbcResize(const Point& rRef, const
Fraction& xFact, const Fract
void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn,
double cs)
{
SetGlueReallyAbsolute(true);
- tools::Long dx=maRect.Right()-maRect.Left();
- tools::Long dy=maRect.Bottom()-maRect.Top();
- Point aP(maRect.TopLeft());
- RotatePoint(aP,rRef,sn,cs);
- maRect.SetLeft(aP.X() );
- maRect.SetTop(aP.Y() );
- maRect.SetRight(maRect.Left()+dx );
- maRect.SetBottom(maRect.Top()+dy );
+ tools::Long dx = getRectangle().Right() - getRectangle().Left();
+ tools::Long dy = getRectangle().Bottom() - getRectangle().Top();
+ Point aPoint1(getRectangle().TopLeft());
+ RotatePoint(aPoint1, rRef, sn, cs);
+ Point aPoint2(aPoint1.X() + dx, aPoint1.Y() + dy);
+ tools::Rectangle aRectangle(aPoint1, aPoint2);
+ setRectangle(aRectangle);
+
if (maGeo.nRotationAngle==0_deg100) {
maGeo.nRotationAngle=NormAngle36000(nAngle);
maGeo.mfSinRotationAngle=sn;
@@ -213,14 +217,17 @@ void SdrTextObj::NbcShear(const Point& rRef, Degree100
/*nAngle*/, double tn, bo
SetGlueReallyAbsolute(true);
// when this is a SdrPathObj, aRect may be uninitialized
- tools::Polygon aPol(Rect2Poly(maRect.IsEmpty() ? GetSnapRect() : maRect,
maGeo));
+ tools::Polygon aPol(Rect2Poly(getRectangle().IsEmpty() ? GetSnapRect() :
getRectangle(), maGeo));
sal_uInt16 nPointCount=aPol.GetSize();
... etc. - the rest is truncated