summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2024-10-18 12:59:17 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-10-23 23:41:39 +0200
commiteb627159e30ce027cbb8c47a69241f4c0421d993 (patch)
tree432b1caa0051faf24d083ab1bf71149cc38c508e /svx
parentaa2b46b323837a0b48b23d7344f361bb88d770fa (diff)
tdf#163597: 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.Grand@me.com> (cherry picked from commit 25d6bd3ebcf4a5d6003288863620565749433787) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175382 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx5
-rw-r--r--svx/source/sdr/primitive2d/sdrdecompositiontools.cxx3
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx16
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx7
4 files changed, 25 insertions, 6 deletions
diff --git a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
index adfcd193b65a..1599f6e08443 100644
--- a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
+++ b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
@@ -270,6 +270,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;
@@ -279,11 +280,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 2913f19b2548..57aad9519988 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -621,7 +621,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 044058545de4..c7cc6998cbb8 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -993,6 +993,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());