diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-04-02 22:12:28 +0200 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2019-08-25 13:42:06 +0200 |
commit | eb581eff6ac41b938299b4c154ded6891bdd0c11 (patch) | |
tree | 8cc33a7850cc65d754667d7d1dfb3376b2428f1c /svx | |
parent | 81f73f1c1706d790c010e8fc0abcb2a0e9e86ace (diff) |
pdfium: Use std::vector to hold the PdfData.
This fixes the destruction of the static cache of the PDF data; without
this, there were already missing uno runtime info.
(cherry picked from commit 20055ebe1b27f716a2acf1f0f4dda2864ae811bf)
Change-Id: I877c9ccf96c4b7eabf3d643e17f324d86d987f94
Reviewed-on: https://gerrit.libreoffice.org/77691
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdpdf.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdpdf.hxx | 4 | ||||
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 8 | ||||
-rw-r--r-- | svx/source/xoutdev/_xoutbmp.cxx | 4 |
5 files changed, 13 insertions, 13 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index c74de64e69a4..8ac19ae1525a 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -145,6 +145,7 @@ std::unique_ptr<sdr::contact::ViewContact> SdrGrafObj::CreateObjectSpecificViewC return std::make_unique<sdr::contact::ViewContactOfGraphic>(*this); } + // check if SVG and if try to get ObjectInfoPrimitive2D and extract info void SdrGrafObj::onGraphicChanged() @@ -342,7 +343,6 @@ void SdrGrafObj::SetGraphic( const Graphic& rGraphic ) const Graphic& SdrGrafObj::GetGraphic() const { - ForceSwapIn(); return mpGraphicObject->GetGraphic(); } @@ -463,6 +463,7 @@ Size SdrGrafObj::getOriginalSize() const return aSize; } +// TODO Remove void SdrGrafObj::ForceSwapIn() const { if (pGraphicLink && (mpGraphicObject->GetType() == GraphicType::NONE || @@ -711,7 +712,6 @@ SdrObject* SdrGrafObj::getFullDragClone() const // temporary interaction object and load graphic if(pRetval && IsLinkedGraphic()) { - pRetval->ForceSwapIn(); pRetval->ReleaseGraphicLink(); } @@ -907,7 +907,7 @@ bool SdrGrafObj::isEmbeddedPdfData() const return mpGraphicObject->GetGraphic().hasPdfData(); } -std::shared_ptr<uno::Sequence<sal_Int8>> const & SdrGrafObj::getEmbeddedPdfData() const +std::shared_ptr<std::vector<sal_Int8>> const & SdrGrafObj::getEmbeddedPdfData() const { return mpGraphicObject->GetGraphic().getPdfData(); } diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 7bcb2cae241d..6ac08e5e7f9d 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -118,7 +118,7 @@ struct FPDFBitmapDeleter using namespace com::sun::star; ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools::Rectangle& rRect, - const std::shared_ptr<uno::Sequence<sal_Int8>>& pPdfData) + const std::shared_ptr<std::vector<sal_Int8>>& pPdfData) : maTmpList() , mpVD(VclPtr<VirtualDevice>::Create()) , maScaleRect(rRect) @@ -166,7 +166,7 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools: FPDF_InitLibraryWithConfig(&aConfig); // Load the buffer using pdfium. - mpPdfDocument = FPDF_LoadMemDocument(mpPdfData->getConstArray(), mpPdfData->getLength(), + mpPdfDocument = FPDF_LoadMemDocument(mpPdfData->data(), mpPdfData->size(), /*password=*/nullptr); if (!mpPdfDocument) { diff --git a/svx/source/svdraw/svdpdf.hxx b/svx/source/svdraw/svdpdf.hxx index bc3ba11946f6..70b5a44e4ddf 100644 --- a/svx/source/svdraw/svdpdf.hxx +++ b/svx/source/svdraw/svdpdf.hxx @@ -161,7 +161,7 @@ class ImpSdrPdfImport final ::std::vector<SdrObject*> maTmpList; ScopedVclPtr<VirtualDevice> mpVD; tools::Rectangle const maScaleRect; - const std::shared_ptr<css::uno::Sequence<sal_Int8>> mpPdfData; + const std::shared_ptr<std::vector<sal_Int8>> mpPdfData; size_t mnMapScalingOfs; // from here on, not edited with MapScaling std::unique_ptr<SfxItemSet> mpLineAttr; std::unique_ptr<SfxItemSet> mpFillAttr; @@ -233,7 +233,7 @@ class ImpSdrPdfImport final public: ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools::Rectangle& rRect, - const std::shared_ptr<css::uno::Sequence<sal_Int8>>& pPdfData); + const std::shared_ptr<std::vector<sal_Int8>>& pPdfData); ~ImpSdrPdfImport(); int GetPageCount() const { return mnPageCount; } diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 1b2536a6a509..1c64d13566d6 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -296,7 +296,7 @@ Graphic SvXMLGraphicOutputStream::GetGraphic() mpOStm->Seek( 0 ); sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW; sal_uInt16 nDeterminedFormat = GRFILTER_FORMAT_DONTKNOW; - GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, "", *mpOStm ,nFormat, &nDeterminedFormat ); + GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, "", *mpOStm ,nFormat,&nDeterminedFormat); if (nDeterminedFormat == GRFILTER_FORMAT_DONTKNOW) { @@ -760,8 +760,8 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(aStream.xStream)); if (bUseGfxLink && aGfxLink.GetDataSize() && aGfxLink.GetData()) { - const std::shared_ptr<uno::Sequence<sal_Int8>>& rPdfData = aGraphic.getPdfData(); - if (rPdfData && rPdfData->hasElements()) + const std::shared_ptr<std::vector<sal_Int8>>& rPdfData = aGraphic.getPdfData(); + if (rPdfData && !rPdfData->empty()) { // See if we have this PDF already, and avoid duplicate storage. auto aIt = maExportPdf.find(rPdfData.get()); @@ -776,7 +776,7 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X // 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->data(), rPdfData->size()); } else { diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 4d33fda7534d..6aeca72a6eb1 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -185,8 +185,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()) { - const std::shared_ptr<uno::Sequence<sal_Int8>>& rPdfData = rGraphic.getPdfData(); - pOutStream->WriteBytes(rPdfData->getConstArray(), rPdfData->getLength()); + const std::shared_ptr<std::vector<sal_Int8>>& rPdfData = rGraphic.getPdfData(); + pOutStream->WriteBytes(rPdfData->data(), rPdfData->size()); aMedium.Commit(); if (!aMedium.GetError()) nErr = ERRCODE_NONE; |