diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-04-03 16:49:41 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-04-03 17:56:44 +0200 |
commit | f4e0cbaa15c2861e87149a62c9c80a9e9b4094b3 (patch) | |
tree | 340671f6eefc01d0e581310e716ffe3a5279ec12 /writerfilter | |
parent | 97bcf0b645fa5ce14cfd806548c6805952fd3e76 (diff) |
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
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 17 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 5ceeaeb8450c..e938f98be74f 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -541,6 +541,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; @@ -1762,8 +1770,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 1747958ae07b..1d72ece73a80 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -372,6 +372,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(); |