From 805aa2151e476a5e8e60806c7321ba7288f91813 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 26 Aug 2011 01:17:24 +0200 Subject: Related: fdo#39337 It turns out dmapper ignores the position of an entry --- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 11 ++++++++--- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 0fef1e893bf0..658a3d28b7fc 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -266,6 +266,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference const& x m_aDefaultState(), m_bSkipUnknown(false), m_aFontEncodings(), + m_aFontIndexes(), m_aColorTable(), m_bFirstRun(true), m_bFirstRow(true), @@ -1988,10 +1989,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { case RTF_F: if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE || m_aStates.top().nDestinationState == DESTINATION_FONTENTRY) - m_nCurrentFontIndex = nParam; + { + m_aFontIndexes.push_back(nParam); + m_nCurrentFontIndex = std::find(m_aFontIndexes.begin(), m_aFontIndexes.end(), nParam) - m_aFontIndexes.begin(); + } else { - m_aStates.top().aCharacterSprms->push_back(make_pair(NS_sprm::LN_CRgFtc0, pIntValue)); + RTFValue::Pointer_t pValue(new RTFValue(std::find(m_aFontIndexes.begin(), m_aFontIndexes.end(), nParam) - m_aFontIndexes.begin())); + m_aStates.top().aCharacterSprms->push_back(make_pair(NS_sprm::LN_CRgFtc0, pValue)); m_aStates.top().nCurrentEncoding = getEncodingTable(nParam); } break; @@ -2422,7 +2427,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) OUString aName; switch (nKeyword) { - case RTF_NOFPAGES: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("PageCount")); break; + case RTF_NOFPAGES: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("PageCount")); nParam = 99; break; case RTF_NOFWORDS: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("WordCount")); break; case RTF_NOFCHARS: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("CharacterCount")); break; case RTF_NOFCHARSWS: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("NonWhitespaceCharacterCount")); break; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index aee3f79d6717..d5a65ef2629e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -362,6 +362,8 @@ namespace writerfilter { bool m_bSkipUnknown; /// Font index <-> encoding map, *not* part of the parser state std::map m_aFontEncodings; + /// Maps the non-continious font indexes to the continous dmapper indexes. + std::vector m_aFontIndexes; /// Color index <-> RGB color value map std::vector m_aColorTable; bool m_bFirstRun; -- cgit