[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Feb 21 11:41:16 UTC 2017
sw/qa/extras/rtfexport/data/fdo82006.rtf | 2 +-
sw/qa/extras/rtfexport/data/tdf104081.rtf | 4 ++++
sw/qa/extras/rtfexport/rtfexport.cxx | 7 +++++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 +-
writerfilter/source/dmapper/SettingsTable.cxx | 7 +++++--
writerfilter/source/dmapper/SettingsTable.hxx | 2 +-
writerfilter/source/rtftok/rtfdispatchflag.cxx | 3 +++
7 files changed, 22 insertions(+), 5 deletions(-)
New commits:
commit 291c9122b23ce7aa619e828b895b08dcd21bf025
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Feb 21 09:06:20 2017 +0100
tdf#104081 RTF import: handle \htmautsp
It's the opposite of OOXML's <w:doNotUseHTMLParagraphAutoSpacing/>, so
the default is different.
Also adapt the fdo82006 bugdoc where the original bugdoc contained this
flag, but the testcase did not.
Change-Id: I2fd757a8f95be9b1bee63570c9f587c17d3b22bc
Reviewed-on: https://gerrit.libreoffice.org/34507
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/qa/extras/rtfexport/data/fdo82006.rtf b/sw/qa/extras/rtfexport/data/fdo82006.rtf
index 0f5ee43..e108d4c 100644
--- a/sw/qa/extras/rtfexport/data/fdo82006.rtf
+++ b/sw/qa/extras/rtfexport/data/fdo82006.rtf
@@ -1,4 +1,4 @@
-{\rtf1
+{\rtf1\htmautsp
\pard\plain
\ql \sb100\sa100\sbauto1\saauto1 hello\par
}
diff --git a/sw/qa/extras/rtfexport/data/tdf104081.rtf b/sw/qa/extras/rtfexport/data/tdf104081.rtf
new file mode 100644
index 0000000..0f5ee43
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf104081.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+\pard\plain
+\ql \sb100\sa100\sbauto1\saauto1 hello\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index bffb2b1..ff413cf 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -892,6 +892,13 @@ DECLARE_RTFEXPORT_TEST(testFdo82006, "fdo82006.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
}
+DECLARE_RTFEXPORT_TEST(testTdf104081, "tdf104081.rtf")
+{
+ // These were 494 (280 twips), as \htmautsp was ignored.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
+}
+
DECLARE_RTFEXPORT_TEST(testTdf88583, "tdf88583.odt")
{
// This was FillStyle_NONE, as background color was missing from the color table during export.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index bfa2a5b..820c3f8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -601,7 +601,7 @@ public:
SettingsTablePtr const & GetSettingsTable()
{
if( !m_pSettingsTable )
- m_pSettingsTable.reset( new SettingsTable );
+ m_pSettingsTable.reset(new SettingsTable(m_rDMapper));
return m_pSettingsTable;
}
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index 8d7bace..9a52c41 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -30,6 +30,7 @@
#include <comphelper/sequence.hxx>
#include <ooxml/resourceids.hxx>
#include <ConversionHelper.hxx>
+#include <DomainMapper.hxx>
#include "util.hxx"
using namespace com::sun::star;
@@ -99,12 +100,14 @@ struct SettingsTable_Impl
};
-SettingsTable::SettingsTable()
+SettingsTable::SettingsTable(const DomainMapper& rDomainMapper)
: LoggedProperties("SettingsTable")
, LoggedTable("SettingsTable")
, m_pImpl( new SettingsTable_Impl )
{
-
+ // HTML paragraph auto-spacing is opt-in for RTF, opt-out for OOXML.
+ if (rDomainMapper.IsRTFImport())
+ m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing = true;
}
SettingsTable::~SettingsTable()
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx
index 6ef0a30..75c0d76 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -45,7 +45,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
std::unique_ptr<SettingsTable_Impl> m_pImpl;
public:
- SettingsTable();
+ SettingsTable(const DomainMapper& rDomainMapper);
virtual ~SettingsTable() override;
//returns default TabStop in 1/100th mm
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 98b212b..3491499 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -1069,6 +1069,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue);
}
break;
+ case RTF_HTMAUTSP:
+ m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing, std::make_shared<RTFValue>(0));
+ break;
default:
{
SAL_INFO("writerfilter", "TODO handle flag '" << keywordToString(nKeyword) << "'");
More information about the Libreoffice-commits
mailing list