summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-05-31 20:25:11 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-07-29 18:44:33 +0200
commit90b043013fdcf7ea5daffe09b6f26446e902f1d0 (patch)
tree124627622b7db3a294eecd351c4e86a93ec95447
parent001ef8612d938299781dec4730ae702082d18a24 (diff)
tdf#133547 Fix breaking of PDF graphic objects
ImpSdrPdfImport did not handle -1 as the page number correctly. When the page number is -1 it means it was never explicitly set and should be treated as page with index 0 most of the time. So instead of allowing -1 as the page index, return it as 0 already in Graphic (VectorGraphicData). Change-Id: I3813f3ceeb5e41cb06fc40d67297d2439d7f3407 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95227 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 573de30566e4477c8dc09abec08f1082d16c74bc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95800 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> (cherry picked from commit 1e6b3014f1ecb06c40d3f1549351870abc4f9582)
-rw-r--r--include/vcl/vectorgraphicdata.hxx3
-rw-r--r--svx/source/svdraw/svdedtv2.cxx2
2 files changed, 3 insertions, 2 deletions
diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx
index 10069d5119a8..75688d2b00a7 100644
--- a/include/vcl/vectorgraphicdata.hxx
+++ b/include/vcl/vectorgraphicdata.hxx
@@ -27,6 +27,7 @@
#include <rtl/ustring.hxx>
#include <deque>
#include <memory>
+#include <algorithm>
typedef css::uno::Sequence<sal_Int8> VectorGraphicDataArray;
@@ -109,7 +110,7 @@ public:
const BitmapEx& getReplacement() const;
BitmapChecksum GetChecksum() const;
- sal_Int32 getPageIndex() const { return mnPageIndex; }
+ sal_Int32 getPageIndex() const { return std::max(sal_Int32(0), mnPageIndex); }
bool isPrimitiveSequenceCreated() const { return mbSequenceCreated; }
};
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index cf9746ae93ba..e4d58699ad1d 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -2052,7 +2052,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo)
#if HAVE_FEATURE_PDFIUM
aLogicRect = pGraf->GetLogicRect();
ImpSdrPdfImport aFilter(*mpModel, pObj->GetLayer(), aLogicRect, aGraphic);
- if (pGraf->getEmbeddedPageNumber() < aFilter.GetPageCount())
+ if (aGraphic.getPageNumber() < aFilter.GetPageCount())
{
nInsAnz = aFilter.DoImport(*pOL, nInsPos, aGraphic.getPageNumber(), pProgrInfo);
}