include/svx/svdograf.hxx              |    4 +++-
 include/vcl/graph.hxx                 |    4 ++--
 include/vcl/pdfread.hxx               |    5 ++---
 svtools/qa/unit/GraphicObjectTest.cxx |    2 --
 svx/source/svdraw/svdograf.cxx        |    6 +++---
 svx/source/svdraw/svdpdf.cxx          |    4 ++--
 svx/source/svdraw/svdpdf.hxx          |    4 ++--
 svx/source/xml/xmlgrhlp.cxx           |    8 ++++----
 svx/source/xoutdev/_xoutbmp.cxx       |    4 ++--
 vcl/inc/impgraph.hxx                  |    8 ++++----
 vcl/source/filter/ipdf/pdfread.cxx    |   27 ++++++++++++++-------------
 vcl/source/gdi/graph.cxx              |    8 ++++----
 vcl/source/gdi/impgraph.cxx           |   20 ++++++++++----------
 vcl/source/gdi/pdfwriter_impl.cxx     |   10 +++++-----
 vcl/source/gdi/pdfwriter_impl.hxx     |    4 ++--
 15 files changed, 59 insertions(+), 59 deletions(-)

New commits:
commit 29852ce9ca039d34e6be73a2e006a577ff64adcd
Author:     Jan Holesovsky <ke...@collabora.com>
AuthorDate: Tue Apr 2 22:12:28 2019 +0200
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sat Mar 21 15:50:38 2020 +0100

    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)
    
    Reviewed-on: https://gerrit.libreoffice.org/77691
    Tested-by: Jenkins
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    (cherry picked from commit eb581eff6ac41b938299b4c154ded6891bdd0c11)
    
    Change-Id: I877c9ccf96c4b7eabf3d643e17f324d86d987f94
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90841
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index c3e2ae0c1874..4309e65956a7 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -144,7 +144,9 @@ public:
     const Graphic&          GetGraphic() const;
 
     Graphic                 GetTransformedGraphic( SdrGrafObjTransformsAttrs 
nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
+
     GraphicType             GetGraphicType() const;
+
     GraphicAttr             GetGraphicAttr( SdrGrafObjTransformsAttrs 
nTransformFlags = SdrGrafObjTransformsAttrs::ALL  ) const;
 
     // Keep ATM for SD.
@@ -197,7 +199,7 @@ public:
     GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const;
 
     bool isEmbeddedPdfData() const;
-    std::shared_ptr<css::uno::Sequence<sal_Int8>> const & getEmbeddedPdfData() 
const;
+    std::shared_ptr<std::vector<sal_Int8>> const & 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 cc8df96fc68c..2ad98c871cae 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -232,8 +232,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 1e555d9841c7..a088ed2c002b 100644
--- a/include/vcl/pdfread.hxx
+++ b/include/vcl/pdfread.hxx
@@ -39,15 +39,14 @@ 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, double 
fResolutionDPI = 96.);
 
 VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic, double 
fResolutionDPI = 96.);
 
 VCL_DLLPUBLIC size_t ImportPDF(const OUString& rURL, std::vector<Bitmap>& 
rBitmaps,
-                               css::uno::Sequence<sal_Int8>& rPdfData,
-                               const double fResolutionDPI = 96.);
+                               std::vector<sal_Int8>& rPdfData, const double 
fResolutionDPI = 96.);
 
 /// Import PDF as Graphic images (1 per page), all unloaded.
 /// Since Graphic is unloaded, we need to return the page size (in pixels) 
separately.
diff --git a/svtools/qa/unit/GraphicObjectTest.cxx 
b/svtools/qa/unit/GraphicObjectTest.cxx
index 3f6c69b7e051..3c0ed1ab9912 100644
--- a/svtools/qa/unit/GraphicObjectTest.cxx
+++ b/svtools/qa/unit/GraphicObjectTest.cxx
@@ -11,8 +11,6 @@
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/plugin/TestPlugIn.h>
 
-#include <vcl/GraphicObject.hxx>
-
 #include <test/bootstrapfixture.hxx>
 
 #include <tools/stream.hxx>
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 0e4413b3764f..ba87156b3769 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -138,6 +138,7 @@ std::unique_ptr<sdr::contact::ViewContact> 
SdrGrafObj::CreateObjectSpecificViewC
     return o3tl::make_unique<sdr::contact::ViewContactOfGraphic>(*this);
 }
 
+
 // check if SVG and if try to get ObjectInfoPrimitive2D and extract info
 
 void SdrGrafObj::onGraphicChanged()
@@ -335,7 +336,6 @@ void SdrGrafObj::SetGraphic( const Graphic& rGraphic )
 
 const Graphic& SdrGrafObj::GetGraphic() const
 {
-    ForceSwapIn();
     return mpGraphicObject->GetGraphic();
 }
 
@@ -456,6 +456,7 @@ Size SdrGrafObj::getOriginalSize() const
     return aSize;
 }
 
