[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 20 06:29:38 PST 2013


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    3 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   14 ++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 377ec698afc98a9a098b456f4ae3c694498df6a2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 20 15:24:30 2013 +0100

    CppunitTest_sw_ooxmlexport: register wps, wp and a namespaces
    
    This are all required to be able to assert the drawingML equivalent of
    VML XPath expressions.
    
    Change-Id: I79460d6ae7448120f8b9c27acdba52d33ff52a5a

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index bd099be..fce4547 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -135,6 +135,9 @@ xmlNodeSetPtr Test::getXPathNode(xmlDocPtr pXmlDoc, const OString& rXPath)
     xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w"), BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main"));
     xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("v"), BAD_CAST("urn:schemas-microsoft-com:vml"));
     xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("mc"), BAD_CAST("http://schemas.openxmlformats.org/markup-compatibility/2006"));
+    xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wps"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingShape"));
+    xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wp"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"));
+    xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main"));
     xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(rXPath.getStr()), pXmlXpathCtx);
     return pXmlXpathObj->nodesetval;
 }
commit b810e510f15b95ea64c52ae1eec2212280aef678
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 20 15:02:51 2013 +0100

    sw: drawingml export of text frame btLr text direction
    
    CppunitTest_sw_ooxmlexport's testFdo69636 is a reproducer for this problem.
    
    Change-Id: Ibfd2f9388c22436d5677380a22184a2970b8e7be

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index f16d047..c8aa7a0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -311,8 +311,11 @@ public:
 };
 
 // Undo the text direction mangling done by the frame btLr handler in writerfilter::dmapper::DomainMapper::lcl_startCharacterGroup()
-bool lcl_checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttributeList* pTextboxAttrList)
+bool lcl_checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttributeList* pTextboxAttrList = 0, sax_fastparser::FastAttributeList* pBodyPrAttrList = 0)
 {
+    // The intended usage is to pass either a valid VML or DML attribute list.
+    assert(pTextboxAttrList || pBodyPrAttrList);
+
     if (!pStartNode->IsTxtNode())
         return false;
 
@@ -345,7 +348,10 @@ bool lcl_checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttributeList* p
         const SvxCharRotateItem& rCharRotate = static_cast<const SvxCharRotateItem&>(*pItem);
         if (rCharRotate.GetValue() == 900)
         {
-            pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top");
+            if (pTextboxAttrList)
+                pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top");
+            else
+                pBodyPrAttrList->add(XML_vert, "vert270");
             return true;
         }
     }
@@ -471,7 +477,11 @@ void DocxAttributeOutput::WriteDMLTextFrame(sw::Frame* pParentFrame)
     m_rExport.mpParentFrame = NULL;
     m_pSerializer->startElementNS( XML_wps, XML_txbx, FSEND );
     m_pSerializer->startElementNS( XML_w, XML_txbxContent, FSEND );
+
+    m_bFrameBtLr = lcl_checkFrameBtlr(m_rExport.pDoc->GetNodes()[nStt], 0, m_pBodyPrAttrList);
     m_rExport.WriteText( );
+    m_bFrameBtLr = false;
+
     m_pSerializer->endElementNS( XML_w, XML_txbxContent );
     m_pSerializer->endElementNS( XML_wps, XML_txbx );
     XFastAttributeListRef xBodyPrAttrList(m_pBodyPrAttrList);


More information about the Libreoffice-commits mailing list