diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-10-18 11:19:04 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-03-17 22:01:15 +0100 |
commit | 6ac2d66c78d6c080aabfa46157113684c2f3a3b0 (patch) | |
tree | f9f3311931b517eeeca54701aa9dc772ee28698a /include | |
parent | dc3c59a1d9e9240acfbc1a613115f04f577d1ca4 (diff) |
pdfium: Make Insert -> Image... use VectorGraphicData for PDF.
In principle, the current Svg/Emf/Wmf and PDF handling is trying to
achieve the same thing: Keep the original stream untouched, provide a
replacement graphics, and a kind of rendering.
To hold the data, the Svg/Emf/Wmf and PDF were using different structures
though. This commit consolidatates that, and makes the Insert
-> Image... (for PDF) actually using the VectorGraphicData to hold the
original stream.
This breaks loading the PDF as a document via PDFium - I'll fix it in
the next commit(s).
Change-Id: Iac102f32b757390a03438c165e430283851cc10b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90561
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svx/svdograf.hxx | 2 | ||||
-rw-r--r-- | include/svx/xmlgrhlp.hxx | 1 | ||||
-rw-r--r-- | include/vcl/graph.hxx | 4 | ||||
-rw-r--r-- | include/vcl/pdfread.hxx | 12 | ||||
-rw-r--r-- | include/vcl/vectorgraphicdata.hxx | 4 |
5 files changed, 5 insertions, 18 deletions
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index 8944db82bc2d..db4a3f168892 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -199,8 +199,6 @@ public: bool isEmbeddedVectorGraphicData() const; GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const; - bool isEmbeddedPdfData() const; - 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/svx/xmlgrhlp.hxx b/include/svx/xmlgrhlp.hxx index 3f80f0191ba4..37d8c63bda35 100644 --- a/include/svx/xmlgrhlp.hxx +++ b/include/svx/xmlgrhlp.hxx @@ -58,7 +58,6 @@ private: std::unordered_map<OUString, css::uno::Reference<css::graphic::XGraphic>> maGraphicObjects; std::unordered_map<Graphic, std::pair<OUString, OUString>> maExportGraphics; - std::unordered_map<void*, std::pair<OUString, OUString>> maExportPdf; SvXMLGraphicHelperMode meCreateMode; OUString maOutputMimeType; diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index b159d4bf3797..271de60d1605 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -204,10 +204,6 @@ public: const VectorGraphicDataPtr& getVectorGraphicData() 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. void setPageNumber(sal_Int32 nPageNumber); /// Get 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 d16c951f81cd..b56e8139447d 100644 --- a/include/vcl/pdfread.hxx +++ b/include/vcl/pdfread.hxx @@ -37,16 +37,8 @@ VCL_DLLPUBLIC size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vecto size_t nFirstPage = 0, int nPages = 1, double fResolutionDPI = 96.); -/// Imports a PDF stream into rGraphic as a GDIMetaFile. -VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, size_t nPageIndex, - 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, - std::vector<sal_Int8>& rPdfData, double fResolutionDPI = 96.); +/// Imports a PDF stream into rGraphic as VectorGraphicData. +VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic); /// 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/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx index b05671852c2c..096c89e1aa56 100644 --- a/include/vcl/vectorgraphicdata.hxx +++ b/include/vcl/vectorgraphicdata.hxx @@ -46,7 +46,8 @@ enum class VectorGraphicDataType { Svg = 0, Emf = 1, - Wmf = 2 + Wmf = 2, + Pdf = 3 }; class VCL_DLLPUBLIC VectorGraphicData @@ -70,6 +71,7 @@ private: std::unique_ptr<WmfExternal> mpExternalHeader; // on demand creators + void ensurePdfReplacement(); void ensureReplacement(); void ensureSequenceAndRange(); |