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

alexey.chemichev alexey.chemichev at gmail.com
Wed Nov 18 11:39:56 PST 2015


 oox/source/core/xmlfilterbase.cxx |   30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 8beea0f6b43b9fe893418687a75d28a6d624ede7
Author: alexey.chemichev <alexey.chemichev at gmail.com>
Date:   Wed Nov 18 13:11:18 2015 -0500

    tdf#90904 DOCX export metadata for "Pages", "Word count", "Character count"
    
    /oox/source/core/xmlfilterbase.cxx: writeAppProperties modified.
    Stats are extracted from DocumentProperties->DocumentStatistics.
    No stat counter found for the lines of text
    
    Change-Id: Ibc2e848a97776f65f0bfd4a880e5279e9c507dd0
    Reviewed-on: https://gerrit.libreoffice.org/20046
    Reviewed-by: jan iversen <jani at documentfoundation.org>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index f140d1d..a89cc9d 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -650,9 +650,6 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProp
     writeElement( pAppProps, XML_Template,              xProperties->getTemplateName() );
 #ifdef OOXTODO
     writeElement( pAppProps, XML_Manager,               "manager" );
-    writeElement( pAppProps, XML_Pages,                 "pages" );
-    writeElement( pAppProps, XML_Words,                 "words" );
-    writeElement( pAppProps, XML_Characters,            "characters" );
     writeElement( pAppProps, XML_PresentationFormat,    "presentation format" );
     writeElement( pAppProps, XML_Lines,                 "lines" );
     writeElement( pAppProps, XML_Slides,                "slides" );
@@ -681,10 +678,33 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProp
 #endif  /* def OOXTODO */
 
     comphelper::SequenceAsHashMap aStats = xProperties->getDocumentStatistics();
-    comphelper::SequenceAsHashMap::iterator it = aStats.find("ParagraphCount");
+    comphelper::SequenceAsHashMap::iterator it;
+    sal_Int32 nValue = 0;
+
+    it = aStats.find("PageCount");
+    if (it != aStats.end())
+    {
+            if (it->second >>= nValue)
+                writeElement(pAppProps, XML_Pages, nValue);
+    }
+
+    it = aStats.find("WordCount");
+    if (it != aStats.end())
+    {
+            if (it->second >>= nValue)
+                writeElement(pAppProps, XML_Words, nValue);
+    }
+
+    it = aStats.find("CharacterCount");
+    if (it != aStats.end())
+    {
+            if (it->second >>= nValue)
+                writeElement(pAppProps, XML_Characters, nValue);
+    }
+
+    it = aStats.find("ParagraphCount");
     if (it != aStats.end())
     {
-            sal_Int32 nValue = 0;
             if (it->second >>= nValue)
                 writeElement(pAppProps, XML_Paragraphs, nValue);
     }


More information about the Libreoffice-commits mailing list