diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-04-02 22:12:28 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-04-03 17:54:02 +0200 |
commit | ba328bb8862810712393e2ce3329ce798db84541 (patch) | |
tree | ac28251c29c5b3d9d8e0be298d5d1a1da24a0dce | |
parent | pdfium: Delay the swap out. (diff) | |
download | core-ba328bb8862810712393e2ce3329ce798db84541.tar.gz core-ba328bb8862810712393e2ce3329ce798db84541.zip |
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.
Change-Id: I877c9ccf96c4b7eabf3d643e17f324d86d987f94
-rw-r--r-- | include/svx/svdograf.hxx | 2 | ||||
-rw-r--r-- | include/vcl/graph.hxx | 4 | ||||
-rw-r--r-- | include/vcl/pdfread.hxx | 4 | ||||
-rw-r--r-- | svtools/qa/unit/GraphicObjectTest.cxx | 4 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.cxx | 10 | ||||
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 2 | ||||
-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 | 4 | ||||
-rw-r--r-- | svx/source/xoutdev/_xoutbmp.cxx | 4 | ||||
-rw-r--r-- | vcl/inc/impgraph.hxx | 8 | ||||
-rw-r--r-- | vcl/source/filter/ipdf/pdfread.cxx | 26 | ||||
-rw-r--r-- | vcl/source/gdi/graph.cxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 16 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 10 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 4 |
16 files changed, 57 insertions, 57 deletions
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index aa7a6c221506..9e9b5a9625ba 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -194,7 +194,7 @@ public: GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const; bool isEmbeddedPdfData() const; - std::shared_ptr<css::uno::Sequence<sal_Int8>> getEmbeddedPdfData() const; + std::shared_ptr<std::vector<sal_Int8>> getEmbeddedPdfData() const; /// Returns the page number of the embedded data (typically to re-render or import it). sal_Int32 getEmbeddedPageNumber() const; diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 881abda221e4..4f5108b3f2ce 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -229,8 +229,8 @@ public: const VectorGraphicDataPtr& getVectorGraphicData() const; - void setPdfData(const std::shared_ptr<css::uno::Sequence<sal_Int8>>& rPdfData); - const std::shared_ptr<css::uno::Sequence<sal_Int8>>& getPdfData() const; + void setPdfData(const std::shared_ptr<std::vector<sal_Int8>>& rPdfData); + const std::shared_ptr<std::vector<sal_Int8>>& getPdfData() const; bool hasPdfData() const; /// Set the page number of the multi-page source this Graphic is rendered from. diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx index e579f435261e..0ff6b39941c0 100644 --- a/include/vcl/pdfread.hxx +++ b/include/vcl/pdfread.hxx @@ -40,7 +40,7 @@ VCL_DLLPUBLIC size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vecto /// Imports a PDF stream into rGraphic as a GDIMetaFile. VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, size_t nPageIndex, - css::uno::Sequence<sal_Int8>& rPdfData, + std::vector<sal_Int8>& rPdfData, sal_uInt64 nPos = STREAM_SEEK_TO_BEGIN, sal_uInt64 nSize = STREAM_SEEK_TO_END, const double fResolutionDPI = 96.); @@ -49,7 +49,7 @@ VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic, const double fResolutionDPI = 96.); VCL_DLLPUBLIC size_t ImportPDF(const OUString& rURL, std::vector<Bitmap>& rBitmaps, - css::uno::Sequence<sal_Int8>& rPdfData, + std::vector<sal_Int8>& rPdfData, const double fResolutionDPI = 96.); /// Import PDF as Graphic images (1 per page), all unloaded. diff --git a/svtools/qa/unit/GraphicObjectTest.cxx b/svtools/qa/unit/GraphicObjectTest.cxx index e304f8e79996..afaf5d30f752 100644 --- a/svtools/qa/unit/GraphicObjectTest.cxx +++ b/svtools/qa/unit/GraphicObjectTest.cxx @@ -333,11 +333,11 @@ void GraphicObjectTest::testPdf() } CPPUNIT_ASSERT_MESSAGE("Missing image", pGraphicObject); - CPPUNIT_ASSERT(pGraphicObject->GetGraphic().getPdfData()->hasElements()); + CPPUNIT_ASSERT(!pGraphicObject->GetGraphic().getPdfData()->empty()); CPPUNIT_ASSERT(pGraphicObject->SwapOut()); CPPUNIT_ASSERT(pGraphicObject->SwapIn()); // This failed, swap out + swap in lost the PDF data. - CPPUNIT_ASSERT(pGraphicObject->GetGraphic().getPdfData()->hasElements()); + CPPUNIT_ASSERT(!pGraphicObject->GetGraphic().getPdfData()->empty()); xComponent->dispose(); #endif diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 0bb04b0c5d56..a93d822a2667 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -82,13 +82,13 @@ GraphicID::GraphicID( const GraphicObject& rObj ) } else if (rGraphic.hasPdfData()) { - std::shared_ptr<css::uno::Sequence<sal_Int8>> pPdfData = rGraphic.getPdfData(); + std::shared_ptr<std::vector<sal_Int8>> pPdfData(rGraphic.getPdfData()); const BitmapEx& rBmpEx = rGraphic.GetBitmapEx(); mnID1 |= (rGraphic.getPageNumber() & 0x0fffffff); mnID2 = rBmpEx.GetSizePixel().Width(); mnID3 = rBmpEx.GetSizePixel().Height(); - mnID4 = vcl_get_checksum(0, pPdfData->getConstArray(), pPdfData->getLength()); + mnID4 = vcl_get_checksum(0, pPdfData->data(), pPdfData->size()); } else if( rGraphic.IsAnimated() ) { @@ -164,7 +164,7 @@ private: // VectorGraphicData support VectorGraphicDataPtr maVectorGraphicData; - std::shared_ptr<uno::Sequence<sal_Int8>> mpPdfData; + std::shared_ptr<std::vector<sal_Int8>> mpPdfData; bool ImplInit( const GraphicObject& rObj ); void ImplFillSubstitute( Graphic& rSubstitute ); @@ -250,7 +250,7 @@ bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) else { mpBmpEx = new BitmapEx( rGraphic.GetBitmapEx() ); - if (rGraphic.hasPdfData() && rGraphic.getPdfData()->hasElements()) + if (rGraphic.hasPdfData() && !rGraphic.getPdfData()->empty()) mpPdfData = rGraphic.getPdfData(); } } @@ -297,7 +297,7 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) else if( mpBmpEx ) { rSubstitute = *mpBmpEx; - if (mpPdfData && mpPdfData->hasElements()) + if (mpPdfData && !mpPdfData->empty()) rSubstitute.setPdfData(mpPdfData); } else if( mpAnimation ) diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index df190f4861ee..f84d5e37f0ab 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1126,7 +1126,7 @@ bool SdrGrafObj::isEmbeddedPdfData() const return pGraphic->GetGraphic().hasPdfData(); } -std::shared_ptr<uno::Sequence<sal_Int8>> SdrGrafObj::getEmbeddedPdfData() const +std::shared_ptr<std::vector<sal_Int8>> SdrGrafObj::getEmbeddedPdfData() const { return pGraphic->GetGraphic().getPdfData(); } diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index f9417709f541..64fbdb83dbf9 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -114,7 +114,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) @@ -168,7 +168,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 d3ea4aece8c4..df8eac35bbe7 100644 --- a/svx/source/svdraw/svdpdf.hxx +++ b/svx/source/svdraw/svdpdf.hxx @@ -155,7 +155,7 @@ class ImpSdrPdfImport final ::std::vector<SdrObject*> maTmpList; ScopedVclPtr<VirtualDevice> mpVD; tools::Rectangle 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; @@ -232,7 +232,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 38be563ba9c6..cdbda1db341c 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -558,8 +558,8 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName, // vcl::ImportPDF() possibly downgraded the PDF data from a // higher PDF version, while aGfxLink still contains the // original data provided by the user. - std::shared_ptr<uno::Sequence<sal_Int8>> pPdfData = aGraphic.getPdfData(); - pStream->WriteBytes(pPdfData->getConstArray(), pPdfData->getLength()); + std::shared_ptr<std::vector<sal_Int8>> pPdfData = aGraphic.getPdfData(); + pStream->WriteBytes(pPdfData->data(), pPdfData->size()); // put into cache maExportPdf[aGraphic.getPdfData().get()] = std::make_pair(rPictureStreamName, aMimeType); diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 3b7b5045b42b..63687c3a8313 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -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()) { - 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; diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 3d998ec94ac5..a80e780d00f6 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -55,7 +55,7 @@ private: /// The PDF stream from which this Graphic is rendered, /// as converted (version downgraded) from the original, /// which should be in GfxLink. - std::shared_ptr<css::uno::Sequence<sal_Int8>> mpPdfData; + std::shared_ptr<std::vector<sal_Int8>> mpPdfData; OUString msOriginURL; GraphicExternalLink maGraphicExternalLink; @@ -93,7 +93,7 @@ private: bool hasPdfData() const { - return mpPdfData && mpPdfData->hasElements(); + return mpPdfData && !mpPdfData->empty(); } void ImplCreateSwapInfo(); @@ -174,9 +174,9 @@ private: const VectorGraphicDataPtr& getVectorGraphicData() const { return maVectorGraphicData; } - const std::shared_ptr<css::uno::Sequence<sal_Int8>>& getPdfData() const; + const std::shared_ptr<std::vector<sal_Int8>>& getPdfData() const; - void setPdfData(const std::shared_ptr<css::uno::Sequence<sal_Int8>>& rPdfData); + void setPdfData(const std::shared_ptr<std::vector<sal_Int8>>& rPdfData); }; #endif // INCLUDED_VCL_INC_IMPGRAPH_HXX diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 8240c4af3217..87bfdc60b629 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -226,7 +226,7 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBi bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, size_t nPageIndex, - css::uno::Sequence<sal_Int8>& rPdfData, + std::vector<sal_Int8>& rPdfData, sal_uInt64 nPos, sal_uInt64 nSize, const double fResolutionDPI) { @@ -244,9 +244,9 @@ bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, return false; aMemoryStream.Seek(STREAM_SEEK_TO_END); - rPdfData = css::uno::Sequence<sal_Int8>(aMemoryStream.Tell()); + rPdfData = std::vector<sal_Int8>(aMemoryStream.Tell()); aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemoryStream.ReadBytes(rPdfData.getArray(), rPdfData.getLength()); + aMemoryStream.ReadBytes(rPdfData.data(), rPdfData.size()); return true; } @@ -255,19 +255,19 @@ bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, bool ImportPDF(SvStream& rStream, Graphic& rGraphic, const double fResolutionDPI) { - uno::Sequence<sal_Int8> aPdfData; + std::vector<sal_Int8> aPdfData; Bitmap aBitmap; const bool bRet = ImportPDF(rStream, aBitmap, 0, aPdfData, STREAM_SEEK_TO_BEGIN, STREAM_SEEK_TO_END, fResolutionDPI); rGraphic = aBitmap; - rGraphic.setPdfData(std::make_shared<css::uno::Sequence<sal_Int8>>(aPdfData)); + rGraphic.setPdfData(std::make_shared<std::vector<sal_Int8>>(aPdfData)); rGraphic.setPageNumber(0); // We currently import only the first page. return bRet; } size_t ImportPDF(const OUString& rURL, std::vector<Bitmap>& rBitmaps, - css::uno::Sequence<sal_Int8>& rPdfData, + std::vector<sal_Int8>& rPdfData, const double fResolutionDPI) { std::unique_ptr<SvStream> xStream( @@ -282,9 +282,9 @@ size_t ImportPDF(const OUString& rURL, std::vector<Bitmap>& rBitmaps, return 0; aMemoryStream.Seek(STREAM_SEEK_TO_END); - rPdfData = css::uno::Sequence<sal_Int8>(aMemoryStream.Tell()); + rPdfData = std::vector<sal_Int8>(aMemoryStream.Tell()); aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemoryStream.ReadBytes(rPdfData.getArray(), rPdfData.getLength()); + aMemoryStream.ReadBytes(rPdfData.data(), rPdfData.size()); return rBitmaps.size(); } @@ -302,14 +302,14 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<std::pair<Graphic, Si // Copy into PdfData aMemoryStream.Seek(STREAM_SEEK_TO_END); - auto pPdfData = std::make_shared<css::uno::Sequence<sal_Int8>>(aMemoryStream.Tell()); + auto pPdfData = std::make_shared<std::vector<sal_Int8>>(aMemoryStream.Tell()); aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemoryStream.ReadBytes(pPdfData->getArray(), pPdfData->getLength()); + aMemoryStream.ReadBytes(pPdfData->data(), pPdfData->size()); // Prepare the link with the PDF stream. - const size_t nGraphicContentSize = pPdfData->getLength(); + const size_t nGraphicContentSize = pPdfData->size(); std::unique_ptr<sal_uInt8[]> pGraphicContent(new sal_uInt8[nGraphicContentSize]); - memcpy(pGraphicContent.get(), pPdfData->get(), nGraphicContentSize); + memcpy(pGraphicContent.get(), pPdfData->data(), nGraphicContentSize); std::shared_ptr<GfxLink> pGfxLink(std::make_shared<GfxLink>( std::move(pGraphicContent), nGraphicContentSize, GfxLinkType::NativePdf)); @@ -322,7 +322,7 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<std::pair<Graphic, Si // Load the buffer using pdfium. FPDF_DOCUMENT pPdfDocument - = FPDF_LoadMemDocument(pPdfData->getArray(), pPdfData->getLength(), /*password=*/nullptr); + = FPDF_LoadMemDocument(pPdfData->data(), pPdfData->size(), /*password=*/nullptr); if (!pPdfDocument) return 0; diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 04e567e44d5d..bf8da62b15cf 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -611,21 +611,21 @@ const VectorGraphicDataPtr& Graphic::getVectorGraphicData() const return mxImpGraphic->getVectorGraphicData(); } -void Graphic::setPdfData(const std::shared_ptr<uno::Sequence<sal_Int8>>& rPdfData) +void Graphic::setPdfData(const std::shared_ptr<std::vector<sal_Int8>>& rPdfData) { ImplTestRefCount(); mxImpGraphic->setPdfData(rPdfData); } -const std::shared_ptr<uno::Sequence<sal_Int8>>& Graphic::getPdfData() const +const std::shared_ptr<std::vector<sal_Int8>>& Graphic::getPdfData() const { return mxImpGraphic->getPdfData(); } bool Graphic::hasPdfData() const { - std::shared_ptr<uno::Sequence<sal_Int8>> pPdfData = getPdfData(); - return pPdfData && pPdfData->hasElements(); + std::shared_ptr<std::vector<sal_Int8>> pPdfData = getPdfData(); + return pPdfData && !pPdfData->empty(); } void Graphic::setPageNumber(sal_Int32 nPageNumber) diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 56d1c92da6a1..48f10e30a917 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -328,7 +328,7 @@ bool ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const bRet = (*maVectorGraphicData) == (*rImpGraphic.maVectorGraphicData); } } - else if (mpPdfData && mpPdfData->hasElements()) + else if (mpPdfData && !mpPdfData->empty()) { bRet = (rImpGraphic.mpPdfData && *mpPdfData == *rImpGraphic.mpPdfData); } @@ -352,12 +352,12 @@ bool ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const return bRet; } -void ImpGraphic::setPdfData(const std::shared_ptr<uno::Sequence<sal_Int8>>& rPdfData) +void ImpGraphic::setPdfData(const std::shared_ptr<std::vector<sal_Int8>>& rPdfData) { mpPdfData = rPdfData; } -const std::shared_ptr<uno::Sequence<sal_Int8>>& ImpGraphic::getPdfData() const +const std::shared_ptr<std::vector<sal_Int8>>& ImpGraphic::getPdfData() const { return mpPdfData; } @@ -1446,10 +1446,10 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const nRet = maEx.GetChecksum(); } - if (mpPdfData && mpPdfData->hasElements()) + if (mpPdfData && !mpPdfData->empty()) // Include the PDF data in the checksum, so a metafile with // and without PDF data is considered to be different. - nRet = vcl_get_checksum(nRet, mpPdfData->getConstArray(), mpPdfData->getLength()); + nRet = vcl_get_checksum(nRet, mpPdfData->data(), mpPdfData->size()); } break; @@ -1485,7 +1485,7 @@ bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const return bResult; } -static std::map<BitmapChecksum, std::shared_ptr<css::uno::Sequence<sal_Int8>>> sPdfDataCache; +static std::map<BitmapChecksum, std::shared_ptr<std::vector<sal_Int8>>> sPdfDataCache; void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) { @@ -1650,7 +1650,7 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) rImpGraphic.maEx = aBitmap; std::vector<Bitmap> aBitmaps; - if (vcl::RenderPDFBitmaps(rImpGraphic.mpPdfData->getConstArray(), rImpGraphic.mpPdfData->getLength(), aBitmaps, rImpGraphic.mnPageNumber, 1) == 1) + if (vcl::RenderPDFBitmaps(rImpGraphic.mpPdfData->data(), rImpGraphic.mpPdfData->size(), aBitmaps, rImpGraphic.mnPageNumber, 1) == 1) rImpGraphic.maEx = aBitmaps[0]; rImpGraphic.meType = GraphicType::Bitmap; @@ -1745,7 +1745,7 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic) } else if (rImpGraphic.hasPdfData()) { - BitmapChecksum nPdfId = vcl_get_checksum(0, rImpGraphic.mpPdfData->getConstArray(), rImpGraphic.mpPdfData->getLength()); + BitmapChecksum nPdfId = vcl_get_checksum(0, rImpGraphic.mpPdfData->data(), rImpGraphic.mpPdfData->size()); if (sPdfDataCache.find(nPdfId) == sPdfDataCache.end()) sPdfDataCache.emplace(nPdfId, rImpGraphic.mpPdfData); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index cc4dfab1aa46..0b5b74e21d3c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -4948,12 +4948,12 @@ bool PDFWriterImpl::emitEmbeddedFiles() aLine.append(rEmbeddedFile.m_nObject); aLine.append(" 0 obj\n"); aLine.append("<< /Type /EmbeddedFile /Length "); - aLine.append(static_cast<sal_Int64>(rEmbeddedFile.m_aData.getLength())); + aLine.append(static_cast<sal_Int64>(rEmbeddedFile.m_aData.size())); aLine.append(" >>\nstream\n"); CHECK_RETURN(writeBuffer(aLine.getStr(), aLine.getLength())); aLine.setLength(0); - CHECK_RETURN(writeBuffer(rEmbeddedFile.m_aData.getArray(), rEmbeddedFile.m_aData.getLength())); + CHECK_RETURN(writeBuffer(rEmbeddedFile.m_aData.data(), rEmbeddedFile.m_aData.size())); aLine.append("\nendstream\nendobj\n\n"); CHECK_RETURN(writeBuffer(aLine.getStr(), aLine.getLength())); @@ -8838,7 +8838,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject ) void PDFWriterImpl::writeJPG( JPGEmit& rObject ) { - if (rObject.m_aReferenceXObject.m_aPDFData.hasElements() && !m_aContext.UseReferenceXObject) + if (!rObject.m_aReferenceXObject.m_aPDFData.empty() && !m_aContext.UseReferenceXObject) { writeReferenceXObject(rObject.m_aReferenceXObject); return; @@ -9146,7 +9146,7 @@ void PDFWriterImpl::writeReferenceXObject(ReferenceXObjectEmit& rEmit) // Parse the PDF data, we need that to write the PDF dictionary of our // object. SvMemoryStream aPDFStream; - aPDFStream.WriteBytes(rEmit.m_aPDFData.getArray(), rEmit.m_aPDFData.getLength()); + aPDFStream.WriteBytes(rEmit.m_aPDFData.data(), rEmit.m_aPDFData.size()); aPDFStream.Seek(0); filter::PDFDocument aPDFDocument; if (!aPDFDocument.Read(aPDFStream)) @@ -9382,7 +9382,7 @@ namespace bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { - if (rObject.m_aReferenceXObject.m_aPDFData.hasElements() && !m_aContext.UseReferenceXObject) + if (!rObject.m_aReferenceXObject.m_aPDFData.empty() && !m_aContext.UseReferenceXObject) { writeReferenceXObject(rObject.m_aReferenceXObject); return true; diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index cf8fe720050c..e28896000963 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -224,7 +224,7 @@ public: /// Size of the bitmap replacement, in pixels. Size m_aPixelSize; /// PDF data from the graphic object, if not writing a reference XObject. - css::uno::Sequence<sal_Int8> m_aPDFData; + std::vector<sal_Int8> m_aPDFData; ReferenceXObjectEmit() : m_nFormObject(0), @@ -452,7 +452,7 @@ public: /// ID of the file. sal_Int32 m_nObject; /// Contents of the file. - css::uno::Sequence<sal_Int8> m_aData; + std::vector<sal_Int8> m_aData; PDFEmbeddedFile() : m_nObject(0) |