Kaydet (Commit) 480ca743 authored tarafından Radu Ioan's avatar Radu Ioan Kaydeden (comit) Miklos Vajna

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/15151Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 861a86df
......@@ -29,7 +29,8 @@ class UNOTOOLS_DLLPUBLIC DocInfoHelper
{
public:
static OUString GetGeneratorString();
static OUString GetApplicationString();
static OUString GetVersionString();
};
} // namespace utl
......
......@@ -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 */
......
......@@ -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: */
......@@ -41,8 +41,24 @@ OUString DocInfoHelper::GetGeneratorString()
{
aResult.append( aValue.replace( ' ', '_' ) );
aResult.append( '/' );
}
aValue = utl::ConfigManager::getProductVersion();
aValue = GetVersionString();
if ( !aValue.isEmpty() )
{
aResult.append( aValue );
}
return aResult.makeStringAndClear();
}
OUString DocInfoHelper::GetVersionString()
{
OUStringBuffer aResult;
// version is <product_versions>_<product_extension>$<platform>
OUString aValue( utl::ConfigManager::getProductVersion() );
if ( !aValue.isEmpty() )
{
aResult.append( aValue.replace( ' ', '_' ) );
......@@ -63,7 +79,6 @@ OUString DocInfoHelper::GetGeneratorString()
aResult.append( '_' );
aResult.append( arch );
aResult.append( ' ' );
}
// second product: LibreOffice_project/<build_information>
// build_information has '(' and '[' encoded as '$', ')' and ']' ignored
......@@ -97,6 +112,7 @@ OUString DocInfoHelper::GetGeneratorString()
return aResult.makeStringAndClear();
}
} // end of namespace utl
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment