[Libreoffice-commits] core.git: writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Sat Jul 5 01:49:04 PDT 2014


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

New commits:
commit 2ff63282f7bf61379d8b96e7180d5800b2f1e05e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Jul 5 10:18:31 2014 +0200

    Use comphelper::SequenceAsHashMap
    
    Change-Id: I555514cb8647ff4a53eeff14933cfc4a868a3ab3

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1be8c91..4f8649f 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -40,6 +40,7 @@
 #include <tools/mapunit.hxx>
 #include <comphelper/classids.hxx>
 #include <comphelper/embeddedobjectcontainer.hxx>
+#include <comphelper/sequenceashashmap.hxx>
 #include <sfx2/sfxbasemodel.hxx>
 
 #include <oox/mathml/import.hxx>
@@ -4168,7 +4169,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     case RTF_NOFCHARSWS:
         if (m_xDocumentProperties.is())
         {
-            uno::Sequence<beans::NamedValue> aSet = m_xDocumentProperties->getDocumentStatistics();
+            comphelper::SequenceAsHashMap aSeq = m_xDocumentProperties->getDocumentStatistics();
             OUString aName;
             switch (nKeyword)
             {
@@ -4190,18 +4191,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
             }
             if (!aName.isEmpty())
             {
-                bool bFound = false;
-                int nLen = aSet.getLength();
-                for (int i = 0; i < nLen; ++i)
-                    if (aSet[i].Name.equals(aName))
-                        aSet[i].Value = uno::makeAny(sal_Int32(nParam));
-                if (!bFound)
-                {
-                    aSet.realloc(nLen + 1);
-                    aSet[nLen].Name = aName;
-                    aSet[nLen].Value = uno::makeAny(sal_Int32(nParam));
-                }
-                m_xDocumentProperties->setDocumentStatistics(aSet);
+                aSeq[aName] = uno::makeAny(sal_Int32(nParam));
+                m_xDocumentProperties->setDocumentStatistics(aSeq.getAsConstNamedValueList());
             }
         }
         break;


More information about the Libreoffice-commits mailing list