editeng/source/editeng/impedit.hxx                 |   16 +++---
 editeng/source/editeng/impedit3.cxx                |   50 ++++++++++-----------
 editeng/source/outliner/outliner.cxx               |    8 +--
 include/editeng/editdata.hxx                       |   18 ++-----
 oox/source/drawingml/textbodypropertiescontext.cxx |    4 -
 oox/source/export/drawingml.cxx                    |    4 -
 sd/qa/unit/TextFittingTest.cxx                     |   22 ++++-----
 sd/source/ui/dlg/NotesChildWindow.cxx              |    2 
 sd/source/ui/view/drtxtob.cxx                      |    4 -
 svx/source/svdraw/svdotext.cxx                     |   22 ++++-----
 svx/source/svdraw/svdotextdecomposition.cxx        |    2 
 svx/source/unodraw/unoshape.cxx                    |    8 +--
 12 files changed, 76 insertions(+), 84 deletions(-)

New commits:
commit a3daf52dd21ae03a8b04e1f9132a6713c9cc414f
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Apr 2 11:16:30 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Apr 3 16:41:59 2024 +0200

    Base scale on 1.0, not on 100.0
    
    Simplifies things by avoiding many repeated multiplications / divisions
    by 100 during calculations.
    
    Change-Id: Ib063d343549139c8d83e5b06570dc61f39ea0df6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165666
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index e09712f74bad..07f6af002358 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -780,34 +780,34 @@ private:
 
     double scaleXSpacingValue(tools::Long nXValue) const
     {
-        if (!maStatus.DoStretch() || maScalingParameters.fSpacingX == 100.0)
+        if (!maStatus.DoStretch() || maScalingParameters.fSpacingX == 1.0)
             return nXValue;
 
-        return double(nXValue) * (maScalingParameters.fSpacingX / 100.0);
+        return double(nXValue) * maScalingParameters.fSpacingX;
     }
 
     double scaleYSpacingValue(sal_uInt16 nYValue) const
     {
-        if (!maStatus.DoStretch() || maScalingParameters.fSpacingY == 100.0)
+        if (!maStatus.DoStretch() || maScalingParameters.fSpacingY == 1.0)
             return nYValue;
 
-        return double(nYValue) * (maScalingParameters.fSpacingY / 100.0);
+        return double(nYValue) * maScalingParameters.fSpacingY;
     }
 
     double scaleXFontValue(tools::Long nXValue) const
     {
-        if (!maStatus.DoStretch() || (maScalingParameters.fFontX == 100.0))
+        if (!maStatus.DoStretch() || (maScalingParameters.fFontX == 1.0))
             return nXValue;
 
-        return double(nXValue) * (maScalingParameters.fFontX / 100.0);
+        return double(nXValue) * maScalingParameters.fFontX;
     }
 
     double scaleYFontValue(sal_uInt16 nYValue) const
     {
-        if (!maStatus.DoStretch() || (maScalingParameters.fFontY == 100.0))
+        if (!maStatus.DoStretch() || (maScalingParameters.fFontY == 1.0))
             return nYValue;
 
-        return double(nYValue) * (maScalingParameters.fFontY / 100.0);
+        return double(nYValue) * maScalingParameters.fFontY;
     }
 
     void setRoundToNearestPt(bool bRound) { mbRoundToNearestPt = bRound; }
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index a2dee889aa63..75fe99e684ee 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -447,19 +447,19 @@ namespace
 {
 constexpr std::array<ScalingParameters, 13> constScaleLevels =
 {
-    ScalingParameters{100.0, 100.0, 100.0,  90.0 },
-    ScalingParameters{ 92.5,  92.5, 100.0,  90.0 },
-    ScalingParameters{ 92.5,  92.5, 100.0,  80.0 },
-    ScalingParameters{ 85.0,  85.0, 100.0,  90.0 },
-    ScalingParameters{ 85.0,  85.0, 100.0,  80.0 },
-    ScalingParameters{ 77.5,  77.5, 100.0,  80.0 },
-    ScalingParameters{ 70.0,  70.0, 100.0,  80.0 },
-    ScalingParameters{ 62.5,  62.5, 100.0,  80.0 },
-    ScalingParameters{ 55.0,  55.0, 100.0,  80.0 },
-    ScalingParameters{ 47.5,  47.5, 100.0,  80.0 },
-    ScalingParameters{ 40.0,  40.0, 100.0,  80.0 },
-    ScalingParameters{ 32.5,  32.5, 100.0,  80.0 },
-    ScalingParameters{ 25.0,  25.0, 100.0,  80.0 },
+    ScalingParameters{ 1.000,  1.000,  1.0,  0.9 },
+    ScalingParameters{ 0.925,  0.925,  1.0,  0.9 },
+    ScalingParameters{ 0.925,  0.925,  1.0,  0.8 },
+    ScalingParameters{ 0.850,  0.850,  1.0,  0.9 },
+    ScalingParameters{ 0.850,  0.850,  1.0,  0.8 },
+    ScalingParameters{ 0.775,  0.775,  1.0,  0.8 },
+    ScalingParameters{ 0.700,  0.700,  1.0,  0.8 },
+    ScalingParameters{ 0.625,  0.625,  1.0,  0.8 },
+    ScalingParameters{ 0.550,  0.550,  1.0,  0.8 },
+    ScalingParameters{ 0.475,  0.475,  1.0,  0.8 },
+    ScalingParameters{ 0.400,  0.400,  1.0,  0.8 },
+    ScalingParameters{ 0.325,  0.325,  1.0,  0.8 },
+    ScalingParameters{ 0.250,  0.250,  1.0,  0.8 },
 };
 
 } // end anonymous ns
