[Libreoffice-commits] core.git: external/pdfium svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Aug 15 07:06:51 UTC 2018
external/pdfium/0001-Add-FPDFFormObj_GetObject-API.patch.1 | 108 ++++++++++
external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2 | 6
external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 | 72 ------
external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2 | 28 ++
external/pdfium/0012-svx-import-processed-PDF-text.patch.2 | 14 -
external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 | 9
external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 | 6
external/pdfium/UnpackedTarball_pdfium.mk | 3
svx/source/svdraw/svdpdf.cxx | 2
9 files changed, 146 insertions(+), 102 deletions(-)
New commits:
commit e264e31cd904d373f43240bb626b3a0d66f95d26
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Tue Aug 14 21:01:28 2018 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Wed Aug 15 09:06:22 2018 +0200
pdfium: replace FPDFFormObj_GetSubObject() with backport
Change-Id: If5fc2fb328320f6cad608bebbc704ced3d69cee8
Reviewed-on: https://gerrit.libreoffice.org/59006
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/external/pdfium/0001-Add-FPDFFormObj_GetObject-API.patch.1 b/external/pdfium/0001-Add-FPDFFormObj_GetObject-API.patch.1
new file mode 100644
index 000000000000..8aec3cd21fa6
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFFormObj_GetObject-API.patch.1
@@ -0,0 +1,108 @@
+From 1d273f1cf00676725da6f0cd17e107f114030e87 Mon Sep 17 00:00:00 2001
+Date: Mon, 16 Jul 2018 19:20:36 +0000
+Subject: [PATCH] Add FPDFFormObj_GetObject() API
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+To be used together with the existing FPDFFormObj_CountObjects()
+function.
+
+Change-Id: I8ed69624e967708c8db7e8f135e28fbe6a52752f
+Reviewed-on: https://pdfium-review.googlesource.com/37890
+Reviewed-by: Nicolás Peña Moreno <npm at chromium.org>
+Reviewed-by: Henrique Nakashima <hnakashima at chromium.org>
+Commit-Queue: Nicolás Peña Moreno <npm at chromium.org>
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp | 20 +++++++++++++++++++
+ fpdfsdk/fpdf_editpage.cpp | 41 +++++++++++++++++++++++++++-----------
+ fpdfsdk/fpdf_view_c_api_test.c | 1 +
+ public/fpdf_edit.h | 10 ++++++++++
+ 4 files changed, 60 insertions(+), 12 deletions(-)
+
+diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
+index ded55b9be..f1dbf7019 100644
+--- a/fpdfsdk/fpdf_editpage.cpp
++++ b/fpdfsdk/fpdf_editpage.cpp
+@@ -140,6 +140,23 @@ unsigned int GetUnsignedAlpha(float alpha) {
+ return static_cast<unsigned int>(alpha * 255.f + 0.5f);
+ }
+
++const CPDF_PageObjectList* CPDFPageObjListFromFPDFFormObject(
++ FPDF_PAGEOBJECT page_object) {
++ auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
++ if (!pPageObj)
++ return nullptr;
++
++ CPDF_FormObject* pFormObject = pPageObj->AsForm();
++ if (!pFormObject)
++ return nullptr;
++
++ const CPDF_Form* pForm = pFormObject->form();
++ if (!pForm)
++ return nullptr;
++
++ return pForm->GetPageObjectList();
++}
++
+ } // namespace
+
+ FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument() {
+@@ -812,21 +829,21 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
+
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFFormObj_CountObjects(FPDF_PAGEOBJECT page_object) {
+- auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
+- if (!pPageObj)
+- return -1;
+-
+- CPDF_FormObject* pFormObject = pPageObj->AsForm();
+- if (!pFormObject)
++ const CPDF_PageObjectList* pObjectList =
++ CPDFPageObjListFromFPDFFormObject(page_object);
++ if (!pObjectList)
+ return -1;
+
+- const CPDF_Form* pForm = pFormObject->form();
+- if (!pForm)
+- return -1;
++ return pObjectList->size();
++}
+
+- const CPDF_PageObjectList* pObjectList = pForm->GetPageObjectList();
++FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
++FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index) {
++ const CPDF_PageObjectList* pObjectList =
++ CPDFPageObjListFromFPDFFormObject(form_object);
+ if (!pObjectList)
+- return -1;
++ return nullptr;
+
+- return pObjectList->size();
++ return FPDFPageObjectFromCPDFPageObject(
++ pObjectList->GetPageObjectByIndex(index));
+ }
+diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
+index fdd8c97d0..b97a7adbd 100644
+--- a/public/fpdf_edit.h
++++ b/public/fpdf_edit.h
+@@ -1265,6 +1265,16 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text);
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
+
++// Experimental API.
++// Get page object in |form_object| at |index|.
++//
++// form_object - handle to a form object.
++// index - the 0-based index of a page object.
++//
++// Returns the handle to the page object, or NULL on error.
++FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
++FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index);
++
+ #ifdef __cplusplus
+ } // extern "C"
+ #endif // __cplusplus
+--
+2.16.4
+
diff --git a/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2 b/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
index 896e676bf287..473fe55fd2e8 100644
--- a/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
+++ b/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
@@ -40,9 +40,9 @@ index 912df63..3244943 100644
diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
--- a/pdfium/public/fpdf_edit.h
+++ b/pdfium/public/fpdf_edit.h
-@@ -1142,6 +1142,15 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text);
- FPDF_EXPORT int FPDF_CALLCONV
- FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
+@@ -1152,6 +1152,15 @@ FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
+ FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+ FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index);
+// Get the number of characters from a text object.
+//
diff --git a/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 b/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2
deleted file mode 100644
index 346ce2c2848c..000000000000
--- a/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2
+++ /dev/null
@@ -1,72 +0,0 @@
-From 636f92aac24f0accfbce910c9153d5479e097e5f Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
-Date: Tue, 5 Jun 2018 11:34:38 +0200
-Subject: [PATCH 10/14] svx: support importing forms from PDFs
-
----
- pdfium/fpdfsdk/cpdfsdk_helpers.h | 5 +++++
- pdfium/fpdfsdk/fpdf_editpage.cpp | 30 ++++++++++++++++++++++++++++++
- pdfium/public/fpdf_edit.h | 17 +++++++++++++++++
- 3 files changed, 52 insertions(+)
-
-diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h
-index 13362cf..477bb74 100644
---- a/pdfium/fpdfsdk/cpdfsdk_helpers.h
-+++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h
-@@ -209,6 +209,11 @@ inline CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(
- return reinterpret_cast<CPDF_TextObject*>(page_object);
- }
-
-+inline CPDF_FormObject* CPDFFormObjectFromFPDFPageObject(
-+ FPDF_PAGEOBJECT page_object) {
-+ return reinterpret_cast<CPDF_FormObject*>(page_object);
-+}
-+
- ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
-
- #ifdef PDF_ENABLE_XFA
-diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
-index 9c353a4..bf68250 100644
---- a/pdfium/fpdfsdk/fpdf_editpage.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -671,3 +671,17 @@ FPDFFormObj_CountObjects(FPDF_PAGEOBJECT page_object) {
-
- return pObjectList->size();
- }
-+
-+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
-+FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
-+{
-+ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object);
-+ if (pFrmObj)
-+ {
-+ const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
-+ if (pObjectList)
-+ return pObjectList->GetPageObjectByIndex(index);
-+ }
-+
-+ return nullptr;
-+}
-diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
-index 4264ccd..ca76954 100644
---- a/pdfium/public/fpdf_edit.h
-+++ b/pdfium/public/fpdf_edit.h
-@@ -1151,6 +1151,15 @@ FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
- FPDF_EXPORT int FPDF_CALLCONV
- FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
-
-+// Get the page object from a form object.
-+//
-+// form_object - Handle to a form object. Returned by FPDFPage_GetObject.
-+// index - The index of a page object.
-+// Return value:
-+// The handle of the page object. Null for failed.
-+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
-+FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index);
-+
- #ifdef __cplusplus
- } // extern "C"
- #endif // __cplusplus
---
-2.16.3
-
diff --git a/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2 b/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2
index 081840e20576..3849de8b7c24 100644
--- a/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2
+++ b/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2
@@ -8,13 +8,29 @@ Subject: [PATCH 11/14] svx: correctly possition form objects from PDF
pdfium/public/fpdf_edit.h | 18 ++++++++++++++++++
2 files changed, 43 insertions(+)
+diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h
+index 13362cf..477bb74 100644
+--- a/pdfium/fpdfsdk/cpdfsdk_helpers.h
++++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h
+@@ -209,6 +209,11 @@ inline CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(
+ return reinterpret_cast<CPDF_TextObject*>(page_object);
+ }
+
++inline CPDF_FormObject* CPDFFormObjectFromFPDFPageObject(
++ FPDF_PAGEOBJECT page_object) {
++ return reinterpret_cast<CPDF_FormObject*>(page_object);
++}
++
+ ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
+
+ #ifdef PDF_ENABLE_XFA
diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
index bf68250..f4a1688 100644
--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -810,3 +810,28 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
-
- return nullptr;
+@@ -688,3 +688,28 @@ FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index) {
+ return FPDFPageObjectFromCPDFPageObject(
+ pObjectList->GetPageObjectByIndex(index));
}
+
+FPDF_EXPORT void FPDF_CALLCONV
@@ -45,9 +61,9 @@ diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
index ca76954..f249e64 100644
--- a/pdfium/public/fpdf_edit.h
+++ b/pdfium/public/fpdf_edit.h
-@@ -1098,6 +1098,24 @@ FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object);
- FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
- FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index);
+@@ -1161,6 +1161,24 @@ FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index);
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+// Get the matrix of a particular form object.
+//
diff --git a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2 b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
index 7996e7cd87e1..24ec2dfc5349 100644
--- a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
+++ b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
@@ -72,7 +72,7 @@ index f4a1688..f34d3b5 100644
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "public/fpdf_formfill.h"
#include "third_party/base/logging.h"
-@@ -651,6 +652,46 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
+@@ -668,6 +669,46 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
return true;
}
@@ -118,14 +118,14 @@ index f4a1688..f34d3b5 100644
+
FPDF_EXPORT int FPDF_CALLCONV
FPDFFormObj_CountObjects(FPDF_PAGEOBJECT page_object) {
- auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
+ const CPDF_PageObjectList* pObjectList =
diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
index f249e64..e14b2a5 100644
--- a/pdfium/public/fpdf_edit.h
+++ b/pdfium/public/fpdf_edit.h
-@@ -1151,6 +1151,19 @@ FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
- FPDF_EXPORT int FPDF_CALLCONV
- FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+@@ -1152,6 +1152,19 @@ FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
+ FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+ FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index);
+// Get the processed text of a text object.
+//
@@ -140,9 +140,9 @@ index f249e64..e14b2a5 100644
+ int char_count,
+ unsigned short* result);
+
- // Get the page object from a form object.
+ // Get the number of characters from a text object.
//
- // form_object - Handle to a form object. Returned by FPDFPage_GetObject.
+ // text_object - Handle of text object returned by FPDFPageObj_NewTextObj
--
2.16.3
diff --git a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
index e0d5ae1abff8..f664c80232a5 100644
--- a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
+++ b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
@@ -49,15 +49,6 @@ index 29c8b01..a52e1a9 100644
return ret_count;
}
-@@ -714,7 +714,7 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
- {
- const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
- if (pObjectList)
-- return pObjectList->GetPageObjectByIndex(index);
-+ return FPDFPageObjectFromCPDFPageObject(pObjectList->GetPageObjectByIndex(index));
- }
-
- return nullptr;
--
2.16.3
diff --git a/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 b/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
index 9ce208578d0b..2dce41ae65aa 100644
--- a/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
+++ b/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
@@ -54,9 +54,9 @@ diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
index 4351649..f858ab2 100644
--- a/pdfium/public/fpdf_edit.h
+++ b/pdfium/public/fpdf_edit.h
-@@ -1142,6 +1142,17 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text);
- FPDF_EXPORT int FPDF_CALLCONV
- FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
+@@ -1165,6 +1165,17 @@ FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
+ int char_count,
+ unsigned short* result);
+// Get the font name of a text object.
+//
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 957a859625f4..3506a027a0a0 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -19,10 +19,11 @@ pdfium_patches += 0001-Add-FPDFTextObj_GetFontSize-API.patch.patch.1
pdfium_patches += 0001-Add-FPDFText_GetTextRenderMode-API.patch.1
# Backport of <https://pdfium-review.googlesource.com/37316>.
pdfium_patches += 0001-Add-FPDFFormObj_CountObjects-API.patch.1
+# Backport of <https://pdfium-review.googlesource.com/37890>.
+pdfium_patches += 0001-Add-FPDFFormObj_GetObject-API.patch.1
pdfium_patches += 0002-svx-more-accurate-PDF-text-importing.patch.2
pdfium_patches += 0003-svx-import-PDF-images-as-BGRA.patch.2
pdfium_patches += 0004-svx-support-PDF-text-color.patch.2
-pdfium_patches += 0010-svx-support-importing-forms-from-PDFs.patch.2
pdfium_patches += 0011-svx-correctly-possition-form-objects-from-PDF.patch.2
pdfium_patches += 0012-svx-import-processed-PDF-text.patch.2
pdfium_patches += 0014-svx-update-PDFium-patch-and-code.patch.2
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 682e6681e950..8faf9c6649eb 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -793,7 +793,7 @@ void ImpSdrPdfImport::ImportForm(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex
const int nCount = FPDFFormObj_CountObjects(pPageObject);
for (int nIndex = 0; nIndex < nCount; ++nIndex)
{
- FPDF_PAGEOBJECT pFormObject = FPDFFormObj_GetSubObject(pPageObject, nIndex);
+ FPDF_PAGEOBJECT pFormObject = FPDFFormObj_GetObject(pPageObject, nIndex);
ImportPdfObject(pFormObject, pTextPage, -1);
}
More information about the Libreoffice-commits
mailing list