[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Nov 28 13:20:04 UTC 2017
sw/qa/extras/rtfexport/data/tdf104035.rtf | 14 ++++++++++++++
sw/qa/extras/rtfexport/rtfexport3.cxx | 8 ++++++++
sw/source/filter/ww8/docxsdrexport.cxx | 2 +-
sw/source/filter/ww8/rtfattributeoutput.cxx | 9 +++++++--
4 files changed, 30 insertions(+), 3 deletions(-)
New commits:
commit b5e871deb8ce390b9fa694e21b0272c7462da703
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Nov 28 09:08:12 2017 +0100
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.
Change-Id: Iafe8f6bb8733cae38a89f6c407763b0327e894e8
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/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 260cf7f78f8c..d50f7fefa067 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -921,7 +921,7 @@ bool DocxSdrExport::Impl::isSupportedDMLShape(const uno::Reference<drawing::XSha
{
uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
if (xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonShape")
- || xServiceInfo->supportsService("com.sun.star.drawing.PolyLineShape"))
+ || xServiceInfo->supportsService("com.sun.star.drawing.PolyLineShape"))
return false;
// For signature line shapes, we don't want DML, just the VML shape.
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];
More information about the Libreoffice-commits
mailing list