summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-04-04 17:13:45 +0900
committerJan Holesovsky <kendy@collabora.com>2018-05-22 12:17:08 +0200
commit8783b4f3ffbfd4ae064296c65e8d803bd0460051 (patch)
treec4619d8a66221f3f39294cf3da446b7049e5e389 /svx
parent637d9cbec7358f171069bfab4ffb70dcd24ada3f (diff)
pdf: share pdf data in Graphic
(cherry picked from commit e3b59350ddceb158d01dedfe368bb600a9b37ea8) Also includes... graphic: move access to cxx for PDFData and VectorGraphicData We need strict control when PDFData and VectorGraphicData is accessed and changed, so create access methods for PDFData and move the access methods to cxx (for VectorGraphicData). Reviewed-on: https://gerrit.libreoffice.org/52395 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 18caee072ccbd2be7b947ef2659204d3c18a05f1) Change-Id: I39324a807a4db559bad5501b5913e62a0aeabf01 8146aa4e206788afff71142e1877fd7a885f4652
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdograf.cxx3
-rw-r--r--svx/source/xml/xmlgrhlp.cxx6
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx6
3 files changed, 8 insertions, 7 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index e24495f9d9f0..c9115151abab 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -443,7 +443,8 @@ const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const
{
const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement());
}
- else if (pGraphic->GetGraphic().getPdfData().hasElements())
+ else if (pGraphic->GetGraphic().hasPdfData() ||
+ pGraphic->GetGraphic().GetType() == GraphicType::GdiMetafile)
{
// Replacement graphic for bitmap + PDF is just the bitmap.
const_cast<SdrGrafObj*>(this)->mpReplacementGraphic = new GraphicObject(pGraphic->GetGraphic().GetBitmapEx());
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index de29f96df181..59d683dea1e2 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -565,14 +565,14 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName,
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream( aStream.xStream ));
if( bUseGfxLink && aGfxLink.GetDataSize() && aGfxLink.GetData() )
{
- const uno::Sequence<sal_Int8>& rPdfData = aGraphic.getPdfData();
- if (rPdfData.hasElements())
+ const std::shared_ptr<uno::Sequence<sal_Int8>>& rPdfData = aGraphic.getPdfData();
+ if (rPdfData && rPdfData->hasElements())
{
// The graphic has PDF data attached to it, use that.
// vcl::ImportPDF() possibly downgraded the PDF data from a
// higher PDF version, while aGfxLink still contains the
// original data provided by the user.
- pStream->WriteBytes(rPdfData.getConstArray(), rPdfData.getLength());
+ pStream->WriteBytes(rPdfData->getConstArray(), rPdfData->getLength());
bRet = (pStream->GetError() == 0);
}
else
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 8d5e30876909..c033d671f910 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -175,7 +175,7 @@ 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 (rGraphic.hasPdfData() && rFilterName.equalsIgnoreAsciiCase("pdf"))
{
if (!(nFlags & XOutFlags::DontAddExtension))
aURL.setExtension(rFilterName);
@@ -184,8 +184,8 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
SfxMedium aMedium(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), 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());
+ std::shared_ptr<uno::Sequence<sal_Int8>> pPdfData = rGraphic.getPdfData();
+ pOutStream->WriteBytes(pPdfData->getConstArray(), pPdfData->getLength());
aMedium.Commit();
if (!aMedium.GetError())
nErr = GRFILTER_OK;