summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-03-13 20:04:45 +0100
committerTomaž Vajngerl <quikee@gmail.com>2020-03-23 17:18:00 +0100
commit571755b3653bb06586e7cae232d1ca943719a732 (patch)
tree62b51c6d529632159cf5bc90f21685863f03ec37 /filter
parentd5215e23e9f90792718b4462e5c565e9839e932a (diff)
pdfium: support for pages when using PDF import with pdfium
Moving PDF to use VectorGraphicData in Graphic has temporary removed the support for showing different PDF pages when opening the PDF using pdfium (LO_IMPORT_USE_PDFIUM=1). This adds the support for back by specifying whcih PDF page to render when creating the VectorGraphicData (and can't be changd afterwards), which is used to create a Graphic and contains the PDF source data array. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90562 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 27ee05f860e8225a41e15e0853fcef00a9d7a621) Change-Id: Ib915216b8d4c0c063d0fead44ff156b1915a35d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90844 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/pdf/pdfdecomposer.cxx28
1 files changed, 22 insertions, 6 deletions
diff --git a/filter/source/pdf/pdfdecomposer.cxx b/filter/source/pdf/pdfdecomposer.cxx
index c926b1b35a9d..a03e70bd5d1a 100644
--- a/filter/source/pdf/pdfdecomposer.cxx
+++ b/filter/source/pdf/pdfdecomposer.cxx
@@ -39,8 +39,9 @@ public:
XPdfDecomposer& operator=(const XPdfDecomposer&) = delete;
// XPdfDecomposer
- uno::Sequence<uno::Reference<graphic::XPrimitive2D>>
- SAL_CALL getDecomposition(const uno::Sequence<sal_Int8>& xPdfData) override;
+ uno::Sequence<uno::Reference<graphic::XPrimitive2D>> SAL_CALL
+ getDecomposition(const uno::Sequence<sal_Int8>& xPdfData,
+ const uno::Sequence<beans::PropertyValue>& xDecompositionParameters) override;
// XServiceInfo
OUString SAL_CALL getImplementationName() override;
@@ -50,12 +51,27 @@ public:
XPdfDecomposer::XPdfDecomposer(uno::Reference<uno::XComponentContext> const&) {}
-uno::Sequence<uno::Reference<graphic::XPrimitive2D>>
- SAL_CALL XPdfDecomposer::getDecomposition(const uno::Sequence<sal_Int8>& xPdfData)
+uno::Sequence<uno::Reference<graphic::XPrimitive2D>> SAL_CALL XPdfDecomposer::getDecomposition(
+ const uno::Sequence<sal_Int8>& xPdfData, const uno::Sequence<beans::PropertyValue>& xParameters)
{
+ sal_Int32 nPageIndex = -1;
+
+ for (sal_Int32 index = 0; index < xParameters.getLength(); index++)
+ {
+ const beans::PropertyValue& rProperty = xParameters[index];
+
+ if (rProperty.Name == "PageIndex")
+ {
+ rProperty.Value >>= nPageIndex;
+ }
+ }
+
+ if (nPageIndex < 0)
+ nPageIndex = 0;
+
std::vector<Bitmap> aBitmaps;
- vcl::RenderPDFBitmaps(xPdfData.getConstArray(), xPdfData.getLength(), aBitmaps, 0,
- 1 /*, fResolutionDPI*/);
+ vcl::RenderPDFBitmaps(xPdfData.getConstArray(), xPdfData.getLength(), aBitmaps, nPageIndex, 1);
+
BitmapEx aReplacement(aBitmaps[0]);
// short form for scale and translate transformation