summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/source/core/graphichelper.cxx3
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx20
2 files changed, 23 insertions, 0 deletions
diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx
index f163af063b04..5be57e8a8c2a 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -87,6 +87,9 @@ void GraphicHelper::GetPreferredExtension( OUString& rExtension, const Graphic&
case GfxLinkType::NativeSvg:
aExtension = "svg";
break;
+ case GfxLinkType::NativePdf:
+ aExtension = "pdf";
+ break;
default:
break;
}
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 7dea7331395d..592434b40154 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -39,6 +39,8 @@
#define FORMAT_JPG "jpg"
#define FORMAT_PNG "png"
+using namespace com::sun::star;
+
GraphicFilter* XOutBitmap::pGrfFilter = nullptr;
Animation XOutBitmap::MirrorAnimation( const Animation& rAnimation, bool bHMirr, bool bVMirr )
@@ -172,6 +174,24 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
}
}
+ // Write PDF data in original form if possible.
+ if (rGraphic.getPdfData().hasElements() && rFilterName.equalsIgnoreAsciiCase("pdf"))
+ {
+ if (!(nFlags & XOutFlags::DontAddExtension))
+ aURL.setExtension(rFilterName);
+
+ rFileName = aURL.GetMainURL(INetURLObject::NO_DECODE);
+ SfxMedium aMedium(aURL.GetMainURL(INetURLObject::NO_DECODE), StreamMode::WRITE|StreamMode::SHARE_DENYNONE|StreamMode::TRUNC);
+ if (SvStream* pOutStream = aMedium.GetOutStream())
+ {
+ uno::Sequence<sal_Int8> aPdfData = rGraphic.getPdfData();
+ pOutStream->WriteBytes(aPdfData.getConstArray(), aPdfData.getLength());
+ aMedium.Commit();
+ if (!aMedium.GetError())
+ nErr = GRFILTER_OK;
+ }
+ }
+
if( GRFILTER_OK != nErr )
{
if( ( nFlags & XOutFlags::UseNativeIfPossible ) &&