summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2019-04-02 22:12:28 +0200
committerAshod Nakashian <ashnakash@gmail.com>2019-08-25 13:42:06 +0200
commiteb581eff6ac41b938299b4c154ded6891bdd0c11 (patch)
tree8cc33a7850cc65d754667d7d1dfb3376b2428f1c
parent81f73f1c1706d790c010e8fc0abcb2a0e9e86ace (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>
-rw-r--r--include/svx/svdograf.hxx4
-rw-r--r--include/vcl/graph.hxx4
-rw-r--r--include/vcl/pdfread.hxx5
-rw-r--r--svtools/qa/unit/GraphicObjectTest.cxx2
-rw-r--r--svx/source/svdraw/svdograf.cxx6
-rw-r--r--svx/source/svdraw/svdpdf.cxx4
-rw-r--r--svx/source/svdraw/svdpdf.hxx4
-rw-r--r--svx/source/xml/xmlgrhlp.cxx8
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx4
-rw-r--r--vcl/inc/impgraph.hxx8
-rw-r--r--vcl/source/filter/ipdf/pdfread.cxx27
-rw-r--r--vcl/source/gdi/graph.cxx8
-rw-r--r--vcl/source/gdi/impgraph.cxx20
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx10
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx4
15 files changed, 59 insertions, 59 deletions
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 597f5c42e743..02bcc83357fd 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -147,7 +147,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.
@@ -200,7 +202,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 f3f0c0aa1ab3..91371a82beeb 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -223,8 +223,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 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;
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 8837dc63903c..1a1d2f283f1c 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -91,7 +91,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;
@@ -143,7 +143,7 @@ private:
bool hasPdfData() const
{
- return mpPdfData && mpPdfData->hasElements();
+ return mpPdfData && !mpPdfData->empty();
}
void ImplCreateSwapInfo();
@@ -227,9 +227,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 06d9c80d321a..5159145cb055 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -547,21 +547,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 7547853eba2a..8a1936020051 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -125,13 +125,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())
{
@@ -439,7 +439,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);
}
@@ -470,14 +470,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();
@@ -1696,10 +1696,10 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
{
if(maVectorGraphicData)
nRet = maVectorGraphicData->GetChecksum();
- else if (mpPdfData && mpPdfData->hasElements())
+ else 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());
else if( mpAnimation )
nRet = mpAnimation->GetChecksum();
else
@@ -1742,7 +1742,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 )
{
@@ -1906,7 +1906,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;
@@ -2002,7 +2002,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 1bcc180a0863..dc9e4f249b6a 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -4516,12 +4516,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()));
@@ -8473,7 +8473,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;
@@ -8787,7 +8787,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))
@@ -9023,7 +9023,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 7dd40d96e039..68d2cbce80e9 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -203,7 +203,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),
@@ -423,7 +423,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)