[Libreoffice-commits] core.git: external/pdfium svx/source

2018-09-05 Thread Libreoffice Gerrit user
 external/pdfium/0001-Add-FPDFTextObj_GetText-API.patch.1   |  
164 ++
 external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2  |   
69 
 external/pdfium/0004-svx-support-PDF-text-color.patch.2|   
13 
 external/pdfium/0011-svx-correctly-possition-form-objects-from-PDF.patch.2 |   
 6 
 external/pdfium/0012-svx-import-processed-PDF-text.patch.2 |  
148 -
 external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2  |   
13 
 external/pdfium/UnpackedTarball_pdfium.mk  |   
 4 
 svx/source/svdraw/svdpdf.cxx   |   
 8 
 8 files changed, 172 insertions(+), 253 deletions(-)

New commits:
commit 51dca926f5968e9227391f7c47d25b9442178eaa
Author: Miklos Vajna 
AuthorDate: Tue Sep 4 21:17:39 2018 +0200
Commit: Miklos Vajna 
CommitDate: Wed Sep 5 09:11:21 2018 +0200

pdfium: replace FPDFTextObj_CountChars/GetTextProcessed patches with 
backport

Change-Id: I9c198ff0cd31de064fcc4a3bb0ed92066f38e4c5
Reviewed-on: https://gerrit.libreoffice.org/60007
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/external/pdfium/0001-Add-FPDFTextObj_GetText-API.patch.1 
b/external/pdfium/0001-Add-FPDFTextObj_GetText-API.patch.1
new file mode 100644
index ..22926462cdac
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFTextObj_GetText-API.patch.1
@@ -0,0 +1,164 @@
+From 3bee9c60f013b8b7e99c39ee35699d132b330334 Mon Sep 17 00:00:00 2001
+Date: Tue, 7 Aug 2018 21:45:34 +
+Subject: [PATCH] Add FPDFTextObj_GetText() API
+
+Generalize CPDF_TextPage::GetTextByRect(), so that it's possible to get
+the text from a text page using a predicate, that way we can easily
+get the text that belongs to single text object as well.
+
+Change-Id: Ia457af0f41184694dc1481709be72b35685bce7f
+Reviewed-on: https://pdfium-review.googlesource.com/39530
+Reviewed-by: Henrique Nakashima 
+Reviewed-by: Lei Zhang 
+Commit-Queue: Lei Zhang 
+---
+ core/fpdftext/cpdf_textpage.cpp| 18 +--
+ core/fpdftext/cpdf_textpage.h  |  4 
+ fpdfsdk/fpdf_edittext.cpp  | 18 +++
+ fpdfsdk/fpdf_text_embeddertest.cpp | 45 ++
+ fpdfsdk/fpdf_view_c_api_test.c |  1 +
+ public/fpdf_edit.h | 20 +
+ 6 files changed, 104 insertions(+), 2 deletions(-)
+
+diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
+index 289416043..ed7f36fb6 100644
+--- a/core/fpdftext/cpdf_textpage.cpp
 b/core/fpdftext/cpdf_textpage.cpp
