[Libreoffice-commits] .: 2 commits - writerfilter/source
Caolán McNamara
caolan at kemper.freedesktop.org
Sat May 5 07:58:09 PDT 2012
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
New commits:
commit a96e7428b74504cf9ca9e02b21a5647a3aa55e56
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat May 5 15:56:03 2012 +0100
Resolves: fdo#47347 overwrite incorrect font table entry with the correct one
Change-Id: I563cf50b6eb029276115b9b02951d36b1ec0d39c
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index da16787..fa59904 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -885,7 +885,15 @@ void RTFDocumentImpl::text(OUString& rString)
writerfilter::Reference<Properties>::Pointer_t const pProp(
new RTFReferenceProperties(m_aStates.top().aTableAttributes, m_aStates.top().aTableSprms)
);
- m_aFontTableEntries.insert(make_pair(m_nCurrentFontIndex, pProp));
+
+ //See fdo#47347 initial invalid font entry properties are inserted first,
+ //so when we attempt to insert the correct ones, there's already an
+ //entry in the map for them, so the new ones aren't inserted.
+ RTFReferenceTable::Entries_t::iterator lb = m_aFontTableEntries.lower_bound(m_nCurrentFontIndex);
+ if (lb != m_aFontTableEntries.end() && !(m_aFontTableEntries.key_comp()(m_nCurrentFontIndex, lb->first)))
+ lb->second = pProp;
+ else
+ m_aFontTableEntries.insert(lb, make_pair(m_nCurrentFontIndex, pProp));
}
break;
case DESTINATION_STYLESHEET:
commit 349d64b821c657aa9b94667c7f9fac3bdb677342
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat May 5 14:43:40 2012 +0100
Related: fdo#47347 m_aFontEncodings is a map so returns 0 on unknown fontindex
Change-Id: I3addf0d27058ed9ef01d4893ad932c13623c283c
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9bbbcb0..da16787 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -518,8 +518,9 @@ rtl_TextEncoding RTFDocumentImpl::getEncoding(sal_uInt32 nFontIndex)
{
if (!m_pSuperstream)
{
- if (nFontIndex < m_aFontEncodings.size())
- return m_aFontEncodings[nFontIndex];
+ std::map<int, rtl_TextEncoding>::iterator it = m_aFontEncodings.find(nFontIndex);
+ if (it != m_aFontEncodings.end())
+ return it->second;
return msfilter::util::getBestTextEncodingFromLocale(Application::GetSettings().GetLocale());
}
else
More information about the Libreoffice-commits
mailing list