summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx25
-rw-r--r--sw/qa/extras/ww8export/data/tdf59674_numberingTabStop.odtbin0 -> 14840 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx12
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx14
4 files changed, 32 insertions, 19 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 3e919588d498..47fa3b72a8db 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -273,28 +273,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134260, "tdf134260.docx")
// - Expected: 0
// - Actual : 1270
- auto xNum1Levels
- = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules");
-
- CPPUNIT_ASSERT_EQUAL(
- sal_Int32(0),
- comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["ListtabStopPosition"]
- .get<sal_Int32>());
-
- auto xNum2Levels
- = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(2), "NumberingRules");
+ auto xNumLevels
+ = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(3), "NumberingRules");
+ sal_Int32 nTabPosExpected = mbExported ? 1270 : 0;
CPPUNIT_ASSERT_EQUAL(
- sal_Int32(0),
- comphelper::SequenceAsHashMap(xNum2Levels->getByIndex(0))["ListtabStopPosition"]
+ nTabPosExpected,
+ comphelper::SequenceAsHashMap(xNumLevels->getByIndex(0))["ListtabStopPosition"]
.get<sal_Int32>());
- auto xNum3Levels
- = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(3), "NumberingRules");
-
+ nTabPosExpected = mbExported ? 2598 : 0;
CPPUNIT_ASSERT_EQUAL(
- sal_Int32(0),
- comphelper::SequenceAsHashMap(xNum3Levels->getByIndex(0))["ListtabStopPosition"]
+ nTabPosExpected,
+ comphelper::SequenceAsHashMap(xNumLevels->getByIndex(1))["ListtabStopPosition"]
.get<sal_Int32>());
}
diff --git a/sw/qa/extras/ww8export/data/tdf59674_numberingTabStop.odt b/sw/qa/extras/ww8export/data/tdf59674_numberingTabStop.odt
new file mode 100644
index 000000000000..5edcbaebcf93
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf59674_numberingTabStop.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 460937c08895..512cce9ca4bc 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -136,6 +136,18 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote)
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
}
+DECLARE_WW8EXPORT_TEST(testTdf59674_numberingTabStop, "tdf59674_numberingTabStop.odt")
+{
+ // This bug is mainly for MS Word. The round-trip looked fine in LO. Test exporting a non-useless value.
+ auto xNum1Levels = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(2), "NumberingRules");
+ sal_Int32 nTabPos2 = comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["ListtabStopPosition"].get<sal_Int32>();
+ xNum1Levels.set(getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(3), "NumberingRules"));
+ sal_Int32 nTabPos3 = comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["ListtabStopPosition"].get<sal_Int32>();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1281), nTabPos2);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5001), nTabPos3); //previously 640
+}
+
DECLARE_WW8EXPORT_TEST(testdf79553_lineNumbers, "tdf79553_lineNumbers.doc")
{
bool bValue = false;
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 3efd99cdcb92..da7182a941dd 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -595,8 +595,18 @@ void MSWordExportBase::NumberingLevel(
{
nIndentAt = static_cast<sal_Int16>(rFormat.GetIndentAt());
nFirstLineIndex = static_cast<sal_Int16>(rFormat.GetFirstLineIndent());
- nListTabPos = rFormat.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB?
- static_cast<sal_Int16>( rFormat.GetListtabPos() ) : 0;
+ nListTabPos = 0;
+ if ( rFormat.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
+ {
+ nListTabPos = static_cast<sal_Int16>( rFormat.GetListtabPos() );
+
+ // Writer usually treats nIndentAt as a tabstop, but Word doesn't (at least for .doc and .rtf).
+ // NOTE: There will still be problems if the tabstop is only SLIGHTLY larger than the align-at position,
+ // i.e. if the tab position is not behind the numbering character. Oh well. Better design your document better.
+ const sal_Int32 nStart = nIndentAt + nFirstLineIndex; // nFirstLineIndex is a negative offset
+ if ( nListTabPos <= nStart )
+ nListTabPos = nIndentAt;
+ }
}
AttrOutput().NumberingLevel( nLvl,