summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-11-28 09:08:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-11-28 21:52:43 +0100
commit822e9af8ec8018fed098c16a50136fb9f0fa5b0e (patch)
tree806ee3ade42b0a12b91fd41e413330449d3ef832
parent2867c32c99b85e42b018266988dc8f7796c1fc77 (diff)
tdf#104035 RTF export: fix handling of absolute tab positions
RtfAttributeOutput::ParaTabStop() assumed that they are always absolute, but WW8AttributeOutput::ParaTabStop() points out what compat setting decides if they are absolute or relative. (cherry picked from commit b5e871deb8ce390b9fa694e21b0272c7462da703) Change-Id: Iafe8f6bb8733cae38a89f6c407763b0327e894e8 Reviewed-on: https://gerrit.libreoffice.org/45412 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/qa/extras/rtfexport/data/tdf104035.rtf14
-rw-r--r--sw/qa/extras/rtfexport/rtfexport3.cxx8
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx9
3 files changed, 29 insertions, 2 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf104035.rtf b/sw/qa/extras/rtfexport/data/tdf104035.rtf
new file mode 100644
index 000000000000..730238eb0c63
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf104035.rtf
@@ -0,0 +1,14 @@
+{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033
+{\fonttbl
+{\f5\fswiss\fcharset0\fprq2 Helvetica;}
+}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+\margl1440\margr1440
+\facingp\widowctrl\ftnbj\aenddoc\lytprtmet\hyphcaps0\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0\sectd \psz1\sbkodd\pgnrestart\linex0\headery1440\footery1080\endnhere\titlepg\sectdefaultcl
+\pard\plain \fi-2880\li2880\widctlpar\tx450\tx2880\tx3427\tx3787\tx4147\adjustright
+{\b\f5 1.0\tab FACILITY}
+{\f0\fs26 \tab Navy Golf operation physical/service environment is clean, safe and friendly for employees and customers, and creates a
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 9c174450c95f..0c63f23972e0 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -60,6 +60,14 @@ DECLARE_RTFEXPORT_TEST(testTdf108949_footnote, "tdf108949_footnote.rtf")
getProperty<sal_Int32>(xFootnote->getAnchor(), "CharColor"));
}
+DECLARE_RTFEXPORT_TEST(testTdf104035, "tdf104035.rtf")
+{
+ auto aTabStops = getProperty<uno::Sequence<style::TabStop>>(getParagraph(1), "ParaTabStops");
+ CPPUNIT_ASSERT(aTabStops.hasElements());
+ // This was 3330 twips instead, as tabs were assumed to be relative.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(450)), aTabStops[0].Position);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 8b5ba978104d..6c8bb3390979 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -78,6 +78,7 @@
#include <lineinfo.hxx>
#include <rtf.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentSettingAccess.hxx>
#include <vcl/cvtgrf.hxx>
#include <oox/mathml/export.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>
@@ -2838,8 +2839,12 @@ void RtfAttributeOutput::ParaWidows(const SvxWidowsItem& rWidows)
void RtfAttributeOutput::ParaTabStop(const SvxTabStopItem& rTabStop)
{
- long nOffset
- = static_cast<const SvxLRSpaceItem&>(m_rExport.GetItem(RES_LR_SPACE)).GetTextLeft();
+ long nOffset = 0;
+ // Tabs are absolute by default.
+ if (m_rExport.m_pDoc->getIDocumentSettingAccess().get(
+ DocumentSettingId::TABS_RELATIVE_TO_INDENT))
+ nOffset = static_cast<const SvxLRSpaceItem&>(m_rExport.GetItem(RES_LR_SPACE)).GetTextLeft();
+
for (sal_uInt16 n = 0; n < rTabStop.Count(); n++)
{
const SvxTabStop& rTS = rTabStop[n];