writerfilter/source/rtftok/rtfdocumentimpl.cxx | 17 +++++++++++++++-- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-)
New commits: commit 5e7f26787c6025ec1dffa9eee17405220325f7ae Author: Miklos Vajna <vmik...@suse.cz> Date: Tue Apr 3 16:49:41 2012 +0200 fdo#45182 fix RTF import of character encoding in footnotes There were two problems here: 1) \plain reset the character properties, but did not touch the current encoding 2) the default properties were not passed to substreams Signed-off-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 04160e6..84e2b48 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -569,6 +569,14 @@ int RTFDocumentImpl::getFontIndex(int nIndex) return m_pSuperstream->getFontIndex(nIndex); } +RTFParserState& RTFDocumentImpl::getDefaultState() +{ + if (!m_pSuperstream) + return m_aDefaultState; + else + return m_pSuperstream->getDefaultState(); +} + void RTFDocumentImpl::resolve(Stream & rMapper) { m_pMapperStream = &rMapper; @@ -1778,8 +1786,13 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252; break; case RTF_PLAIN: - m_aStates.top().aCharacterSprms = m_aDefaultState.aCharacterSprms; - m_aStates.top().aCharacterAttributes = m_aDefaultState.aCharacterAttributes; + { + m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms; + RTFValue::Pointer_t pValue = m_aStates.top().aCharacterSprms.find(NS_sprm::LN_CRgFtc0); + if (pValue.get()) + m_aStates.top().nCurrentEncoding = getEncoding(pValue->getInt()); + m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes; + } break; case RTF_PARD: m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 4a7551d..0126882 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -373,6 +373,8 @@ namespace writerfilter { int getFontIndex(int nIndex); /// Return the encoding associated with a dmapper font index. rtl_TextEncoding getEncoding(sal_uInt32 nFontIndex); + /// Get the default parser state. + RTFParserState& getDefaultState(); private: SvStream& Strm();
_______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits