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

Rohit Deshmukh rohit.deshmukh at synerzip.com
Fri Apr 11 00:53:21 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo76597.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    9 +++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   14 ++++++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |   14 ++++++++++++--
 4 files changed, 35 insertions(+), 2 deletions(-)

New commits:
commit 05c5da4c376d676ff89cd40dd0dea9eeb4bc1e75
Author: Rohit Deshmukh <rohit.deshmukh at synerzip.com>
Date:   Fri Apr 4 17:47:21 2014 +0530

    fdo#76597: Fix preservation issue of Spacing between paragraph
    
    Change-Id: I458bed111893a8d2fef79b11e28263a5bd2ed9cf
    Reviewed-on: https://gerrit.libreoffice.org/8842
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo76597.docx b/sw/qa/extras/ooxmlexport/data/fdo76597.docx
new file mode 100644
index 0000000..a970136
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76597.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2d18453..2722075 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3068,6 +3068,15 @@ DECLARE_OOXMLEXPORT_TEST(test76734_2K7, "test76734_2K7.docx")
     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]", "Requires", "wps");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFDO76597, "fdo76597.docx")
+{
+    // check XML
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:spacing", "before", "96");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:spacing", "after", "120");
+}
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 04f5d37..d2e932e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6335,6 +6335,13 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
             AddToAttrList( m_pParagraphSpacingAttrList,
                     FSNS( XML_w, XML_beforeAutospacing ), "1" );
         }
+        else if (m_bParaBeforeAutoSpacing && m_nParaBeforeSpacing == -1)
+        {
+            AddToAttrList( m_pParagraphSpacingAttrList,
+                    FSNS( XML_w, XML_beforeAutospacing ), "0" );
+            AddToAttrList( m_pParagraphSpacingAttrList,
+                    FSNS( XML_w, XML_before ), OString::number( rULSpace.GetUpper() ).getStr() );
+        }
         else
         {
             AddToAttrList( m_pParagraphSpacingAttrList,
@@ -6348,6 +6355,13 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
             AddToAttrList( m_pParagraphSpacingAttrList,
                     FSNS( XML_w, XML_afterAutospacing ), "1" );
         }
+        else if (m_bParaAfterAutoSpacing && m_nParaAfterSpacing == -1)
+        {
+            AddToAttrList( m_pParagraphSpacingAttrList,
+                    FSNS( XML_w, XML_afterAutospacing ), "0" );
+            AddToAttrList( m_pParagraphSpacingAttrList,
+                                FSNS( XML_w, XML_after ), OString::number( rULSpace.GetLower()).getStr() );
+        }
         else
         {
             AddToAttrList( m_pParagraphSpacingAttrList,
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index f48e654..b9df3b3 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -559,9 +559,14 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
                 else
                     default_spacing = 280;
             }
-            m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
             if  (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag
             {
+                m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
+                m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
+            }
+            else
+            {
+                default_spacing = -1;
                 m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
             }
         }
@@ -577,9 +582,14 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
                 else
                     default_spacing = 280;
             }
-            m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
             if  (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag
             {
+                m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
+                m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
+            }
+            else
+            {
+                default_spacing = -1;
                 m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
             }
         }


More information about the Libreoffice-commits mailing list