diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2022-08-15 21:35:52 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-08-29 09:42:34 +0200 |
commit | 57f9b4b7d1ad164c56af12009ef1dafbc1be8369 (patch) | |
tree | 0836093d88414cf85a7068a4e881066e9c45bce7 /oox | |
parent | 95aea41eb9fbb99452097e5b36f09b8782c8dfff (diff) |
tdf#144092 pptx import: fix import of empty cell and shape text properties
For table cells and shapes without any text, text properties weren't
correctly imported. Both the master styles and properties defined in
the endParaRPr were ignored.
It appears the current implementation does attempt to import those in
TextParagraph::insertAt(...), after the attempt they end up in the
TextRange('s nodes) but they are ignored.
This commit implements a fix by: If the cell or shape has no text, the
text properties are also pushed into the shape or cell's propset
directly
Change-Id: Ie425b3e9a73937a2503e47322e25f37ed9a2a6be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138651
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/shape.cxx | 11 | ||||
-rw-r--r-- | oox/source/drawingml/table/tablecell.cxx | 19 |
2 files changed, 29 insertions, 1 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index bd4d773c15d0..3e81a1b95a27 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1800,6 +1800,17 @@ Reference< XShape > const & Shape::createAndInsert( aPropertySet.setAnyProperty(PROP_ParaAdjust, uno::Any(eAdjust)); } } + + // tdf#144092 For empty textboxes push character styles & + // endParaRPr into the Shape's properties + if (rParagraphs.size() == 1 && pParagraph->getRuns().empty()) + { + TextCharacterProperties aTextCharacterProps{ pParagraph->getCharacterStyle( + aCharStyleProperties, *mpMasterTextListStyle, + getTextBody()->getTextListStyle()) }; + aTextCharacterProps.assignUsed(pParagraph->getEndProperties()); + aTextCharacterProps.pushToPropSet(aPropertySet, rFilterBase); + } } } } diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index d979fb54e63f..77b69b8e4e3e 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -22,6 +22,8 @@ #include <basegfx/color/bcolor.hxx> #include <oox/drawingml/shapepropertymap.hxx> #include <drawingml/textbody.hxx> +#include <drawingml/textcharacterproperties.hxx> +#include <drawingml/textparagraph.hxx> #include <oox/drawingml/theme.hxx> #include <oox/core/xmlfilterbase.hxx> #include <oox/helper/propertyset.hxx> @@ -542,7 +544,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons // TODO: phClr? aFillProperties.pushToPropMap( aPropMap, rFilterBase.getGraphicHelper() ); - PropertySet( xPropSet ).setProperties( aPropMap ); + PropertySet aPropSet{xPropSet}; + aPropSet.setProperties( aPropMap ); if ( getVertToken() == XML_eaVert ) { @@ -551,6 +554,20 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle ); + // tdf#144092 For empty cells push character styles & endParaRPr to the Cell's properties + const TextParagraphVector& rParagraphs = getTextBody()->getParagraphs(); + if (rParagraphs.size() == 1) + { + const auto pFirstParagraph = rParagraphs.at(0); + if (pFirstParagraph->getRuns().empty()) + { + TextCharacterProperties aTextCharacterProps{ pFirstParagraph->getCharacterStyle( + aTextStyleProps, *pMasterTextListStyle, getTextBody()->getTextListStyle()) }; + aTextCharacterProps.assignUsed(pFirstParagraph->getEndProperties()); + aTextCharacterProps.pushToPropSet(aPropSet, rFilterBase); + } + } + if (getVertToken() == XML_vert) xPropSet->setPropertyValue("RotateAngle", Any(short(27000))); else if (getVertToken() == XML_vert270) |