sw/qa/extras/rtfimport/data/tdf96308-deftab.rtf | 8 ++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 8 ++++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 10 +++++++++- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-)
New commits: commit 1f1ddaad5dd401b70ae69fb18f7873d652242154 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Jan 8 09:08:57 2016 +0100 Related: tdf#96308 RTF import: fix RTF_DEFTAB handling Change-Id: Ia2655bf5748ea62155613a222d0cb17b678196c5 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 0000000..49ad344 --- /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 dc47a95..b1f7706 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 2c32453..19c0cbe 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 d0671a1..7ef2b4f 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits