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

Miklos Vajna vmiklos at collabora.co.uk
Tue Feb 18 16:04:18 CET 2014


 oox/source/drawingml/textparagraphpropertiescontext.cxx       |   15 ++++++++++
 sw/qa/extras/ooxmlexport/data/dml-groupshape-paraspacing.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                      |   12 ++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx                  |    6 ++--
 4 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 9e6960c74dee374e2c9d1af25cb2b678366b19b4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Feb 18 14:29:11 2014 +0100

    DOCX drawingML export: fix paragraph margins
    
    Without the EndParagraphProperties() call, w:spacing wasn't ever
    written as a paragraph property.
    
    Change-Id: Iff4ca2a9e0725ac38d7b528c220c8ea58fc89cab

diff --git a/sw/qa/extras/ooxmlexport/data/dml-groupshape-paraspacing.docx b/sw/qa/extras/ooxmlexport/data/dml-groupshape-paraspacing.docx
new file mode 100755
index 0000000..1cb48d3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/dml-groupshape-paraspacing.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a7ea175..60e0f4f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2317,6 +2317,18 @@ DECLARE_OOXMLEXPORT_TEST(testDmlGroupshapeRelsize, "dml-groupshape-relsize.docx"
     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "page");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testDmlGroupshapeParaspacing, "dml-groupshape-paraspacing.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    // Paragraph spacing of shape text in groupshapes was left, the w:spacing element was missing in pPr.
+    assertXPath(pXmlDoc,
+                "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:pPr/w:spacing",
+                "before",
+                "240");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index f376d52..d30840f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3466,11 +3466,13 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
         sal_Int32 nAktPos = 0;
         sal_Int32 nEnd = aStr.getLength();
 
-        m_pSerializer->startElementNS( XML_w, XML_p, FSEND );
+        StartParagraph(ww8::WW8TableNodeInfo::Pointer_t());
 
         // Write paragraph properties.
         m_pSerializer->startElementNS(XML_w, XML_pPr, FSEND);
+        StartParagraphProperties();
         aAttrIter.OutParaAttr(false);
+        EndParagraphProperties(0, 0, 0, 0);
         m_pSerializer->endElementNS(XML_w, XML_pPr);
 
         do {
@@ -3497,7 +3499,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
             aAttrIter.NextPos();
         }
         while( nAktPos < nEnd );
-        m_pSerializer->endElementNS( XML_w, XML_p );
+        EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t());
     }
     m_pSerializer->endElementNS( XML_w, XML_txbxContent );
 }
commit 3c058338fbd28fba3664651b9ecc7cfefa046ec3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Feb 18 13:41:42 2014 +0100

    DOCX drawingML import: handle paragraph top margin
    
    Change-Id: I4a69647af5b068c35bea0a5f9665a5e68eb76293

diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx
index aca1d78..36860f0 100644
--- a/oox/source/drawingml/textparagraphpropertiescontext.cxx
+++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx
@@ -23,6 +23,8 @@
 #include <com/sun/star/awt/FontDescriptor.hpp>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
 
+#include <svx/unopage.hxx>
+
 #include "oox/drawingml/colorchoicecontext.hxx"
 #include "oox/drawingml/textcharacterpropertiescontext.hxx"
 #include "oox/drawingml/fillproperties.hxx"
@@ -259,6 +261,19 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
                 }
             }
             break;
+        case OOX_TOKEN( doc, spacing ):
+            {
+                OptValue<OUString> oBefore = rAttribs.getString(OOX_TOKEN(doc, before));
+                if (oBefore.has())
+                {
+                    TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin();
+                    rSpacing.nValue = TWIPS_TO_MM(oBefore.get().toInt32());
+                    rSpacing.bHasValue = true;
+                }
+            }
+            break;
+        default:
+            SAL_WARN("oox", "TextParagraphPropertiesContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
     }
     return this;
 }


More information about the Libreoffice-commits mailing list