+// TODO Remove
 void SdrGrafObj::ForceSwapIn() const
 {
     if (pGraphicLink && (mpGraphicObject->GetType() == GraphicType::NONE  ||
@@ -704,7 +705,6 @@ SdrObject* SdrGrafObj::getFullDragClone() const
     // temporary interaction object and load graphic
     if(pRetval && IsLinkedGraphic())
     {
-        pRetval->ForceSwapIn();
         pRetval->ReleaseGraphicLink();
     }
 
@@ -894,7 +894,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 881880255f90..ecf78dbdd3e5 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -115,7 +115,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)
@@ -163,7 +163,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 4e99e87b21a5..b84a268f66bd 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -295,7 +295,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)
         {
@@ -759,8 +759,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());
@@ -775,7 +775,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 9b9f28944771..83f42f4df95d 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -184,8 +184,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 30c88594c5d6..b61c5d24c901 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -87,7 +87,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;
     std::unique_ptr<GraphicID>   mpGraphicID;
     GraphicExternalLink          maGraphicExternalLink;
 
@@ -139,7 +139,7 @@ private:
 
     bool hasPdfData() const
     {
-        return mpPdfData && mpPdfData->hasElements();
+        return mpPdfData && !mpPdfData->empty();
     }
 
     void                ImplCreateSwapInfo();
@@ -223,9 +223,9 @@ private:
 
     const VectorGraphicDataPtr& getVectorGraphicData() const;
 
-    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);
 
     bool ensureAvailable () const;
 
diff --git a/vcl/source/filter/ipdf/pdfread.cxx 
b/vcl/source/filter/ipdf/pdfread.cxx
index b7b43c1d0d4d..bd406deac93e 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -18,6 +18,7 @@
 #endif
 
 #include <impgraph.hxx>
+
 #include <vcl/graph.hxx>
 #include <bitmapwriteaccess.hxx>
 #include <unotools/ucbstreamhelper.hxx>
@@ -213,7 +214,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, sal_uInt64 nPos, 
sal_uInt64 nSize,
+               std::vector<sal_Int8>& rPdfData, sal_uInt64 nPos, sal_uInt64 
nSize,
                const double fResolutionDPI)
 {
     // Get the preview of the first page.
@@ -229,27 +230,27 @@ bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, size_t 
nPageIndex,
     if (!getCompatibleStream(rStream, aMemoryStream, nPos, nSize))
         return false;
 
-    rPdfData = css::uno::Sequence<sal_Int8>(aMemoryStream.TellEnd());
+    rPdfData = std::vector<sal_Int8>(aMemoryStream.TellEnd());
     aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
-    aMemoryStream.ReadBytes(rPdfData.getArray(), rPdfData.getLength());
+    aMemoryStream.ReadBytes(rPdfData.data(), rPdfData.size());
 
     return true;
 }
 
 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, const double 
fResolutionDPI)
+                 std::vector<sal_Int8>& rPdfData, const double fResolutionDPI)
 {
     std::unique_ptr<SvStream> xStream(
         ::utl::UcbStreamHelper::CreateStream(rURL, StreamMode::READ | 
StreamMode::SHARE_DENYNONE));
@@ -264,9 +265,9 @@ size_t ImportPDF(const OUString& rURL, std::vector<Bitmap>& 
rBitmaps,
     if (!getCompatibleStream(*xStream, aMemoryStream, STREAM_SEEK_TO_BEGIN, 
STREAM_SEEK_TO_END))
         return 0;
 
-    rPdfData = css::uno::Sequence<sal_Int8>(aMemoryStream.TellEnd());
+    rPdfData = std::vector<sal_Int8>(aMemoryStream.TellEnd());
     aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN);
-    aMemoryStream.ReadBytes(rPdfData.getArray(), rPdfData.getLength());
+    aMemoryStream.ReadBytes(rPdfData.data(), rPdfData.size());
 
     return rBitmaps.size();
 }
@@ -284,14 +285,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));
 
@@ -304,7 +305,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 9a9cfea8502f..18f7fd385dd2 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -570,21 +570,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 f3806ae06a53..e9fc256e9508 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -126,13 +126,13 @@ GraphicID::GraphicID(ImpGraphic const & rGraphic)
         }
         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.ImplGetBitmapExRef();
 
             mnID1 |= (rGraphic.mnPageNumber & 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.ImplIsAnimated())
         {
@@ -440,7 +440,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);
                 }
@@ -471,14 +471,14 @@ const VectorGraphicDataPtr& 
ImpGraphic::getVectorGraphicData() const
     return maVectorGraphicData;
 }
 
-void ImpGraphic::setPdfData(const std::shared_ptr<uno::Sequence<sal_Int8>>& 
rPdfData)
+void ImpGraphic::setPdfData(const std::shared_ptr<std::vector<sal_Int8>>& 
rPdfData)
 {
     ensureAvailable();
 
     mpPdfData = rPdfData;
 }
 
-const std::shared_ptr<uno::Sequence<sal_Int8>>& ImpGraphic::getPdfData() const
+const std::shared_ptr<std::vector<sal_Int8>>& ImpGraphic::getPdfData() const
 {
     ensureAvailable();
 
@@ -1710,10 +1710,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;
 
@@ -1751,7 +1751,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 )
 {
@@ -1915,7 +1915,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;
@@ -2011,7 +2011,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 ed542157340b..39a0e2004d3f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -4875,12 +4875,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()));
@@ -8816,7 +8816,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;
@@ -9130,7 +9130,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))
@@ -9366,7 +9366,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 7ba9a79b5376..18b0059fb69e 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -204,7 +204,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),
@@ -424,7 +424,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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to