diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-04-04 17:13:45 +0900 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-06-01 08:59:09 +0200 |
commit | 499f472bd1b3e7f557b743a4f57d3ea0412922fb (patch) | |
tree | 4c5bb5b109aedbb5423ee59f79d97004663686b1 /svx | |
parent | 22adcad267653c8996b733119dfcb35c6391bdf9 (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.cxx | 2 | ||||
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 6 | ||||
-rw-r--r-- | svx/source/xoutdev/_xoutbmp.cxx | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 3eb3abfe0953..9b98cb7aae7d 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -438,7 +438,7 @@ const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const { const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rVectorGraphicDataPtr->getReplacement()); } - else if (pGraphic->GetGraphic().getPdfData().hasElements() + else if (pGraphic->GetGraphic().hasPdfData() || pGraphic->GetGraphic().GetType() == GraphicType::GdiMetafile) { // Replacement graphic for PDF and metafiles is just the bitmap. diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index ff7e4043d519..62491105c116 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -545,14 +545,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() == ERRCODE_NONE); } else diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index bd16f0113c65..8e00f37959aa 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -183,7 +183,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, } // 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); @@ -192,8 +192,8 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, 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 = ERRCODE_NONE; |