[Libreoffice] [PUSHED][PATCH] Remove unnecessary parameter to IDocumentStatistics::UpdateDocStat

Miklos Vajna vmiklos at frugalware.org
Tue Aug 23 15:30:15 PDT 2011


On Tue, Aug 23, 2011 at 04:41:59PM +0100, Caolán McNamara <caolanm at redhat.com> wrote:
> d) I'm not sure there's any good reason to set the DocStat in the
> (current) rtf filter.

You mean something like this? Given that the idl says these properties
are readonly (I did not notice that so far), I don't think there is a
reason to set them.

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0fef1e8..4d91514 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2416,34 +2416,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         case RTF_NOFWORDS:
         case RTF_NOFCHARS:
         case RTF_NOFCHARSWS:
-            if (m_xDocumentProperties.is())
-            {
-                uno::Sequence<beans::NamedValue> aSet = m_xDocumentProperties->getDocumentStatistics();
-                OUString aName;
-                switch (nKeyword)
-                {
-                    case RTF_NOFPAGES: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("PageCount")); 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;
-                    default: break;
-                }
-                if (aName.getLength())
-                {
-                    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);
-                }
-            }
+            // Ignore document statistics, Writer will calculate them.
             break;
         case RTF_VERSION:
             if (m_xDocumentProperties.is())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110824/75323f63/attachment.pgp>


More information about the LibreOffice mailing list