+@@ -426,7 +426,8 @@ int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point,
+   return pos < nCount ? pos : NearPos;
+ }
+ 
+-WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
++WideString CPDF_TextPage::GetTextByPredicate(
++const std::function& predicate) const {
+   if (!m_bIsParsed)
+ return WideString();
+ 
+@@ -435,7 +436,7 @@ WideString CPDF_TextPage::GetTextByRect(const 
CFX_FloatRect& rect) const {
+   bool IsAddLineFeed = false;
+   WideString strText;
+   for (const auto& charinfo : m_CharList) {
+-if (IsRectIntersect(rect, charinfo.m_CharBox)) {
++if (predicate(charinfo)) {
+   if (fabs(posy - charinfo.m_Origin.y) > 0 && !IsContainPreChar &&
+   IsAddLineFeed) {
+ posy = charinfo.m_Origin.y;
+@@ -460,6 +461,19 @@ WideString CPDF_TextPage::GetTextByRect(const 
CFX_FloatRect& rect) const {
+   return strText;
+ }
+ 
++WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
++  return GetTextByPredicate([&rect](const PAGECHAR_INFO& charinfo) {
++return IsRectIntersect(rect, charinfo.m_CharBox);
++  });
++}
++
++WideString CPDF_TextPage::GetTextByObject(
++const CPDF_TextObject* pTextObj) const {
++  return GetTextByPredicate([pTextObj](const PAGECHAR_INFO& charinfo) {
++return charinfo.m_pTextObj == pTextObj;
++  });
++}
++
+ void CPDF_TextPage::GetCharInfo(int index, FPDF_CHAR_INFO* info) const {
+   if (!m_bIsParsed || !pdfium::IndexInBounds(m_CharList, index))
+ return;
+diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
+index 36d01854f..90b45bd96 100644
+--- a/core/fpdftext/cpdf_textpage.h
 b/core/fpdftext/cpdf_textpage.h
+@@ -8,6 +8,7 @@
+ #define CORE_FPDFTEXT_CPDF_TEXTPAGE_H_
+ 
+ #include 
++#include 
+ #include 
+ 
+ #include "core/fpdfapi/page/cpdf_pageobjectlist.h"
+@@ -97,6 +98,7 @@ class CPDF_TextPage {
+   std::vector GetRectArray(int start, int nCount) const;
+   int GetIndexAtPos(const CFX_PointF& point, const CFX_SizeF& tolerance) 
const;
+   WideString GetTextByRect(const CFX_FloatRect& rect) const;
++  WideString GetTextByObject(const CPDF_TextObject* pTextObj) const;
+ 
+   // Returns string with the text from |m_TextBuf| that are covered by the 
input
+   // range. |start| and |count| are in terms of the |m_CharIndex|, so the 
range
+@@ -151,6 +153,8 @@

[Libreoffice-commits] core.git: external/pdfium svx/source

2018-08-28 Thread Libreoffice Gerrit user
 external/pdfium/0001-Add-FPDFText_GetFontName-API.patch.1   |   87 
++
 external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2   |   10 
+
 external/pdfium/0012-svx-import-processed-PDF-text.patch.2  |4 
 external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 |   77 

 external/pdfium/UnpackedTarball_pdfium.mk   |3 
 svx/source/svdraw/svdpdf.cxx|7 
 6 files changed, 104 insertions(+), 84 deletions(-)

New commits:
commit b4c003397eb29beff055044091c1d088acda2bae
Author: Miklos Vajna 
AuthorDate: Tue Aug 28 21:07:05 2018 +0200
Commit: Miklos Vajna 
CommitDate: Wed Aug 29 08:37:24 2018 +0200

pdfium: replace FPDFTextObj_GetFontName() patch with backport

Change-Id: I36d86e7ccca66b09f2f49e401d77deb52fbf742a
Reviewed-on: https://gerrit.libreoffice.org/59738
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/external/pdfium/0001-Add-FPDFText_GetFontName-API.patch.1 
b/external/pdfium/0001-Add-FPDFText_GetFontName-API.patch.1
new file mode 100644
index ..3ddd8e6b8127
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFText_GetFontName-API.patch.1
@@ -0,0 +1,87 @@
+From 53d4f0a4526ef996caf5005ae84406a9467423f2 Mon Sep 17 00:00:00 2001
+Date: Wed, 1 Aug 2018 01:28:49 +
+Subject: [PATCH] Add FPDFText_GetFontName() API
+
+This follows the same pattern as DefaultGetFaceName(), so the client has
+to call this function twice, but allocation of the string buffer happens
+outside pdfium.
+
+Change-Id: I06b7dcd00aca9b9b94799dad3f139617d7f5451e
+Reviewed-on: https://pdfium-review.googlesource.com/38870
+Commit-Queue: Lei Zhang 
+Reviewed-by: Lei Zhang 
+Reviewed-by: Henrique Nakashima 
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp |  28 
+ fpdfsdk/fpdf_edittext.cpp  |  22 ++
+ fpdfsdk/fpdf_view_c_api_test.c |   1 +
+ public/fpdf_edit.h |  18 ++
+ testing/resources/text_font.pdf| Bin 0 -> 10576 bytes
+ 5 files changed, 69 insertions(+)
+ create mode 100644 testing/resources/text_font.pdf
+
+diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
+index c552d615e..6aa44b3b2 100644
+--- a/fpdfsdk/fpdf_edittext.cpp
 b/fpdfsdk/fpdf_edittext.cpp
+@@ -548,6 +548,28 @@ FPDF_EXPORT double FPDF_CALLCONV 
FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text) {
+   return pTextObj->GetFontSize();
+ }
+ 
++FPDF_EXPORT unsigned long FPDF_CALLCONV
++FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text,
++void* buffer,
++unsigned long length) {
++  CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
++  if (!pTextObj)
++return 0;
++
++  CPDF_Font* pPdfFont = pTextObj->GetFont();
++  if (!pPdfFont)
++return 0;
++
++  CFX_Font* pFont = pPdfFont->GetFont();
++  ASSERT(pFont);
++
++  ByteString name = pFont->GetFamilyName();
++  unsigned long dwStringLen = name.GetLength() + 1;
++  if (buffer && length >= dwStringLen)
++memcpy(buffer, name.c_str(), dwStringLen);
++  return dwStringLen;
++}
++
+ FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font) {
+   CPDF_Font* pFont = CPDFFontFromFPDFFont(font);
+   if (!pFont)
+diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
+index b97a7adbd..4d5aa9c48 100644
+--- a/public/fpdf_edit.h
 b/public/fpdf_edit.h
+@@ -1256,6 +1256,24 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+ // Returns one of the FPDF_TEXTRENDERMODE_* flags on success, -1 on error.
+ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT 
text);
+ 
++// Experimental API.
++// Get the font name of a text object.
++//
++// text - the handle to the text object.
++// buffer   - the address of a buffer that receives the font name.
++// length   - the size, in bytes, of |buffer|.
++//
++// Returns the number of bytes in the font name (including the trailing NUL
++// character) on success, 0 on error.
++//
++// Regardless of the platform, the |buffer| is always in UTF-8 encoding.
++// If |length| is less than the returned length, or |buffer| is NULL, |buffer|
++// will not be modified.
++FPDF_EXPORT unsigned long FPDF_CALLCONV
++FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text,
++void* buffer,
++unsigned long length);
++
+ // Experimental API.
+ // Get number of page objects inside |form_object|.
+ //
+-- 
+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 473fe55fd2e8..6288dccba6b4 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
@@ -20,7 +20,15 @@ index 912df63..3244943 100644
  #include "core/fpdfapi/page/cpdf_form.h"
  #include "core/fpdfapi/page/cp

[Libreoffice-commits] core.git: external/pdfium svx/source

2018-08-15 Thread Libreoffice Gerrit user
 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 
AuthorDate: Tue Aug 14 21:01:28 2018 +0200
Commit: Miklos Vajna 
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 

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 ..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 +
+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 
+Reviewed-by: Henrique Nakashima 
+Commit-Queue: Nicolás Peña Moreno 
+---
+ 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(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
++FPD

[Libreoffice-commits] core.git: external/pdfium svx/source

2018-08-08 Thread Libreoffice Gerrit user
 external/pdfium/0001-Add-FPDFFormObj_CountObjects-API.patch.1   |   77 
++
 external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2   |6 
 external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2  |   30 
---
 external/pdfium/0012-svx-import-processed-PDF-text.patch.2  |8 
-
 external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 |6 
 external/pdfium/UnpackedTarball_pdfium.mk   |2 
 svx/source/svdraw/svdpdf.cxx|2 
 7 files changed, 94 insertions(+), 37 deletions(-)

New commits:
commit 3820aff0a577f72d63446a62f0e614a1408ab114
Author: Miklos Vajna 
AuthorDate: Tue Aug 7 22:52:39 2018 +0200
Commit: Miklos Vajna 
CommitDate: Wed Aug 8 09:03:34 2018 +0200

pdfium: replace FPDFFormObj_CountSubObjects() with backport

Change-Id: Ie7aaf6790c29818236f38b90409860dedecb3cb3
Reviewed-on: https://gerrit.libreoffice.org/58711
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/external/pdfium/0001-Add-FPDFFormObj_CountObjects-API.patch.1 
b/external/pdfium/0001-Add-FPDFFormObj_CountObjects-API.patch.1
new file mode 100644
index ..190fc6b2c9b6
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFFormObj_CountObjects-API.patch.1
@@ -0,0 +1,77 @@
+From b66077d3ef7ba594f2a831840783549f4dd70d86 Mon Sep 17 00:00:00 2001
+Date: Wed, 11 Jul 2018 13:25:02 +
+Subject: [PATCH] Add FPDFFormObj_CountObjects() API
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+To find out the number of sub-objects a form object has, similar to how
+FPDFPage_CountObjects() does it for page objects.
+
+Change-Id: I7e5775dece42b74fd5b71b1d9622a1aa37bf64ac
+Reviewed-on: https://pdfium-review.googlesource.com/37316
+Commit-Queue: Nicolás Peña Moreno 
+Reviewed-by: Nicolás Peña Moreno 
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp | 14 ++
+ fpdfsdk/fpdf_editpage.cpp  | 21 +
+ fpdfsdk/fpdf_view_c_api_test.c |  1 +
+ public/fpdf_edit.h |  9 
+ testing/resources/form_object.in   | 80 +
+ testing/resources/form_object.pdf  | 91 ++
+ 6 files changed, 216 insertions(+)
+ create mode 100644 testing/resources/form_object.in
+ create mode 100644 testing/resources/form_object.pdf
+
+diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
+index 8a1200885..4151de5df 100644
+--- a/fpdfsdk/fpdf_editpage.cpp
 b/fpdfsdk/fpdf_editpage.cpp
+@@ -751,3 +751,24 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int 
line_cap) {
+   pPageObj->SetDirty(true);
+   return true;
+ }
++
++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)
++return -1;
++
++  const CPDF_Form* pForm = pFormObject->form();
++  if (!pForm)
++return -1;
++
++  const CPDF_PageObjectList* pObjectList = pForm->GetPageObjectList();
++  if (!pObjectList)
++return -1;
++
++  return pObjectList->size();
++}
+diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
+index b85537d0b..e6f193a37 100644
+--- a/public/fpdf_edit.h
 b/public/fpdf_edit.h
+@@ -1226,6 +1226,15 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+ // Returns one of the FPDF_TEXTRENDERMODE_* flags on success, -1 on error.
+ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT 
text);
+ 
++// Experimental API.
++// Get number of page objects inside |form_object|.
++//
++//   form_object - handle to a form object.
++//
++// Returns the number of objects in |form_object| on success, -1 on error.
++FPDF_EXPORT int FPDF_CALLCONV
++FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
++
+ #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 d4f8de52b3ec..896e676bf287 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
-@@ -1133,6 +1133,15 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
- // Returns one of the FPDF_TEXTRENDERMODE_* flags on success, -1 on error.
- FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT 
text);
+@@ -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);
  
 +// Get the nu

