diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-09-18 21:07:10 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-12-17 13:55:51 +0100 |
commit | 8024c3c7cf3c681ec23348db7dc8fee1759d9128 (patch) | |
tree | 3822c19113fe0b57eb77a35055ec8eca70baffc2 | |
parent | 3465490b8bcc9606596b1011a530f4955daf8d0a (diff) |
pdfium: update to 3550
Allows dropping all the backports, so only one custom API patch remains.
(cherry picked from commit 56ac8214ab35387f8861044b62c79fae6d7ccac5)
[ This brings pdfium to the same version as cp-6.2, ignoring recent
changes. ]
Conflicts:
external/pdfium/UnpackedTarball_pdfium.mk
Change-Id: I13dc4f62be86d0859862cbd95bb14e07bbcf53d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107866
Tested-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | download.lst | 4 | ||||
-rw-r--r-- | external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2 | 82 | ||||
-rw-r--r-- | external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2 | 4 | ||||
-rw-r--r-- | external/pdfium/0004-svx-support-PDF-text-color.patch.2 | 119 | ||||
-rw-r--r-- | external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2 | 100 | ||||
-rw-r--r-- | external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 | 94 | ||||
-rw-r--r-- | external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2 | 75 | ||||
-rw-r--r-- | external/pdfium/0012-svx-import-processed-PDF-text.patch.2 | 148 | ||||
-rw-r--r-- | external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 | 83 | ||||
-rw-r--r-- | external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 | 77 | ||||
-rw-r--r-- | external/pdfium/Library_pdfium.mk | 37 | ||||
-rw-r--r-- | external/pdfium/UnpackedTarball_pdfium.mk | 11 | ||||
-rw-r--r-- | external/pdfium/build.patch.1 | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdpdf.cxx | 48 |
14 files changed, 67 insertions, 821 deletions
diff --git a/download.lst b/download.lst index 37c69be838d2..ac943bfadb04 100644 --- a/download.lst +++ b/download.lst @@ -214,8 +214,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b633 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz -export PDFIUM_SHA256SUM := 4acbc905fee1743e96169ca155347a81fb2b0f381281109c1860aa4408ec6c4f -export PDFIUM_TARBALL := pdfium-3471.tar.bz2 +export PDFIUM_SHA256SUM := 572460f7f9e2f86d022a9c6a82f1e2ded6c3c29ba352d4b9fac60b87e2159679 +export PDFIUM_TARBALL := pdfium-3550.tar.bz2 export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca 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 deleted file mode 100644 index ef6649b5f4cb..000000000000 --- a/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2 +++ /dev/null @@ -1,82 +0,0 @@ -From 5f83d0a3fac4f8ccef457c03b74433ffd7b12e2a Mon Sep 17 00:00:00 2001 -From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> -Date: Tue, 5 Jun 2018 11:28:30 +0200 -Subject: [PATCH 02/14] svx: more accurate PDF text importing - ---- - pdfium/fpdfsdk/fpdf_editpage.cpp | 84 ++++++++++++++++++++++++++++++++++++++++ - pdfium/public/fpdf_edit.h | 36 +++++++++++++++++ - 2 files changed, 120 insertions(+) - -diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp -index 912df63..3244943 100644 ---- a/pdfium/fpdfsdk/fpdf_editpage.cpp -+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp -@@ -13,6 +13,7 @@ - - #include "constants/page_object.h" - #include "core/fpdfapi/edit/cpdf_pagecontentgenerator.h" -+#include "core/fpdfapi/font/cpdf_font.h" - #include "core/fpdfapi/page/cpdf_form.h" - #include "core/fpdfapi/page/cpdf_formobject.h" - #include "core/fpdfapi/page/cpdf_imageobject.h" -@@ -440,6 +441,26 @@ FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, - pPageObj->Transform(matrix); - } - -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object) -+{ -+ if (!text_object) -+ return 0; -+ -+ CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object); -+ return pTxtObj->CountChars(); -+} -+ -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object) -+{ -+ if (!text_object) -+ return 0; -+ -+ CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object); -+ return pTxtObj->GetFontSize(); -+} -+ - FPDF_EXPORT void FPDF_CALLCONV - FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object, - FPDF_BYTESTRING blend_mode) { -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 -@@ -1107,6 +1107,26 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document, - FPDF_FONT font, - float font_size); - -+// Get the number of characters from a text object. -+// -+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj -+// or FPDFPageObj_NewTextObjEx. -+// Return Value: -+// A character count in the text object. -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object); -+ -+ -+// Get the font size of a text object. -+// -+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj -+// or FPDFPageObj_NewTextObjEx. -+// -+// Return Value: -+// The value of the font size -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object); -+ - #ifdef __cplusplus - } // extern "C" - #endif // __cplusplus --- -2.16.3 - diff --git a/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2 b/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2 index 21c3d007fb3d..08b272526578 100644 --- a/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2 +++ b/external/pdfium/0003-svx-import-PDF-images-as-BGRA.patch.2 @@ -26,14 +26,14 @@ index fed1581..3f400c7 100644 + if (!pImg) + return nullptr; + -+ RetainPtr<CFX_DIBSource> pSource = pImg->LoadDIBSource(); ++ RetainPtr<CFX_DIBBase> pSource = pImg->LoadDIBBase(); + if (!pSource) + return nullptr; + + RetainPtr<CFX_DIBitmap> pBitmap; + pBitmap = pSource->CloneConvert(FXDIB_Argb); + -+ return pBitmap.Leak(); ++ return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak()); +} + FPDF_EXPORT unsigned long FPDF_CALLCONV diff --git a/external/pdfium/0004-svx-support-PDF-text-color.patch.2 b/external/pdfium/0004-svx-support-PDF-text-color.patch.2 deleted file mode 100644 index a99f8f5966dd..000000000000 --- a/external/pdfium/0004-svx-support-PDF-text-color.patch.2 +++ /dev/null @@ -1,119 +0,0 @@ -From 914467a56b9c4cd6a27cfa9b7ed61ebfb5a122d3 Mon Sep 17 00:00:00 2001 -From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> -Date: Tue, 5 Jun 2018 11:29:49 +0200 -Subject: [PATCH 04/14] svx: support PDF text color - ---- - pdfium/fpdfsdk/cpdfsdk_helpers.h | 5 +++++ - pdfium/fpdfsdk/fpdf_editpage.cpp | 30 +++++++++++++++++++++++++----- - pdfium/public/fpdf_edit.h | 16 ++++++++++++++++ - 3 files changed, 46 insertions(+), 5 deletions(-) - -diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h -index d93ecfc..13362cf 100644 ---- a/pdfium/fpdfsdk/cpdfsdk_helpers.h -+++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h -@@ -204,6 +204,11 @@ inline CPDF_TextPageFind* CPDFTextPageFindFromFPDFSchHandle( - return reinterpret_cast<CPDF_TextPageFind*>(handle); - } - -+inline CPDF_TextObject* CPDFTextObjectFromFPDFPageObject( -+ FPDF_PAGEOBJECT page_object) { -+ return reinterpret_cast<CPDF_TextObject*>(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 3244943..f8e2418 100644 ---- a/pdfium/fpdfsdk/fpdf_editpage.cpp -+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp -@@ -443,7 +443,7 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object) - if (!text_object) - return 0; - -- CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object); -+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object); - return pTxtObj->CountChars(); - } - -@@ -453,7 +453,7 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object) - if (!text_object) - return 0; - -- CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object); -+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object); - return pTxtObj->GetFontSize(); - } - -@@ -645,3 +645,23 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) { - pPageObj->SetDirty(true); - return true; - } -+ -+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV -+FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object, -+ unsigned int* R, -+ unsigned int* G, -+ unsigned int* B, -+ unsigned int* A) -+{ -+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object); -+ if (!pTxtObj || !R || !G || !B || !A) -+ return false; -+ -+ const uint32_t strokeRGB = pTxtObj->m_ColorState.GetStrokeRGB(); -+ *R = FXSYS_GetRValue(strokeRGB); -+ *G = FXSYS_GetGValue(strokeRGB); -+ *B = FXSYS_GetBValue(strokeRGB); -+ *A = static_cast<unsigned int>( -+ (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f); -+ return true; -+} -diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h -index 602849f..fa9902e 100644 ---- a/pdfium/public/fpdf_edit.h -+++ b/pdfium/public/fpdf_edit.h -@@ -1016,6 +1016,22 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object); - FPDF_EXPORT int FPDF_CALLCONV - FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object); - -+// Get the stroke RGBA of a text. Range of values: 0 - 255. -+// -+// path - the handle to the path object. -+// R - the red component of the path stroke color. -+// G - the green component of the path stroke color. -+// B - the blue component of the path stroke color. -+// A - the stroke alpha of the path. -+// -+// Returns TRUE on success. -+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV -+FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object, -+ unsigned int* R, -+ unsigned int* G, -+ unsigned int* B, -+ unsigned int* A); -+ - #ifdef __cplusplus - } // extern "C" - #endif // __cplusplus -diff --git a/pdfium/fpdfsdk/fpdf_edittext.cpp b/pdfium/fpdfsdk/fpdf_edittext.cpp -index c38873faa..aa3287ef4 100644 ---- a/pdfium/fpdfsdk/fpdf_edittext.cpp -+++ b/pdfium/fpdfsdk/fpdf_edittext.cpp -@@ -398,11 +398,6 @@ CPDF_Font* LoadCompositeFont(CPDF_Document* pDoc, - return pDoc->LoadFont(fontDict); - } - --CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) { -- auto* obj = CPDFPageObjectFromFPDFPageObject(page_object); -- return obj ? obj->AsText() : nullptr; --} -- - } // namespace - - FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV --- -2.16.3 - diff --git a/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2 b/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2 deleted file mode 100644 index c141cc4b58ea..000000000000 --- a/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2 +++ /dev/null @@ -1,100 +0,0 @@ -From 32ec9efddb8e1706085478fd8434dd2860840345 Mon Sep 17 00:00:00 2001 -From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> -Date: Tue, 5 Jun 2018 11:33:56 +0200 -Subject: [PATCH 09/14] svx: support color text for imported PDFs - ---- - pdfium/core/fpdfapi/page/cpdf_imageobject.cpp | 2 +- - pdfium/core/fxge/cfx_pathdata.cpp | 4 +-- - pdfium/fpdfsdk/fpdf_editpage.cpp | 47 ++++++++++++++++++++++----- - pdfium/public/fpdf_edit.h | 10 +++--- - 4 files changed, 46 insertions(+), 17 deletions(-) - -diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp -index 2249e8e..9c353a4 100644 ---- a/pdfium/fpdfsdk/fpdf_editpage.cpp -+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp -@@ -733,21 +733,50 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object, - } - - FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV --FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object, -- unsigned int* R, -- unsigned int* G, -- unsigned int* B, -- unsigned int* A) -+FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object, -+ unsigned int* R, -+ unsigned int* G, -+ unsigned int* B, -+ unsigned int* A) - { - CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object); - if (!pTxtObj || !R || !G || !B || !A) - return false; - -- const uint32_t strokeRGB = pTxtObj->m_ColorState.GetStrokeRGB(); -- *R = FXSYS_GetRValue(strokeRGB); -- *G = FXSYS_GetGValue(strokeRGB); -- *B = FXSYS_GetBValue(strokeRGB); -+ bool bFill = false; -+ bool bStroke = false; -+ CPDF_Font* pFont = pTxtObj->m_TextState.GetFont(); -+ const TextRenderingMode text_render_mode = pTxtObj->m_TextState.GetTextMode(); -+ switch (text_render_mode) -+ { -+ case TextRenderingMode::MODE_FILL: -+ case TextRenderingMode::MODE_FILL_CLIP: -+ bFill = true; -+ break; -+ case TextRenderingMode::MODE_STROKE: -+ case TextRenderingMode::MODE_STROKE_CLIP: -+ if (pFont->GetFace()) -+ bStroke = true; -+ else -+ bFill = true; -+ break; -+ case TextRenderingMode::MODE_FILL_STROKE: -+ case TextRenderingMode::MODE_FILL_STROKE_CLIP: -+ bFill = true; -+ if (pFont->GetFace()) -+ bStroke = true; -+ break; -+ case TextRenderingMode::MODE_INVISIBLE: -+ case TextRenderingMode::MODE_CLIP: -+ return false; -+ } -+ -+ const uint32_t RGB = bStroke ? pTxtObj->m_ColorState.GetStrokeRGB() : pTxtObj->m_ColorState.GetFillRGB(); -+ *R = FXSYS_GetRValue(RGB); -+ *G = FXSYS_GetGValue(RGB); -+ *B = FXSYS_GetBValue(RGB); - *A = static_cast<unsigned int>( - (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f); -+ - return true; - } -diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h -index fc906f4..4264ccd 100644 ---- a/pdfium/public/fpdf_edit.h -+++ b/pdfium/public/fpdf_edit.h -@@ -1075,11 +1075,11 @@ FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object, - // - // Returns TRUE on success. - FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV --FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object, -- unsigned int* R, -- unsigned int* G, -- unsigned int* B, -- unsigned int* A); -+FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object, -+ unsigned int* R, -+ unsigned int* G, -+ unsigned int* B, -+ unsigned int* A); - - #ifdef __cplusplus - } // extern "C" --- -2.16.3 - 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 f0b09bbf7abf..000000000000 --- a/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 +++ /dev/null @@ -1,94 +0,0 @@ -From 636f92aac24f0accfbce910c9153d5479e097e5f Mon Sep 17 00:00:00 2001 -From: Ashod Nakashian <ashod.nakashian@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 -@@ -704,3 +704,31 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object, - - return true; - } -+ -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object) -+{ -+ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object); -+ if (pFrmObj) -+ { -+ const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList(); -+ if (pObjectList) -+ return pObjectList->size(); -+ } -+ -+ return 0; -+} -+ -+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 -@@ -1081,6 +1081,23 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object, - unsigned int* B, - unsigned int* A); - -+// Get number of page objects inside the form object. -+// -+// form_object - Handle to a form object. Returned by FPDFPage_GetObject. -+// Return value: -+// The number of the page objects. -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_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 deleted file mode 100644 index 081840e20576..000000000000 --- a/external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2 +++ /dev/null @@ -1,75 +0,0 @@ -From c82f6e80d94f8598221009035c8f336f5f656333 Mon Sep 17 00:00:00 2001 -From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> -Date: Tue, 5 Jun 2018 11:35:14 +0200 -Subject: [PATCH 11/14] svx: correctly possition form objects from PDF - ---- - pdfium/fpdfsdk/fpdf_editpage.cpp | 25 +++++++++++++++++++++++++ - pdfium/public/fpdf_edit.h | 18 ++++++++++++++++++ - 2 files changed, 43 insertions(+) - -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; - } -+ -+FPDF_EXPORT void FPDF_CALLCONV -+FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object, -+ double* a, -+ double* b, -+ double* c, -+ double* d, -+ double* e, -+ double* f) -+{ -+ if (!form_object || !a || !b || !c || !d || !e || !f) -+ return; -+ -+ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object); -+ if (pFrmObj) -+ { -+ const CFX_Matrix& matrix = pFrmObj->form_matrix(); -+ *a = matrix.a; -+ *b = matrix.b; -+ *c = matrix.c; -+ *d = matrix.d; -+ *e = matrix.e; -+ *f = matrix.f; -+ } -+} -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); - -+// Get the matrix of a particular form object. -+// -+// form_object - Handle of form object -+// a - Pointer to a double value receiving coefficient "a" of the matrix. -+// b - Pointer to a double value receiving coefficient "b" of the matrix. -+// c - Pointer to a double value receiving coefficient "c" of the matrix. -+// d - Pointer to a double value receiving coefficient "d" of the matrix. -+// e - Pointer to a double value receiving coefficient "e" of the matrix. -+// f - Pointer to a double value receiving coefficient "f" of the matrix. -+FPDF_EXPORT void FPDF_CALLCONV -+FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object, -+ double* a, -+ double* b, -+ double* c, -+ double* d, -+ double* e, -+ double* f); -+ - #ifdef __cplusplus - } // extern "C" - #endif // __cplusplus --- -2.16.3 - diff --git a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2 b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2 deleted file mode 100644 index 008c7047bdfa..000000000000 --- a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2 +++ /dev/null @@ -1,148 +0,0 @@ -From 7e8ecec81f102993e3fe73256415dcf049c09e29 Mon Sep 17 00:00:00 2001 -From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> -Date: Tue, 5 Jun 2018 11:35:39 +0200 -Subject: [PATCH 12/14] svx: import processed PDF text - ---- - pdfium/core/fpdftext/cpdf_textpage.cpp | 29 ++++++++++++++++++++++++ - pdfium/core/fpdftext/cpdf_textpage.h | 2 ++ - pdfium/fpdfsdk/fpdf_editpage.cpp | 41 ++++++++++++++++++++++++++++++++++ - pdfium/public/fpdf_edit.h | 13 +++++++++++ - 4 files changed, 85 insertions(+) - -diff --git a/pdfium/core/fpdftext/cpdf_textpage.cpp b/pdfium/core/fpdftext/cpdf_textpage.cpp -index 5690698..4d7c48a 100644 ---- a/pdfium/core/fpdftext/cpdf_textpage.cpp -+++ b/pdfium/core/fpdftext/cpdf_textpage.cpp -@@ -1464,3 +1464,32 @@ Optional<PAGECHAR_INFO> CPDF_TextPage::GenerateCharInfo(wchar_t unicode) { - info.m_Origin.x, info.m_Origin.y); - return info; - } -+ -+WideString CPDF_TextPage::GetTextObjectText(CPDF_TextObject* pTextObj) -+{ -+ if (!m_bIsParsed) -+ return WideString(); -+ -+ float posy = 0; -+ bool IsContainPreChar = false; -+ bool IsAddLineFeed = false; -+ WideString strText; -+ for (const auto& charinfo : m_CharList) { -+ if (charinfo.m_pTextObj == pTextObj) { -+ IsContainPreChar = true; -+ IsAddLineFeed = false; -+ if (charinfo.m_Unicode) -+ strText += charinfo.m_Unicode; -+ } else if (charinfo.m_Unicode == 32) { -+ if (IsContainPreChar && charinfo.m_Unicode) { -+ strText += charinfo.m_Unicode; -+ IsContainPreChar = false; -+ IsAddLineFeed = false; -+ } -+ } else { -+ IsContainPreChar = false; -+ IsAddLineFeed = true; -+ } -+ } -+ return strText; -+} -diff --git a/pdfium/core/fpdftext/cpdf_textpage.h b/pdfium/core/fpdftext/cpdf_textpage.h -index 43a0312..7d5d5ec 100644 ---- a/pdfium/core/fpdftext/cpdf_textpage.h -+++ b/pdfium/core/fpdftext/cpdf_textpage.h -@@ -105,6 +105,8 @@ class CPDF_TextPage { - WideString GetPageText(int start, int count) const; - WideString GetAllPageText() const { return GetPageText(0, CountChars()); } - -+ WideString GetTextObjectText(CPDF_TextObject* pTextObj); -+ - int CountRects(int start, int nCount); - bool GetRect(int rectIndex, CFX_FloatRect* pRect) const; - -diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp -index f4a1688..f34d3b5 100644 ---- a/pdfium/fpdfsdk/fpdf_editpage.cpp -+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp -@@ -26,6 +26,7 @@ - #include "core/fpdfapi/parser/cpdf_string.h" - #include "core/fpdfdoc/cpdf_annot.h" - #include "core/fpdfdoc/cpdf_annotlist.h" -+#include "core/fpdftext/cpdf_textpage.h" - #include "fpdfsdk/cpdfsdk_helpers.h" - #include "public/fpdf_formfill.h" - #include "third_party/base/logging.h" -@@ -656,6 +657,46 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) { - return true; - } - -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object, -+ FPDF_TEXTPAGE page, -+ int char_start, -+ int char_count, -+ unsigned short* result) -+{ -+ if (!page || !text_object || char_start < 0 || char_count < 0 || !result) -+ return 0; -+ -+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object); -+ CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(page); -+ int char_available = textpage->CountChars() - char_start; -+ if (char_available <= 0) -+ return 0; -+ -+ char_count = std::min(char_count, char_available); -+ if (char_count == 0) { -+ // Writing out "", which has a character count of 1 due to the NUL. -+ *result = '\0'; -+ return 1; -+ } -+ -+ WideString str = textpage->GetTextObjectText(pTxtObj); -+ -+ if (str.GetLength() > static_cast<size_t>(char_count)) -+ str = str.Left(static_cast<size_t>(char_count)); -+ -+ // UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected -+ // the number of items to stay the same. -+ ByteString byte_str = str.UTF16LE_Encode(); -+ size_t byte_str_len = byte_str.GetLength(); -+ constexpr size_t kBytesPerCharacter = sizeof(unsigned short); -+ int ret_count = byte_str_len / kBytesPerCharacter; -+ -+ ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator. -+ memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len); -+ return ret_count; -+} -+ - FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV - FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object, - unsigned int* R, -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 -@@ -1088,6 +1088,19 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object); - FPDF_EXPORT int FPDF_CALLCONV - FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object); - -+// Get the processed text of a text object. -+// -+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj -+// or FPDFPageObj_NewTextObjEx. -+// Return Value: -+// The number of characters (not bytes) written in result. -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object, -+ FPDF_TEXTPAGE page, -+ int char_start, -+ int char_count, -+ unsigned short* result); -+ - // Get the stroke RGBA of a text. Range of values: 0 - 255. - // - // path - the handle to the path object. --- -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 deleted file mode 100644 index d56c2ce69e70..000000000000 --- a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 +++ /dev/null @@ -1,83 +0,0 @@ -From f701ff3ce04a4e7e757a9f3ee62b4967749455dd Mon Sep 17 00:00:00 2001 -From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> -Date: Tue, 5 Jun 2018 14:27:55 +0200 -Subject: [PATCH 14/14] svx: update PDFium patch and code - ---- - pdfium/fpdfsdk/cpdfsdk_helpers.h | 2 ++ - pdfium/fpdfsdk/fpdf_editimg.cpp | 2 +- - pdfium/fpdfsdk/fpdf_editpage.cpp | 19 ++++++++++++------- - pdfium/public/fpdf_edit.h | 16 ++++++++-------- - 4 files changed, 23 insertions(+), 16 deletions(-) - -diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h -index 477bb74..c907ad8 100644 ---- a/pdfium/fpdfsdk/cpdfsdk_helpers.h -+++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h -@@ -40,6 +40,8 @@ class CPDF_TextPage; - class CPDF_TextPageFind; - class IPDFSDK_PauseAdapter; - class FX_PATHPOINT; -+class CPDF_TextObject; -+class CPDF_FormObject; - - #ifdef PDF_ENABLE_XFA - class CPDFXFA_Context; -diff --git a/pdfium/fpdfsdk/fpdf_editimg.cpp b/pdfium/fpdfsdk/fpdf_editimg.cpp -index 3f400c7..968b84a 100644 ---- a/pdfium/fpdfsdk/fpdf_editimg.cpp -+++ b/pdfium/fpdfsdk/fpdf_editimg.cpp -@@ -203,7 +203,7 @@ FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object) { - RetainPtr<CFX_DIBitmap> pBitmap; - pBitmap = pSource->CloneConvert(FXDIB_Argb); - -- return pBitmap.Leak(); -+ return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak()); - } - - FPDF_EXPORT unsigned long FPDF_CALLCONV -diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp -index 29c8b01..a52e1a9 100644 ---- a/pdfium/fpdfsdk/fpdf_editpage.cpp -+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp -@@ -693,7 +693,7 @@ FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object, - int ret_count = byte_str_len / kBytesPerCharacter; - - ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator. -- memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len); -+ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len); - return ret_count; - } - -@@ -736,10 +736,15 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object, - return false; - } - -- const uint32_t RGB = bStroke ? pTxtObj->m_ColorState.GetStrokeRGB() : pTxtObj->m_ColorState.GetFillRGB(); -- *R = FXSYS_GetRValue(RGB); -- *G = FXSYS_GetGValue(RGB); -- *B = FXSYS_GetBValue(RGB); -+ const CPDF_Color* pColor = bStroke ? pTxtObj->m_ColorState.GetStrokeColor() : pTxtObj->m_ColorState.GetFillColor(); -+ if (pColor == nullptr) -+ return false; -+ -+ int r, g, b; -+ pColor->GetRGB(&r, &g, &b); -+ *R = r; -+ *G = g; -+ *B = b; - *A = static_cast<unsigned int>( - (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f); - -@@ -768,7 +773,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 deleted file mode 100644 index 8eb0bac1eed2..000000000000 --- a/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 +++ /dev/null @@ -1,77 +0,0 @@ -From 04f9899ddf5f9691ffaca5091082183f167e95d3 Mon Sep 17 00:00:00 2001 -From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> -Date: Wed, 6 Jun 2018 06:34:56 +0200 -Subject: [PATCH] svx: set the font name of imported PDF text - ---- - pdfium/fpdfsdk/fpdf_editpage.cpp | 23 +++++++++++++++++++++++ - pdfium/public/fpdf_edit.h | 11 +++++++++++ - 2 files changed, 34 insertions(+) - -diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp -index a52e1a9..9daffc0 100644 ---- a/pdfium/fpdfsdk/fpdf_editpage.cpp -+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp -@@ -20,6 +20,7 @@ - #include "core/fpdfapi/page/cpdf_pageobject.h" - #include "core/fpdfapi/page/cpdf_pathobject.h" - #include "core/fpdfapi/page/cpdf_shadingobject.h" -+#include "core/fpdfapi/page/cpdf_textobject.h" - #include "core/fpdfapi/parser/cpdf_array.h" - #include "core/fpdfapi/parser/cpdf_document.h" - #include "core/fpdfapi/parser/cpdf_number.h" -@@ -458,6 +459,29 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object) - return pTxtObj->GetFontSize(); - } - -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text_object, char* result) -+{ -+ if (!text_object) -+ return 0; -+ -+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object); -+ CPDF_Font* pPdfFont = pTxtObj->GetFont(); -+ if (!pPdfFont) -+ return 0; -+ -+ CFX_Font* pFont = pPdfFont->GetFont(); -+ if (!pFont) -+ return 0; -+ -+ ByteString byte_str = pFont->GetFamilyName(); -+ const size_t byte_str_len = byte_str.GetLength(); -+ -+ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len); -+ result[byte_str_len] = '\0'; -+ return byte_str_len; -+} -+ - FPDF_EXPORT void FPDF_CALLCONV - FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object, - FPDF_BYTESTRING blend_mode) { -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 -@@ -1068,6 +1068,17 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document, - FPDF_FONT font, - float font_size); - -+// Get the font name of a text object. -+// -+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj -+// or FPDFPageObj_NewTextObjEx. -+// result - The result in ascii. -+// -+// Return Value: -+// The number of characters / bytes written in result. -+FPDF_EXPORT int FPDF_CALLCONV -+FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text_object, char* result); -+ - // Get the number of characters from a text object. - // - // text_object - Handle of text object returned by FPDFPageObj_NewTextObj --- -2.16.3 - diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk index 05d84c749a05..f9a62bf75b46 100644 --- a/external/pdfium/Library_pdfium.mk +++ b/external/pdfium/Library_pdfium.mk @@ -67,7 +67,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_fieldaction \ UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_filewriteadapter \ UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_helpers \ - UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_memoryaccess \ UnpackedTarball/pdfium/fpdfsdk/fpdf_annot \ UnpackedTarball/pdfium/fpdfsdk/fpdf_attachment \ UnpackedTarball/pdfium/fpdfsdk/fpdf_catalog \ @@ -240,7 +239,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_read_validator \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_charposlist \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_devicebuffer \ - UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibsource \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_docrenderdata \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imagecacheentry \ @@ -281,6 +279,10 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_avail \ UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentmanager \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_transparency \ + UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibbase \ + UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_stream \ + UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_table \ + UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_stringarchivestream \ )) # fpdfdoc @@ -331,12 +333,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ # fxcodec $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec \ - UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec_fax \ - UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec_flate \ - UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec_icc \ - UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec_jbig \ - UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec_jpeg \ - UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec_jpx_opj \ UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder \ UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_ArithIntDecoder \ UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_BitStream \ @@ -358,6 +354,13 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gif \ UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gifcontext \ UnpackedTarball/pdfium/core/fxcodec/gif/cfx_lzwdecompressor \ + UnpackedTarball/pdfium/core/fxcodec/codec/cfx_codec_memory \ + UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_faxmodule \ + UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_iccmodule \ + UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jbig2module \ + UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jpxmodule \ + UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jpegmodule \ + UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_flatemodule \ )) # fxcrt @@ -402,8 +405,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxcrt/bytestring \ UnpackedTarball/pdfium/core/fxcrt/cfx_binarybuf \ UnpackedTarball/pdfium/core/fxcrt/cfx_bitstream \ - UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_posix \ - UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_windows \ UnpackedTarball/pdfium/core/fxcrt/cfx_utf8decoder \ UnpackedTarball/pdfium/core/fxcrt/cfx_widetextbuf \ UnpackedTarball/pdfium/core/fxcrt/fx_random \ @@ -412,6 +413,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxcrt/cfx_seekablemultistream \ UnpackedTarball/pdfium/core/fxcrt/css/cfx_cssdata \ UnpackedTarball/pdfium/core/fxcrt/fx_codepage \ + UnpackedTarball/pdfium/core/fxcrt/cfx_utf8encoder \ + UnpackedTarball/pdfium/core/fxcrt/cfx_readonlymemorystream \ )) # fxge @@ -420,7 +423,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxge/dib/cfx_bitmapstorer \ UnpackedTarball/pdfium/core/fxge/dib/cfx_dibextractor \ UnpackedTarball/pdfium/core/fxge/dib/cfx_dibitmap \ - UnpackedTarball/pdfium/core/fxge/dib/cfx_dibsource \ UnpackedTarball/pdfium/core/fxge/dib/cfx_filtereddib \ UnpackedTarball/pdfium/core/fxge/dib/cfx_imagerenderer \ UnpackedTarball/pdfium/core/fxge/dib/cfx_imagestretcher \ @@ -466,6 +468,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxge/fx_ge_fontmap \ UnpackedTarball/pdfium/core/fxge/fx_ge_linux \ UnpackedTarball/pdfium/core/fxge/fx_ge_text \ + UnpackedTarball/pdfium/core/fxge/dib/cfx_dibbase \ )) # javascript, build with pdf_enable_v8 disabled. @@ -542,6 +545,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/page_allocator \ UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/spin_lock \ UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_alloc \ + UnpackedTarball/pdfium/third_party/base/debug/alias \ )) # skia_shared @@ -600,6 +604,13 @@ $(eval $(call gb_Library_add_generated_cobjects,pdfium,\ UnpackedTarball/pdfium/third_party/freetype/src/src/smooth/smooth \ UnpackedTarball/pdfium/third_party/freetype/src/src/truetype/truetype \ UnpackedTarball/pdfium/third_party/freetype/src/src/type1/type1 \ + UnpackedTarball/pdfium/third_party/freetype/src/src/base/ftdebug \ +)) +endif + +ifneq ($(OS),WNT) +$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ + UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_posix \ )) endif @@ -612,6 +623,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxge/win32/fx_win32_dib \ UnpackedTarball/pdfium/core/fxge/win32/fx_win32_gdipext \ UnpackedTarball/pdfium/core/fxge/win32/fx_win32_print \ + UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_windows \ )) $(eval $(call gb_Library_use_system_win32_libs,pdfium,\ @@ -641,9 +653,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxge/android/cfpf_skiafontmgr \ UnpackedTarball/pdfium/core/fxge/android/cfx_androidfontinfo \ UnpackedTarball/pdfium/core/fxge/android/fx_android_imp \ - UnpackedTarball/pdfium/core/fxge/android/cfpf_skiabufferfont \ - UnpackedTarball/pdfium/core/fxge/android/cfpf_skiafilefont \ - UnpackedTarball/pdfium/core/fxge/android/cfpf_skiafontdescriptor \ UnpackedTarball/pdfium/core/fxge/android/cfpf_skiapathfont \ )) endif diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index dc1ad7b4e221..d99f1077da98 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -13,15 +13,7 @@ pdfium_patches += ubsan.patch # Fixes build on our baseline. pdfium_patches += build.patch.1 # Adds missing editing API -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 += 0009-svx-support-color-text-for-imported-PDFs.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 -pdfium_patches += 0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium)) @@ -45,7 +37,8 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\ mv third_party/base/allocator/partition_allocator/address_space_randomization.cc third_party/base/allocator/partition_allocator/address_space_randomization.cpp && \ mv third_party/base/allocator/partition_allocator/page_allocator.cc third_party/base/allocator/partition_allocator/page_allocator.cpp && \ mv third_party/base/allocator/partition_allocator/partition_alloc.cc third_party/base/allocator/partition_allocator/partition_alloc.cpp && \ - mv third_party/base/allocator/partition_allocator/spin_lock.cc third_party/base/allocator/partition_allocator/spin_lock.cpp \ + mv third_party/base/allocator/partition_allocator/spin_lock.cc third_party/base/allocator/partition_allocator/spin_lock.cpp && \ + mv third_party/base/debug/alias.cc third_party/base/debug/alias.cpp \ )) # vim: set noet sw=4 ts=4: diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1 index 901edbbf4e56..721c1784719d 100644 --- a/external/pdfium/build.patch.1 +++ b/external/pdfium/build.patch.1 @@ -125,12 +125,12 @@ diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h index 7f4eb86c0..5e227f86e 100644 --- a/core/fpdfdoc/cpdf_dest.h +++ b/core/fpdfdoc/cpdf_dest.h -@@ -46,7 +46,7 @@ class CPDF_Dest { +@@ -41,7 +41,7 @@ float* pZoom) const; private: -- UnownedPtr<const CPDF_Array> const m_pObj; -+ UnownedPtr<const CPDF_Array> m_pObj; +- UnownedPtr<const CPDF_Array> const m_pArray; ++ UnownedPtr<const CPDF_Array> m_pArray; }; #endif // CORE_FPDFDOC_CPDF_DEST_H_ diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 8e7d9e28f0eb..8f79523b4c3e 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -863,10 +863,10 @@ void ImpSdrPdfImport::ImportForm(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex FPDFFormObj_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f); mCurMatrix = Matrix(a, b, c, d, e, f); - const int nCount = FPDFFormObj_CountSubObjects(pPageObject); + 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); } @@ -896,12 +896,10 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex aTextMatrix.Transform(left, right, top, bottom); const tools::Rectangle aRect = PointsToLogic(left, right, top, bottom); - const int nChars = FPDFTextObj_CountChars(pPageObject) * 2; - std::unique_ptr<sal_Unicode[]> pText(new sal_Unicode[nChars + 1]); // + terminating null + const int nChars = FPDFTextObj_GetText(pPageObject, pTextPage, nullptr, 0); + std::unique_ptr<sal_Unicode[]> pText(new sal_Unicode[nChars]); - unsigned short* pShortText = reinterpret_cast<unsigned short*>(pText.get()); - const int nActualChars - = FPDFTextObj_GetTextProcessed(pPageObject, pTextPage, 0, nChars, pShortText); + const int nActualChars = FPDFTextObj_GetText(pPageObject, pTextPage, pText.get(), nChars); if (nActualChars <= 0) { return; @@ -926,10 +924,11 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex mbFntDirty = true; } - std::unique_ptr<char[]> pFontName(new char[80 + 1]); // + terminating null + const int nFontName = 80 + 1; + std::unique_ptr<char[]> pFontName(new char[nFontName]); // + terminating null char* pCharFontName = reinterpret_cast<char*>(pFontName.get()); - int nFontNameChars = FPDFTextObj_GetFontName(pPageObject, pCharFontName); - if (nFontNameChars > 0) + int nFontNameChars = FPDFTextObj_GetFontName(pPageObject, pCharFontName, nFontName); + if (nFontName >= nFontNameChars) { OUString sFontName = OUString::createFromAscii(pFontName.get()); if (sFontName != aFnt.GetFamilyName()) @@ -941,9 +940,32 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex } Color aTextColor(COL_TRANSPARENT); - unsigned int nR, nG, nB, nA; - if (FPDFTextObj_GetColor(pPageObject, &nR, &nG, &nB, &nA)) - aTextColor = Color(nR, nG, nB); + bool bFill = false; + bool bUse = true; + switch (FPDFText_GetTextRenderMode(pPageObject)) + { + case FPDF_TEXTRENDERMODE_FILL: + case FPDF_TEXTRENDERMODE_FILL_CLIP: + case FPDF_TEXTRENDERMODE_FILL_STROKE: + case FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP: + bFill = true; + break; + case FPDF_TEXTRENDERMODE_STROKE: + case FPDF_TEXTRENDERMODE_STROKE_CLIP: + break; + case FPDF_TEXTRENDERMODE_INVISIBLE: + case FPDF_TEXTRENDERMODE_CLIP: + bUse = false; + break; + } + if (bUse) + { + unsigned int nR, nG, nB, nA; + bool bRet = bFill ? FPDFPageObj_GetFillColor(pPageObject, &nR, &nG, &nB, &nA) + : FPDFPageObj_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA); + if (bRet) + aTextColor = Color(nR, nG, nB); + } if (aTextColor != mpVD->GetTextColor()) { |