On Tue, Aug 23, 2011 at 04:41:59PM +0100, Caolán McNamara <caol...@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())

Attachment: pgp9sbG0VgV90.pgp
Description: PGP signature

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to