diff options
| author | Miklos Vajna <vmiklos@suse.cz> | 2012-04-03 16:49:41 +0200 | 
|---|---|---|
| committer | Luboš Luňák <l.lunak@suse.cz> | 2012-04-13 16:14:15 +0200 | 
| commit | 5e7f26787c6025ec1dffa9eee17405220325f7ae (patch) | |
| tree | 48b1ebd9181f1c0a6433e07fd705dab5d0b9eacb | |
| parent | 1ad759b17798848b0e4caa2a39c0b292e86efab1 (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
Signed-off-by: Luboš Luňák <l.lunak@suse.cz>
| -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 04160e679ba2..84e2b48c16cd 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 4a7551d6864c..0126882f059b 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();  | 
