summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-04-01 20:12:09 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-04-02 05:48:41 +0200
commit4bdbf0f898e8642b0a34195537d1516cc8eee819 (patch)
treec3227c1785873f4579f73c89f0e9f74e7b7a0292
parent6027c219444ade7274841a5ba45e62bdc1ea3238 (diff)
editeng: combine scaling parameters into ScalingParameters struct
This makes dealing with scaling parameters much clearer and it improves readability. Change-Id: I327b6530ef5587972cc0075390704754a33563a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165632 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--editeng/source/editeng/editeng.cxx28
-rw-r--r--editeng/source/editeng/impedit.hxx41
-rw-r--r--editeng/source/editeng/impedit2.cxx4
-rw-r--r--editeng/source/editeng/impedit3.cxx57
-rw-r--r--editeng/source/editeng/impedit4.cxx12
-rw-r--r--editeng/source/outliner/outlin2.cxx15
-rw-r--r--editeng/source/outliner/outliner.cxx14
-rw-r--r--include/editeng/editdata.hxx16
-rw-r--r--include/editeng/editeng.hxx9
-rw-r--r--include/editeng/outliner.hxx9
-rw-r--r--sd/qa/unit/TextFittingTest.cxx12
-rw-r--r--sd/source/ui/dlg/NotesChildWindow.cxx2
-rw-r--r--sd/source/ui/view/drtxtob.cxx2
-rw-r--r--svx/source/svdraw/svdotext.cxx24
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx4
-rw-r--r--svx/source/svdraw/svdoutl.cxx2
16 files changed, 116 insertions, 135 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 2493325ac578..7f13edfcf1be 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2229,35 +2229,19 @@ bool EditEngine::HasText( const SvxSearchItem& rSearchItem )
return getImpl().HasText(rSearchItem);
}
-void EditEngine::setGlobalScale(double fFontScaleX, double fFontScaleY, double fSpacingScaleX, double fSpacingScaleY)
+ScalingParameters EditEngine::getScalingParameters() const
{
- getImpl().setScale(fFontScaleX, fFontScaleY, fSpacingScaleX, fSpacingScaleY);
+ return getImpl().getScalingParameters();
}
-void EditEngine::getGlobalSpacingScale(double& rX, double& rY) const
+void EditEngine::resetScalingParameters()
{
- getImpl().getSpacingScale(rX, rY);
+ getImpl().resetScalingParameters();
}
-basegfx::B2DTuple EditEngine::getGlobalSpacingScale() const
+void EditEngine::setScalingParameters(ScalingParameters const& rScalingParameters)
{
- double x = 0.0;
- double y = 0.0;
- getImpl().getSpacingScale(x, y);
- return {x, y};
-}
-
-void EditEngine::getGlobalFontScale(double& rX, double& rY) const
-{
- getImpl().getFontScale(rX, rY);
-}
-
-basegfx::B2DTuple EditEngine::getGlobalFontScale() const
-{
- double x = 0.0;
- double y = 0.0;
- getImpl().getFontScale(x, y);
- return {x, y};
+ getImpl().setScalingParameters(rScalingParameters);
}
void EditEngine::setRoundFontSizeToPt(bool bRound)
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index cc469fc867a2..a694196dbade 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -571,10 +571,7 @@ private:
Color maBackgroundColor;
- double mfFontScaleX;
- double mfFontScaleY;
- double mfSpacingScaleX;
- double mfSpacingScaleY;
+ ScalingParameters maScalingParameters;
bool mbRoundToNearestPt;
CharCompressType mnAsianCompressionMode;
@@ -781,34 +778,34 @@ private:
double scaleXSpacingValue(tools::Long nXValue) const
{
- if (!maStatus.DoStretch() || mfSpacingScaleX == 100.0)
+ if (!maStatus.DoStretch() || maScalingParameters.fSpacingX == 100.0)
return nXValue;
- return double(nXValue) * mfSpacingScaleX / 100.0;
+ return double(nXValue) * (maScalingParameters.fSpacingX / 100.0);
}
double scaleYSpacingValue(sal_uInt16 nYValue) const
{
- if (!maStatus.DoStretch() || mfSpacingScaleY == 100.0)
+ if (!maStatus.DoStretch() || maScalingParameters.fSpacingY == 100.0)
return nYValue;
- return double(nYValue) * mfSpacingScaleY / 100.0;
+ return double(nYValue) * (maScalingParameters.fSpacingY / 100.0);
}
- double scaleYFontValue(sal_uInt16 nYValue) const
+ double scaleXFontValue(tools::Long nXValue) const
{
- if (!maStatus.DoStretch() || (mfFontScaleY == 100.0))
- return nYValue;
+ if (!maStatus.DoStretch() || (maScalingParameters.fFontX == 100.0))
+ return nXValue;
- return double(nYValue) * mfFontScaleY / 100.0;
+ return double(nXValue) * (maScalingParameters.fFontX / 100.0);
}
- double scaleXFontValue(tools::Long nXValue) const
+ double scaleYFontValue(sal_uInt16 nYValue) const
{
- if (!maStatus.DoStretch() || (mfFontScaleX == 100.0))
- return nXValue;
+ if (!maStatus.DoStretch() || (maScalingParameters.fFontY == 100.0))
+ return nYValue;
- return double(nXValue) * mfFontScaleY / 100.0;
+ return double(nYValue) * (maScalingParameters.fFontY / 100.0);
}
void setRoundToNearestPt(bool bRound) { mbRoundToNearestPt = bRound; }
@@ -1247,18 +1244,16 @@ public:
SvxCellJustifyMethod GetJustifyMethod( sal_Int32 nPara ) const;
SvxCellVerJustify GetVerJustification( sal_Int32 nPara ) const;
- void setScale(double fFontScaleX, double fFontScaleY, double fSpacingScaleX, double fSpacingScaleY);
+ void setScalingParameters(ScalingParameters const& rScalingParameters);
- void getFontScale(double& rX, double& rY) const
+ void resetScalingParameters()
{
- rX = mfFontScaleX;
- rY = mfFontScaleY;
+ setScalingParameters(ScalingParameters());
}
- void getSpacingScale(double& rX, double& rY) const
+ ScalingParameters getScalingParameters()
{
- rX = mfSpacingScaleX;
- rY = mfSpacingScaleY;
+ return maScalingParameters;
}
sal_Int32 GetBigTextObjectStart() const { return mnBigTextObjectStart; }
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 6ab1041d378e..d3f07cec65ed 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -104,10 +104,6 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
mpUndoManager(nullptr),
maWordDelimiters(" .,;:-`'?!_=\"{}()[]"),
maBackgroundColor(COL_AUTO),
- mfFontScaleX(100.0),
- mfFontScaleY(100.0),
- mfSpacingScaleX(100.0),
- mfSpacingScaleY(100.0),
mbRoundToNearestPt(false),
mnAsianCompressionMode(CharCompressType::NONE),
meDefaultHorizontalTextDirection(EEHorizontalTextDirection::Default),
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index e5816803f7ce..821e345a1b05 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1006,8 +1006,9 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
// Search for Tab-Pos...
tools::Long nCurPos = nTmpWidth + nStartX;
// consider scaling
- if (maStatus.DoStretch() && (mfFontScaleX != 100.0))
- nCurPos = basegfx::fround(double(nCurPos) * 100.0 / std::max(mfFontScaleX, 1.0));
+ double fFontScalingX = maScalingParameters.fFontX;
+ if (maStatus.DoStretch() && (fFontScalingX != 100.0))
+ nCurPos = basegfx::fround(double(nCurPos) * 100.0 / std::max(fFontScalingX, 1.0));
short nAllSpaceBeforeText = static_cast< short >(rLRItem.GetTextLeft()/* + rLRItem.GetTextLeft()*/ + nSpaceBeforeAndMinLabelWidth);
aCurrentTab.aTabStop = pNode->GetContentAttribs().FindTabStop( nCurPos - nAllSpaceBeforeText /*rLRItem.GetTextLeft()*/, maEditDoc.GetDefTab() );
@@ -1530,7 +1531,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
sal_uInt16 nPropLineSpace = rLSItem.GetPropLineSpace();
double fProportionalScale = double(nPropLineSpace) / 100.0;
constexpr const double f80Percent = 8.0 / 10.0;
- double fSpacingFactor = mfSpacingScaleY / 100.0;
+ double fSpacingFactor = maScalingParameters.fSpacingY / 100.0;
if (nPropLineSpace && nPropLineSpace < 100)
{
// Adapted code from sw/source/core/text/itrform2.cxx
@@ -1554,9 +1555,9 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
}
else if (rLSItem.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Off)
{
- if (mfSpacingScaleY < 100.0)
+ if (maScalingParameters.fSpacingY < 100.0)
{
- double fSpacingFactor = mfSpacingScaleY / 100.0;
+ double fSpacingFactor = maScalingParameters.fSpacingY / 100.0;
sal_uInt16 nPropLineSpace = basegfx::fround(100.0 * fSpacingFactor);
if (nPropLineSpace && nPropLineSpace < 100)
{
@@ -3022,23 +3023,25 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo
if (maStatus.DoStretch())
{
- if (mfFontScaleY != 100.0)
+ if (maScalingParameters.fFontY != 100.0)
{
double fHeightRounded = roundToNearestPt(aRealSz.Height());
- double fNewHeight = fHeightRounded * (mfFontScaleY / 100.0);
+ double fNewHeight = fHeightRounded * (maScalingParameters.fFontY / 100.0);
fNewHeight = roundToNearestPt(fNewHeight);
aRealSz.setHeight(basegfx::fround(fNewHeight));
}
- if (mfFontScaleX != 100.0)
+ if (maScalingParameters.fFontX != 100.0)
{
- if (mfFontScaleX == mfFontScaleY && nRelWidth == 100 )
+ auto fFontX = maScalingParameters.fFontX;
+ auto fFontY = maScalingParameters.fFontY;
+ if (fFontX == fFontY && nRelWidth == 100 )
{
aRealSz.setWidth( 0 );
}
else
{
double fWidthRounded = roundToNearestPt(aRealSz.Width());
- double fNewWidth = fWidthRounded * (mfFontScaleX / 100.0);
+ double fNewWidth = fWidthRounded * (fFontX / 100.0);
fNewWidth = roundToNearestPt(fNewWidth);
aRealSz.setWidth(basegfx::fround(fNewWidth));
@@ -3055,15 +3058,15 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo
>0 >100 > (Proportional)
<0 >100 < (The amount, thus disproportional)
*/
- if (nKerning < 0 && mfFontScaleX > 100.0)
+ if (nKerning < 0 && fFontX > 100.0)
{
// disproportional
- nKerning = basegfx::fround((double(nKerning) * 100.0) / mfFontScaleX);
+ nKerning = basegfx::fround((double(nKerning) * 100.0) / fFontX);
}
else if ( nKerning )
{
// Proportional
- nKerning = basegfx::fround((double(nKerning) * mfFontScaleX) / 100.0);
+ nKerning = basegfx::fround((double(nKerning) * fFontX) / 100.0);
}
rFont.SetFixKerning( static_cast<short>(nKerning) );
}
@@ -4528,30 +4531,20 @@ void ImpEditEngine::SetFlatMode( bool bFlat )
mpActiveView->ShowCursor();
}
-void ImpEditEngine::setScale(double fFontScaleX, double fFontScaleY, double fSpacingScaleX, double fSpacingScaleY)
+void ImpEditEngine::setScalingParameters(ScalingParameters const& rScalingParameters)
{
- bool bChanged;
+ ScalingParameters aNewScalingParameters(rScalingParameters);
- if (!IsEffectivelyVertical())
- {
- bChanged = mfFontScaleX != fFontScaleX || mfFontScaleY != fFontScaleY ||
- mfSpacingScaleX != fSpacingScaleX || mfSpacingScaleY != fSpacingScaleY;
- mfFontScaleX = fFontScaleX;
- mfFontScaleY = fFontScaleY;
- mfSpacingScaleX = fSpacingScaleX;
- mfSpacingScaleY = fSpacingScaleY;
- }
- else
+ if (IsEffectivelyVertical())
{
- bChanged = mfFontScaleX != fFontScaleY || mfFontScaleY != fFontScaleX ||
- mfSpacingScaleX != fSpacingScaleY || mfSpacingScaleY != fSpacingScaleX;
- mfFontScaleX = fFontScaleY;
- mfFontScaleY = fFontScaleX;
- mfSpacingScaleX = fSpacingScaleY;
- mfSpacingScaleY = fSpacingScaleX;
+ std::swap(aNewScalingParameters.fFontX, aNewScalingParameters.fFontY);
+ std::swap(aNewScalingParameters.fSpacingX, aNewScalingParameters.fSpacingY);
}
- if (bChanged && maStatus.DoStretch())
+ bool bScalingChanged = maScalingParameters != aNewScalingParameters;
+ maScalingParameters = aNewScalingParameters;
+
+ if (bScalingChanged && maStatus.DoStretch())
{
FormatFullDoc();
// (potentially) need everything redrawn
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index b761c4914c07..b7e322b68ccd 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1121,7 +1121,9 @@ std::unique_ptr<EditTextObject> ImpEditEngine::CreateTextObject( EditSelection a
// sleeper set up when Olli paragraphs not hacked!
if ( bAllowBigObjects && bOnlyFullParagraphs && IsFormatted() && IsUpdateLayout() && ( nTextPortions >= nBigObjectStart ) )
{
- XParaPortionList* pXList = new XParaPortionList(GetRefDevice(), GetColumnWidth(maPaperSize), mfFontScaleX, mfFontScaleY, mfSpacingScaleX, mfSpacingScaleY);
+ XParaPortionList* pXList = new XParaPortionList(GetRefDevice(), GetColumnWidth(maPaperSize),
+ maScalingParameters.fFontX, maScalingParameters.fFontY,
+ maScalingParameters.fSpacingX, maScalingParameters.fSpacingY);
pTxtObj->SetPortionInfo(std::unique_ptr<XParaPortionList>(pXList));
for ( nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
@@ -1206,10 +1208,10 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject
if (pPortionInfo && ( static_cast<tools::Long>(pPortionInfo->GetPaperWidth()) == GetColumnWidth(maPaperSize))
&& pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode()
- && pPortionInfo->getFontScaleX() == mfFontScaleX
- && pPortionInfo->getFontScaleY() == mfFontScaleY
- && pPortionInfo->getSpacingScaleX() == mfSpacingScaleX
- && pPortionInfo->getSpacingScaleY() == mfSpacingScaleY)
+ && pPortionInfo->getFontScaleX() == maScalingParameters.fFontX
+ && pPortionInfo->getFontScaleY() == maScalingParameters.fFontY
+ && pPortionInfo->getSpacingScaleX() == maScalingParameters.fSpacingX
+ && pPortionInfo->getSpacingScaleY() == maScalingParameters.fSpacingY)
{
if ( (pPortionInfo->GetRefDevPtr() == GetRefDevice()) ||
(pPortionInfo->RefDevIsVirtual() && GetRefDevice()->IsVirtual()) )
diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx
index e4d0386cf2c0..268c194652c4 100644
--- a/editeng/source/outliner/outlin2.cxx
+++ b/editeng/source/outliner/outlin2.cxx
@@ -477,7 +477,12 @@ void Outliner::QuickFormatDoc()
pEditEngine->QuickFormatDoc();
}
-void Outliner::setGlobalScale(double rFontX, double rFontY, double rSpacingX, double rSpacingY)
+ScalingParameters Outliner::getScalingParameters() const
+{
+ return pEditEngine->getScalingParameters();
+}
+
+void Outliner::setScalingParameters(ScalingParameters const& rScalingParameters)
{
// reset bullet size
sal_Int32 nParagraphs = pParaList->GetParagraphCount();
@@ -488,13 +493,7 @@ void Outliner::setGlobalScale(double rFontX, double rFontY, double rSpacingX, do
pPara->aBulSize.setWidth( -1 );
}
- pEditEngine->setGlobalScale(rFontX, rFontY, rSpacingX, rSpacingY);
-}
-
-void Outliner::getGlobalScale(double& rFontX, double& rFontY, double& rSpacingX, double& rSpacingY) const
-{
- pEditEngine->getGlobalFontScale(rFontX, rFontY);
- pEditEngine->getGlobalSpacingScale(rSpacingX, rSpacingY);
+ pEditEngine->setScalingParameters(rScalingParameters);
}
void Outliner::setRoundFontSizeToPt(bool bRound) const
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index bb8a8ac419ec..b6f715da52d0 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -845,12 +845,10 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const
}
// Use original scale...
- double nStretchY = 100.0;
- getGlobalScale(o3tl::temporary(double()), nStretchY, o3tl::temporary(double()), o3tl::temporary(double()));
- double fScale = pFmt->GetBulletRelSize() * nStretchY / 100.0;
+ double fFontScaleY = pFmt->GetBulletRelSize() * (getScalingParameters().fFontY / 100.0);
double fScaledLineHeight = aStdFont.GetFontSize().Height();
- fScaledLineHeight *= fScale * 10;
+ fScaledLineHeight *= fFontScaleY * 10;
fScaledLineHeight /= 1000.0;
aBulletFont.SetAlignment( ALIGN_BOTTOM );
@@ -893,12 +891,10 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point&
tools::Rectangle aBulletArea( ImpCalcBulletArea( nPara, true, false ) );
- double nStretchX = 100.0;
- getGlobalScale(o3tl::temporary(double()), o3tl::temporary(double()),
- nStretchX, o3tl::temporary(double()));
+ double fSpacingFactorX = getScalingParameters().fSpacingX / 100.0;
- tools::Long nStretchBulletX = basegfx::fround(double(aBulletArea.Left()) * nStretchX / 100.0);
- tools::Long nStretchBulletWidth = basegfx::fround(double(aBulletArea.GetWidth()) * nStretchX / 100.0);
+ tools::Long nStretchBulletX = basegfx::fround(double(aBulletArea.Left()) * fSpacingFactorX);
+ tools::Long nStretchBulletWidth = basegfx::fround(double(aBulletArea.GetWidth()) * fSpacingFactorX);
aBulletArea = tools::Rectangle(Point(nStretchBulletX, aBulletArea.Top()),
Size(nStretchBulletWidth, aBulletArea.GetHeight()) );
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
index da789675d1b6..6c8e5abe2db7 100644
--- a/include/editeng/editdata.hxx
+++ b/include/editeng/editdata.hxx
@@ -156,6 +156,22 @@ struct ParagraphInfos
bool bValid; // A query during formatting is not valid!
};
+struct ScalingParameters
+{
+ double fFontX = 100.0;
+ double fFontY = 100.0;
+ double fSpacingX = 100.0;
+ double fSpacingY = 100.0;
+
+ bool operator==(const ScalingParameters& rOther) const
+ {
+ return fFontX == rOther.fFontX
+ && fFontY == rOther.fFontY
+ && fSpacingX == rOther.fSpacingX
+ && fSpacingY == rOther.fSpacingY;
+ }
+};
+
struct EECharAttrib
{
const SfxPoolItem* pAttr;
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 03c8b281c1fa..263a0931dff8 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -416,12 +416,9 @@ public:
void QuickDelete( const ESelection& rSel );
SAL_DLLPRIVATE void QuickMarkToBeRepainted( sal_Int32 nPara );
- SAL_DLLPRIVATE void setGlobalScale(double fFontScaleX, double fFontScaleY, double fSpacingScaleX, double fSpacingScaleY);
-
- SAL_DLLPRIVATE void getGlobalSpacingScale(double& rX, double& rY) const;
- basegfx::B2DTuple getGlobalSpacingScale() const;
- SAL_DLLPRIVATE void getGlobalFontScale(double& rX, double& rY) const;
- basegfx::B2DTuple getGlobalFontScale() const;
+ void setScalingParameters(ScalingParameters const& rScalingParameters);
+ void resetScalingParameters();
+ ScalingParameters getScalingParameters() const;
SAL_DLLPRIVATE void setRoundFontSizeToPt(bool bRound);
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 3e4dac1082ad..e0d14487ea13 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -938,8 +938,13 @@ public:
bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder );
SAL_DLLPRIVATE bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, bool* pbBulletPos );
- void setGlobalScale(double rFontX = 100.0, double rFontY = 100.0, double rSpacingX = 100.0, double rSpacingY = 100.0);
- void getGlobalScale(double& rFontX, double& rFontY, double& rSpacingX, double& rSpacingY) const;
+ ScalingParameters getScalingParameters() const;
+ void setScalingParameters(ScalingParameters const& rScalingParameters);
+ void resetScalingParameters()
+ {
+ setScalingParameters(ScalingParameters());
+ }
+
void setRoundFontSizeToPt(bool bRound) const;
void EraseVirtualDevice();
diff --git a/sd/qa/unit/TextFittingTest.cxx b/sd/qa/unit/TextFittingTest.cxx
index 998a33dba8c9..5a9c37730e69 100644
--- a/sd/qa/unit/TextFittingTest.cxx
+++ b/sd/qa/unit/TextFittingTest.cxx
@@ -73,16 +73,16 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest)
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), rEditEngine.GetParagraphCount());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(87.49, rEditEngine.getGlobalFontScale().getY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(90.0, rEditEngine.getGlobalSpacingScale().getY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(87.49, rEditEngine.getScalingParameters().fFontY, 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(90.0, rEditEngine.getScalingParameters().fSpacingY, 1E-2);
// Add paragraph 5
rEditView.SetSelection(ESelection(4, 0, 4, 0));
rEditView.InsertText(u"\nD5"_ustr);
CPPUNIT_ASSERT_EQUAL(sal_Int32(5), rEditEngine.GetParagraphCount());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(54.68, rEditEngine.getGlobalFontScale().getY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, rEditEngine.getGlobalSpacingScale().getY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(54.68, rEditEngine.getScalingParameters().fFontY, 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, rEditEngine.getScalingParameters().fSpacingY, 1E-2);
// Add paragraph 6
rEditView.SetSelection(ESelection(5, 0, 5, 0));
@@ -105,8 +105,8 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest)
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rEditEngine.GetParagraphCount());
// not ideal - scaling should be 100%, but close enough
- CPPUNIT_ASSERT_DOUBLES_EQUAL(99.05, rEditEngine.getGlobalFontScale().getY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, rEditEngine.getGlobalSpacingScale().getY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(99.05, rEditEngine.getScalingParameters().fFontY, 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, rEditEngine.getScalingParameters().fSpacingY, 1E-2);
// are we still in text edit mode?
CPPUNIT_ASSERT_EQUAL(true, pView1->IsTextEdit());
diff --git a/sd/source/ui/dlg/NotesChildWindow.cxx b/sd/source/ui/dlg/NotesChildWindow.cxx
index 9b037757a2dd..79c0bdaaa95b 100644
--- a/sd/source/ui/dlg/NotesChildWindow.cxx
+++ b/sd/source/ui/dlg/NotesChildWindow.cxx
@@ -180,7 +180,7 @@ void NotesEditWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
// For setGlobalScale to work correctly EEControlBits::STRETCHING must be set.
mrParentWindow.GetOutliner()->SetControlWord(mrParentWindow.GetOutliner()->GetControlWord()
| EEControlBits::STRETCHING);
- mrParentWindow.GetOutliner()->setGlobalScale(30.0, 30.0);
+ mrParentWindow.GetOutliner()->setScalingParameters({ 30.0, 30.0 });
provideNoteText();
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index 01a1e94d74bf..3b15ceaef650 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -188,7 +188,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
pOLV = pOView->GetViewByWindow(mpViewShell->GetActiveWindow());
if (pOutliner)
- pOutliner->getGlobalScale(o3tl::temporary(double()), stretchY, o3tl::temporary(double()), o3tl::temporary(double()));
+ stretchY = pOutliner->getScalingParameters().fFontY;
if(pOLV && !pOLV->GetSelection().HasRange())
{
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index cc8846504752..1a2c28b627f9 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -988,7 +988,7 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextS
nY = nX;
bNoMoreLoop = true;
}
- rOutliner.setGlobalScale(nX, nY);
+ rOutliner.setScalingParameters({nX, nY});
nLoopCount++;
Size aSiz(rOutliner.CalcTextSize());
tools::Long nXDiff = aSiz.Width() - nWantWdt;
@@ -1178,7 +1178,7 @@ void SdrTextObj::ImpInitDrawOutliner( SdrOutliner& rOutl ) const
nOutlinerMode = OutlinerMode::TextObject;
rOutl.Init( nOutlinerMode );
- rOutl.setGlobalScale(100.0, 100.0, 100.0, 100.0);
+ rOutl.resetScalingParameters();
EEControlBits nStat=rOutl.GetControlWord();
nStat &= ~EEControlBits(EEControlBits::STRETCHING|EEControlBits::AUTOPAGESIZE);
@@ -1243,9 +1243,7 @@ double SdrTextObj::GetFontScale() const
// This eventually calls ImpAutoFitText
UpdateOutlinerFormatting(rOutliner, o3tl::temporary(tools::Rectangle()));
- double fScaleY;
- rOutliner.getGlobalScale(o3tl::temporary(double()), fScaleY, o3tl::temporary(double()), o3tl::temporary(double()));
- return fScaleY;
+ return rOutliner.getScalingParameters().fFontY;
}
double SdrTextObj::GetSpacingScale() const
@@ -1254,9 +1252,7 @@ double SdrTextObj::GetSpacingScale() const
// This eventually calls ImpAutoFitText
UpdateOutlinerFormatting(rOutliner, o3tl::temporary(tools::Rectangle()));
- double fSpacingScaleY;
- rOutliner.getGlobalScale(o3tl::temporary(double()), o3tl::temporary(double()), o3tl::temporary(double()), fSpacingScaleY);
- return fSpacingScaleY;
+ return rOutliner.getScalingParameters().fSpacingY;
}
void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner ) const
@@ -1282,7 +1278,7 @@ void SdrTextObj::autoFitTextForCompatibility(SdrOutliner& rOutliner, const Size&
double fMaxScale = rItem.GetMaxScale();
if (fMaxScale > 0.0)
{
- rOutliner.setGlobalScale(fMaxScale, fMaxScale, 100.0, 100.0);
+ rOutliner.setScalingParameters({ fMaxScale, fMaxScale, 100.0, 100.0 });
}
else
{
@@ -1302,9 +1298,9 @@ void SdrTextObj::autoFitTextForCompatibility(SdrOutliner& rOutliner, const Size&
else
fCurrentFitFactor = double(rTextBoxSize.Height()) / aCurrentTextBoxSize.Height();
- double fInitialFontScaleY = 0.0;
- double fInitialSpacing = 0.0;
- rOutliner.getGlobalScale(o3tl::temporary(double()), fInitialFontScaleY, o3tl::temporary(double()), fInitialSpacing);
+ auto aParameters = rOutliner.getScalingParameters();
+ double fInitialFontScaleY = aParameters.fFontY;
+ double fInitialSpacing = aParameters.fSpacingY;
if (fCurrentFitFactor >= 1.0 && fInitialFontScaleY >= 100.0 && fInitialSpacing >= 100.0)
return;
@@ -1352,7 +1348,7 @@ void SdrTextObj::autoFitTextForCompatibility(SdrOutliner& rOutliner, const Size&
if (fCurrentFitFactor >= fFitFactorTarget)
continue;
- rOutliner.setGlobalScale(fCurrentFontScale, fCurrentFontScale, 100.0, fCurrentSpacing);
+ rOutliner.setScalingParameters({ fCurrentFontScale, fCurrentFontScale, 100.0, fCurrentSpacing });
aCurrentTextBoxSize = rOutliner.CalcTextSizeNTP();
aCurrentTextBoxSize.extendBy(0, nExtendTextBoxBy);
@@ -1379,7 +1375,7 @@ void SdrTextObj::autoFitTextForCompatibility(SdrOutliner& rOutliner, const Size&
}
}
}
- rOutliner.setGlobalScale(fBestFontScale, fBestFontScale, 100.0, fBestSpacing);
+ rOutliner.setScalingParameters({ fBestFontScale, fBestFontScale, 100.0, fBestSpacing });
}
void SdrTextObj::SetupOutlinerFormatting( SdrOutliner& rOutl, tools::Rectangle& rPaintRect ) const
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 5736f26f51b7..e54fdfd76cd7 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1375,7 +1375,9 @@ void SdrTextObj::impDecomposeStretchTextPrimitive(
// to layout without mirroring
const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX());
const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY());
- rOutliner.setGlobalScale(fScaleX * 100.0, fScaleY * 100.0, 100.0, 100.0);
+ ScalingParameters aScalingParameters{fScaleX * 100.0, fScaleY * 100.0};
+
+ rOutliner.setScalingParameters(aScalingParameters);
// When mirroring in X and Y,
// move the null point which was top left to bottom right.
diff --git a/svx/source/svdraw/svdoutl.cxx b/svx/source/svdraw/svdoutl.cxx
index 02bb89e38bda..8198c260e344 100644
--- a/svx/source/svdraw/svdoutl.cxx
+++ b/svx/source/svdraw/svdoutl.cxx
@@ -50,7 +50,7 @@ void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
nOutlinerMode2 = OutlinerMode::TextObject;
Init( nOutlinerMode2 );
- setGlobalScale(100.0, 100.0, 100.0, 100.0);
+ resetScalingParameters();
EEControlBits nStat = GetControlWord();
nStat &= ~EEControlBits( EEControlBits::STRETCHING | EEControlBits::AUTOPAGESIZE );