[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - svx/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 1 10:32:25 UTC 2020
svx/source/svdraw/svdedtv2.cxx | 17 ++++++++++++++++-
svx/source/svdraw/svdpdf.cxx | 13 ++++++++-----
svx/source/svdraw/svdpdf.hxx | 8 +++++---
3 files changed, 29 insertions(+), 9 deletions(-)
New commits:
commit bdfc08855324e71168e633fa579aa04add5c0957
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Mar 27 20:14:39 2020 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Apr 1 12:31:40 2020 +0200
pdfium: make breaking of PDF graphic work again
Changing PDF to use VectorGraphicData deleted the calls which
triggered the breaking of the PDF. This change makes breaking
work again.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91234
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit f265b14d6f8e3e63260b3c8ecce48d4251288fea)
Change-Id: I1d817f1556e37fcbcc3d2850b690eb0810676fa5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91446
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index d6ef069e9564..cf9746ae93ba 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -45,6 +45,7 @@
#include <sal/log.hxx>
#include <memory>
#include <vector>
+#include <vcl/graph.hxx>
using ::std::vector;
using namespace com::sun::star;
@@ -2043,7 +2044,21 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo)
SdrGrafObj* pGraf = dynamic_cast<SdrGrafObj*>( pObj );
if (pGraf != nullptr)
{
- if (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedVectorGraphicData())
+ Graphic aGraphic = pGraf->GetGraphic();
+ auto const & pVectorGraphicData = aGraphic.getVectorGraphicData();
+
+ if (pVectorGraphicData && pVectorGraphicData->getVectorGraphicDataType() == VectorGraphicDataType::Pdf)
+ {
+#if HAVE_FEATURE_PDFIUM
+ aLogicRect = pGraf->GetLogicRect();
+ ImpSdrPdfImport aFilter(*mpModel, pObj->GetLayer(), aLogicRect, aGraphic);
+ if (pGraf->getEmbeddedPageNumber() < aFilter.GetPageCount())
+ {
+ nInsAnz = aFilter.DoImport(*pOL, nInsPos, aGraphic.getPageNumber(), pProgrInfo);
+ }
+#endif // HAVE_FEATURE_PDFIUM
+ }
+ else if (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedVectorGraphicData() )
{
GDIMetaFile aMetaFile(GetMetaFile(pGraf));
if (aMetaFile.GetActionSize())
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index ecf78dbdd3e5..d24d85b2205d 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -29,6 +29,7 @@
#include <vcl/bitmapaccess.hxx>
#include <vcl/graph.hxx>
+#include <vcl/vectorgraphicdata.hxx>
#include <editeng/editdata.hxx>
#include <o3tl/make_unique.hxx>
@@ -115,11 +116,11 @@ struct FPDFBitmapDeleter
using namespace com::sun::star;
ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools::Rectangle& rRect,
- const std::shared_ptr<std::vector<sal_Int8>>& pPdfData)
- : maTmpList()
+ Graphic const& rGraphic)
+ : mrGraphic(rGraphic)
+ , maTmpList()
, mpVD(VclPtr<VirtualDevice>::Create())
, maScaleRect(rRect)
- , mpPdfData(pPdfData)
, mnMapScalingOfs(0)
, mpModel(&rModel)
, mnLayer(nLay)
@@ -163,8 +164,10 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools:
FPDF_InitLibraryWithConfig(&aConfig);
// Load the buffer using pdfium.
- mpPdfDocument = FPDF_LoadMemDocument(mpPdfData->data(), mpPdfData->size(),
- /*password=*/nullptr);
+ auto const& rVectorGraphicData = mrGraphic.getVectorGraphicData();
+ mpPdfDocument = FPDF_LoadMemDocument(
+ rVectorGraphicData->getVectorGraphicDataArray().getConstArray(),
+ rVectorGraphicData->getVectorGraphicDataArrayLength(), /*password=*/nullptr);
if (!mpPdfDocument)
{
//TODO: Handle failure to load.
diff --git a/svx/source/svdraw/svdpdf.hxx b/svx/source/svdraw/svdpdf.hxx
index 70b5a44e4ddf..1005b081142a 100644
--- a/svx/source/svdraw/svdpdf.hxx
+++ b/svx/source/svdraw/svdpdf.hxx
@@ -32,6 +32,7 @@
#include <tools/fract.hxx>
#include <vcl/metaact.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/graph.hxx>
#include <svx/svdobj.hxx>
#include <svx/xdash.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -158,10 +159,10 @@ class ImpSdrPdfImport final
double ma, mb, mc, md, me, mf;
};
- ::std::vector<SdrObject*> maTmpList;
+ Graphic const& mrGraphic;
+ std::vector<SdrObject*> maTmpList;
ScopedVclPtr<VirtualDevice> mpVD;
tools::Rectangle const maScaleRect;
- 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 +234,8 @@ class ImpSdrPdfImport final
public:
ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools::Rectangle& rRect,
- const std::shared_ptr<std::vector<sal_Int8>>& pPdfData);
+ Graphic const& rGraphic);
+
~ImpSdrPdfImport();
int GetPageCount() const { return mnPageCount; }
More information about the Libreoffice-commits
mailing list