include/oox/drawingml/drawingmltypes.hxx | 3 + include/oox/export/drawingml.hxx | 1 oox/source/drawingml/drawingmltypes.cxx | 6 +++ oox/source/export/drawingml.cxx | 35 +++++++++++++++++++ sd/qa/unit/data/pptx/tdf79082.pptx |binary sd/qa/unit/export-tests-ooxml2.cxx | 57 +++++++++++++++++++++++++++++++ 6 files changed, 102 insertions(+)
New commits: commit 3d0298bf54363b7887e62b86908b6768f4da4d71 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> AuthorDate: Tue May 5 12:02:47 2020 +0200 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Wed May 6 22:53:50 2020 +0200 tdf#79082 Export paragraph tab stops to ooxml Change-Id: I7d25dc1ab3c960aafc07a3be69b54f5aceef23fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93462 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> (cherry picked from commit 2c14bbd5820f854be3a4b1c0f49b9d9afa05b08c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93526 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index 5e3517b58524..8b513d8c3f61 100644 --- a/include/oox/drawingml/drawingmltypes.hxx +++ b/include/oox/drawingml/drawingmltypes.hxx @@ -106,6 +106,9 @@ sal_Int32 GetCoordinate( sal_Int32 nValue ); /** converts an emu string into 1/100th mmm */ sal_Int32 GetCoordinate( const OUString& sValue ); +/** converts 1/100mm to EMU */ +sal_Int32 GetPointFromCoordinate( sal_Int32 nValue ); + /** converts a ST_Percentage % string into 1/1000th of % */ sal_Int32 GetPercent( const OUString& sValue ); diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index a3da6a3cb442..fb7b7877138c 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -247,6 +247,7 @@ public: void WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, float fFirstCharHeight); 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); void WriteRun( const css::uno::Reference< css::text::XTextRange >& rRun, bool& rbOverridingCharHeight, sal_Int32& rnCharHeight ); void WriteRunProperties( const css::uno::Reference< css::beans::XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect, diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx index f341ff3f9587..9a5ddf3cc4b9 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -54,6 +54,12 @@ sal_Int32 GetCoordinate( const OUString& sValue ) return GetCoordinate( nRet ); } +/** converts 1/100mm to EMU */ +sal_Int32 GetPointFromCoordinate( sal_Int32 nValue ) +{ + return nValue * 360; +} + /** converts a ST_Percentage % string into 1/1000th of % */ sal_Int32 GetPercent( const OUString& sValue ) { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 468c89ad7b7e..4259feb2ae81 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2393,6 +2393,40 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS } } +void DrawingML::WriteParagraphTabStops(const Reference<XPropertySet>& rXPropSet) +{ + css::uno::Sequence<css::style::TabStop> aTabStops; + if (GetProperty(rXPropSet, "ParaTabStops")) + aTabStops = *o3tl::doAccess<css::uno::Sequence<css::style::TabStop>>(mAny); + + if (aTabStops.getLength() > 0) + mpFS->startElementNS(XML_a, XML_tabLst); + + for (const css::style::TabStop& rTabStop : std::as_const(aTabStops)) + { + OString sPosition = OString::number(GetPointFromCoordinate(rTabStop.Position)); + OString sAlignment; + switch (rTabStop.Alignment) + { + case css::style::TabAlign_DECIMAL: + sAlignment = "dec"; + break; + case css::style::TabAlign_RIGHT: + sAlignment = "r"; + break; + case css::style::TabAlign_CENTER: + sAlignment = "ctr"; + break; + case css::style::TabAlign_LEFT: + default: + sAlignment = "l"; + } + mpFS->singleElementNS(XML_a, XML_tab, XML_algn, sAlignment, XML_pos, sPosition); + } + if (aTabStops.getLength() > 0) + mpFS->endElementNS(XML_a, XML_tabLst); +} + bool DrawingML::IsGroupShape( const Reference< XShape >& rXShape ) { bool bRet = false; @@ -2593,6 +2627,7 @@ void DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara } WriteParagraphNumbering( rXPropSet, fFirstCharHeight, nLevel ); + WriteParagraphTabStops( rXPropSet ); mpFS->endElementNS( XML_a, XML_pPr ); } diff --git a/sd/qa/unit/data/pptx/tdf79082.pptx b/sd/qa/unit/data/pptx/tdf79082.pptx new file mode 100644 index 000000000000..8dcf4ff0a9e0 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf79082.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 6bac3cca9584..7a188b885d08 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -182,6 +182,7 @@ public: void testTdf127372(); void testTdf127379(); void testTdf98603(); + void testTdf79082(); void testTdf119087(); void testTdf131554(); void testTdf132282(); @@ -285,6 +286,7 @@ public: CPPUNIT_TEST(testTdf127372); CPPUNIT_TEST(testTdf127379); CPPUNIT_TEST(testTdf98603); + CPPUNIT_TEST(testTdf79082); CPPUNIT_TEST(testTdf119087); CPPUNIT_TEST(testTdf131554); CPPUNIT_TEST(testTdf132282); @@ -2639,6 +2641,61 @@ void SdOOXMLExportTest2::testTdf98603() CPPUNIT_ASSERT_EQUAL(OUString("IL"), aLocale.Country); } +void SdOOXMLExportTest2::testTdf79082() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf79082.pptx"), PPTX); + utl::TempFile tempFile; + xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile ); + + xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]", + "pos", + "360000"); + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]", + "algn", + "l"); + + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[2]", + "pos", + "756000"); + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[2]", + "algn", + "l"); + + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[3]", + "pos", + "1440000"); + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[3]", + "algn", + "ctr"); + + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[4]", + "pos", + "1800000"); + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[4]", + "algn", + "r"); + + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[5]", + "pos", + "3240000"); + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[5]", + "algn", + "dec"); + + xDocShRef->DoClose(); +} + void SdOOXMLExportTest2::testTdf119087() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf119087.pptx"), PPTX); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits