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 /svx/source/xml | |
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 'svx/source/xml')
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index ed5b97aa15b9..e456900f78cf 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -754,29 +754,7 @@ 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<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()); - if (aIt != maExportPdf.end()) - { - auto const& aURLAndMimePair = aIt->second; - rOutSavedMimeType = aURLAndMimePair.second; - return aURLAndMimePair.first; - } - - // The graphic has PDF data attached to it, use that. - // 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->data(), rPdfData->size()); - } - else - { - pStream->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize()); - } - + pStream->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize()); rOutSavedMimeType = aMimeType; bSuccess = (pStream->GetError() == ERRCODE_NONE); } @@ -842,8 +820,6 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X // put into cache maExportGraphics[aGraphic] = std::make_pair(aStoragePath, rOutSavedMimeType); - if (aGraphic.hasPdfData()) - maExportPdf[aGraphic.getPdfData().get()] = std::make_pair(aStoragePath, rOutSavedMimeType); return aStoragePath; } |