[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa sw/source
Vasily Melenchuk (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 1 07:58:21 UTC 2020
sw/qa/extras/ooxmlexport/data/tdf134063.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 12 ++++++++++++
sw/source/core/text/txttab.cxx | 15 ++++++---------
3 files changed, 18 insertions(+), 9 deletions(-)
New commits:
commit 28962153ca3826ca2aba626f8cc8ff9c6dab9eab
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Wed Jun 17 13:42:37 2020 +0300
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Jul 1 09:57:45 2020 +0200
tdf#134063: sw: redesigned support for tab at zero position
Initial support for tab position at zero (d2e428d1) was not
taking into account hack for tab positions below zero. So
previous behavior is restored (search is started from 0) but
we also taking into account potential tabs at zero position
in SwLineInfo::GetTabStop()
Change-Id: I8b315ab69f9a53ac15002a41a81e069ff832f692
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96526
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
(cherry picked from commit 02c0e015f84ddcc6fa94433f603ef89f358a0391)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96582
Reviewed-by: Vasily Melenchuk <vasily.melenchuk at cib.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97478
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf134063.docx b/sw/qa/extras/ooxmlexport/data/tdf134063.docx
new file mode 100644
index 000000000000..372fed20e57f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf134063.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 3cd34365a2f2..abb55384f68f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -393,6 +393,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak3, "tdf123636_newlinePage
assertXPath(pDump, "/root/page[1]/body/txt[3]/Text[1]", "Portion", "Last line on page 1");
}
+DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx")
+{
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+ xmlDocPtr pDump = parseLayoutDump();
+
+ // There are three tabs with default width
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, "//page[1]/body/txt[1]/Text[1]", "nWidth").toInt32());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, "//page[1]/body/txt[1]/Text[2]", "nWidth").toInt32());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, "//page[1]/body/txt[1]/Text[3]", "nWidth").toInt32());
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak4, "tdf123636_newlinePageBreak4.docx")
{
//MS Compatibility flag: SplitPgBreakAndParaMark
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 37b00c532bae..63c253b0d0d7 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -51,6 +51,11 @@ const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nSearchPos, const SwTwip
if( rTabStop.GetTabPos() > SwTwips(nRight) )
return i ? nullptr : &rTabStop;
+ // If we are starting search from zero position,
+ // than we should include tabstop at zero position
+ if ((nSearchPos == 0) && (rTabStop.GetTabPos() == 0))
+ return &rTabStop;
+
if( rTabStop.GetTabPos() > nSearchPos )
return &rTabStop;
}
@@ -122,7 +127,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
// #i24363# tab stops relative to indent
// nSearchPos: The current position relative to the tabs origin
- SwTwips nSearchPos = bRTL ?
+ const SwTwips nSearchPos = bRTL ?
nTabLeft - nCurrentAbsPos :
nCurrentAbsPos - nTabLeft;
@@ -130,14 +135,6 @@ 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 )
{
More information about the Libreoffice-commits
mailing list