[Libreoffice-commits] core.git: include/unotools oox/source sw/qa unotools/source

Radu Ioan ioan.radu.g at gmail.com
Fri May 1 15:02:15 PDT 2015


 include/unotools/docinfohelper.hxx          |    3 +
 oox/source/core/xmlfilterbase.cxx           |    5 +-
 sw/qa/extras/ooxmlexport/data/tdf89790.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx   |    7 +++
 unotools/source/config/docinfohelper.cxx    |   50 ++++++++++++++++++----------
 5 files changed, 45 insertions(+), 20 deletions(-)

New commits:
commit 480ca7434a330b2678f9ef287cffd6d9cf27bed5
Author: Radu Ioan <ioan.radu.g at gmail.com>
Date:   Sat Apr 4 19:03:35 2015 +0300

    tdf#89790 -  DOCX: saving LO version number in correct tag in app.xml
    
    Converted existing method that provides application name and version in two functions
    
    Change-Id: I93b70da7c78ee5db3d6eb710a2a2a9f4b7b4fb86
    Reviewed-on: https://gerrit.libreoffice.org/15151
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/include/unotools/docinfohelper.hxx b/include/unotools/docinfohelper.hxx
index ddc28b0..320b3b5 100644
--- a/include/unotools/docinfohelper.hxx
+++ b/include/unotools/docinfohelper.hxx
@@ -29,7 +29,8 @@ class UNOTOOLS_DLLPUBLIC DocInfoHelper
 {
 public:
     static OUString GetGeneratorString();
-
+    static OUString GetApplicationString();
+    static OUString GetVersionString();
 };
 
 }   // namespace utl
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 4ff011a..772142b 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -58,6 +58,7 @@
 #include <tools/datetime.hxx>
 #include <com/sun/star/util/Duration.hpp>
 #include <sax/tools/converter.hxx>
+#include <unotools/configmgr.hxx>
 
 using ::com::sun::star::xml::dom::DocumentBuilder;
 using ::com::sun::star::xml::dom::XDocument;
@@ -692,9 +693,9 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProp
     writeElement( pAppProps, XML_HyperlinksChanged,     "hyperlinks changed" );
     writeElement( pAppProps, XML_DigSig,                "digital signature" );
 #endif  /* def OOXTODO */
-    writeElement( pAppProps, XML_Application,           utl::DocInfoHelper::GetGeneratorString() );
+    writeElement( pAppProps, XML_Application,           utl::ConfigManager::getProductName() );
+    writeElement( pAppProps, XML_AppVersion,            utl::DocInfoHelper::GetVersionString() );
 #ifdef OOXTODO
-    writeElement( pAppProps, XML_AppVersion,            "app version" );
     writeElement( pAppProps, XML_DocSecurity,           "doc security" );
 #endif  /* def OOXTODO */
 
diff --git a/sw/qa/extras/ooxmlexport/data/tdf89790.docx b/sw/qa/extras/ooxmlexport/data/tdf89790.docx
new file mode 100644
index 0000000..180951e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf89790.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 6964c90..89a1502 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -795,6 +795,13 @@ DECLARE_OOXMLEXPORT_TEST(testSectionHeader, "sectionprot.odt")
     }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf89790, "tdf89790.docx")
+{
+    if (xmlDocPtr pXmlDoc = parseExport("docProps/app.xml"))
+
+         assertXPath(pXmlDoc, "/extended-properties:Properties/extended-properties:AppVersion");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/docinfohelper.cxx b/unotools/source/config/docinfohelper.cxx
index b5d0cf9..0ea143cf 100644
--- a/unotools/source/config/docinfohelper.cxx
+++ b/unotools/source/config/docinfohelper.cxx
@@ -41,30 +41,45 @@ OUString DocInfoHelper::GetGeneratorString()
     {
         aResult.append( aValue.replace( ' ', '_' ) );
         aResult.append( '/' );
+    }
+
+    aValue = GetVersionString();
+    if ( !aValue.isEmpty() )
+    {
+        aResult.append( aValue );
+    }
+
+    return aResult.makeStringAndClear();
+}
+
+
+OUString DocInfoHelper::GetVersionString()
+{
+    OUStringBuffer aResult;
 
-        aValue = utl::ConfigManager::getProductVersion();
+    // version is <product_versions>_<product_extension>$<platform>
+    OUString aValue( utl::ConfigManager::getProductVersion() );
+    if ( !aValue.isEmpty() )
+    {
+        aResult.append( aValue.replace( ' ', '_' ) );
+
+        aValue = utl::ConfigManager::getProductExtension();
         if ( !aValue.isEmpty() )
         {
             aResult.append( aValue.replace( ' ', '_' ) );
-
-            aValue = utl::ConfigManager::getProductExtension();
-            if ( !aValue.isEmpty() )
-            {
-                aResult.append( aValue.replace( ' ', '_' ) );
-            }
         }
-
-        OUString os( "$_OS" );
-        OUString arch( "$_ARCH" );
-        ::rtl::Bootstrap::expandMacros(os);
-        ::rtl::Bootstrap::expandMacros(arch);
-        aResult.append( '$' );
-        aResult.append( os );
-        aResult.append( '_' );
-        aResult.append( arch );
-        aResult.append( ' ' );
     }
 
+    OUString os( "$_OS" );
+    OUString arch( "$_ARCH" );
+    ::rtl::Bootstrap::expandMacros(os);
+    ::rtl::Bootstrap::expandMacros(arch);
+    aResult.append( '$' );
+    aResult.append( os );
+    aResult.append( '_' );
+    aResult.append( arch );
+    aResult.append( ' ' );
+
     // second product: LibreOffice_project/<build_information>
     // build_information has '(' and '[' encoded as '$', ')' and ']' ignored
     // and ':' replaced by '-'
@@ -97,6 +112,7 @@ OUString DocInfoHelper::GetGeneratorString()
     return aResult.makeStringAndClear();
 }
 
+
 } // end of namespace utl
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list