[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - oox/source sd/qa
Regina Henschel (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 11 10:03:55 UTC 2021
oox/source/drawingml/scene3dcontext.cxx | 24 +++++++++++++++++++++
oox/source/drawingml/textbodypropertiescontext.cxx | 16 ++++++++++++++
sd/qa/unit/data/pptx/tdf140865Wordart3D.pptx |binary
sd/qa/unit/export-tests-ooxml1.cxx | 24 +++++++++++++++++++++
4 files changed, 64 insertions(+)
New commits:
commit d1026ad7ad1562235b328bb5be2e00ceabd09475
Author: Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Mon Mar 8 17:28:27 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Mar 11 11:03:21 2021 +0100
tdf#140865 roundtrip pptx wordart 3D, add sp3d
Change-Id: I446ae4e8c9dd5f2fbf3efe289681339f967c515a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112185
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
(cherry picked from commit dbbb8cafcb801638bde3b21796eaebfc807acbdc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112229
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx
index 91b73f0bbd95..813f9442c901 100644
--- a/oox/source/drawingml/scene3dcontext.cxx
+++ b/oox/source/drawingml/scene3dcontext.cxx
@@ -92,6 +92,30 @@ ContextHandlerRef SceneText3DPropertiesContext::onCreateContext( sal_Int32 aElem
case A_TOKEN( backdrop ):
case A_TOKEN( extLst ):
return nullptr; // TODO: later (backdrop is not supported by core anyway)
+
+ case A_TOKEN( bevelT ):
+ case A_TOKEN( bevelB ):
+ {
+ BevelProperties aProps;
+ if( rAttribs.hasAttribute( XML_w ) )
+ aProps.mnWidth = rAttribs.getInteger( XML_w, 0 );
+ if( rAttribs.hasAttribute( XML_h ) )
+ aProps.mnHeight = rAttribs.getInteger( XML_h, 0 );
+ if( rAttribs.hasAttribute( XML_prst ) )
+ aProps.mnPreset = rAttribs.getToken( XML_prst, XML_none );
+
+ if( aElementToken == A_TOKEN( bevelT ) )
+ mr3DProperties.maTopBevelProperties.set( aProps );
+ else
+ mr3DProperties.maBottomBevelProperties.set( aProps );
+ break;
+ }
+
+ case A_TOKEN( extrusionClr ):
+ return new ColorContext( *this, mr3DProperties.maExtrusionColor );
+
+ case A_TOKEN( contourClr ):
+ return new ColorContext( *this, mr3DProperties.maContourColor );
}
return nullptr;
}
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index 5bc244b73fc2..4d94191dcfc7 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -177,6 +177,22 @@ ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement
// EG_Text3D
case A_TOKEN( sp3d ): // CT_Shape3D
+ {
+ if (mpShapePtr && mpShapePtr->getServiceName() == "com.sun.star.drawing.CustomShape")
+ {
+ if (rAttribs.hasAttribute(XML_extrusionH))
+ mpShapePtr->getTextBody()->get3DProperties().mnExtrusionH = rAttribs.getInteger(XML_extrusionH, 0);
+ if (rAttribs.hasAttribute(XML_contourW))
+ mpShapePtr->getTextBody()->get3DProperties().mnContourW = rAttribs.getInteger(XML_contourW, 0);
+ if (rAttribs.hasAttribute(XML_z))
+ mpShapePtr->getTextBody()->get3DProperties().mnShapeZ = rAttribs.getInteger(XML_z, 0);
+ if (rAttribs.hasAttribute(XML_prstMaterial))
+ mpShapePtr->getTextBody()->get3DProperties().mnMaterial = rAttribs.getToken(XML_prstMaterial, XML_none);
+ return new SceneText3DPropertiesContext(*this, mpShapePtr->getTextBody()->get3DProperties());
+ }
+ break;
+ }
+
case A_TOKEN( flatTx ): // CT_FlatText
break;
diff --git a/sd/qa/unit/data/pptx/tdf140865Wordart3D.pptx b/sd/qa/unit/data/pptx/tdf140865Wordart3D.pptx
new file mode 100644
index 000000000000..e55bc43800b4
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf140865Wordart3D.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index a76c8ec137e6..d0837001ceca 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -102,6 +102,7 @@ public:
void testTdf136911();
void testArcTo();
void testNarrationMimeType();
+ void testTdf140865Wordart3D();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
@@ -153,6 +154,7 @@ public:
CPPUNIT_TEST(testTdf136911);
CPPUNIT_TEST(testArcTo);
CPPUNIT_TEST(testNarrationMimeType);
+ CPPUNIT_TEST(testTdf140865Wordart3D);
CPPUNIT_TEST_SUITE_END();
@@ -1325,6 +1327,28 @@ void SdOOXMLExportTest1::testNarrationMimeType()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest1::testTdf140865Wordart3D()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf140865Wordart3D.pptx"), PPTX);
+ utl::TempFile aTempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &aTempFile);
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "ppt/slides/slide1.xml");
+
+ // without the fix in place a:sp3d was lost on round trip, and so extrusion was lost.
+ constexpr OStringLiteral sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr");
+ assertXPath(pXmlDoc, sPathStart + "/a:sp3d", "extrusionH", "342900");
+ assertXPath(pXmlDoc, sPathStart + "/a:sp3d", "contourW", "12700");
+ assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:bevelT", "w", "114300");
+ assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:bevelT", "h", "38100");
+ assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:bevelT", "prst", "softRound");
+ assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:bevelB", "h", "152400");
+ assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:extrusionClr/a:srgbClr", "val", "990000");
+ assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:contourClr/a:srgbClr", "val", "009876");
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list