Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

See
http://cgit.freedesktop.org/libreoffice/core/commit/?id=f4e0cba

I'm attaching a backport of the fix for 3-5.

Thanks,

Miklos
From d547ff471039d8d3847839d6d26a0af7bdba9b17 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@suse.cz>
Date: Tue, 3 Apr 2012 16:49:41 +0200
Subject: [PATCH] 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
---
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   17 +++++++++++++++--
 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 a117ec6..1a7f8b9 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;
@@ -1763,8 +1771,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 461b88e..676d75e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -369,6 +369,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();
-- 
1.7.7


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.