[Libreoffice-commits] core.git: external/pdfium svx/source

2018-08-01 Thread Libreoffice Gerrit user
 external/pdfium/0001-Add-FPDFText_GetTextRenderMode-API.patch.1 |  118 
++
 external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2   |6 
 external/pdfium/0004-svx-support-PDF-text-color.patch.2 |   51 

 external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2   |  100 

 external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2  |   10 
 external/pdfium/0012-svx-import-processed-PDF-text.patch.2  |   16 
-
 external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2   |   24 
--
 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|   29 
++
 10 files changed, 167 insertions(+), 196 deletions(-)

New commits:
commit d8b7ac327cfe39f46aaa871cfa7a8fdc8b2b6b54
Author: Miklos Vajna 
AuthorDate: Wed Aug 1 08:34:42 2018 +0200
Commit: Miklos Vajna 
CommitDate: Wed Aug 1 09:34:02 2018 +0200

pdfium: replace FPDFTextObj_GetColor() patch with backport

Upstream already got FPDFPageObj_GetFillColor() and
FPDFPageObj_GetStrokeColor(), so what was necessary is just a
FPDFText_GetTextRenderMode() to find out which one to use.

Change-Id: I2f31fcadee8a4377b890e01ea62ed96bce275f2b
Reviewed-on: https://gerrit.libreoffice.org/58381
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/external/pdfium/0001-Add-FPDFText_GetTextRenderMode-API.patch.1 
b/external/pdfium/0001-Add-FPDFText_GetTextRenderMode-API.patch.1
new file mode 100644
index ..47874119baeb
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFText_GetTextRenderMode-API.patch.1
@@ -0,0 +1,118 @@
+From 1448cc11b9be67d2d1fcd3f2f833cc6f79ad8d42 Mon Sep 17 00:00:00 2001
+Date: Tue, 3 Jul 2018 13:52:33 +
+Subject: [PATCH] Add FPDFText_GetTextRenderMode() API
+
+This allows deciding if FPDFPageObj_GetFillColor() or
+FPDFPageObj_GetStrokeColor() should be used to get the effective color
+of a text object.
+
+Change-Id: Ic6e99a9eb8512b164756da8b5fcd8cd7771271ae
+Reviewed-on: https://pdfium-review.googlesource.com/36750
+Reviewed-by: dsinclair 
+Commit-Queue: dsinclair 
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp | 17 
+ fpdfsdk/fpdf_edittext.cpp  | 37 +
+ fpdfsdk/fpdf_view_c_api_test.c |  1 +
+ public/fpdf_edit.h | 17 
+ testing/resources/text_render_mode.pdf | 75 ++
+ 5 files changed, 147 insertions(+)
+ create mode 100644 testing/resources/text_render_mode.pdf
+
+diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
+index 3115e2a16..c552d615e 100644
+--- a/fpdfsdk/fpdf_edittext.cpp
 b/fpdfsdk/fpdf_edittext.cpp
+@@ -14,6 +14,7 @@
+ #include "core/fpdfapi/font/cpdf_type1font.h"
+ #include "core/fpdfapi/page/cpdf_docpagedata.h"
+ #include "core/fpdfapi/page/cpdf_textobject.h"
++#include "core/fpdfapi/page/cpdf_textstate.h"
+ #include "core/fpdfapi/parser/cpdf_array.h"
+ #include "core/fpdfapi/parser/cpdf_dictionary.h"
+ #include "core/fpdfapi/parser/cpdf_document.h"
+@@ -27,6 +28,31 @@
+ #include "fpdfsdk/cpdfsdk_helpers.h"
+ #include "public/fpdf_edit.h"
+ 
++// These checks are here because core/ and public/ cannot depend on each 
other.
++static_assert(static_cast(TextRenderingMode::MODE_FILL) ==
++  FPDF_TEXTRENDERMODE_FILL,
++  "TextRenderingMode::MODE_FILL value mismatch");
++static_assert(static_cast(TextRenderingMode::MODE_STROKE) ==
++  FPDF_TEXTRENDERMODE_STROKE,
++  "TextRenderingMode::MODE_STROKE value mismatch");
++static_assert(static_cast(TextRenderingMode::MODE_FILL_STROKE) ==
++  FPDF_TEXTRENDERMODE_FILL_STROKE,
++  "TextRenderingMode::MODE_FILL_STROKE value mismatch");
++static_assert(static_cast(TextRenderingMode::MODE_INVISIBLE) ==
++  FPDF_TEXTRENDERMODE_INVISIBLE,
++  "TextRenderingMode::MODE_INVISIBLE value mismatch");
++static_assert(static_cast(TextRenderingMode::MODE_FILL_CLIP) ==
++  FPDF_TEXTRENDERMODE_FILL_CLIP,
++  "TextRenderingMode::MODE_FILL_CLIP value mismatch");
++static_assert(static_cast(TextRenderingMode::MODE_STROKE_CLIP) ==
++  FPDF_TEXTRENDERMODE_STROKE_CLIP,
++  "TextRenderingMode::MODE_STROKE_CLIP value mismatch");
++static_assert(static_cast(TextRenderingMode::MODE_FILL_STROKE_CLIP) ==
++  FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP,
++  "TextRenderingMode::MODE_FILL_STROKE_CLIP value mismatch");
++static_assert(static_cast(TextRenderingMode::MODE_CLIP) ==
++  FPDF_TEXTRENDERMODE_CLIP,
++  "TextRenderingMode::MODE_CLIP value mismatch");
+ namespace {
+ 
+ CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc,
+@@ -545,3 +571,14 @@ FPDFPageObj_

[Libreoffice-commits] core.git: external/pdfium svx/source

2018-07-12 Thread Miklos Vajna
 external/pdfium/0001-Add-FPDFText_GetMatrix-API.patch.1
   |  109 ++
 external/pdfium/0001-svx-import-PDF-text-using-PDFium.patch.2  
   |  177 --
 external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2  
   |  101 -
 external/pdfium/0004-svx-support-PDF-text-color.patch.2
   |   59 +--
 external/pdfium/0007-svx-improved-text-importing-from-PDF.patch.2  
   |   62 ---
 
external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2
 |   76 
 external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2  
   |   35 -
 external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 
   |4 
 external/pdfium/0012-svx-import-processed-PDF-text.patch.2 
   |   12 
 external/pdfium/0013-svx-cleanup-pdfium-importer.patch.2   
   |  130 ---
 external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2  
   |   17 
 external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
   |   22 -
 external/pdfium/UnpackedTarball_pdfium.mk  
   |6 
 svx/source/svdraw/svdpdf.cxx   
   |2 
 14 files changed, 167 insertions(+), 645 deletions(-)

New commits:
commit 4ed059490d02afcbe359ab39def6729beeab6196
Author: Miklos Vajna 
Date:   Wed Jul 11 21:02:29 2018 +0200

pdfium: replace FPDFTextObj_GetMatrix() patch with backport

Also remove unused FPDFTextObj_GetUnicode() and FPDFTextObj_GetText().

Change-Id: I4b1f88f878f2754ff790b67d286a9d5366acc641
Reviewed-on: https://gerrit.libreoffice.org/57292
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/external/pdfium/0001-Add-FPDFText_GetMatrix-API.patch.1 
b/external/pdfium/0001-Add-FPDFText_GetMatrix-API.patch.1
new file mode 100644
index ..40b19a235254
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFText_GetMatrix-API.patch.1
@@ -0,0 +1,109 @@
+From 21ef03b50ef64d25a05d7ac047c0e382237c9b15 Mon Sep 17 00:00:00 2001
+From: Miklos Vajna 
+Date: Tue, 19 Jun 2018 15:45:42 +
+Subject: [PATCH] Add FPDFText_GetMatrix() API
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is similar to FPDFPath_GetMatrix(), but works on text, not path
+objects.
+
+Change-Id: If268362b7fa4398124b953e0e2225074523f5f65
+Reviewed-on: https://pdfium-review.googlesource.com/35434
+Reviewed-by: dsinclair 
+Reviewed-by: Nicolás Peña Moreno 
+Commit-Queue: Nicolás Peña Moreno 
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp | 17 +
+ fpdfsdk/fpdf_edittext.cpp  | 30 ++
+ public/fpdf_edit.h | 25 +
+ 3 files changed, 72 insertions(+)
+
+diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
+index 2996a505e..c38873faa 100644
+--- a/fpdfsdk/fpdf_edittext.cpp
 b/fpdfsdk/fpdf_edittext.cpp
+@@ -398,6 +398,11 @@ 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
+@@ -475,6 +480,31 @@ FPDFText_SetFillColor(FPDF_PAGEOBJECT text_object,
+   return FPDFPageObj_SetFillColor(text_object, R, G, B, A);
+ }
+ 
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_PAGEOBJECT text,
++   double* a,
++   double* b,
++   double* c,
++   double* d,
++   double* e,
++   double* f) {
++  if (!text || !a || !b || !c || !d || !e || !f)
++return false;
++
++  CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
++  if (!pTextObj)
++return false;
++
++  CFX_Matrix text_matrix = pTextObj->GetTextMatrix();
++  *a = text_matrix.a;
++  *b = text_matrix.b;
++  *c = text_matrix.c;
++  *d = text_matrix.d;
++  *e = text_matrix.e;
++  *f = text_matrix.f;
++
++  return true;
++}
++
+ FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font) {
+   CPDF_Font* pFont = CPDFFontFromFPDFFont(font);
+   if (!pFont)
+diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
+index c0766a33b..5a2eeb449 100644
+--- a/public/fpdf_edit.h
 b/public/fpdf_edit.h
+@@ -954,6 +954,31 @@ FPDFText_SetFillColor(FPDF_PAGEOBJECT text_object,
+   unsigned int B,
+   unsigned int A);
+ 
++// Experimental API.
++// Get the transform matrix of a text objec

[Libreoffice-commits] core.git: external/pdfium svx/source

2018-06-22 Thread Miklos Vajna
 external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.1 |   62 
++
 external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.2 |   54 

 external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2  |   45 
---
 external/pdfium/UnpackedTarball_pdfium.mk  |3 
 svx/source/svdraw/svdpdf.cxx   |2 
 5 files changed, 65 insertions(+), 101 deletions(-)

New commits:
commit 40bb0d6da2a6bdf504b9e1501ab3bc8c25896d05
Author: Miklos Vajna 
Date:   Thu Jun 21 09:16:37 2018 +0100

pdfium: replace FPDFPath_GetStrokeWidth() patch with backport

Change-Id: I43b8eb81b720e83eba887600116b01026e018af9
Reviewed-on: https://gerrit.libreoffice.org/56220
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git 
a/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.1 
b/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.1
new file mode 100644
index ..792e3461b446
--- /dev/null
+++ b/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.1
@@ -0,0 +1,62 @@
+From f912b5deb5e0db286d6d203b73c189d67cf7534f Mon Sep 17 00:00:00 2001
+From: Miklos Vajna 
+Date: Tue, 22 May 2018 14:27:29 +
+Subject: [PATCH] Add FPDFPageObj_GetStrokeWidth() API
+
+It was already possible to set the stroke width of a page object, this
+is the other direction.
+
+Change-Id: I5c4681b232768fc928bc7a169f223877284d4812
+Reviewed-on: https://pdfium-review.googlesource.com/32770
+Reviewed-by: dsinclair 
+Commit-Queue: dsinclair 
+---
+ fpdfsdk/fpdf_editpage.cpp | 10 ++
+ public/fpdf_edit.h| 10 ++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
+index 1a98f3d7c..83703c3e0 100644
+--- a/fpdfsdk/fpdf_editpage.cpp
 b/fpdfsdk/fpdf_editpage.cpp
+@@ -593,6 +593,16 @@ FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, 
float width) {
+   return true;
+ }
+ 
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
++FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width) {
++  auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
++  if (!pPageObj || !width)
++return false;
++
++  *width = pPageObj->m_GraphState.GetLineWidth();
++  return true;
++}
++
+ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+ FPDFPageObj_SetLineJoin(FPDF_PAGEOBJECT page_object, int line_join) {
+   if (!page_object)
+diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
+index fa9902ee9..49018df05 100644
+--- a/public/fpdf_edit.h
 b/public/fpdf_edit.h
+@@ -678,6 +678,16 @@ FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float 
width);
+ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+ FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width);
+ 
++// Experimental API.
++// Get the stroke width of a page object.
++//
++// path   - the handle to the page object.
++// width  - the width of the stroke.
++//
++// Returns TRUE on success
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
++FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width);
++
+ // Set the line join of |page_object|.
+ //
+ // page_object  - handle to a page object.
+-- 
+2.16.4
+
diff --git 
a/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.2 
b/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.2
deleted file mode 100644
index ed0e4d4af418..
--- a/external/pdfium/0005-svx-support-Paths-in-PDFs-while-importing.patch.2
+++ /dev/null
@@ -1,54 +0,0 @@
-From 42afb017a64ffcc89f670df5f5a0d42a6e710b20 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian 
-Date: Tue, 5 Jun 2018 11:30:22 +0200
-Subject: [PATCH 05/14] svx: support Paths in PDFs while importing
-

- pdfium/fpdfsdk/fpdf_editpath.cpp | 10 ++
- pdfium/public/fpdf_edit.h|  9 +
- 2 files changed, 19 insertions(+)
-
-diff --git a/pdfium/fpdfsdk/fpdf_editpath.cpp 
b/pdfium/fpdfsdk/fpdf_editpath.cpp
-index aca2beb..55f9fce 100644
 a/pdfium/fpdfsdk/fpdf_editpath.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editpath.cpp
-@@ -117,6 +117,16 @@ FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float 
width) {
-   return true;
- }
- 
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFPath_GetStrokeWidth(FPDF_PAGEOBJECT path, float* width) {
-+  auto* pPathObj = CPDFPathObjectFromFPDFPageObject(path);
-+  if (!pPathObj || !width)
-+return false;
-+
-+  *width = pPathObj->m_GraphState.GetLineWidth();
-+  return true;
-+}
-+
- FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetFillColor(FPDF_PAGEOBJECT 
path,
-   unsigned int R,
-   unsigned int G,
-diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
-index fa9902e..b44bc71 100644
 a/pdfium/public/fpdf_edit.h
-+++ b/pdfium/public/fpdf_edit.h
-@@ -678,6 +678,15 @@ FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float 
width);
- FPDF_EXPORT FPDF_BOOL FPDF_CA