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

Justin Luth justin_luth at sil.org
Sat Nov 4 04:42:06 UTC 2017


 sw/qa/extras/ooxmlexport/data/tdf46938_clearTabStop.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx               |    6 ++++
 sw/source/filter/ww8/docxattributeoutput.cxx             |   20 +++++++++++++++
 3 files changed, 26 insertions(+)

New commits:
commit b41d698fa121f3a4d1afdde56f88a135fc71b48a
Author: Justin Luth <justin_luth at sil.org>
Date:   Thu Nov 2 11:16:13 2017 +0300

    tdf#46938 ooxmlexport: override style tabstops when tabs removed
    
    Having no tabs defined is the default value, so nothing generally
    needs to be written. But if the paragraph style defines tabstops,
    but the current paragraph doesn't have any, then those style
    tabstops need to be cleared.
    
    Change-Id: I7a818c658403cc683b0c5b7452b6c88ea00f771d
    Reviewed-on: https://gerrit.libreoffice.org/44244
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf46938_clearTabStop.docx b/sw/qa/extras/ooxmlexport/data/tdf46938_clearTabStop.docx
new file mode 100644
index 000000000000..8dea12fcb5c8
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf46938_clearTabStop.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 1375a2edef89..e3d18b3fb7e9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -46,6 +46,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92524_autoColor, "tdf92524_autoColor.doc")
     CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<sal_uInt32>(getParagraph(1), "ParaBackColor"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf46938_clearTabStop, "tdf46938_clearTabStop.docx")
+{
+    // Number of tabstops should be zero, overriding the one in the style
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty< uno::Sequence<style::TabStop> >(getParagraph(1), "ParaTabStops").getLength());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf82065_Ind_start_strict, "tdf82065_Ind_start_strict.docx")
 {
     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 146b7b9e3a5f..57e182dc34ac 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7610,7 +7610,27 @@ void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop )
 
     // <w:tabs> must contain at least one <w:tab>, so don't write it empty
     if( nCount == 0 )
+    {
+        // clear style tabs - otherwise style will override...
+        if( GetExport().m_pStyAttr )
+        {
+            const SvxTabStopItem* pStyleTabs = GetExport().m_pStyAttr->GetItem<SvxTabStopItem>(RES_PARATR_TABSTOP);
+            if( pStyleTabs && pStyleTabs->Count() )
+            {
+                m_pSerializer->startElementNS( XML_w, XML_tabs, FSEND );
+                for( int i = 0; i < pStyleTabs->Count(); ++i )
+                {
+                    m_pSerializer->singleElementNS( XML_w, XML_tab,
+                        FSNS( XML_w, XML_val ), OString("clear"),
+                        FSNS( XML_w, XML_pos ), OString::number(pStyleTabs->At(i).GetTabPos()),
+                        FSEND );
+                }
+                m_pSerializer->endElementNS( XML_w, XML_tabs );
+            }
+        }
+
         return;
+    }
     if( nCount == 1 && rTabStop[ 0 ].GetAdjustment() == SvxTabAdjust::Default )
     {
         GetExport().setDefaultTabStop( rTabStop[ 0 ].GetTabPos());


More information about the Libreoffice-commits mailing list