SHA256
1
0
forked from pool/libreoffice

Accepting request 1031922 from LibreOffice:7.4

- Fix bsc#1202866 - LO-L3: PPTX: indentation of list items far too far to the left (overruns bullet items)
  * bsc1202866.patch

OBS-URL: https://build.opensuse.org/request/show/1031922
OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=1045
This commit is contained in:
Danilo Spinella 2022-11-02 10:09:41 +00:00 committed by Git OBS Bridge
parent ea62613b16
commit 27bb23bd7b
4 changed files with 247 additions and 0 deletions

235
bsc1202866.patch Normal file
View File

@ -0,0 +1,235 @@
From b05c289cf0278ff9737dd928c5a97611e69219a8 Mon Sep 17 00:00:00 2001
From: Sarper Akdemir <sarper.akdemir@collabora.com>
Date: Mon, 24 Oct 2022 01:50:36 +0300
Subject: [PATCH 1/3] tdf#149961 pptx import: fix indents for autofitted
texboxes
For autofitted textboxes, Impress scales the indents with the
text size while PowerPoint doesn't.
Scale the indents inversely propotional to autofit font
scale so that the visual appearance on import is similar to
PowerPoint.
Change-Id: I7876b35a1f4221789564fcf23ccbe3fe21db3d48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141717
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141939
Reviewed-by: Andras Timar <andras.timar@collabora.com>
---
oox/inc/drawingml/textparagraph.hxx | 3 +-
oox/inc/drawingml/textparagraphproperties.hxx | 1 +
oox/source/drawingml/textbody.cxx | 5 ++-
oox/source/drawingml/textparagraph.cxx | 5 ++-
.../drawingml/textparagraphproperties.cxx | 10 ++++-
.../pptx/tdf149961-autofitIndentation.pptx | Bin 0 -> 34123 bytes
sd/qa/unit/import-tests2.cxx | 40 ++++++++++++++++++
7 files changed, 58 insertions(+), 6 deletions(-)
create mode 100644 sd/qa/unit/data/pptx/tdf149961-autofitIndentation.pptx
diff --git a/oox/inc/drawingml/textparagraph.hxx b/oox/inc/drawingml/textparagraph.hxx
index 1f43249372a5..4920c99da7c5 100644
--- a/oox/inc/drawingml/textparagraph.hxx
+++ b/oox/inc/drawingml/textparagraph.hxx
@@ -77,7 +77,8 @@ public:
const TextListStyle& rMasterTextListStyle,
const TextListStyle& rTextListStyle,
bool bFirst,
- float nDefaultCharHeight) const;
+ float nDefaultCharHeight,
+ sal_Int32 nAutofitFontScale) const;
bool HasMathXml() const
{
diff --git a/oox/inc/drawingml/textparagraphproperties.hxx b/oox/inc/drawingml/textparagraphproperties.hxx
index 8ea56a7b0736..083b61e37da7 100644
--- a/oox/inc/drawingml/textparagraphproperties.hxx
+++ b/oox/inc/drawingml/textparagraphproperties.hxx
@@ -103,6 +103,7 @@ public:
const BulletList* pMasterBuList,
bool bApplyBulletList,
float fFontSize,
+ sal_Int32 nAutofitFontScale = 100000,
bool bPushDefaultValues = false ) const;
/** Returns the largest character size of this paragraph. If possible the
diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx
index 0f053ab6ad74..1be15c4f885d 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -65,7 +65,7 @@ void TextBody::insertAt(
for (auto const& paragraph : maParagraphs)
{
paragraph->insertAt(rFilterBase, xText, xAt, rTextStyleProperties, aMasterTextStyle,
- maTextListStyle, (nIndex == 0), nCharHeight);
+ maTextListStyle, (nIndex == 0), nCharHeight, getTextProperties().mnFontScale);
++nIndex;
}
}
@@ -148,7 +148,8 @@ void TextBody::ApplyStyleEmpty(
float nCharHeight = xProps->getPropertyValue("CharHeight").get<float>();
TextParagraphProperties aParaProp;
aParaProp.apply(*pTextParagraphStyle);
- aParaProp.pushToPropSet(&rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), true, nCharHeight, true);
+ aParaProp.pushToPropSet(&rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(),
+ true, nCharHeight, getTextProperties().mnFontScale, true);
}
}
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx
index f91ee279bb3b..80f9fd3739b3 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -87,7 +87,8 @@ void TextParagraph::insertAt(
const Reference < XTextCursor > &xAt,
const TextCharacterProperties& rTextStyleProperties,
const TextListStyle& rMasterTextListStyle,
- const TextListStyle& rTextListStyle, bool bFirst, float nDefaultCharHeight) const
+ const TextListStyle& rTextListStyle, bool bFirst,
+ float nDefaultCharHeight, sal_Int32 nAutofitFontScale) const
{
try {
sal_Int32 nParagraphSize = 0;
@@ -175,7 +176,7 @@ void TextParagraph::insertAt(
}
float fCharacterSize = nCharHeight > 0 ? GetFontHeight ( nCharHeight ) : pTextParagraphStyle->getCharHeightPoints( 12 );
- aParaProp.pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), true, fCharacterSize, true );
+ aParaProp.pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), true, fCharacterSize, nAutofitFontScale, true );
}
// empty paragraphs do not have bullets in ppt
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index 23efb301e963..0006b7530a76 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -405,7 +405,7 @@ void TextParagraphProperties::apply( const TextParagraphProperties& rSourceProps
void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase,
const Reference < XPropertySet >& xPropSet, PropertyMap& rioBulletMap, const BulletList* pMasterBuList, bool bApplyBulletMap, float fCharacterSize,
- bool bPushDefaultValues ) const
+ sal_Int32 nAutofitFontScale, bool bPushDefaultValues ) const
{
PropertySet aPropSet( xPropSet );
aPropSet.setProperties( maTextParagraphPropertyMap );
@@ -431,6 +431,14 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
std::optional< sal_Int32 > noParaLeftMargin( moParaLeftMargin );
std::optional< sal_Int32 > noFirstLineIndentation( moFirstLineIndentation );
+ // tdf#149961 Impress scales the indents when text is autofitted while Powerpoint doesn't
+ // Try to counteract this by multiplying indents by the inverse of the autofit font scale.
+ if ( nAutofitFontScale )
+ {
+ if ( noParaLeftMargin ) noParaLeftMargin = *noParaLeftMargin * MAX_PERCENT / nAutofitFontScale;
+ if ( noFirstLineIndentation ) noFirstLineIndentation = *noFirstLineIndentation * MAX_PERCENT / nAutofitFontScale;
+ }
+
if ( nNumberingType != NumberingType::NUMBER_NONE )
{
if ( noParaLeftMargin )
From df3b9d85b71df464731b02f1ff425bfd09b2db20 Mon Sep 17 00:00:00 2001
From: Sarper Akdemir <sarper.akdemir@collabora.com>
Date: Mon, 24 Oct 2022 14:16:16 +0300
Subject: [PATCH 2/3] related tdf#149961 pptx export: scale indents for
autofitted textboxes
For autofitted textboxes, Impress scales the indents with
the text size while PowerPoint doesn't.
Try to compensate for this by scaling exported indents
proportionally to the font scale on autofitted textboxes.
Change-Id: Ib0f967e923d23553b4cdbd1bbe2e137d97b1b2e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141758
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
---
include/oox/export/drawingml.hxx | 2 +-
oox/source/export/drawingml.cxx | 26 +++++++++++++++---
.../data/odp/autofitted-textbox-indent.odp | Bin 0 -> 12486 bytes
sd/qa/unit/export-tests-ooxml3.cxx | 22 +++++++++++++++
4 files changed, 45 insertions(+), 5 deletions(-)
create mode 100644 sd/qa/unit/data/odp/autofitted-textbox-indent.odp
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index c80024ea1fdd..674457b3c6e4 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -302,7 +302,7 @@ public:
@returns true if any paragraph properties were written
*/
- bool WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 nElement);
+ bool WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet, float fFirstCharHeight, sal_Int32 nElement);
void WriteParagraphNumbering(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight,
sal_Int16 nLevel );
void WriteParagraphTabStops(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0ab497a4fed3..5ee48ff6e338 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3020,7 +3020,7 @@ void DrawingML::WriteLinespacing(const LineSpacing& rSpacing, float fFirstCharHe
}
}
-bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 nElement)
+bool DrawingML::WriteParagraphProperties(const Reference<XTextContent>& rParagraph, const Reference<XPropertySet>& rXShapePropSet, float fFirstCharHeight, sal_Int32 nElement)
{
Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY );
Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY );
@@ -3110,6 +3110,24 @@ bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara
return false;
}
+ // for autofitted textboxes, scale the indents
+ if (GetProperty(rXShapePropSet, "TextFitToSize") && mAny.get<TextFitToSizeType>() == TextFitToSizeType_AUTOFIT)
+ {
+ SvxShapeText* pTextShape = dynamic_cast<SvxShapeText*>(rXShapePropSet.get());
+ if (pTextShape)
+ {
+ SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pTextShape->GetSdrObject());
+ if (pTextObject)
+ {
+ const auto nFontScaleY = pTextObject->GetFontScaleY();
+ nLeftMargin = nLeftMargin * nFontScaleY / 100;
+ nLineIndentation = nLineIndentation * nFontScaleY / 100;
+ nParaLeftMargin = nParaLeftMargin * nFontScaleY / 100;
+ nParaFirstLineIndent = nParaFirstLineIndent * nFontScaleY / 100;
+ }
+ }
+ }
+
if (nParaLeftMargin) // For Paragraph
mpFS->startElementNS( XML_a, nElement,
XML_lvl, sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0),
@@ -3197,7 +3215,7 @@ void DrawingML::WriteLstStyles(const css::uno::Reference<css::text::XTextContent
fFirstCharHeight = xFirstRunPropSet->getPropertyValue("CharHeight").get<float>();
mpFS->startElementNS(XML_a, XML_lstStyle);
- if( !WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_lvl1pPr) )
+ if( !WriteParagraphProperties(rParagraph, rXShapePropSet, fFirstCharHeight, XML_lvl1pPr) )
mpFS->startElementNS(XML_a, XML_lvl1pPr);
WriteRunProperties(xFirstRunPropSet, false, XML_defRPr, true, rbOverridingCharHeight,
rnCharHeight, GetScriptType(rRun->getString()), rXShapePropSet);
@@ -3239,7 +3257,7 @@ void DrawingML::WriteParagraph( const Reference< XTextContent >& rParagraph,
rnCharHeight = 100 * fFirstCharHeight;
rbOverridingCharHeight = true;
}
- WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_pPr);
+ WriteParagraphProperties(rParagraph, rXShapePropSet, fFirstCharHeight, XML_pPr);
bPropertiesWritten = true;
}
WriteRun( run, rbOverridingCharHeight, rnCharHeight, rXShapePropSet);
@@ -3733,7 +3751,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
if( aAny >>= xParagraph )
{
mpFS->startElementNS(XML_a, XML_p);
- WriteParagraphProperties(xParagraph, nCharHeight, XML_pPr);
+ WriteParagraphProperties(xParagraph, rXPropSet, nCharHeight, XML_pPr);
sal_Int16 nDummy = -1;
WriteRunProperties(rXPropSet, false, XML_endParaRPr, false,
bOverridingCharHeight, nCharHeight, nDummy, rXPropSet);

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Oct 28 09:38:35 UTC 2022 - Andras Timar <andras.timar@collabora.com>
- Fix bsc#1202866 - LO-L3: PPTX: indentation of list items far too far to the left (overruns bullet items)
* bsc1202866.patch
-------------------------------------------------------------------
Wed Oct 26 08:41:00 UTC 2022 - Andras Timar <andras.timar@collabora.com>

View File

@ -111,6 +111,8 @@ Patch10: fix_gtk_popover_on_3.20.patch
Patch13: libreoffice-7.4.1.2-grep.patch
# LO-L3: Text box shows that does not show in PowerPoint
Patch14: bsc1201095.patch
# LO-L3: PPTX: indentation of list items far too far to the left (overruns bullet items)
Patch15: bsc1202866.patch
# Build with java 8
Patch101: 0001-Revert-java-9-changes.patch
# try to save space by using hardlinks
@ -1032,6 +1034,7 @@ Provides %{langname} translations and additional resources (help files, etc.) fo
%endif
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch990 -p1
%patch991 -p1

3
poppler-22.09.0.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb30d5852a41e2e
size 1842704