diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-02-06 17:42:36 -0500 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-02-21 16:00:05 +0100 |
commit | 5160c2696ff3cb21ac29fbf731a8e0d094be357b (patch) | |
tree | 9aadb0cc8407582c30d68d866e6ae7c94cc01ec1 /package | |
parent | 935552e403da4ec93ce74b28e6cb9997560fc781 (diff) |
ofopxml: always generate default application/xml
MS Office always sets the application/xml entry
but LO doesn't preserve unknown entries.
Since this is a standard and always-set entry
LO should always stamp it as well.
Change-Id: I28b47634f2aa1fec233c9184deb65fd43f2f3ae8
Reviewed-on: https://gerrit.libreoffice.org/48724
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit 00492aff753510bcb4fab81c5258584f3cda2d17)
Reviewed-on: https://gerrit.libreoffice.org/50044
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'package')
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index ca2df1558b51..b59cca3ac22e 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1054,9 +1054,14 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: // Convert vector into a uno::Sequence // TODO/LATER: use Default entries in future - uno::Sequence< beans::StringPair > aDefaultsSequence; - uno::Sequence< beans::StringPair > aOverridesSequence( aManList.size() ); - sal_Int32 nSeqLength = 0; + uno::Sequence< beans::StringPair > aDefaultsSequence(aManList.size()); + // Add at least the application/xml default entry. + aDefaultsSequence[0].First = "xml"; + aDefaultsSequence[0].Second= "application/xml"; + sal_Int32 nDefSeqLength = 1; + + uno::Sequence< beans::StringPair > aOverridesSequence(aManList.size()); + sal_Int32 nOverSeqLength = 0; for ( vector< uno::Sequence< beans::PropertyValue > >::const_iterator aIter = aManList.begin(), aEnd = aManList.end(); aIter != aEnd; @@ -1070,13 +1075,15 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: if ( !aType.isEmpty() ) { // only nonempty type makes sense here - nSeqLength++; ( *aIter )[PKG_MNFST_FULLPATH].Value >>= aPath; - aOverridesSequence[nSeqLength-1].First = "/" + aPath; - aOverridesSequence[nSeqLength-1].Second = aType; + //FIXME: For now we have no way of deferentiating defaults from others. + aOverridesSequence[nOverSeqLength].First = "/" + aPath; + aOverridesSequence[nOverSeqLength].Second = aType; + ++nOverSeqLength; } } - aOverridesSequence.realloc( nSeqLength ); + aOverridesSequence.realloc(nOverSeqLength); + aDefaultsSequence.realloc(nDefSeqLength); ::comphelper::OFOPXMLHelper::WriteContentSequence( xConTypeOutStream, aDefaultsSequence, aOverridesSequence, m_xContext ); |