diff --git a/bsc1178807.diff b/bsc1178807.diff new file mode 100644 index 0000000..a606fc3 --- /dev/null +++ b/bsc1178807.diff @@ -0,0 +1,79 @@ +From 0bd430959f1605cb7ab5ab2efdb4b6fd217cd8c2 Mon Sep 17 00:00:00 2001 +From: Miklos Vajna +Date: Wed, 6 Jan 2021 10:23:44 +0100 +Subject: [PATCH] bsc1178807.diff + +tdf#134288 svx: fix rendering of text on a zero-width shape + +We have conflicting requirements here: on one hand, the shape is zero +width, so the text area is also zero. On the other hand, we put some +text on the shape, which should be visible. + +The result was that the left/right text margin (2x250 mm100) was counted +as part of the text area, so we put a few (but not 1) characters / line +for zero width. Fix this to be PowerPoint-compatible: as the width +decreases, we break the text up to more and more lines, but if the width +is 0, then we don't break it up at all. + +An alternative would be to do this later in +SdrTextObj::impDecomposeBlockTextPrimitive(), but there we no longer +know the width is really 0, because the text margins and some small +increase (+1 to be an inclusive range, +1 to have a non-zero scale) is +already added to the original width. + +(cherry picked from commit 65e2ef43f186164729e1cc071b805bc1a7125cfe) + +Conflicts: + svx/qa/unit/sdr.cxx + +Change-Id: Ieaa3e726bc5d37983b6221452e14f01db315f790 +--- + .../sdr/primitive2d/sdrdecompositiontools.cxx | 28 +++++++++++++++++-- + 1 file changed, 26 insertions(+), 2 deletions(-) + +diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +index 2ee2bb625e2d..801190f5e92a 100644 +--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx ++++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +@@ -278,12 +278,36 @@ namespace drawinglayer::primitive2d + + // create a range describing the wanted text position and size (aTextAnchorRange). This + // means to use the text distance values here +- const basegfx::B2DPoint aTopLeft(aSnapRange.getMinX() + rText.getTextLeftDistance(), aSnapRange.getMinY() + rText.getTextUpperDistance()); +- const basegfx::B2DPoint aBottomRight(aSnapRange.getMaxX() - rText.getTextRightDistance(), aSnapRange.getMaxY() - rText.getTextLowerDistance()); ++ sal_Int32 nTextLeftDistance = rText.getTextLeftDistance(); ++ // If the margin is larger than the entire width of the text area, then limit the ++ // margin. ++ if (nTextLeftDistance > aSnapRange.getWidth()) ++ nTextLeftDistance = aSnapRange.getWidth(); ++ sal_Int32 nTextRightDistance = rText.getTextRightDistance(); ++ if (nTextRightDistance > aSnapRange.getWidth()) ++ nTextRightDistance = aSnapRange.getWidth(); ++ const basegfx::B2DPoint aTopLeft(aSnapRange.getMinX() + nTextLeftDistance, ++ aSnapRange.getMinY() ++ + rText.getTextUpperDistance()); ++ const basegfx::B2DPoint aBottomRight(aSnapRange.getMaxX() - nTextRightDistance, ++ aSnapRange.getMaxY() ++ - rText.getTextLowerDistance()); + basegfx::B2DRange aTextAnchorRange; + aTextAnchorRange.expand(aTopLeft); + aTextAnchorRange.expand(aBottomRight); + ++ if (aTextAnchorRange.getWidth() == 0) ++ { ++ // If the shape has no width, then don't attempt to break the text into multiple ++ // lines, not a single character would satisfy a zero width requirement. ++ // SdrTextObj::impDecomposeBlockTextPrimitive() uses the same constant to ++ // effectively set no limits. ++ aTextAnchorRange.expand( ++ basegfx::B2DPoint(aTopLeft.getX() - 1000000, aTopLeft.getY())); ++ aTextAnchorRange.expand( ++ basegfx::B2DPoint(aBottomRight.getX() + 1000000, aBottomRight.getY())); ++ } ++ + // now create a transformation from this basic range (aTextAnchorRange) + // #i121494# if we have no scale use at least 1.0 to have a carrier e.g. for + // mirror values, else these will get lost +-- +2.26.2 + diff --git a/libreoffice.changes b/libreoffice.changes index db5c571..6dc9f03 100644 --- a/libreoffice.changes +++ b/libreoffice.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jan 12 10:32:53 UTC 2021 - Andras Timar + +- Fix bsc#1178807 - LO-L3: Text box from PowerPoint renders vertically instead of horizontally + * bsc1178807.diff + ------------------------------------------------------------------- Sat Jan 2 11:07:57 UTC 2021 - Callum Farmer diff --git a/libreoffice.spec b/libreoffice.spec index 2b9734c..f4adb25 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -1,7 +1,7 @@ # # spec file for package libreoffice # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -104,6 +104,8 @@ Patch5: bsc1178944.diff Patch6: bsc1178943.diff # Fix build with ICU 68 Patch7: icu68.patch +# Bug 1178807 - LO-L3: Text box from PowerPoint renders vertically instead of horizontally +Patch8: bsc1178807.diff # try to save space by using hardlinks Patch990: install-with-hardlinks.diff # save time by relying on rpm check rather than doing stupid find+grep @@ -965,6 +967,7 @@ Provides %{langname} translations and additional resources (help files, etc.) fo %patch5 -p1 %patch6 -p1 %patch7 -p1 +%patch8 -p1 %patch990 -p1 %patch991 -p1