summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2017-09-04 14:14:39 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-11-29 10:54:38 +0100
commit65066627c26059caedbf239cb41b97c1721334a0 (patch)
tree57d73783d316565575d62e167fe7cf3f1a94f0a0 /xmloff
parentf0a2fee5006f27b8ebf2b2e583964818986caec5 (diff)
tdf#109202: Convert images to desired format in (f)odt filter
Pass down mimetype to SvXMLGraphicHelper Change-Id: I9c81c06d2a1d6168704440094081e99d0bcbbff9 Reviewed-on: https://gerrit.libreoffice.org/41893 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> (cherry picked from commit 082cdbc991a2e31556bab53a5b8214cb89138354) Reviewed-on: https://gerrit.libreoffice.org/45401 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmlexp.cxx4
-rw-r--r--xmloff/source/text/txtparae.cxx13
2 files changed, 15 insertions, 2 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 33cd48a9982c..f8970a58f2c2 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2451,6 +2451,10 @@ bool SvXMLExport::SetNullDateOnUnitConverter()
return mpImpl->mbNullDateInitialized;
}
+OUString SvXMLExport::GetImageFilterName() const
+{
+ return msImgFilterName;
+}
void SvXMLElementExport::StartElement(
const sal_uInt16 nPrefixKey,
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index ccbb11b4d2c2..4ab345e599c3 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -118,6 +118,7 @@
#include <algorithm>
#include <iterator>
#include <comphelper/processfactory.hxx>
+#include <comphelper/graphicmimetype.hxx>
using namespace ::std;
using namespace ::com::sun::star;
@@ -3096,8 +3097,16 @@ void XMLTextParagraphExport::_exportTextGraphic(
sGrfFilter );
// Add mimetype to make it easier for readers to get the base64 image type right, tdf#109202
- OUString aSourceMimeType = getMimeType(sOrigURL);
- if ( !aSourceMimeType.isEmpty() )
+ // do we have a hard export image filter set? then that's our mimetype
+ OUString aSourceMimeType = GetExport().GetImageFilterName();
+ // otherwise determine mimetype from graphic
+ if ( aSourceMimeType.isEmpty() )
+ aSourceMimeType = getMimeType(sOrigURL);
+ else // !aSourceMimeType.isEmpty()
+ {
+ const OString aExt( OUStringToOString( aSourceMimeType, RTL_TEXTENCODING_ASCII_US ) );
+ aSourceMimeType = comphelper::GraphicMimeTypeHelper::GetMimeTypeForExtension( aExt );
+ }
GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "mime-type", aSourceMimeType);
{