summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2020-05-29 14:25:04 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-06-05 01:11:11 +0200
commitd2e428d1abb9f2907c0b87d55830e8742f8209b9 (patch)
tree212a329c70a0e1377f7a5b1d15b510a96ecdc463 /sw
parentc148ba2b18d42733587fbf169a08f9469daed8fe (diff)
tdf#83309: docx import: allow for lists tabstop at zero position
Zero position is valid value for tabstop, but previously it was treated as "no tab stop defined". Right now writer distinguishes tab stop at zero postion and no tab stop. Change-Id: Ie32da3d36a263644ba85a882029a8b29ae0501c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95132 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf83309.docxbin0 -> 12795 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx14
-rw-r--r--sw/source/core/text/txttab.cxx10
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx2
5 files changed, 25 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf83309.docx b/sw/qa/extras/ooxmlexport/data/tdf83309.docx
new file mode 100644
index 000000000000..8dfddb6ed201
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf83309.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index b95d0afe4e8f..43cdd62d5b20 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -578,6 +578,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf125038c, "tdf125038c.docx")
CPPUNIT_ASSERT_EQUAL(OUString("email: test@test.test"), aActual);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf83309, "tdf83309.docx")
+{
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+ OUString sNodeType;
+
+ // First paragraph does not have tab before
+ sNodeType = parseDump("/root/page/body/txt[1]/Text[1]", "nType");
+ CPPUNIT_ASSERT_EQUAL(OUString("PortionType::Text"), sNodeType);
+
+ // Second paragraph starts with tab
+ sNodeType = parseDump("/root/page/body/txt[2]/Text[1]", "nType");
+ CPPUNIT_ASSERT_EQUAL(OUString("PortionType::TabLeft"), sNodeType);
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf121661, "tdf121661.docx")
{
xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index a38cbe048d44..616a919eb2e0 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -119,7 +119,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
// #i24363# tab stops relative to indent
// nSearchPos: The current position relative to the tabs origin
- const SwTwips nSearchPos = bRTL ?
+ SwTwips nSearchPos = bRTL ?
nTabLeft - nCurrentAbsPos :
nCurrentAbsPos - nTabLeft;
@@ -127,6 +127,14 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
// any hard set tab stops:
// Note: If there are no user defined tab stops, there is always a
// default tab stop.
+
+ // If search is started from zero position (beginning of line), than
+ // lets do it from -1: this will allow to include into account potential
+ // tab stop at zero position. Yes, it will be zero width tab useless
+ // mostly, but this have sense in case of lists.
+ if (nSearchPos == 0)
+ nSearchPos = -1;
+
const SvxTabStop* pTabStop = m_aLineInf.GetTabStop( nSearchPos, nMyRight );
if ( pTabStop )
{
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b06cd1461d5a..937906cad902 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6995,7 +6995,7 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel,
// indentation
m_pSerializer->startElementNS(XML_w, XML_pPr);
- if( nListTabPos != 0 )
+ if( nListTabPos >= 0 )
{
m_pSerializer->startElementNS(XML_w, XML_tabs);
m_pSerializer->singleElementNS( XML_w, XML_tab,
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 1774c37239e7..df51bb99be36 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -583,7 +583,7 @@ void MSWordExportBase::NumberingLevel(
sal_Int16 nIndentAt = 0;
sal_Int16 nFirstLineIndex = 0;
- sal_Int16 nListTabPos = 0;
+ sal_Int16 nListTabPos = -1;
// #i86652#
if (rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)