[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - oox/source sw/qa

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 6 22:42:35 UTC 2020


 oox/source/export/vmlexport.cxx            |   17 ++++++++++++++++-
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx |    4 ++++
 2 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit ad4f819be0502bdf30ab4644a91f53ff224d16f8
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Aug 6 14:11:38 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Aug 7 00:42:03 2020 +0200

    oox: VML export: for rotated text shape, produce bottom-to-top
    
    This is for shapes that fail the lcl_isTextBox() check in
    VMLExport::StartShape(), they can be rotated too but with a different
    property than the "TextPreRotateAngle" that is used in
    VMLExport::EndShape().
    
    Change-Id: I530aae8b7138f47bae8434e205632f5f4adbb231
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100249
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 090c61eb93db4302d4565d5f11f7673190835fdb)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100259
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index dc0fe18cd437..950b0afd240d 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1369,8 +1369,23 @@ sal_Int32 VMLExport::StartShape()
 
         if( pParaObj )
         {
+            uno::Reference<beans::XPropertySet> xPropertySet(const_cast<SdrObject*>(m_pSdrObject)->getUnoShape(), uno::UNO_QUERY);
+            sax_fastparser::FastAttributeList* pTextboxAttrList = FastSerializerHelper::createAttrList();
+            sax_fastparser::XFastAttributeListRef xTextboxAttrList(pTextboxAttrList);
+            if (xPropertySet->getPropertySetInfo()->hasPropertyByName("RotateAngle"))
+            {
+                sal_Int32 nTextRotateAngle = sal_Int32();
+                if (xPropertySet->getPropertyValue("RotateAngle") >>= nTextRotateAngle)
+                {
+                    if (nTextRotateAngle == 9000)
+                    {
+                        pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top");
+                    }
+                }
+            }
+
             // this is reached only in case some text is attached to the shape
-            m_pSerializer->startElementNS(XML_v, XML_textbox);
+            m_pSerializer->startElementNS(XML_v, XML_textbox, xTextboxAttrList);
             m_pTextExport->WriteOutliner(*pParaObj);
             m_pSerializer->endElementNS(XML_v, XML_textbox);
             if( bOwnParaObj )
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 08136531b9df..ad019ecd0504 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -79,6 +79,10 @@ DECLARE_OOXMLEXPORT_TEST(testAtPageShapeRelOrientation, "rotated_shape.fodt")
         "/wp:positionV/wp:posOffset", "1080135");
     assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor"
         "/wp:positionV", "relativeFrom", "page");
+
+    // now test text rotation -> VML writing direction
+    assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape/v:textbox", "style", "mso-layout-flow-alt:bottom-to-top");
+
 }
 
 DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter,


More information about the Libreoffice-commits mailing list