diff options
-rw-r--r-- | oox/source/drawingml/table/tablecell.cxx | 37 | ||||
-rw-r--r-- | sd/qa/unit/layout-tests.cxx | 14 |
2 files changed, 33 insertions, 18 deletions
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index b0849b7002f3..9d16bce09d17 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -569,7 +569,24 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons { xPropSet->setPropertyValue("TextWritingMode", Any(css::text::WritingMode_TB_RL)); } - else if ( getVertToken() == XML_vert ) + + 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))); } @@ -577,7 +594,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons { xPropSet->setPropertyValue("RotateAngle", Any(short(9000))); } - else if ( getVertToken() != XML_horz ) + else if ( getVertToken() != XML_horz && getVertToken() != XML_eaVert ) { // put the vert value in the grab bag for roundtrip const Sequence<sal_Int8>& aTokenNameSeq = StaticTokenMap().getUtf8TokenName(getVertToken()); @@ -599,22 +616,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons } xPropSet->setPropertyValue("CellInteropGrabBag", Any(aGrabBag)); } - - 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); - } - } } } diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx index e401f2d0822b..5e9d0e26537b 100644 --- a/sd/qa/unit/layout-tests.cxx +++ b/sd/qa/unit/layout-tests.cxx @@ -340,6 +340,20 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf148966) } } +CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTableVerticalText) +{ + xmlDocUniquePtr pXmlDoc = load("pptx/tcPr-vert-roundtrip.pptx"); + + // Without the accompanying fix, would fail with: + // - Expected: -900 + // - Actual : 0 + // - In <>, attribute 'orientation' of '//font[1]' incorrect value. + // i.e. table cell text that was supposed to be vertical (rotated 90 + // degrees) was not vertical. + assertXPath(pXmlDoc, "//font[1]", "orientation", "-900"); + assertXPath(pXmlDoc, "//font[2]", "orientation", "900"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |