summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2022-08-28 09:17:24 +0300
committerMiklos Vajna <vmiklos@collabora.com>2022-08-31 13:36:10 +0200
commitaebd3c4a7def4476f34e171fce395d6ba70e3e1e (patch)
tree3a83a090b71dfb43fbe13145d17c8965922cd142 /oox/source
parent1a0ceb76e2fe12cdfff7cabf06ef43cfba296a34 (diff)
tdf#144092 pptx export: export endParaRPr for empty shape & cells
Alters ShapeExport::WriteTextBox so that when it is called with an empty text (on PPTX export) an attempt to export empty text's char properties (stored in the Shape or Cell's properties directly) made on ShapeExport::WriteText. These properties are exported into endParaRPr. Implementing this caused some tests that contain connector shapes fail with XML schema validation errors, therefore disabled export of txBody inside cxnSp tags. Also adds a unit test that checks roundtrip of empty shape or cell's endParaRPr. Change-Id: I3e3feda802f42560fa7fecc9c0b1afe73a900a84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138960 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/export/drawingml.cxx18
-rw-r--r--oox/source/export/shapes.cxx11
2 files changed, 26 insertions, 3 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 2a536b809220..51ac5f660237 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3781,6 +3781,24 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
sal_Int32 nCharHeight = -1;
bool bFirstParagraph = true;
+ // tdf#144092 For shapes without text: Export run properties (into
+ // endParaRPr) from the shape's propset instead of the paragraph's.
+ if(xXText->getString().isEmpty() && enumeration->hasMoreElements())
+ {
+ Any aAny (enumeration->nextElement());
+ Reference<XTextContent> xParagraph;
+ if( aAny >>= xParagraph )
+ {
+ mpFS->startElementNS(XML_a, XML_p);
+ WriteParagraphProperties(xParagraph, nCharHeight, XML_pPr);
+ sal_Int16 nDummy = -1;
+ WriteRunProperties(rXPropSet, false, XML_endParaRPr, false,
+ bOverridingCharHeight, nCharHeight, nDummy, rXPropSet);
+ mpFS->endElementNS(XML_a, XML_p);
+ }
+ return;
+ }
+
while( enumeration->hasMoreElements() )
{
Reference< XTextContent > paragraph;
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 79258d7d10e2..90e4ad86926f 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1797,8 +1797,12 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape
WriteOutline( xShapeProps );
pFS->endElementNS( mnXmlNamespace, XML_spPr );
- // write text
- WriteTextBox( xShape, mnXmlNamespace );
+ // connector shape (cxnSp) cannot contain text (txBody) (according to schema)
+ if( nShapeNode != XML_cxnSp )
+ {
+ // write text
+ WriteTextBox( xShape, mnXmlNamespace );
+ }
pFS->endElementNS(mnXmlNamespace, nShapeNode);
@@ -2025,7 +2029,8 @@ ShapeExport& ShapeExport::WriteTextBox( const Reference< XInterface >& xIface, s
}
Reference< XText > xXText( xIface, UNO_QUERY );
- if( NonEmptyText( xIface ) && xXText.is() )
+ if( (NonEmptyText( xIface ) || GetDocumentType() == DOCUMENT_PPTX)
+ && xXText.is() )
{
FSHelperPtr pFS = GetFS();