summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-01-08 09:08:57 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-08 09:09:19 +0100
commit1f1ddaad5dd401b70ae69fb18f7873d652242154 (patch)
treee6d1d49f62276bbb08586d8c79bca2ea5a5b11bb
parent8085555f6de5905028fdc0761c9e5b2fd4a3609a (diff)
Related: tdf#96308 RTF import: fix RTF_DEFTAB handling
Change-Id: Ia2655bf5748ea62155613a222d0cb17b678196c5
-rw-r--r--sw/qa/extras/rtfimport/data/tdf96308-deftab.rtf8
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx8
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx10
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx2
4 files changed, 27 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf96308-deftab.rtf b/sw/qa/extras/rtfimport/data/tdf96308-deftab.rtf
new file mode 100644
index 000000000000..49ad344fcb0b
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf96308-deftab.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+{\stylesheet
+{
+\s23\pvpg Slogan;}
+}
+\deftab284
+hello\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index dc47a95a2a91..b1f77063a1f3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2383,6 +2383,14 @@ DECLARE_RTFIMPORT_TEST(testTdf54584, "tdf54584.rtf")
xFields->nextElement());
}
+DECLARE_RTFIMPORT_TEST(testTdf96308Deftab, "tdf96308-deftab.rtf")
+{
+ uno::Reference<lang::XMultiServiceFactory> xTextFactory(mxComponent, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xDefaults(xTextFactory->createInstance("com.sun.star.text.Defaults"), uno::UNO_QUERY);
+ // This was 1270 as \deftab was ignored on import.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(284)), getProperty<sal_Int32>(xDefaults, "TabStopDistance"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2c32453cc093..19c0cbefd225 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -704,6 +704,14 @@ oox::GraphicHelper& RTFDocumentImpl::getGraphicHelper()
return *m_pGraphicHelper;
}
+bool RTFDocumentImpl::isStyleSheetImport()
+{
+ if (m_aStates.empty())
+ return false;
+ Destination eDestination = m_aStates.top().eDestination;
+ return eDestination == Destination::STYLESHEET || eDestination == Destination::STYLEENTRY;
+}
+
void RTFDocumentImpl::resolve(Stream& rMapper)
{
m_pMapperStream = &rMapper;
@@ -6328,7 +6336,7 @@ RTFFrame::RTFFrame(RTFParserState* pParserState)
void RTFFrame::setSprm(Id nId, Id nValue)
{
- if (m_pParserState->m_pDocumentImpl->getFirstRun())
+ if (m_pParserState->m_pDocumentImpl->getFirstRun() && !m_pParserState->m_pDocumentImpl->isStyleSheetImport())
{
m_pParserState->m_pDocumentImpl->checkFirstRun();
m_pParserState->m_pDocumentImpl->setNeedPar(false);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index d0671a1b5bb4..7ef2b4fdce70 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -395,6 +395,8 @@ public:
/// Get the default parser state.
RTFParserState& getDefaultState();
oox::GraphicHelper& getGraphicHelper();
+ /// Are we inside the stylesheet table?
+ bool isStyleSheetImport();
private:
SvStream& Strm();