Kaydet (Commit) 1f1ddaad authored tarafından Miklos Vajna's avatar Miklos Vajna

Related: tdf#96308 RTF import: fix RTF_DEFTAB handling

Change-Id: Ia2655bf5748ea62155613a222d0cb17b678196c5
üst 8085555f
{\rtf1
{\stylesheet
{
\s23\pvpg Slogan;}
}
\deftab284
hello\par
}
...@@ -2383,6 +2383,14 @@ DECLARE_RTFIMPORT_TEST(testTdf54584, "tdf54584.rtf") ...@@ -2383,6 +2383,14 @@ DECLARE_RTFIMPORT_TEST(testTdf54584, "tdf54584.rtf")
xFields->nextElement()); 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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -704,6 +704,14 @@ oox::GraphicHelper& RTFDocumentImpl::getGraphicHelper() ...@@ -704,6 +704,14 @@ oox::GraphicHelper& RTFDocumentImpl::getGraphicHelper()
return *m_pGraphicHelper; 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) void RTFDocumentImpl::resolve(Stream& rMapper)
{ {
m_pMapperStream = &rMapper; m_pMapperStream = &rMapper;
...@@ -6328,7 +6336,7 @@ RTFFrame::RTFFrame(RTFParserState* pParserState) ...@@ -6328,7 +6336,7 @@ RTFFrame::RTFFrame(RTFParserState* pParserState)
void RTFFrame::setSprm(Id nId, Id nValue) 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->checkFirstRun();
m_pParserState->m_pDocumentImpl->setNeedPar(false); m_pParserState->m_pDocumentImpl->setNeedPar(false);
......
...@@ -395,6 +395,8 @@ public: ...@@ -395,6 +395,8 @@ public:
/// Get the default parser state. /// Get the default parser state.
RTFParserState& getDefaultState(); RTFParserState& getDefaultState();
oox::GraphicHelper& getGraphicHelper(); oox::GraphicHelper& getGraphicHelper();
/// Are we inside the stylesheet table?
bool isStyleSheetImport();
private: private:
SvStream& Strm(); SvStream& Strm();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment