svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx       |    5 ++++-
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |    3 ++-
 svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx    |   16 ++++++++++++----
 svx/source/svdraw/svdotextdecomposition.cxx          |    7 +++++++
 4 files changed, 25 insertions(+), 6 deletions(-)

New commits:
commit 25d6bd3ebcf4a5d6003288863620565749433787
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Fri Oct 18 12:59:17 2024 +0200
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Mon Oct 21 11:42:40 2024 +0200

    Support FixedCellHeight in SdrAutoFitTextPrimitive2D
    
    That was missing with the result that for some cases the
    painted text (where it was missing) differed from the
    text in EditEngine mode (was set there).
    
    Change-Id: I23ddf8e90be2335c56e5a485308c753dfe72a878
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175127
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>

diff --git a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx 
b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
index 43c6aadaf7f7..ddb0a4075d3d 100644
--- a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
+++ b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
@@ -269,6 +269,7 @@ namespace drawinglayer::primitive2d
             ::basegfx::B2DHomMatrix                 maTextRangeTransform;   // 
text range transformation from unit range ([0.0 .. 1.0]) to text range
 
             bool                                    mbWordWrap : 1;         // 
for CustomShapes text layout
+            bool                                    mbFixedCellHeight : 1;
 
             // local decomposition.
             virtual Primitive2DReference create2DDecomposition(const 
geometry::ViewInformation2D& aViewInformation) const override;
@@ -278,11 +279,13 @@ namespace drawinglayer::primitive2d
                 const SdrText* pSdrText,
                 const OutlinerParaObject& rOutlinerParaObjectPtr,
                 ::basegfx::B2DHomMatrix aTextRangeTransform,
-                bool bWordWrap);
+                bool bWordWrap,
+                bool bFixedCellHeight);
 
             // get data
             const basegfx::B2DHomMatrix& getTextRangeTransform() const { 
return maTextRangeTransform; }
             bool getWordWrap() const { return mbWordWrap; }
+            bool isFixedCellHeight() const { return mbFixedCellHeight; }
 
             // compare operator
             virtual bool operator==(const BasePrimitive2D& rPrimitive) const 
override;
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx 
b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index a29d1cbb1900..920b3026ac02 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -679,7 +679,8 @@ sal_uInt32 
SlideBackgroundFillPrimitive2D::getPrimitive2DID() const
                                     &rText.getSdrText(),
                                     rText.getOutlinerParaObject(),
                                     aAnchorTransform,
-                                    bWordWrap);
+                                    bWordWrap,
+                                    rText.isFixedCellHeight());
                 }
                 else if( rText.isChainable() && !rText.isInEditMode() )
                 {
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx 
b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index 363b5e005ce8..7b3c3a705a5c 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -420,10 +420,12 @@ namespace drawinglayer::primitive2d
              const SdrText* pSdrText,
              const OutlinerParaObject& rParaObj,
              ::basegfx::B2DHomMatrix aTextRangeTransform,
-             bool bWordWrap)
+             bool bWordWrap,
+             bool bFixedCellHeight)
          :  SdrTextPrimitive2D(pSdrText, rParaObj),
              maTextRangeTransform(std::move(aTextRangeTransform)),
-             mbWordWrap(bWordWrap)
+             mbWordWrap(bWordWrap),
+             mbFixedCellHeight(bFixedCellHeight)
          {
          }
 
@@ -434,7 +436,8 @@ namespace drawinglayer::primitive2d
                  const SdrBlockTextPrimitive2D& rCompare = static_cast<const 
SdrBlockTextPrimitive2D&>(rPrimitive);
 
                  return (getTextRangeTransform() == 
rCompare.getTextRangeTransform()
-                     && getWordWrap() == rCompare.getWordWrap());
+                     && getWordWrap() == rCompare.getWordWrap()
+                     && isFixedCellHeight() == rCompare.isFixedCellHeight());
              }
 
              return false;
@@ -442,7 +445,12 @@ namespace drawinglayer::primitive2d
 
          rtl::Reference<SdrTextPrimitive2D> 
SdrAutoFitTextPrimitive2D::createTransformedClone(const 
::basegfx::B2DHomMatrix& rTransform) const
          {
-             return new SdrAutoFitTextPrimitive2D(getSdrText(), 
getOutlinerParaObject(), rTransform * getTextRangeTransform(), getWordWrap());
+             return new SdrAutoFitTextPrimitive2D(
+                getSdrText(),
+                getOutlinerParaObject(),
+                rTransform * getTextRangeTransform(),
+                getWordWrap(),
+                isFixedCellHeight());
          }
 
         // provide unique ID
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 39e5431a2581..e228471b3433 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -992,6 +992,13 @@ void SdrTextObj::impDecomposeAutoFitTextPrimitive(
     // set visualizing page at Outliner; needed e.g. for PageNumberField 
decomposition
     
rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
 
+    // Do not forget to set FixedCellHeight, else the line heights will not be 
correct,
+    // see impDecomposeBlockTextPrimitive or impDecomposeStretchTextPrimitive 
in this
+    // file. The visualization for paint and in EditMode would be different. 
Since
+    // SetFixedCellHeight *is* used/done in ::BegTextEdit the error is that it 
is *not*
+    // done here (in contrast to BlockText and StretchText)
+    rOutliner.SetFixedCellHeight(rSdrAutofitTextPrimitive.isFixedCellHeight());
+
     // now get back the layouted text size from outliner
     const Size aOutlinerTextSize(rOutliner.GetPaperSize());
     const basegfx::B2DVector aOutlinerScale(aOutlinerTextSize.Width(), 
aOutlinerTextSize.Height());

Reply via email to