diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-10-18 11:19:04 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-03-23 17:17:11 +0100 |
commit | d5215e23e9f90792718b4462e5c565e9839e932a (patch) | |
tree | 3e4123597f1f2cc3124009154e420c463272114b /include | |
parent | 0b6100fd56691045d141075aad089683d59a76c2 (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).
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90561
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 6ac2d66c78d6c080aabfa46157113684c2f3a3b0)
Change-Id: Iac102f32b757390a03438c165e430283851cc10b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/81062
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
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 | 11 | ||||
-rw-r--r-- | include/vcl/vectorgraphicdata.hxx | 4 |
5 files changed, 4 insertions, 18 deletions
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index 4309e65956a7..2ad6bceea246 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -198,8 +198,6 @@ public: bool isEmbeddedVectorGraphicData() const; GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const; - bool isEmbeddedPdfData() 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/svx/xmlgrhlp.hxx b/include/svx/xmlgrhlp.hxx index 9acd14c1ee58..59eea65101a9 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 c8bbccd4574f..aff67351e3d9 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -227,10 +227,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 a088ed2c002b..986c208c25a5 100644 --- a/include/vcl/pdfread.hxx +++ b/include/vcl/pdfread.hxx @@ -37,16 +37,7 @@ VCL_DLLPUBLIC size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vecto const size_t nFirstPage = 0, int nPages = 1, const 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, const double fResolutionDPI = 96.); +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 159dc7afe286..ad402431181c 100644 --- a/include/vcl/vectorgraphicdata.hxx +++ b/include/vcl/vectorgraphicdata.hxx @@ -45,7 +45,8 @@ enum class VectorGraphicDataType { Svg = 0, Emf = 1, - Wmf = 2 + Wmf = 2, + Pdf = 3 }; class VCL_DLLPUBLIC VectorGraphicData @@ -69,6 +70,7 @@ private: std::unique_ptr<WmfExternal> mpExternalHeader; // on demand creators + void ensurePdfReplacement(); void ensureReplacement(); void ensureSequenceAndRange(); |