Accepting request 862706 from LibreOffice:7.0

- Fix bsc#1178807 - LO-L3: Text box from PowerPoint renders vertically instead of horizontally
  * bsc1178807.diff

OBS-URL: https://build.opensuse.org/request/show/862706
OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=932
This commit is contained in:
Fridrich Strba 2021-01-13 06:28:51 +00:00 committed by Git OBS Bridge
parent 5ab8a97adc
commit 8aef9d8529
3 changed files with 89 additions and 1 deletions

79
bsc1178807.diff Normal file
View File

@ -0,0 +1,79 @@
From 0bd430959f1605cb7ab5ab2efdb4b6fd217cd8c2 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.com>
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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jan 12 10:32:53 UTC 2021 - Andras Timar <andras.timar@collabora.com>
- 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 <gmbr3@opensuse.org>

View File

@ -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