summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-07-03 15:16:58 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-07-06 14:22:48 +0200
commit34c1d80d91b62afa74d0566d88b7f4fbd0dcb433 (patch)
tree31d2078adf60cb6289277ff08dd8dde444491e99 /svx
parent07f66a2bdbd50dc4e3c2318a88e7684f67f494d2 (diff)
tdf#117901 Write signature line images as emf to ooxml
Change-Id: Idbf60be3cef2d9dde454da0279d2810488b1e157 Reviewed-on: https://gerrit.libreoffice.org/56871 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> (cherry picked from commit 7bafb7ca8ef9467f5c55766d2a38ba0d0a60837c) Reviewed-on: https://gerrit.libreoffice.org/56986 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx49
1 files changed, 27 insertions, 22 deletions
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 4b943e817767..b99d7cffd047 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <comphelper/base64.hxx>
+#include <comphelper/graphicmimetype.hxx>
#include <tools/poly.hxx>
#include <vcl/bitmapaccess.hxx>
#include <vcl/virdev.hxx>
@@ -357,33 +358,33 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
}
}
-bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString, bool bAddPrefix)
+bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString, bool bAddPrefix,
+ ConvertDataFormat aTargetFormat)
{
SvMemoryStream aOStm;
- OUString aMimeType;
GfxLink aLink = rGraphic.GetGfxLink();
- ConvertDataFormat aCvtType;
- switch( aLink.GetType() )
+
+ if (aTargetFormat == ConvertDataFormat::Unknown)
{
- case GfxLinkType::NativeJpg:
- aCvtType = ConvertDataFormat::JPG;
- aMimeType = "image/jpeg";
- break;
- case GfxLinkType::NativePng:
- aCvtType = ConvertDataFormat::PNG;
- aMimeType = "image/png";
- break;
- case GfxLinkType::NativeSvg:
- aCvtType = ConvertDataFormat::SVG;
- aMimeType = "image/svg+xml";
- break;
- default:
- // save everything else (including gif) into png
- aCvtType = ConvertDataFormat::PNG;
- aMimeType = "image/png";
- break;
+ switch (aLink.GetType())
+ {
+ case GfxLinkType::NativeJpg:
+ aTargetFormat = ConvertDataFormat::JPG;
+ break;
+ case GfxLinkType::NativePng:
+ aTargetFormat = ConvertDataFormat::PNG;
+ break;
+ case GfxLinkType::NativeSvg:
+ aTargetFormat = ConvertDataFormat::SVG;
+ break;
+ default:
+ // save everything else (including gif) into png
+ aTargetFormat = ConvertDataFormat::PNG;
+ break;
+ }
}
- ErrCode nErr = GraphicConverter::Export(aOStm,rGraphic,aCvtType);
+
+ ErrCode nErr = GraphicConverter::Export(aOStm,rGraphic,aTargetFormat);
if ( nErr )
{
SAL_WARN("svx", "XOutBitmap::GraphicToBase64() invalid Graphic? error: " << nErr );
@@ -396,7 +397,11 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString, b
rOUString = aStrBuffer.makeStringAndClear();
if (bAddPrefix)
+ {
+ OUString aMimeType
+ = comphelper::GraphicMimeTypeHelper::GetMimeTypeForConvertDataFormat(aTargetFormat);
rOUString = aMimeType + ";base64," + rOUString;
+ }
return true;
}