@@ -1069,8 +1069,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                         tools::Long nCurPos = nTmpWidth + nStartX;
                         // consider scaling
                         double fFontScalingX = maScalingParameters.fFontX;
-                        if (maStatus.DoStretch() && (fFontScalingX != 100.0))
-                            nCurPos = basegfx::fround(double(nCurPos) * 100.0 
/ std::max(fFontScalingX, 1.0));
+                        if (maStatus.DoStretch() && (fFontScalingX != 1.0))
+                            nCurPos = basegfx::fround(double(nCurPos) / 
std::max(fFontScalingX, 0.01));
 
                         short nAllSpaceBeforeText = 
short(rLRItem.GetTextLeft());
                         aCurrentTab.aTabStop = 
pNode->GetContentAttribs().FindTabStop( nCurPos - nAllSpaceBeforeText , 
maEditDoc.GetDefTab() );
@@ -1593,7 +1593,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 = maScalingParameters.fSpacingY / 100.0;
+                double fSpacingFactor = maScalingParameters.fSpacingY;
                 if (nPropLineSpace && nPropLineSpace < 100)
                 {
                     // Adapted code from sw/source/core/text/itrform2.cxx
@@ -1617,9 +1617,9 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
             }
             else if (rLSItem.GetInterLineSpaceRule() == 
SvxInterLineSpaceRule::Off)
             {
-                if (maScalingParameters.fSpacingY < 100.0)
+                if (maScalingParameters.fSpacingY < 1.0)
                 {
-                    double fSpacingFactor = maScalingParameters.fSpacingY / 
100.0;
+                    double fSpacingFactor = maScalingParameters.fSpacingY;
                     sal_uInt16 nPropLineSpace = basegfx::fround(100.0 * 
fSpacingFactor);
                     if (nPropLineSpace && nPropLineSpace < 100)
                     {
@@ -3085,14 +3085,14 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, 
sal_Int32 nPos, SvxFont& rFo
 
         if (maStatus.DoStretch())
         {
-            if (maScalingParameters.fFontY != 100.0)
+            if (maScalingParameters.fFontY != 1.0)
             {
                 double fHeightRounded = roundToNearestPt(aRealSz.Height());
-                double fNewHeight = fHeightRounded * 
(maScalingParameters.fFontY / 100.0);
+                double fNewHeight = fHeightRounded * 
maScalingParameters.fFontY;
                 fNewHeight = roundToNearestPt(fNewHeight);
                 aRealSz.setHeight(basegfx::fround(fNewHeight));
             }
-            if (maScalingParameters.fFontX != 100.0)
+            if (maScalingParameters.fFontX != 1.0)
             {
                 auto fFontX = maScalingParameters.fFontX;
                 auto fFontY = maScalingParameters.fFontY;
@@ -3103,7 +3103,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, 
sal_Int32 nPos, SvxFont& rFo
                 else
                 {
                     double fWidthRounded = roundToNearestPt(aRealSz.Width());
-                    double fNewWidth = fWidthRounded * (fFontX / 100.0);
+                    double fNewWidth = fWidthRounded * fFontX;
                     fNewWidth = roundToNearestPt(fNewWidth);
                     aRealSz.setWidth(basegfx::fround(fNewWidth));
 
@@ -3120,15 +3120,15 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, 
sal_Int32 nPos, SvxFont& rFo
   >0        >100        > (Proportional)
   <0        >100        < (The amount, thus disproportional)
 */
-                    if (nKerning < 0 && fFontX > 100.0)
+                    if (nKerning < 0 && fFontX > 1.0)
                     {
                         // disproportional
-                        nKerning = basegfx::fround((double(nKerning) * 100.0) 
/ fFontX);
+                        nKerning = basegfx::fround(nKerning / fFontX);
                     }
                     else if ( nKerning )
                     {
                         // Proportional
-                        nKerning = basegfx::fround((double(nKerning) * fFontX) 
/ 100.0);
+                        nKerning = basegfx::fround(nKerning * fFontX);
                     }
                     rFont.SetFixKerning( static_cast<short>(nKerning) );
                 }
diff --git a/editeng/source/outliner/outliner.cxx 
b/editeng/source/outliner/outliner.cxx
index b6f715da52d0..2e8541e72051 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -846,10 +846,8 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) 
const
 
     // Use original scale...
 
-    double fFontScaleY = pFmt->GetBulletRelSize() * 
(getScalingParameters().fFontY / 100.0);
-    double fScaledLineHeight = aStdFont.GetFontSize().Height();
-    fScaledLineHeight *= fFontScaleY * 10;
-    fScaledLineHeight /= 1000.0;
+    double fFontScaleY = pFmt->GetBulletRelSize() / 100.0 * 
getScalingParameters().fFontY;
+    double fScaledLineHeight = aStdFont.GetFontSize().Height() * fFontScaleY;
 
     aBulletFont.SetAlignment( ALIGN_BOTTOM );
     aBulletFont.SetFontSize(Size(0, basegfx::fround(fScaledLineHeight)));
@@ -891,7 +889,7 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& 
rStartPos, const Point&
 
     tools::Rectangle aBulletArea( ImpCalcBulletArea( nPara, true, false ) );
 
-    double fSpacingFactorX = getScalingParameters().fSpacingX / 100.0;
+    double fSpacingFactorX = getScalingParameters().fSpacingX;
 
     tools::Long nStretchBulletX = basegfx::fround(double(aBulletArea.Left()) * 
fSpacingFactorX);
     tools::Long nStretchBulletWidth = 
basegfx::fround(double(aBulletArea.GetWidth()) * fSpacingFactorX);
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
index 0985e53a1b96..799b29bf5acb 100644
--- a/include/editeng/editdata.hxx
+++ b/include/editeng/editdata.hxx
@@ -158,21 +158,15 @@ struct ParagraphInfos
 
 struct ScalingParameters
 {
-    double fFontX = 100.0;
-    double fFontY = 100.0;
-    double fSpacingX = 100.0;
-    double fSpacingY = 100.0;
+    double fFontX = 1.0;
+    double fFontY = 1.0;
+    double fSpacingX = 1.0;
+    double fSpacingY = 1.0;
 
-    bool operator==(const ScalingParameters& rOther) const
-    {
-        return fFontX == rOther.fFontX
-            && fFontY == rOther.fFontY
-            && fSpacingX == rOther.fSpacingX
-            && fSpacingY == rOther.fSpacingY;
-    }
+    bool operator==(const ScalingParameters& rOther) const = default;
     bool areValuesDefault()
     {
-        return fFontX == 100.0 && fFontY == 100.0 && fSpacingX == 100.0 && 
fSpacingY == 100.0;
+        return fFontX == 1.0 && fFontY == 1.0 && fSpacingX == 1.0 && fSpacingY 
== 1.0;
     }
 };
 
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx 
b/oox/source/drawingml/textbodypropertiescontext.cxx
index 598bee8daa4e..15adc15658d3 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -240,8 +240,8 @@ ContextHandlerRef 
TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement
                 
mrTextBodyProp.maPropertyMap.setProperty(PROP_TextAutoGrowHeight, false);
                 mrTextBodyProp.mnFontScale = 
rAttribs.getInteger(XML_fontScale, 100000);
                 mrTextBodyProp.mnSpacingScale = 
rAttribs.getInteger(XML_lnSpcReduction, 100000);
-                
mrTextBodyProp.maPropertyMap.setProperty(PROP_TextFitToSizeFontScale, 
double(mrTextBodyProp.mnFontScale) / 1000.0);
-                
mrTextBodyProp.maPropertyMap.setProperty(PROP_TextFitToSizeSpacingScale, 100.0 
- double(mrTextBodyProp.mnSpacingScale) / 1000.0);
+                
mrTextBodyProp.maPropertyMap.setProperty(PROP_TextFitToSizeFontScale, 
mrTextBodyProp.mnFontScale / 100000.0);
+                
mrTextBodyProp.maPropertyMap.setProperty(PROP_TextFitToSizeSpacingScale, 1.0 - 
mrTextBodyProp.mnSpacingScale / 100000.0);
                 break;
             }
             case A_TOKEN( spAutoFit ):
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 450d374b3b89..92aa84438e62 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4271,8 +4271,8 @@ void DrawingML::WriteText(const Reference<XInterface>& 
rXIface, bool bBodyPr, bo
                     SdrTextObj* pTextObject = 
DynCastSdrTextObj(pTextShape->GetSdrObject());
                     if (pTextObject)
                     {
-                        nFontScale = sal_Int32(pTextObject->GetFontScale() * 
1000.0);
-                        nSpacingReduction = sal_Int32((100.0 - 
pTextObject->GetSpacingScale()) * 1000.0);
+                        nFontScale = sal_Int32(pTextObject->GetFontScale() * 
100000.0);
+                        nSpacingReduction = sal_Int32((1.0 - 
pTextObject->GetSpacingScale()) * 100000.0);
                     }
                 }
 
diff --git a/sd/qa/unit/TextFittingTest.cxx b/sd/qa/unit/TextFittingTest.cxx
index 13f41ff793db..9fe7946f2289 100644
--- a/sd/qa/unit/TextFittingTest.cxx
+++ b/sd/qa/unit/TextFittingTest.cxx
@@ -44,8 +44,8 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest)
     auto pTextObject = DynCastSdrTextObj(pPage->GetObj(0));
     CPPUNIT_ASSERT(pTextObject);
 
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pTextObject->GetFontScale(), 1E-2);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pTextObject->GetSpacingScale(), 1E-2);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pTextObject->GetFontScale(), 1E-4);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pTextObject->GetSpacingScale(), 1E-4);
 
     {
         OutlinerParaObject* pOutlinerParagraphObject = 
pTextObject->GetOutlinerParaObject();
@@ -73,16 +73,16 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest)
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), rEditEngine.GetParagraphCount());
 
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(92.5, 
rEditEngine.getScalingParameters().fFontY, 1E-2);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(80.0, 
rEditEngine.getScalingParameters().fSpacingY, 1E-2);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.925, 
rEditEngine.getScalingParameters().fFontY, 1E-4);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.8, 
rEditEngine.getScalingParameters().fSpacingY, 1E-4);
 
     // Add paragraph 5
     rEditView.SetSelection(ESelection(4, 0, 4, 0));
     rEditView.InsertText(u"
D5"_ustr);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(5), rEditEngine.GetParagraphCount());
 
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(70.0, 
rEditEngine.getScalingParameters().fFontY, 1E-2);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(80.0, 
rEditEngine.getScalingParameters().fSpacingY, 1E-2);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.7, 
rEditEngine.getScalingParameters().fFontY, 1E-4);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.8, 
rEditEngine.getScalingParameters().fSpacingY, 1E-4);
 
     // Add paragraph 6
     rEditView.SetSelection(ESelection(5, 0, 5, 0));
