summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2019-04-02 22:12:28 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-03-21 15:50:38 +0100
commit29852ce9ca039d34e6be73a2e006a577ff64adcd (patch)
tree3fedbe97ee7931239dfcb75fa089e143f7ff7faf /svx
parent53a2ff7260b61242c7e29af11c2e24c89857c233 (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) Reviewed-on: https://gerrit.libreoffice.org/77691 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> (cherry picked from commit eb581eff6ac41b938299b4c154ded6891bdd0c11) Change-Id: I877c9ccf96c4b7eabf3d643e17f324d86d987f94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90841 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx')
-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
5 files changed, 13 insertions, 13 deletions
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;