diff options
author | Justin Luth <justin_luth@sil.org> | 2017-11-02 11:16:13 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2017-11-04 05:41:37 +0100 |
commit | b41d698fa121f3a4d1afdde56f88a135fc71b48a (patch) | |
tree | a2a0115fe2a91933d3ec851c8c9105a806d452ee /sw | |
parent | bcdc5f56f064e875f58a2f22872393d1fef31839 (diff) |
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@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf46938_clearTabStop.docx | bin | 0 -> 10264 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 20 |
3 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf46938_clearTabStop.docx b/sw/qa/extras/ooxmlexport/data/tdf46938_clearTabStop.docx Binary files differnew file mode 100644 index 000000000000..8dea12fcb5c8 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf46938_clearTabStop.docx 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()); |