@@ -104,17 +104,17 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest)
     rEditView.DeleteSelected();
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rEditEngine.GetParagraphCount());
 
-    // We are back to 100%
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, 
rEditEngine.getScalingParameters().fFontY, 1E-2);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, 
rEditEngine.getScalingParameters().fSpacingY, 1E-2);
+    // not ideal - scaling should be 100%, but close enough
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, 
rEditEngine.getScalingParameters().fFontY, 1E-4);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, 
rEditEngine.getScalingParameters().fSpacingY, 1E-4);
 
     // are we still in text edit mode?
     CPPUNIT_ASSERT_EQUAL(true, pView1->IsTextEdit());
     pView1->SdrEndTextEdit();
     CPPUNIT_ASSERT_EQUAL(false, pView1->IsTextEdit());
 
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pTextObject->GetFontScale(), 1E-2);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pTextObject->GetSpacingScale(), 1E-2);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pTextObject->GetFontScale(), 1E-4);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pTextObject->GetSpacingScale(), 1E-4);
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/ui/dlg/NotesChildWindow.cxx 
b/sd/source/ui/dlg/NotesChildWindow.cxx
index 79c0bdaaa95b..d74b5339e3b9 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()->setScalingParameters({ 30.0, 30.0 });
+    mrParentWindow.GetOutliner()->setScalingParameters({ 0.30, 0.30 });
 
     provideNoteText();
 
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index 3b15ceaef650..0a75f4dd5cef 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -169,7 +169,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
             case SID_ATTR_CHAR_STRIKEOUT:
             case SID_ATTR_CHAR_CASEMAP:
             {
-                double stretchY = 100.0;
+                double stretchY = 1.0;
                 SvxScriptSetItem aSetItem( nSlotId, GetPool() );
                 aSetItem.GetItemSet().Put( aAttrSet, false );
 
@@ -207,7 +207,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
                     if( nSlotId == SID_ATTR_CHAR_FONTHEIGHT )
                     {
                         SvxFontHeightItem aFontItem = dynamic_cast<const 
SvxFontHeightItem&>(*pI);
-                        aFontItem.SetHeight(aFontItem.GetHeight() * (stretchY 
/ 100.0), 100, aFontItem.GetPropUnit());
+                        aFontItem.SetHeight(aFontItem.GetHeight() * stretchY, 
100, aFontItem.GetPropUnit());
                         aFontItem.SetWhich(nWhich);
                         aAttrSet.Put( aFontItem );
                     }
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 526b4d8b0b8e..e66e8ad01459 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -929,8 +929,8 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& 
rOutliner, const Size& rTextS
     tools::Long nXTolMi=nWantWdt/25;  // tolerance: -4%
     tools::Long nXCorr =nWantWdt/20;  // correction scale: 5%
 
-    double nX = (nWantWdt * 100.0) / double(nIsWdt); // calculate X stretching
-    double nY = (nWantHgt * 100.0) / double(nIsHgt); // calculate Y stretching
+    double nX = nWantWdt / double(nIsWdt); // calculate X stretching
+    double nY = nWantHgt / double(nIsHgt); // calculate Y stretching
     bool bChkX = true;
     if (bNoStretching)
     { // might only be possible proportionally
@@ -949,14 +949,14 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& 
rOutliner, const Size& rTextS
     {
         if (nX < 0.0)
             nX = -nX;
-        if (nX < 1.0)
+        if (nX < 0.01)
         {
-            nX = 1.0;
+            nX = 0.01;
             bNoMoreLoop = true;
         }
-        if (nX > 65535.0)
+        if (nX > 655.35)
         {
-            nX = 65535.0;
+            nX = 655.35;
             bNoMoreLoop = true;
         }
 
@@ -964,14 +964,14 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& 
rOutliner, const Size& rTextS
         {
             nY = -nY;
         }
-        if (nY < 1.0)
+        if (nY < 0.01)
         {
-            nY = 1.0;
+            nY = 0.01;
             bNoMoreLoop = true;
         }
-        if (nY > 65535.0)
+        if (nY > 655.35)
         {
-            nY = 65535.0;
+            nY = 655.35;
             bNoMoreLoop = true;
         }
 
@@ -1276,7 +1276,7 @@ void SdrTextObj::setupAutoFitText(SdrOutliner& rOutliner, 
const Size& rTextBoxSi
 
     if (fFontScale > 0.0 && fSpacingScale > 0.0 && !mbInEditMode)
     {
-        rOutliner.setScalingParameters({ fFontScale, fFontScale, 100.0, 
fSpacingScale });
+        rOutliner.setScalingParameters({ fFontScale, fFontScale, 1.0, 
fSpacingScale });
     }
     else
     {
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 7b94bfbc1093..a2582da5e885 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1375,7 +1375,7 @@ void SdrTextObj::impDecomposeStretchTextPrimitive(
     // to layout without mirroring
     const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX());
     const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY());
-    ScalingParameters aScalingParameters{fScaleX * 100.0, fScaleY * 100.0};
+    ScalingParameters aScalingParameters{fScaleX, fScaleY};
 
     rOutliner.setScalingParameters(aScalingParameters);
 
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 95d6ba37304c..de1590536d19 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -2336,7 +2336,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, 
const SfxItemPropertyMapEn
         if (rValue >>= fScale)
         {
             SdrTextFitToSizeTypeItem 
aItem(pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
-            aItem.setFontScale(fScale);
+            aItem.setFontScale(fScale / 100.0);
             pSdrObject->SetMergedItem(aItem);
             return true;
         }
@@ -2349,7 +2349,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, 
const SfxItemPropertyMapEn
         if (rValue >>= fScale)
         {
             SdrTextFitToSizeTypeItem 
aItem(pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
-            aItem.setSpacingScale(fScale);
+            aItem.setSpacingScale(fScale / 100.0);
             pSdrObject->SetMergedItem(aItem);
             return true;
         }
@@ -2875,7 +2875,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, 
const SfxItemPropertyMapEn
         auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
         if (pTextObject)
         {
-            rValue <<= pTextObject->GetFontScale();
+            rValue <<= pTextObject->GetFontScale() * 100.0;
         }
         break;
     }
@@ -2885,7 +2885,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, 
const SfxItemPropertyMapEn
         auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
         if (pTextObject)
         {
-            rValue <<= pTextObject->GetSpacingScale();
+            rValue <<= pTextObject->GetSpacingScale() * 100.0;
         }
         break;
     }

Reply via email to