download.lst                                   |    4 
 external/pdfium/Library_pdfium.mk              |  142 +++++++++++---------
 external/pdfium/README                         |    4 
 external/pdfium/UnpackedTarball_pdfium.mk      |   18 --
 external/pdfium/build.patch.1                  |  171 ++++++++++++++++++++-----
 external/pdfium/c++20-comparison.patch         |   12 -
 external/pdfium/configs/build_config.h         |  132 -------------------
 external/pdfium/inc/pch/precompiled_pdfium.hxx |  105 +++++++--------
 external/pdfium/ubsan.patch                    |    6 
 solenv/flatpak-manifest.in                     |    6 
 svx/source/svdraw/svdpdf.cxx                   |   15 +-
 vcl/qa/cppunit/pdfexport/pdfexport.cxx         |    9 -
 12 files changed, 307 insertions(+), 317 deletions(-)

New commits:
commit b24dbb00f606854776a7b8ed80ef9cb75e748bb9
Author:     Miklos Vajna <[email protected]>
AuthorDate: Wed May 24 20:13:48 2023 +0200
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 15:15:29 2023 +0200

    Update pdfium to 5778
    
    - external/pdfium/abseil-trivial.patch is no longer needed, upstream
      does what we did previously
    
    - external/pdfium/build.patch.1: re-generate with 'patch -p1' + 'git
      diff'
    
    - external/pdfium/include.patch is no longer needed, upstream does what
      we did previously
    
    Change-Id: I39a6f721e436aa53914bbf43b78ac7d86e5eac59
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152244
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index 874354bf337a..398dc963b330 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
1a625b25562fb4c25c8bf4660c704111cdd306b8934b94dcd9b89329909ede55
-export PDFIUM_TARBALL := pdfium-5636.tar.bz2
+export PDFIUM_SHA256SUM := 
b1052ff24e9ffb11af017c444bb0f6ad508d64c9a0fb88cacb0e8210245dde06
+export PDFIUM_TARBALL := pdfium-5778.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/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index 567c304db94b..188faa1cee67 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -286,6 +286,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfunc \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_basedcs \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_indexedcs \
+    UnpackedTarball/pdfium/core/fpdfapi/parser/object_tree_traversal_util \
 ))
 
 # fpdfdoc
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index eeb88d909fe0..55c3cb304f3b 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -1,8 +1,66 @@
+-*- Mode: diff -*-
+diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp 
b/core/fpdfapi/font/cpdf_cidfont.cpp
+index f5a51b24e..8b308d0a6 100644
+--- a/core/fpdfapi/font/cpdf_cidfont.cpp
++++ b/core/fpdfapi/font/cpdf_cidfont.cpp
+@@ -755,7 +755,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, 
bool* pVertGlyph) {
+         uint32_t maccode = CharCodeFromUnicodeForFreetypeEncoding(
+             FT_ENCODING_APPLE_ROMAN, name_unicode);
+         index = maccode ? FT_Get_Char_Index(face, maccode)
+-                        : FT_Get_Name_Index(face, name);
++                        : FT_Get_Name_Index(face, const_cast<char*>(name));
+       }
+       if (index == 0 || index == 0xffff)
+         return charcode ? static_cast<int>(charcode) : -1;
+diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp 
b/core/fpdfapi/font/cpdf_truetypefont.cpp
+index 0a59b54eb..a96e11759 100644
+--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
++++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
+@@ -91,7 +91,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
+               FT_ENCODING_APPLE_ROMAN,
+               m_Encoding.UnicodeFromCharCode(charcode));
+           if (!maccode) {
+-            m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name);
++            m_GlyphIndex[charcode] = FT_Get_Name_Index(face, 
const_cast<char*>(name));
+           } else {
+             m_GlyphIndex[charcode] = FT_Get_Char_Index(face, maccode);
+           }
+@@ -105,7 +105,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
+         m_GlyphIndex[charcode] = FT_Get_Char_Index(face, 32);
+         continue;
+       }
+-      m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name);
++      m_GlyphIndex[charcode] = FT_Get_Name_Index(face, 
const_cast<char*>(name));
+       if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
+         continue;
+ 
+diff --git a/core/fpdfapi/font/cpdf_type1font.cpp 
b/core/fpdfapi/font/cpdf_type1font.cpp
+index 55510e7d7..2f13f00b8 100644
+--- a/core/fpdfapi/font/cpdf_type1font.cpp
++++ b/core/fpdfapi/font/cpdf_type1font.cpp
+@@ -263,7 +263,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
+                                           static_cast<uint32_t>(charcode));
+       if (name) {
+         m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
+-        m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
++        m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), 
const_cast<char*>(name));
+       } else {
+         m_GlyphIndex[charcode] = FT_Get_Char_Index(
+             m_Font.GetFaceRec(), static_cast<uint32_t>(charcode));
+@@ -294,7 +294,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
+       continue;
+ 
+     m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
+-    m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
++    m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), 
const_cast<char*>(name));
+     if (m_GlyphIndex[charcode] != 0)
+       continue;
+ 
 diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp
-index 323de4ffc..f11a0b0ad 100644
+index 228a0c137..bf512beb3 100644
 --- a/core/fpdfdoc/cpdf_metadata.cpp
 +++ b/core/fpdfdoc/cpdf_metadata.cpp
-@@ -74,7 +74,7 @@ std::vector<UnsupportedFeature> 
CPDF_Metadata::CheckForSharedForm() const {
+@@ -77,7 +77,7 @@ std::vector<UnsupportedFeature> 
CPDF_Metadata::CheckForSharedForm() const {
    CFX_XMLParser parser(stream);
    std::unique_ptr<CFX_XMLDocument> doc = parser.Parse();
    if (!doc)
@@ -11,37 +69,11 @@ index 323de4ffc..f11a0b0ad 100644
  
    std::vector<UnsupportedFeature> unsupported;
    CheckForSharedFormInternal(doc->GetRoot(), &unsupported);
-diff --git a/third_party/base/span.h b/third_party/base/span.h
-index ec9f9903f..1c17ad091 100644
---- a/third_party/base/span.h
-+++ b/third_party/base/span.h
-@@ -208,7 +208,7 @@ class span {
-   // Conversions from spans of compatible types: this allows a span<T> to be
-   // seamlessly used as a span<const T>, but not the other way around.
-   template <typename U, typename = internal::EnableIfLegalSpanConversion<U, 
T>>
--  constexpr span(const span<U>& other) : span(other.data(), other.size()) {}
-+  span(const span<U>& other) : span(other.data(), other.size()) {}
-   span& operator=(const span& other) noexcept {
-     if (this != &other) {
-       ReleaseEmptySpan();
-diff --git a/third_party/base/span.h b/third_party/base/span.h
-index 0fb627ba8..dda1fc8bc 100644
---- a/third_party/base/span.h
-+++ b/third_party/base/span.h
-@@ -204,7 +204,7 @@ class span {
-   // size()|.
-   template <typename Container,
-             typename = internal::EnableIfSpanCompatibleContainer<Container, 
T>>
--  constexpr span(Container& container)
-+  span(Container& container)
-       : span(container.data(), container.size()) {}
-   template <
-       typename Container,
 diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp 
b/core/fxcodec/jpx/cjpx_decoder.cpp
-index d8875786c..bc019ebe1 100644
+index 9391d61ab..490ce2230 100644
 --- a/core/fxcodec/jpx/cjpx_decoder.cpp
 +++ b/core/fxcodec/jpx/cjpx_decoder.cpp
-@@ -73,7 +73,7 @@ absl::optional<OpjImageRgbData> alloc_rgb(size_t size) {
+@@ -75,7 +75,7 @@ absl::optional<OpjImageRgbData> alloc_rgb(size_t size) {
    if (!data.b)
      return absl::nullopt;
  
@@ -52,10 +84,10 @@ index d8875786c..bc019ebe1 100644
  void sycc_to_rgb(int offset,
 
 diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
-index 8b3a72700..ea1db23f4 100644
+index a2a44df39..d6cedee46 100644
 --- a/core/fxge/cfx_font.cpp
 +++ b/core/fxge/cfx_font.cpp
-@@ -47,25 +47,9 @@ struct OUTLINE_PARAMS {
+@@ -48,25 +48,9 @@ struct OUTLINE_PARAMS {
  // TODO(crbug.com/pdfium/1400): When FT_Done_MM_Var() is more likely to be
  // available to all users in the future, remove FreeMMVar() and use
  // FT_Done_MM_Var() directly.
@@ -82,10 +114,10 @@ index 8b3a72700..ea1db23f4 100644
  
  FX_RECT FXRectFromFTPos(FT_Pos left, FT_Pos top, FT_Pos right, FT_Pos bottom) 
{
 diff --git a/third_party/base/numerics/safe_conversions_impl.h 
b/third_party/base/numerics/safe_conversions_impl.h
-index 4d8a7b7d9..d14c6dc06 100644
+index 44c921a14..0152a89b7 100644
 --- a/third_party/base/numerics/safe_conversions_impl.h
 +++ b/third_party/base/numerics/safe_conversions_impl.h
-@@ -88,7 +88,7 @@ constexpr typename std::make_unsigned<T>::type 
SafeUnsignedAbs(T value) {
+@@ -89,7 +89,7 @@ constexpr typename std::make_unsigned<T>::type 
SafeUnsignedAbs(T value) {
  
  // TODO(jschuh): Switch to std::is_constant_evaluated() once C++20 is 
supported.
  // Alternately, the usage could be restructured for "consteval if" in C++23.
@@ -94,57 +126,28 @@ index 4d8a7b7d9..d14c6dc06 100644
  
  // TODO(jschuh): Debug builds don't reliably propagate constants, so we 
restrict
  // some accelerated runtime paths to release builds until this can be forced
---- pdfium/core/fpdfapi/font/cpdf_cidfont.cpp.orig     2022-05-20 
09:25:52.066728467 +0000
-+++ pdfium/core/fpdfapi/font/cpdf_cidfont.cpp  2022-05-20 09:25:56.146736531 
+0000
-@@ -738,7 +738,7 @@
-         uint32_t maccode = CharCodeFromUnicodeForFreetypeEncoding(
-             FT_ENCODING_APPLE_ROMAN, name_unicode);
-         index = maccode ? FT_Get_Char_Index(face, maccode)
--                        : FT_Get_Name_Index(face, name);
-+                        : FT_Get_Name_Index(face, const_cast<char*>(name));
-       }
-       if (index == 0 || index == 0xffff)
-         return charcode ? static_cast<int>(charcode) : -1;
---- pdfium/core/fpdfapi/font/cpdf_type1font.cpp.orig   2022-05-20 
09:26:59.090862058 +0000
-+++ pdfium/core/fpdfapi/font/cpdf_type1font.cpp        2022-05-20 
09:27:33.810932435 +0000
-@@ -260,7 +260,7 @@
-                                           static_cast<uint32_t>(charcode));
-       if (name) {
-         m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
--        m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
-+        m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), 
const_cast<char*>(name));
-       } else {
-         m_GlyphIndex[charcode] = FT_Get_Char_Index(
-             m_Font.GetFaceRec(), static_cast<uint32_t>(charcode));
-@@ -291,7 +291,7 @@
-       continue;
- 
-     m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
--    m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
-+    m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), 
const_cast<char*>(name));
-     if (m_GlyphIndex[charcode] != 0)
-       continue;
- 
---- pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp.orig        2022-05-20 
09:26:12.066767996 +0000
-+++ pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp     2022-05-20 
09:26:46.690836923 +0000
-@@ -90,7 +90,7 @@
-               FT_ENCODING_APPLE_ROMAN,
-               m_Encoding.UnicodeFromCharCode(charcode));
-           if (!maccode) {
--            m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name);
-+            m_GlyphIndex[charcode] = FT_Get_Name_Index(face, 
const_cast<char*>(name));
-           } else {
-             m_GlyphIndex[charcode] = FT_Get_Char_Index(face, maccode);
-           }
-@@ -104,7 +104,7 @@
-         m_GlyphIndex[charcode] = FT_Get_Char_Index(face, 32);
-         continue;
-       }
--      m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name);
-+      m_GlyphIndex[charcode] = FT_Get_Name_Index(face, 
const_cast<char*>(name));
-       if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
-         continue;
+diff --git a/third_party/base/span.h b/third_party/base/span.h
+index ed2a3c8de..87493861c 100644
+--- a/third_party/base/span.h
++++ b/third_party/base/span.h
+@@ -211,7 +211,7 @@ class TRIVIAL_ABI GSL_POINTER span {
+ #else
+   template <typename Container,
+             typename = internal::EnableIfSpanCompatibleContainer<Container, 
T>>
+-  constexpr span(Container& container)
++  span(Container& container)
+       : span(container.data(), container.size()) {}
+ #endif
  
+@@ -225,7 +225,7 @@ class TRIVIAL_ABI GSL_POINTER span {
+   // Conversions from spans of compatible types: this allows a span<T> to be
+   // seamlessly used as a span<const T>, but not the other way around.
+   template <typename U, typename = internal::EnableIfLegalSpanConversion<U, 
T>>
+-  constexpr span(const span<U>& other) : span(other.data(), other.size()) {}
++  span(const span<U>& other) : span(other.data(), other.size()) {}
+   span& operator=(const span& other) noexcept {
+     if (this != &other) {
+       ReleaseEmptySpan();
 diff --git a/third_party/libopenjpeg/openjpeg.c 
b/third_party/libopenjpeg/openjpeg.c
 index 29d3ee528..d5c7a1bc9 100644
 --- a/third_party/libopenjpeg/openjpeg.c
commit 5e0d19a958487f18c32a0221dcabe0faf4730c1c
Author:     Miklos Vajna <[email protected]>
AuthorDate: Fri Mar 10 17:21:42 2023 +0100
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 15:06:15 2023 +0200

    Update pdfium to 5636
    
    Some changes in the bundled libtiff, but it seems that would be for XFA
    which we disable, so it doesn't affect us.
    
    Change-Id: Ibadeecf20daec342fbfef6d1e89bd17f5f0095e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148652
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index c636a307ec6b..874354bf337a 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
9fae5f8b3b90a4f7ca663f741e232e1e4c3f098fb7a18b0ad52e74ae172cf16c
-export PDFIUM_TARBALL := pdfium-5522.tar.bz2
+export PDFIUM_SHA256SUM := 
1a625b25562fb4c25c8bf4660c704111cdd306b8934b94dcd9b89329909ede55
+export PDFIUM_TARBALL := pdfium-5636.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/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index 315b5d81ec12..6258e8036360 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -310,6 +310,8 @@
 #include <core/fxcrt/fileaccess_iface.h>
 #include <core/fxcrt/fixed_try_alloc_zeroed_data_vector.h>
 #include <core/fxcrt/fixed_uninit_data_vector.h>
+#include <core/fxcrt/fixed_zeroed_data_vector.h>
+#include <core/fxcrt/fx_2d_size.h>
 #include <core/fxcrt/fx_bidi.h>
 #include <core/fxcrt/fx_codepage.h>
 #include <core/fxcrt/fx_coordinates.h>
commit d7b95c99d5254f283fbc9c52a1587d9eda1bc4f5
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu Jan 12 20:12:37 2023 +0100
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 14:19:46 2023 +0200

    Update pdfium to 5522
    
    The internal libpng 1.6 is now dropped, but that doesn't really affect
    us.
    
    Change-Id: I777c024c76c17689c20bbe6453467ba5fb22baba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145417
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index 6384fa3b9e89..c636a307ec6b 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
7db59b1e91f2bc0ab4c5e19d1a4f881e6a47dbb0d3b7e980a7358225b12a0f35
-export PDFIUM_TARBALL := pdfium-5408.tar.bz2
+export PDFIUM_SHA256SUM := 
9fae5f8b3b90a4f7ca663f741e232e1e4c3f098fb7a18b0ad52e74ae172cf16c
+export PDFIUM_TARBALL := pdfium-5522.tar.bz2
 export PIXMAN_SHA256SUM := 
21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 
505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
commit 7c34dab3b67944e55bd2050f99107a2689108209
Author:     Miklos Vajna <[email protected]>
AuthorDate: Wed Nov 9 13:19:49 2022 +0100
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 14:10:54 2023 +0200

    Update pdfium to 5408
    
    - drop cg-instead-of-carbon.patch.1, no longer needed after
      https://pdfium-review.googlesource.com/c/pdfium/+/99753
    
    - drop AndroidNDK19.patch.1, no longer needed after
      https://pdfium-review.googlesource.com/c/pdfium/+/96530
    
    - drop gcc-c++20-comparison.patch, no longer needed after
      
<https://pdfium.googlesource.com/pdfium/+/065698acf82962a3168a0d56bb1d5964bc593d00>
      "Fix interaction between RetainPtr<T> and transparent comparisons" since
      chromium/5321
    
    Change-Id: I1f861dd8a3d490400bb39c108bd4e767a2f45d30
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142474
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index 73d85020b714..6384fa3b9e89 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
ecb9c2a0d777196949994946e3f24ed251ae5d3db8a9fa1e2827ef857151db13
-export PDFIUM_TARBALL := pdfium-5298.tar.bz2
+export PDFIUM_SHA256SUM := 
7db59b1e91f2bc0ab4c5e19d1a4f881e6a47dbb0d3b7e980a7358225b12a0f35
+export PDFIUM_TARBALL := pdfium-5408.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/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index da02f067edbe..567c304db94b 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -237,9 +237,9 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/render/charposlist \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_devicebuffer \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_docrenderdata \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imageloader \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_imageloader \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imagerenderer \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_pagerendercache \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageimagecache \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_progressiverenderer \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_rendercontext \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_renderoptions \
@@ -563,17 +563,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 
 # pdfium_base
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization
 \
-    
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 \
-    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/oom_callback
 \
-    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_bucket
 \
-    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_oom
 \
-    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_page
 \
-    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_root_base
 \
-    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/random \
     UnpackedTarball/pdfium/third_party/base/memory/aligned_memory \
 ))
 
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index 8b81125d205b..a2214f645ae8 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -30,17 +30,7 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/bigint/BigIntegerUtils.cc 
third_party/bigint/BigIntegerUtils.cpp && \
     mv third_party/bigint/BigUnsigned.cc third_party/bigint/BigUnsigned.cpp && 
\
     mv third_party/bigint/BigUnsignedInABase.cc 
third_party/bigint/BigUnsignedInABase.cpp && \
-    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/debug/alias.cc third_party/base/debug/alias.cpp && \
-    mv third_party/base/allocator/partition_allocator/oom_callback.cc 
third_party/base/allocator/partition_allocator/oom_callback.cpp && \
-    mv third_party/base/allocator/partition_allocator/partition_bucket.cc 
third_party/base/allocator/partition_allocator/partition_bucket.cpp && \
-    mv third_party/base/allocator/partition_allocator/partition_oom.cc 
third_party/base/allocator/partition_allocator/partition_oom.cpp && \
-    mv third_party/base/allocator/partition_allocator/partition_page.cc 
third_party/base/allocator/partition_allocator/partition_page.cpp && \
-    mv third_party/base/allocator/partition_allocator/partition_root_base.cc 
third_party/base/allocator/partition_allocator/partition_root_base.cpp && \
-    mv third_party/base/allocator/partition_allocator/random.cc 
third_party/base/allocator/partition_allocator/random.cpp && \
     mv third_party/base/memory/aligned_memory.cc 
third_party/base/memory/aligned_memory.cpp && \
     mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp && \
     mv third_party/libopenjpeg/opj_malloc.cc 
third_party/libopenjpeg/opj_malloc.cpp && \
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 90bde6ea9d55..eeb88d909fe0 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -158,16 +158,3 @@ index 29d3ee528..d5c7a1bc9 100644
          OPJ_BOOL strict)
  {
      if (p_codec) {
-diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp 
b/core/fpdfapi/parser/cpdf_data_avail.cpp
-index a17ec0353..3b024ac91 100644
---- a/core/fpdfapi/parser/cpdf_data_avail.cpp
-+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
-@@ -902,7 +902,7 @@ CPDF_DataAvail::DocAvailStatus 
CPDF_DataAvail::CheckResources(
-   CPDF_PageObjectAvail* resource_avail =
-       m_PagesResourcesAvail
-           .insert(std::make_pair(
--              resources,
-+              resources.Get(),
-               std::make_unique<CPDF_PageObjectAvail>(
-                   GetValidator(), m_pDocument.Get(), resources.Get())))
-           .first->second.get();
diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index 21bc61f05fb3..315b5d81ec12 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2020-09-21 15:21:21 using:
+ Generated on 2022-11-08 17:05:53 using:
  ./bin/update_pch external/pdfium pdfium --cutoff=1 --exclude:system 
--include:module --include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -31,7 +31,6 @@
 #include <agg_vcgen_stroke.h>
 #include <algorithm>
 #include <array>
-#include <atomic>
 #include <cassert>
 #include <cfloat>
 #include <climits>
@@ -127,11 +126,13 @@
 #include <core/fpdfapi/page/cpdf_graphicstates.h>
 #include <core/fpdfapi/page/cpdf_iccprofile.h>
 #include <core/fpdfapi/page/cpdf_image.h>
+#include <core/fpdfapi/page/cpdf_imageloader.h>
 #include <core/fpdfapi/page/cpdf_imageobject.h>
 #include <core/fpdfapi/page/cpdf_indexedcs.h>
 #include <core/fpdfapi/page/cpdf_meshstream.h>
 #include <core/fpdfapi/page/cpdf_occontext.h>
 #include <core/fpdfapi/page/cpdf_page.h>
+#include <core/fpdfapi/page/cpdf_pageimagecache.h>
 #include <core/fpdfapi/page/cpdf_pagemodule.h>
 #include <core/fpdfapi/page/cpdf_pageobject.h>
 #include <core/fpdfapi/page/cpdf_pageobjectholder.h>
@@ -189,9 +190,7 @@
 #include <core/fpdfapi/render/charposlist.h>
 #include <core/fpdfapi/render/cpdf_devicebuffer.h>
 #include <core/fpdfapi/render/cpdf_docrenderdata.h>
-#include <core/fpdfapi/render/cpdf_imageloader.h>
 #include <core/fpdfapi/render/cpdf_imagerenderer.h>
-#include <core/fpdfapi/render/cpdf_pagerendercache.h>
 #include <core/fpdfapi/render/cpdf_pagerendercontext.h>
 #include <core/fpdfapi/render/cpdf_progressiverenderer.h>
 #include <core/fpdfapi/render/cpdf_rendercontext.h>
@@ -309,6 +308,8 @@
 #include <core/fxcrt/css/cfx_cssvaluelistparser.h>
 #include <core/fxcrt/data_vector.h>
 #include <core/fxcrt/fileaccess_iface.h>
+#include <core/fxcrt/fixed_try_alloc_zeroed_data_vector.h>
+#include <core/fxcrt/fixed_uninit_data_vector.h>
 #include <core/fxcrt/fx_bidi.h>
 #include <core/fxcrt/fx_codepage.h>
 #include <core/fxcrt/fx_coordinates.h>
@@ -461,22 +462,6 @@
 #include <third_party/agg23/agg_rasterizer_scanline_aa.h>
 #include <third_party/agg23/agg_renderer_scanline.h>
 #include <third_party/agg23/agg_scanline_u.h>
-#include 
<third_party/base/allocator/partition_allocator/address_space_randomization.h>
-#include <third_party/base/allocator/partition_allocator/oom.h>
-#include <third_party/base/allocator/partition_allocator/oom_callback.h>
-#include <third_party/base/allocator/partition_allocator/page_allocator.h>
-#include 
<third_party/base/allocator/partition_allocator/page_allocator_internal.h>
-#include <third_party/base/allocator/partition_allocator/partition_alloc.h>
-#include 
<third_party/base/allocator/partition_allocator/partition_alloc_check.h>
-#include 
<third_party/base/allocator/partition_allocator/partition_alloc_constants.h>
-#include <third_party/base/allocator/partition_allocator/partition_bucket.h>
-#include 
<third_party/base/allocator/partition_allocator/partition_direct_map_extent.h>
-#include <third_party/base/allocator/partition_allocator/partition_oom.h>
-#include <third_party/base/allocator/partition_allocator/partition_page.h>
-#include <third_party/base/allocator/partition_allocator/partition_root_base.h>
-#include <third_party/base/allocator/partition_allocator/random.h>
-#include <third_party/base/allocator/partition_allocator/spin_lock.h>
-#include <third_party/base/bits.h>
 #include <third_party/base/check.h>
 #include <third_party/base/check_op.h>
 #include <third_party/base/compiler_specific.h>
commit 338818f1a529740d53f84e48f46f889c65c8a4ea
Author:     Miklos Vajna <[email protected]>
AuthorDate: Tue Sep 13 20:26:53 2022 +0200
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 14:00:29 2023 +0200

    external: update pdfium to 5298
    
    pdfium_arm64.patch.1 is now upstreamed as
    <https://pdfium-review.googlesource.com/c/pdfium/+/96010>.
    
    Change-Id: Iafb1ba480161429094db5446ab50314068ae4cfc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139876
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index c48323b60a13..73d85020b714 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
04e0e3f90589250c1fa97cec543af6f5e6c8c2daa377d614ec1f04b061b86651
-export PDFIUM_TARBALL := pdfium-5187.tar.bz2
+export PDFIUM_SHA256SUM := 
ecb9c2a0d777196949994946e3f24ed251ae5d3db8a9fa1e2827ef857151db13
+export PDFIUM_TARBALL := pdfium-5298.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/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index c30f1ec922ae..da02f067edbe 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -237,7 +237,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/render/charposlist \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_devicebuffer \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_docrenderdata \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imagecacheentry \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imageloader \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imagerenderer \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_pagerendercache \
@@ -406,10 +405,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/css/cfx_cssoutputtextbuf \
     UnpackedTarball/pdfium/core/fxcrt/cfx_datetime \
     UnpackedTarball/pdfium/core/fxcrt/bytestring \
-    UnpackedTarball/pdfium/core/fxcrt/cfx_binarybuf \
     UnpackedTarball/pdfium/core/fxcrt/cfx_bitstream \
     UnpackedTarball/pdfium/core/fxcrt/cfx_utf8decoder \
-    UnpackedTarball/pdfium/core/fxcrt/cfx_widetextbuf \
     UnpackedTarball/pdfium/core/fxcrt/fx_random \
     UnpackedTarball/pdfium/core/fxcrt/fx_string \
     UnpackedTarball/pdfium/core/fxcrt/widestring \
@@ -417,9 +414,14 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/fx_codepage \
     UnpackedTarball/pdfium/core/fxcrt/fx_number \
     UnpackedTarball/pdfium/core/fxcrt/cfx_utf8encoder \
-    UnpackedTarball/pdfium/core/fxcrt/cfx_readonlymemorystream \
     UnpackedTarball/pdfium/core/fxcrt/observed_ptr \
     UnpackedTarball/pdfium/core/fxcrt/string_data_template \
+    UnpackedTarball/pdfium/core/fxcrt/binary_buffer \
+    UnpackedTarball/pdfium/core/fxcrt/cfx_read_only_span_stream \
+    UnpackedTarball/pdfium/core/fxcrt/cfx_read_only_string_stream \
+    UnpackedTarball/pdfium/core/fxcrt/cfx_read_only_vector_stream \
+    UnpackedTarball/pdfium/core/fxcrt/fx_memory_malloc \
+    UnpackedTarball/pdfium/core/fxcrt/widetext_buffer \
 ))
 
 # fxge
@@ -527,6 +529,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 # third_party/abseil-cpp
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     
UnpackedTarball/pdfium/third_party/abseil-cpp/absl/types/bad_optional_access \
+    
UnpackedTarball/pdfium/third_party/abseil-cpp/absl/types/bad_variant_access \
 ))
 
 # third_party/fx_libopenjpeg
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index 513fdd6baed3..8b81125d205b 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -44,7 +44,8 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/base/memory/aligned_memory.cc 
third_party/base/memory/aligned_memory.cpp && \
     mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp && \
     mv third_party/libopenjpeg/opj_malloc.cc 
third_party/libopenjpeg/opj_malloc.cpp && \
-    mv third_party/abseil-cpp/absl/types/bad_optional_access.cc 
third_party/abseil-cpp/absl/types/bad_optional_access.cpp \
+    mv third_party/abseil-cpp/absl/types/bad_optional_access.cc 
third_party/abseil-cpp/absl/types/bad_optional_access.cpp && \
+    mv third_party/abseil-cpp/absl/types/bad_variant_access.cc 
third_party/abseil-cpp/absl/types/bad_variant_access.cpp \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 1c044f7b67c8..90bde6ea9d55 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -12,18 +12,18 @@ index 323de4ffc..f11a0b0ad 100644
    std::vector<UnsupportedFeature> unsupported;
    CheckForSharedFormInternal(doc->GetRoot(), &unsupported);
 diff --git a/third_party/base/span.h b/third_party/base/span.h
-index 0fb627ba8..f71c362e2 100644
+index ec9f9903f..1c17ad091 100644
 --- a/third_party/base/span.h
 +++ b/third_party/base/span.h
-@@ -214,7 +214,7 @@ class span {
+@@ -208,7 +208,7 @@ class span {
    // Conversions from spans of compatible types: this allows a span<T> to be
    // seamlessly used as a span<const T>, but not the other way around.
    template <typename U, typename = internal::EnableIfLegalSpanConversion<U, 
T>>
 -  constexpr span(const span<U>& other) : span(other.data(), other.size()) {}
 +  span(const span<U>& other) : span(other.data(), other.size()) {}
-   span& operator=(const span& other) noexcept = default;
-   ~span() noexcept {
-     if (!size_) {
+   span& operator=(const span& other) noexcept {
+     if (this != &other) {
+       ReleaseEmptySpan();
 diff --git a/third_party/base/span.h b/third_party/base/span.h
 index 0fb627ba8..dda1fc8bc 100644
 --- a/third_party/base/span.h
diff --git a/external/pdfium/c++20-comparison.patch 
b/external/pdfium/c++20-comparison.patch
index 638497f6aee4..d26fe66ad8b7 100644
--- a/external/pdfium/c++20-comparison.patch
+++ b/external/pdfium/c++20-comparison.patch
@@ -10,4 +10,4 @@
 +  bool operator!=(const FxPartitionAllocAllocator& that) const { return 
false; }
  };
  
- // Used to put backing store for std::vector<> and such
+ // Used to put backing store for std::vector<> and such into the
diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index eaa6090cf6c6..21bc61f05fb3 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -54,6 +54,7 @@
 #include <stack>
 #include <stdarg.h>
 #include <stddef.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string>
@@ -188,7 +189,6 @@
 #include <core/fpdfapi/render/charposlist.h>
 #include <core/fpdfapi/render/cpdf_devicebuffer.h>
 #include <core/fpdfapi/render/cpdf_docrenderdata.h>
-#include <core/fpdfapi/render/cpdf_imagecacheentry.h>
 #include <core/fpdfapi/render/cpdf_imageloader.h>
 #include <core/fpdfapi/render/cpdf_imagerenderer.h>
 #include <core/fpdfapi/render/cpdf_pagerendercache.h>
@@ -274,18 +274,18 @@
 #include <core/fxcodec/scanlinedecoder.h>
 #include <core/fxcrt/autonuller.h>
 #include <core/fxcrt/autorestorer.h>
+#include <core/fxcrt/binary_buffer.h>
 #include <core/fxcrt/bytestring.h>
-#include <core/fxcrt/cfx_binarybuf.h>
 #include <core/fxcrt/cfx_bitstream.h>
 #include <core/fxcrt/cfx_datetime.h>
-#include <core/fxcrt/cfx_fixedbufgrow.h>
 #include <core/fxcrt/cfx_memorystream.h>
-#include <core/fxcrt/cfx_readonlymemorystream.h>
+#include <core/fxcrt/cfx_read_only_span_stream.h>
+#include <core/fxcrt/cfx_read_only_string_stream.h>
+#include <core/fxcrt/cfx_read_only_vector_stream.h>
 #include <core/fxcrt/cfx_seekablestreamproxy.h>
 #include <core/fxcrt/cfx_timer.h>
 #include <core/fxcrt/cfx_utf8decoder.h>
 #include <core/fxcrt/cfx_utf8encoder.h>
-#include <core/fxcrt/cfx_widetextbuf.h>
 #include <core/fxcrt/css/cfx_css.h>
 #include <core/fxcrt/css/cfx_csscolorvalue.h>
 #include <core/fxcrt/css/cfx_csscomputedstyle.h>
@@ -307,6 +307,7 @@
 #include <core/fxcrt/css/cfx_cssvalue.h>
 #include <core/fxcrt/css/cfx_cssvaluelist.h>
 #include <core/fxcrt/css/cfx_cssvaluelistparser.h>
+#include <core/fxcrt/data_vector.h>
 #include <core/fxcrt/fileaccess_iface.h>
 #include <core/fxcrt/fx_bidi.h>
 #include <core/fxcrt/fx_codepage.h>
@@ -328,12 +329,14 @@
 #include <core/fxcrt/pauseindicator_iface.h>
 #include <core/fxcrt/retain_ptr.h>
 #include <core/fxcrt/scoped_set_insertion.h>
+#include <core/fxcrt/small_buffer.h>
 #include <core/fxcrt/span_util.h>
 #include <core/fxcrt/stl_util.h>
 #include <core/fxcrt/string_data_template.h>
 #include <core/fxcrt/string_pool_template.h>
 #include <core/fxcrt/unowned_ptr.h>
 #include <core/fxcrt/widestring.h>
+#include <core/fxcrt/widetext_buffer.h>
 #include <core/fxcrt/xml/cfx_xmlchardata.h>
 #include <core/fxcrt/xml/cfx_xmldocument.h>
 #include <core/fxcrt/xml/cfx_xmlelement.h>
commit 66bd1dfa7f2ba8a95f4e29d8e8616af9fb0750f1
Author:     Miklos Vajna <[email protected]>
AuthorDate: Tue Jul 19 20:01:06 2022 +0200
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 13:27:48 2023 +0200

    external: update pdfium to 5187
    
    build.patch.1 is extended to avoid:
    
    > 
C:/lo/master/workdir/UnpackedTarball/pdfium/third_party/libopenjpeg/openjpeg.c(438):
 error C2491: 'opj_decoder_set_strict_mode': definition of dllimport function 
not allowed
    
    and also is extended to avoid:
    
    > /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stl_tree.h:2028:5: note: 
  no known conversion for argument 1 from 
‘std::pair<fxcrt::RetainPtr<CPDF_Object>, std::unique_ptr<CPDF_PageObjectAvail> 
>::first_type {aka fxcrt::RetainPtr<CPDF_Object>}’ to ‘const CPDF_Object* 
const&’
    
    Change-Id: Icacc05627a8612b33d6445685d26470e7c757b8e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137238
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins

diff --git a/download.lst b/download.lst
index a1f5200cf8e1..c48323b60a13 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
eaf4ce9fad32b5d951c524139df23119b66c67720057defb97acab2dfb2582ac
-export PDFIUM_TARBALL := pdfium-5058.tar.bz2
+export PDFIUM_SHA256SUM := 
04e0e3f90589250c1fa97cec543af6f5e6c8c2daa377d614ec1f04b061b86651
+export PDFIUM_TARBALL := pdfium-5187.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/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index 37b0e535df2d..c30f1ec922ae 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -477,6 +477,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/dib/cfx_cmyk_to_srgb \
     UnpackedTarball/pdfium/core/fxge/text_char_pos \
     UnpackedTarball/pdfium/core/fxge/cfx_face \
+    UnpackedTarball/pdfium/core/fxge/cfx_defaultrenderdevice \
     UnpackedTarball/pdfium/core/fxge/calculate_pitch \
 ))
 
@@ -530,30 +531,31 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 
 # third_party/fx_libopenjpeg
 $(eval $(call gb_Library_add_generated_cobjects,pdfium,\
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/bio \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/cio \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/dwt \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/event \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/function_list \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/image \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/invert \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/j2k \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/jp2 \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/mct \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/mqc \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/openjpeg \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/opj_clock \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/pi \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/thread \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/t1 \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/t2 \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/tcd \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/tgt \
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/sparse_array \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/bio \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/cio \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/dwt \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/event \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/function_list \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/image \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/invert \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/j2k \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/jp2 \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/mct \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/mqc \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/openjpeg \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/opj_clock \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/pi \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/thread \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/t1 \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/t2 \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/tcd \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/tgt \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/sparse_array \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/ht_dec \
 ))
 
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/third_party/libopenjpeg20/opj_malloc \
+    UnpackedTarball/pdfium/third_party/libopenjpeg/opj_malloc \
 ))
 
 # pdfium_base
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index 350dae6150f3..513fdd6baed3 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -43,7 +43,7 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/base/allocator/partition_allocator/random.cc 
third_party/base/allocator/partition_allocator/random.cpp && \
     mv third_party/base/memory/aligned_memory.cc 
third_party/base/memory/aligned_memory.cpp && \
     mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp && \
-    mv third_party/libopenjpeg20/opj_malloc.cc 
third_party/libopenjpeg20/opj_malloc.cpp && \
+    mv third_party/libopenjpeg/opj_malloc.cc 
third_party/libopenjpeg/opj_malloc.cpp && \
     mv third_party/abseil-cpp/absl/types/bad_optional_access.cc 
third_party/abseil-cpp/absl/types/bad_optional_access.cpp \
 ))
 
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 3c56f3da633f..1c044f7b67c8 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -145,3 +145,29 @@ index 4d8a7b7d9..d14c6dc06 100644
        if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
          continue;
  
+diff --git a/third_party/libopenjpeg/openjpeg.c 
b/third_party/libopenjpeg/openjpeg.c
+index 29d3ee528..d5c7a1bc9 100644
+--- a/third_party/libopenjpeg/openjpeg.c
++++ b/third_party/libopenjpeg/openjpeg.c
+@@ -433,7 +433,7 @@ OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t 
*p_codec,
+     return OPJ_FALSE;
+ }
+ 
+-OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t 
*p_codec,
++OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec,
+         OPJ_BOOL strict)
+ {
+     if (p_codec) {
+diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp 
b/core/fpdfapi/parser/cpdf_data_avail.cpp
+index a17ec0353..3b024ac91 100644
+--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
++++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
+@@ -902,7 +902,7 @@ CPDF_DataAvail::DocAvailStatus 
CPDF_DataAvail::CheckResources(
+   CPDF_PageObjectAvail* resource_avail =
+       m_PagesResourcesAvail
+           .insert(std::make_pair(
+-              resources,
++              resources.Get(),
+               std::make_unique<CPDF_PageObjectAvail>(
+                   GetValidator(), m_pDocument.Get(), resources.Get())))
+           .first->second.get();
commit df269ce86ccc7c6b5cd4b0a0b7008983d0eecb70
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu May 19 20:24:18 2022 +0200
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 12:51:50 2023 +0200

    external: update pdfium to 5058
    
    Which started to use require __builtin_is_constant_evaluated(), which
    our baseline doesn't have, so patch that out for now.
    
    Change-Id: Idd1923291a933209d18bb677d011c9353c8f8c4d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134648
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index edf069a36f77..a1f5200cf8e1 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
563842a02657daee3a162b769fb42ae436782c839a5ac5d22d04c4e5664970e1
-export PDFIUM_TARBALL := pdfium-4933.tar.bz2
+export PDFIUM_SHA256SUM := 
eaf4ce9fad32b5d951c524139df23119b66c67720057defb97acab2dfb2582ac
+export PDFIUM_TARBALL := pdfium-5058.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/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index b72889e062b2..37b0e535df2d 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -40,14 +40,11 @@ $(eval $(call 
gb_Library_set_generated_cxx_suffix,pdfium,cpp))
 # pdfium
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annot \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annothandlermgr \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annotiteration \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_baannot \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_baannothandler \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_formfillenvironment \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pageview \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_widget \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_widgethandler \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_dataavail \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_ext \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_flatten \
@@ -56,7 +53,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/fpdf_structtree \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_sysfontinfo \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_transformpage \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_actionhandler \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annotiterator \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_customaccess \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_filewriteadapter \
@@ -73,7 +69,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/fpdf_save \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_text \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_view \
-    UnpackedTarball/pdfium/fpdfsdk/ipdfsdk_annothandler \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pauseadapter \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_renderpage \
@@ -84,6 +79,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
        UnpackedTarball/pdfium/constants/page_object \
        UnpackedTarball/pdfium/constants/stream_dict_common \
        UnpackedTarball/pdfium/constants/transparency \
+       UnpackedTarball/pdfium/constants/font_encodings \
 ))
 
 # fdrm
@@ -262,7 +258,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/font/cfx_stockfontarray \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cid2unicodemap \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cmap \
-    UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cmapmanager \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cmapparser \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_fontglobals \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_tounicodemap \
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 45c1528569da..3c56f3da633f 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -81,3 +81,67 @@ index 8b3a72700..ea1db23f4 100644
  }
  
  FX_RECT FXRectFromFTPos(FT_Pos left, FT_Pos top, FT_Pos right, FT_Pos bottom) 
{
+diff --git a/third_party/base/numerics/safe_conversions_impl.h 
b/third_party/base/numerics/safe_conversions_impl.h
+index 4d8a7b7d9..d14c6dc06 100644
+--- a/third_party/base/numerics/safe_conversions_impl.h
++++ b/third_party/base/numerics/safe_conversions_impl.h
+@@ -88,7 +88,7 @@ constexpr typename std::make_unsigned<T>::type 
SafeUnsignedAbs(T value) {
+ 
+ // TODO(jschuh): Switch to std::is_constant_evaluated() once C++20 is 
supported.
+ // Alternately, the usage could be restructured for "consteval if" in C++23.
+-#define IsConstantEvaluated() (__builtin_is_constant_evaluated())
++#define IsConstantEvaluated() (false)
+ 
+ // TODO(jschuh): Debug builds don't reliably propagate constants, so we 
restrict
+ // some accelerated runtime paths to release builds until this can be forced
+--- pdfium/core/fpdfapi/font/cpdf_cidfont.cpp.orig     2022-05-20 
09:25:52.066728467 +0000
++++ pdfium/core/fpdfapi/font/cpdf_cidfont.cpp  2022-05-20 09:25:56.146736531 
+0000
+@@ -738,7 +738,7 @@
+         uint32_t maccode = CharCodeFromUnicodeForFreetypeEncoding(
+             FT_ENCODING_APPLE_ROMAN, name_unicode);
+         index = maccode ? FT_Get_Char_Index(face, maccode)
+-                        : FT_Get_Name_Index(face, name);
++                        : FT_Get_Name_Index(face, const_cast<char*>(name));
+       }
+       if (index == 0 || index == 0xffff)
+         return charcode ? static_cast<int>(charcode) : -1;
+--- pdfium/core/fpdfapi/font/cpdf_type1font.cpp.orig   2022-05-20 
09:26:59.090862058 +0000
++++ pdfium/core/fpdfapi/font/cpdf_type1font.cpp        2022-05-20 
09:27:33.810932435 +0000
+@@ -260,7 +260,7 @@
+                                           static_cast<uint32_t>(charcode));
+       if (name) {
+         m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
+-        m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
++        m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), 
const_cast<char*>(name));
+       } else {
+         m_GlyphIndex[charcode] = FT_Get_Char_Index(
+             m_Font.GetFaceRec(), static_cast<uint32_t>(charcode));
+@@ -291,7 +291,7 @@
+       continue;
+ 
+     m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
+-    m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
++    m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), 
const_cast<char*>(name));
+     if (m_GlyphIndex[charcode] != 0)
+       continue;
+ 
+--- pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp.orig        2022-05-20 
09:26:12.066767996 +0000
++++ pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp     2022-05-20 
09:26:46.690836923 +0000
+@@ -90,7 +90,7 @@
+               FT_ENCODING_APPLE_ROMAN,
+               m_Encoding.UnicodeFromCharCode(charcode));
+           if (!maccode) {
+-            m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name);
++            m_GlyphIndex[charcode] = FT_Get_Name_Index(face, 
const_cast<char*>(name));
+           } else {
+             m_GlyphIndex[charcode] = FT_Get_Char_Index(face, maccode);
+           }
+@@ -104,7 +104,7 @@
+         m_GlyphIndex[charcode] = FT_Get_Char_Index(face, 32);
+         continue;
+       }
+-      m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name);
++      m_GlyphIndex[charcode] = FT_Get_Name_Index(face, 
const_cast<char*>(name));
+       if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
+         continue;
+ 
diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index 06fece1e55ad..eaa6090cf6c6 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -45,6 +45,7 @@
 #include <map>
 #include <math.h>
 #include <memory>
+#include <new>
 #include <numeric>
 #include <ostream>
 #include <set>
@@ -72,6 +73,7 @@
 #include <constants/annotation_flags.h>
 #include <constants/appearance.h>
 #include <constants/ascii.h>
+#include <constants/font_encodings.h>
 #include <constants/form_fields.h>
 #include <constants/form_flags.h>
 #include <constants/page_object.h>
@@ -93,7 +95,6 @@
 #include <core/fpdfapi/font/cpdf_cid2unicodemap.h>
 #include <core/fpdfapi/font/cpdf_cidfont.h>
 #include <core/fpdfapi/font/cpdf_cmap.h>
-#include <core/fpdfapi/font/cpdf_cmapmanager.h>
 #include <core/fpdfapi/font/cpdf_cmapparser.h>
 #include <core/fpdfapi/font/cpdf_font.h>
 #include <core/fpdfapi/font/cpdf_fontencoding.h>
@@ -126,6 +127,7 @@
 #include <core/fpdfapi/page/cpdf_iccprofile.h>
 #include <core/fpdfapi/page/cpdf_image.h>
 #include <core/fpdfapi/page/cpdf_imageobject.h>
+#include <core/fpdfapi/page/cpdf_indexedcs.h>
 #include <core/fpdfapi/page/cpdf_meshstream.h>
 #include <core/fpdfapi/page/cpdf_occontext.h>
 #include <core/fpdfapi/page/cpdf_page.h>
@@ -318,6 +320,7 @@
 #include <core/fxcrt/fx_safe_types.h>
 #include <core/fxcrt/fx_stream.h>
 #include <core/fxcrt/fx_string.h>
+#include <core/fxcrt/fx_string_wrappers.h>
 #include <core/fxcrt/fx_system.h>
 #include <core/fxcrt/fx_unicode.h>
 #include <core/fxcrt/maybe_owned.h>
@@ -339,6 +342,7 @@
 #include <core/fxcrt/xml/cfx_xmlparser.h>
 #include <core/fxcrt/xml/cfx_xmltext.h>
 #include <core/fxge/agg/fx_agg_driver.h>
+#include <core/fxge/calculate_pitch.h>
 #include <core/fxge/cfx_cliprgn.h>
 #include <core/fxge/cfx_color.h>
 #include <core/fxge/cfx_defaultrenderdevice.h>
@@ -374,21 +378,18 @@
 #include <core/fxge/dib/fx_dib.h>
 #include <core/fxge/dib/scanlinecomposer_iface.h>
 #include <core/fxge/fontdata/chromefontdata/chromefontdata.h>
+#include <core/fxge/freetype/fx_freetype.h>
 #include <core/fxge/fx_font.h>
-#include <core/fxge/fx_freetype.h>
 #include <core/fxge/renderdevicedriver_iface.h>
 #include <core/fxge/scoped_font_transform.h>
 #include <core/fxge/systemfontinfo_iface.h>
 #include <core/fxge/text_char_pos.h>
 #include <core/fxge/text_glyph_pos.h>
-#include <fpdfsdk/cpdfsdk_actionhandler.h>
 #include <fpdfsdk/cpdfsdk_annot.h>
-#include <fpdfsdk/cpdfsdk_annothandlermgr.h>
 #include <fpdfsdk/cpdfsdk_annotiteration.h>
 #include <fpdfsdk/cpdfsdk_annotiterator.h>
 #include <fpdfsdk/cpdfsdk_appstream.h>
 #include <fpdfsdk/cpdfsdk_baannot.h>
-#include <fpdfsdk/cpdfsdk_baannothandler.h>
 #include <fpdfsdk/cpdfsdk_customaccess.h>
 #include <fpdfsdk/cpdfsdk_filewriteadapter.h>
 #include <fpdfsdk/cpdfsdk_formfillenvironment.h>
@@ -398,7 +399,6 @@
 #include <fpdfsdk/cpdfsdk_pauseadapter.h>
 #include <fpdfsdk/cpdfsdk_renderpage.h>
 #include <fpdfsdk/cpdfsdk_widget.h>
-#include <fpdfsdk/cpdfsdk_widgethandler.h>
 #include <fpdfsdk/formfiller/cffl_button.h>
 #include <fpdfsdk/formfiller/cffl_checkbox.h>
 #include <fpdfsdk/formfiller/cffl_combobox.h>
@@ -411,7 +411,6 @@
 #include <fpdfsdk/formfiller/cffl_radiobutton.h>
 #include <fpdfsdk/formfiller/cffl_textfield.h>
 #include <fpdfsdk/formfiller/cffl_textobject.h>
-#include <fpdfsdk/ipdfsdk_annothandler.h>
 #include <fpdfsdk/pwl/cpwl_button.h>
 #include <fpdfsdk/pwl/cpwl_caret.h>
 #include <fpdfsdk/pwl/cpwl_cbbutton.h>
@@ -426,7 +425,6 @@
 #include <fpdfsdk/pwl/cpwl_special_button.h>
 #include <fpdfsdk/pwl/cpwl_wnd.h>
 #include <fpdfsdk/pwl/ipwl_fillernotify.h>
-#include <fpdfsdk/pwl/ipwl_systemhandler.h>
 #include <fxjs/cjs_event_context_stub.h>
 #include <fxjs/cjs_runtimestub.h>
 #include <fxjs/ijs_event_context.h>
commit 7aacc93f4385160981052e27383635fc942b5fbe
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu Mar 17 09:02:29 2022 +0100
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 12:40:14 2023 +0200

    external: update pdfium to 4933
    
    Stop tracking build_config.h in our repo, it can be now part of the
    release tarball. It was a mistake in the past to think that this is
    generated code, it's just external code.
    
    Change-Id: Ife2fed362e28c53859399244e2f1247efb1efe86
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131695
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins

diff --git a/download.lst b/download.lst
index c3cd76ddfabb..edf069a36f77 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
2652db0220ffd12b7f62a634e14d21a49116439148101c37cb24ba17b562a39f
-export PDFIUM_TARBALL := pdfium-4818.tar.bz2
+export PDFIUM_SHA256SUM := 
563842a02657daee3a162b769fb42ae436782c839a5ac5d22d04c4e5664970e1
+export PDFIUM_TARBALL := pdfium-4933.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/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index a3f678141e86..b72889e062b2 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -291,6 +291,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfuncdib \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfunc \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_basedcs \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_indexedcs \
 ))
 
 # fpdfdoc
@@ -481,6 +482,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/dib/cfx_cmyk_to_srgb \
     UnpackedTarball/pdfium/core/fxge/text_char_pos \
     UnpackedTarball/pdfium/core/fxge/cfx_face \
+    UnpackedTarball/pdfium/core/fxge/calculate_pitch \
 ))
 
 # javascript, build with pdf_enable_v8 disabled.
diff --git a/external/pdfium/README b/external/pdfium/README
index fdcc91a0a45c..2be9e8f11b26 100644
--- a/external/pdfium/README
+++ b/external/pdfium/README
@@ -13,4 +13,5 @@ gclient sync
 git archive --prefix=pdfium/ --format=tar origin/chromium/${version} > 
pdfium-${version}.tar
 (cd ..; tar --append --file pdfium/pdfium-${version}.tar 
pdfium/third_party/freetype/src/include/ pdfium/third_party/freetype/src/src/)
 (cd ..; tar --append --file pdfium/pdfium-${version}.tar 
pdfium/third_party/abseil-cpp/absl/)
+(cd ..; tar --append --file pdfium/pdfium-${version}.tar 
pdfium/build/build_config.h pdfium/build/buildflag.h)
 bzip2 pdfium-${version}.tar
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index 511f4c85db13..350dae6150f3 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -25,10 +25,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,pdfium,\
     $(foreach patch,$(pdfium_patches),external/pdfium/$(patch)) \
 ))
 
-# Upstream build system generates this, but it's not really a generated file.
-# Stripped down version from 
<https://dxr.mozilla.org/mozilla-central/source/ipc/chromium/src/build/build_config.h>.
-$(eval $(call 
gb_UnpackedTarball_add_file,pdfium,build/build_config.h,external/pdfium/configs/build_config.h))
-
 $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/bigint/BigInteger.cc third_party/bigint/BigInteger.cpp && \
     mv third_party/bigint/BigIntegerUtils.cc 
third_party/bigint/BigIntegerUtils.cpp && \
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index ec29803246ed..45c1528569da 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -50,3 +50,34 @@ index d8875786c..bc019ebe1 100644
  }
  
  void sycc_to_rgb(int offset,
+
+diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
+index 8b3a72700..ea1db23f4 100644
+--- a/core/fxge/cfx_font.cpp
++++ b/core/fxge/cfx_font.cpp
+@@ -47,25 +47,9 @@ struct OUTLINE_PARAMS {
+ // TODO(crbug.com/pdfium/1400): When FT_Done_MM_Var() is more likely to be
+ // available to all users in the future, remove FreeMMVar() and use
+ // FT_Done_MM_Var() directly.
+-//
+-// Use weak symbols to check if FT_Done_MM_Var() is available at runtime.
+-#if !BUILDFLAG(IS_WIN)
+-extern "C" __attribute__((weak)) decltype(FT_Done_MM_Var) FT_Done_MM_Var;
+-#endif
+ 
+ void FreeMMVar(FXFT_FaceRec* rec, FXFT_MM_VarPtr variation_desc) {
+-#if BUILDFLAG(IS_WIN)
+-  // Assume `use_system_freetype` GN var is never set on Windows.
+-  constexpr bool has_ft_done_mm_var_func = true;
+-#else
+-  static const bool has_ft_done_mm_var_func = !!FT_Done_MM_Var;
+-#endif
+-  if (has_ft_done_mm_var_func) {
+-    FT_Done_MM_Var(CFX_GEModule::Get()->GetFontMgr()->GetFTLibrary(),
+-                   variation_desc);
+-  } else {
+     FXFT_Free(rec, variation_desc);
+-  }
+ }
+ 
+ FX_RECT FXRectFromFTPos(FT_Pos left, FT_Pos top, FT_Pos right, FT_Pos bottom) 
{
diff --git a/external/pdfium/c++20-comparison.patch 
b/external/pdfium/c++20-comparison.patch
index 025f9ba010db..638497f6aee4 100644
--- a/external/pdfium/c++20-comparison.patch
+++ b/external/pdfium/c++20-comparison.patch
@@ -1,13 +1,13 @@
 --- core/fxcrt/fx_memory_wrappers.h
 +++ core/fxcrt/fx_memory_wrappers.h
-@@ -70,8 +70,8 @@
+@@ -70,8 +70,8 @@ struct FxPartitionAllocAllocator {
    }
  
    // There's no state, so they are all the same,
--  bool operator==(const FxAllocAllocator& that) { return true; }
--  bool operator!=(const FxAllocAllocator& that) { return false; }
-+  bool operator==(const FxAllocAllocator& that) const { return true; }
-+  bool operator!=(const FxAllocAllocator& that) const { return false; }
+-  bool operator==(const FxPartitionAllocAllocator& that) { return true; }
+-  bool operator!=(const FxPartitionAllocAllocator& that) { return false; }
++  bool operator==(const FxPartitionAllocAllocator& that) const { return true; 
}
++  bool operator!=(const FxPartitionAllocAllocator& that) const { return 
false; }
  };
  
- #endif  // CORE_FXCRT_FX_MEMORY_WRAPPERS_H_
+ // Used to put backing store for std::vector<> and such
diff --git a/external/pdfium/configs/build_config.h 
b/external/pdfium/configs/build_config.h
deleted file mode 100644
index ec93c278767c..000000000000
--- a/external/pdfium/configs/build_config.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file adds defines about the platform we're currently building on.
-//  Operating System:
-//    OS_WIN / OS_APPLE / OS_LINUX / OS_POSIX (MACOSX or LINUX)
-//  Compiler:
-//    COMPILER_MSVC / COMPILER_GCC
-//  Processor:
-//    ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
-//    ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
-
-#ifndef BUILD_BUILD_CONFIG_H_
-#define BUILD_BUILD_CONFIG_H_
-
-// A set of macros to use for platform detection.
-#if defined(ANDROID)
-#define OS_ANDROID 1
-#define OS_LINUX 1
-#elif defined(__APPLE__)
-#define OS_APPLE 1
-#elif defined(__linux__)
-#define OS_LINUX 1
-#elif defined(__DragonFly__)
-#define OS_DRAGONFLY 1
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-#define OS_FREEBSD 1
-#elif defined(__NetBSD__)
-#define OS_NETBSD 1
-#elif defined(__OpenBSD__)
-#define OS_OPENBSD 1
-#elif defined(__sun__)
-#define OS_SOLARIS 1
-#elif defined(_WIN32)
-#define OS_WIN 1
-#else
-#error Please add support for your platform in build/build_config.h
-#endif
-
-// For access to standard BSD features, use OS_BSD instead of a
-// more specific macro.
-#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD) || defined(OS_NETBSD) || 
defined(OS_OPENBSD)
-#define OS_BSD 1
-#endif
-
-// For access to standard POSIX features, use OS_POSIX instead of a more
-// specific macro.
-#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_BSD) || 
defined(OS_SOLARIS)
-#define OS_POSIX 1
-#endif
-
-// Compiler detection.
-#if defined(__GNUC__)
-#define COMPILER_GCC 1
-#elif defined(_MSC_VER)
-#define COMPILER_MSVC 1
-#else
-#error Please add support for your compiler in build/build_config.h
-#endif
-
-// Processor architecture detection.  For more info on what's defined, see:
-//   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
-//   http://www.agner.org/optimize/calling_conventions.pdf
-//   or with gcc, run: "echo | gcc -E -dM -"
-#if defined(_M_X64) || defined(__x86_64__)
-#define ARCH_CPU_X86_FAMILY 1
-#define ARCH_CPU_X86_64 1
-#define ARCH_CPU_64_BITS 1
-#elif defined(_M_IX86) || defined(__i386__)
-#define ARCH_CPU_X86_FAMILY 1
-#define ARCH_CPU_X86 1
-#define ARCH_CPU_32_BITS 1
-#elif defined(__ARMEL__)
-#define ARCH_CPU_ARM_FAMILY 1
-#define ARCH_CPU_ARMEL 1
-#define ARCH_CPU_32_BITS 1
-#define WCHAR_T_IS_UNSIGNED 1
-#elif defined(__powerpc64__)
-#define ARCH_CPU_PPC64 1
-#define ARCH_CPU_64_BITS 1
-#elif defined(__ppc__) || defined(__powerpc__)
-#define ARCH_CPU_PPC 1
-#define ARCH_CPU_32_BITS 1
-#elif defined(__sparc__) && defined(__arch64__)
-#define ARCH_CPU_SPARC 1
-#define ARCH_CPU_64_BITS 1
-#elif defined(__sparc__)
-#define ARCH_CPU_SPARC 1
-#define ARCH_CPU_32_BITS 1
-#elif defined(__mips64) && defined(__LP64__)
-#define ARCH_CPU_MIPS 1
-#define ARCH_CPU_64_BITS 1
-#elif defined(__mips__)
-#define ARCH_CPU_MIPS 1
-#define ARCH_CPU_32_BITS 1
-#elif defined(__hppa__)
-#define ARCH_CPU_HPPA 1
-#define ARCH_CPU_32_BITS 1
-#elif defined(__ia64__)
-#define ARCH_CPU_IA64 1
-#define ARCH_CPU_64_BITS 1
-#elif defined(__s390x__)
-#define ARCH_CPU_S390X 1
-#define ARCH_CPU_64_BITS 1
-#elif defined(__s390__)
-#define ARCH_CPU_S390 1
-#define ARCH_CPU_32_BITS 1
-#elif defined(__sh__)
-#define ARCH_CPU_SH 1
-#define ARCH_CPU_32_BITS 1
-#elif defined(__alpha__)
-#define ARCH_CPU_ALPHA 1
-#define ARCH_CPU_64_BITS 1
-#elif defined(__aarch64__)
-#define ARCH_CPU_ARM_FAMILY 1
-#define ARCH_CPU_ARM64 1
-#define ARCH_CPU_64_BITS 1
-#else
-#error Please add support for your architecture in build/build_config.h
-#endif
-
-// Type detection for wchar_t.
-#if defined(OS_WIN)
-#define WCHAR_T_IS_UTF16
-#else
-#define WCHAR_T_IS_UTF32
-#endif
-
-#endif // BUILD_BUILD_CONFIG_H_
commit eef3b05b70744a6dcb8f665df491c63a670624e8
Author:     Miklos Vajna <[email protected]>
AuthorDate: Wed Jan 12 20:07:02 2022 +0100
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 12:29:21 2023 +0200

    external: update pdfium to 4818
    
    Change-Id: I68751a7b6ca2c8c86a412a0fd401e0d0f172297b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128353
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index 07a697e607de..c3cd76ddfabb 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
ee80fe0a3b20ef5c5babc494cd655d1b1a0bdec710acb04524789df500c563bf
-export PDFIUM_TARBALL := pdfium-4699.tar.bz2
+export PDFIUM_SHA256SUM := 
2652db0220ffd12b7f62a634e14d21a49116439148101c37cb24ba17b562a39f
+export PDFIUM_TARBALL := pdfium-4818.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/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index 1296e6634653..06fece1e55ad 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -66,7 +66,6 @@
 #if PCH_LEVEL >= 2
 #endif // PCH_LEVEL >= 2
 #if PCH_LEVEL >= 3
-#include <absl/types/bad_optional_access.h>
 #include <build/build_config.h>
 #include <constants/access_permissions.h>
 #include <constants/annotation_common.h>
commit 7f59dbcba8e526c03b7faacd9debeb364adbae0e
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu Nov 11 20:26:18 2021 +0100
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 12:29:12 2023 +0200

    external: update pdfium to 4699
    
    Change-Id: I545adce0491e48fad2bfc4003695bd96cc911f22
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125068
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index 16cea36f63ba..07a697e607de 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
eb98a77eaaab9e9e8de541cfd18b9438dd3c538bd5ef163820353179727f5dc9
-export PDFIUM_TARBALL := pdfium-4643.tar.bz2
+export PDFIUM_SHA256SUM := 
ee80fe0a3b20ef5c5babc494cd655d1b1a0bdec710acb04524789df500c563bf
+export PDFIUM_TARBALL := pdfium-4699.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/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index 40748b0699ab..a3f678141e86 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_Library_set_include,pdfium,\
     -I$(call gb_UnpackedTarball_get_dir,pdfium) \
     -I$(call gb_UnpackedTarball_get_dir,pdfium)/third_party \
     -I$(call gb_UnpackedTarball_get_dir,pdfium)/third_party/agg23 \
+    -I$(call gb_UnpackedTarball_get_dir,pdfium)/third_party/abseil-cpp \
     $$(INCLUDE) \
 ))
 
@@ -72,6 +73,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/fpdf_save \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_text \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_view \
+    UnpackedTarball/pdfium/fpdfsdk/ipdfsdk_annothandler \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pauseadapter \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_renderpage \
@@ -524,6 +526,11 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/third_party/agg23/agg_vcgen_stroke \
 ))
 
+# third_party/abseil-cpp
+$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
+    
UnpackedTarball/pdfium/third_party/abseil-cpp/absl/types/bad_optional_access \
+))
+
 # third_party/fx_libopenjpeg
 $(eval $(call gb_Library_add_generated_cobjects,pdfium,\
     UnpackedTarball/pdfium/third_party/libopenjpeg20/bio \
diff --git a/external/pdfium/README b/external/pdfium/README
index 0a146d2e74de..fdcc91a0a45c 100644
--- a/external/pdfium/README
+++ b/external/pdfium/README
@@ -12,4 +12,5 @@ git checkout --track origin/chromium/$version
 gclient sync
 git archive --prefix=pdfium/ --format=tar origin/chromium/${version} > 
pdfium-${version}.tar
 (cd ..; tar --append --file pdfium/pdfium-${version}.tar 
pdfium/third_party/freetype/src/include/ pdfium/third_party/freetype/src/src/)
+(cd ..; tar --append --file pdfium/pdfium-${version}.tar 
pdfium/third_party/abseil-cpp/absl/)
 bzip2 pdfium-${version}.tar
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index f4643376cee0..511f4c85db13 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -47,7 +47,8 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/base/allocator/partition_allocator/random.cc 
third_party/base/allocator/partition_allocator/random.cpp && \
     mv third_party/base/memory/aligned_memory.cc 
third_party/base/memory/aligned_memory.cpp && \
     mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp && \
-    mv third_party/libopenjpeg20/opj_malloc.cc 
third_party/libopenjpeg20/opj_malloc.cpp \
+    mv third_party/libopenjpeg20/opj_malloc.cc 
third_party/libopenjpeg20/opj_malloc.cpp && \
+    mv third_party/abseil-cpp/absl/types/bad_optional_access.cc 
third_party/abseil-cpp/absl/types/bad_optional_access.cpp \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index fce8874af8bd..ec29803246ed 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -38,80 +38,15 @@ index 0fb627ba8..dda1fc8bc 100644
    template <
        typename Container,
 diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp 
b/core/fxcodec/jpx/cjpx_decoder.cpp
-index c66985a7f..817f81dfa 100644
+index d8875786c..bc019ebe1 100644
 --- a/core/fxcodec/jpx/cjpx_decoder.cpp
 +++ b/core/fxcodec/jpx/cjpx_decoder.cpp
-@@ -71,7 +71,7 @@ Optional<OpjImageRgbData> alloc_rgb(size_t size) {
+@@ -73,7 +73,7 @@ absl::optional<OpjImageRgbData> alloc_rgb(size_t size) {
    if (!data.b)
-     return pdfium::nullopt;
+     return absl::nullopt;
  
 -  return data;
 +  return std::move(data);
  }
  
  void sycc_to_rgb(int offset,
-diff --git a/core/fdrm/fx_crypt_aes.cpp b/core/fdrm/fx_crypt_aes.cpp
-index f2170220b..ede18f581 100644
---- a/core/fdrm/fx_crypt_aes.cpp
-+++ b/core/fdrm/fx_crypt_aes.cpp
-@@ -437,7 +437,7 @@ const unsigned int D3[256] = {
-   (block[0] ^= *keysched++, block[1] ^= *keysched++, block[2] ^= *keysched++, 
\
-    block[3] ^= *keysched++)
- #define MOVEWORD(i) (block[i] = newstate[i])
--#define MAKEWORD(i)                                         \
-+#define FMAKEWORD(i)                                         \
-   (newstate[i] = (E0[(block[i] >> 24) & 0xFF] ^             \
-                   E1[(block[(i + C1) % Nb] >> 16) & 0xFF] ^ \
-                   E2[(block[(i + C2) % Nb] >> 8) & 0xFF] ^  \
-@@ -458,10 +458,10 @@ void aes_encrypt_nb_4(CRYPT_aes_context* ctx, unsigned 
int* block) {
-   unsigned int newstate[4];
-   for (i = 0; i < ctx->Nr - 1; i++) {
-     ADD_ROUND_KEY_4();
--    MAKEWORD(0);
--    MAKEWORD(1);
--    MAKEWORD(2);
--    MAKEWORD(3);
-+    FMAKEWORD(0);
-+    FMAKEWORD(1);
-+    FMAKEWORD(2);
-+    FMAKEWORD(3);
-     MOVEWORD(0);
-     MOVEWORD(1);
-     MOVEWORD(2);
-@@ -478,10 +478,10 @@ void aes_encrypt_nb_4(CRYPT_aes_context* ctx, unsigned 
int* block) {
-   MOVEWORD(3);
-   ADD_ROUND_KEY_4();
- }
--#undef MAKEWORD
-+#undef FMAKEWORD
- #undef LASTWORD
- 
--#define MAKEWORD(i)                                         \
-+#define FMAKEWORD(i)                                         \
-   (newstate[i] = (D0[(block[i] >> 24) & 0xFF] ^             \
-                   D1[(block[(i + C1) % Nb] >> 16) & 0xFF] ^ \
-                   D2[(block[(i + C2) % Nb] >> 8) & 0xFF] ^  \
-@@ -502,10 +502,10 @@ void aes_decrypt_nb_4(CRYPT_aes_context* ctx, unsigned 
int* block) {
-   unsigned int newstate[4];
-   for (i = 0; i < ctx->Nr - 1; i++) {
-     ADD_ROUND_KEY_4();
--    MAKEWORD(0);
--    MAKEWORD(1);
--    MAKEWORD(2);
--    MAKEWORD(3);
-+    FMAKEWORD(0);
-+    FMAKEWORD(1);
-+    FMAKEWORD(2);
-+    FMAKEWORD(3);
-     MOVEWORD(0);
-     MOVEWORD(1);
-     MOVEWORD(2);
-@@ -522,7 +522,7 @@ void aes_decrypt_nb_4(CRYPT_aes_context* ctx, unsigned 
int* block) {
-   MOVEWORD(3);
-   ADD_ROUND_KEY_4();
- }
--#undef MAKEWORD
-+#undef FMAKEWORD
- #undef LASTWORD
- 
- void aes_setup(CRYPT_aes_context* ctx, const unsigned char* key, int keylen) {
diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index 83e1ff915b2f..1296e6634653 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -66,6 +66,7 @@
 #if PCH_LEVEL >= 2
 #endif // PCH_LEVEL >= 2
 #if PCH_LEVEL >= 3
+#include <absl/types/bad_optional_access.h>
 #include <build/build_config.h>
 #include <constants/access_permissions.h>
 #include <constants/annotation_common.h>
@@ -450,6 +451,7 @@
 #include <public/fpdf_text.h>
 #include <public/fpdf_transformpage.h>
 #include <public/fpdfview.h>
+#include <third_party/abseil-cpp/absl/types/optional.h>
 #include <third_party/agg23/agg_clip_liang_barsky.h>
 #include <third_party/agg23/agg_conv_dash.h>
 #include <third_party/agg23/agg_conv_stroke.h>
@@ -487,7 +489,6 @@
 #include <third_party/base/notreached.h>
 #include <third_party/base/numerics/safe_conversions.h>
 #include <third_party/base/numerics/safe_math.h>
-#include <third_party/base/optional.h>
 #include <third_party/base/ptr_util.h>
 #include <third_party/base/span.h>
 #include <third_party/skia_shared/SkFloatToDecimal.h>
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 7d2bbdac148f..514de3358f7f 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -837,8 +837,7 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
 
     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, 
nFontName);
+    int nFontNameChars = FPDFTextObj_GetFontSize(pPageObject, &dFontSize);
     if (nFontName >= nFontNameChars)
     {
         OUString sFontName = OUString::createFromAscii(pFontName.get());
commit 50f58e1e3a5029a28fa3f0ff6450d108b43e2ced
Author:     Miklos Vajna <[email protected]>
AuthorDate: Wed Sep 22 20:09:04 2021 +0200
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 12:09:07 2023 +0200

    external: update pdfium to 4643
    
    Change-Id: I4e86b163a9abef88f26c6c0ae91ae0a4008658f1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122485
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index 079cb850831f..16cea36f63ba 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
b0c5725e1cdcef7f52f068fd33adf9e8d833a271c28ba5b6a5a576ef8f2bbbf4
-export PDFIUM_TARBALL := pdfium-4568.tar.bz2
+export PDFIUM_SHA256SUM := 
eb98a77eaaab9e9e8de541cfd18b9438dd3c538bd5ef163820353179727f5dc9
+export PDFIUM_TARBALL := pdfium-4643.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/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index 5c720f054ece..40748b0699ab 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -58,7 +58,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_actionhandler \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annotiterator \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_customaccess \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_fieldaction \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_filewriteadapter \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_helpers \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_annot \
@@ -104,7 +103,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_textfield \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_button \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_textobject \
-    UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_privatedata \
+    UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_fieldaction \
+    UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_perwindowdata \
 ))
 
 # fpdfapi
@@ -288,6 +288,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_pagerendercontext \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfuncdib \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfunc \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_basedcs \
 ))
 
 # fpdfdoc
@@ -363,7 +364,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_DocumentContext \
     UnpackedTarball/pdfium/core/fxcodec/basic/basicmodule \
     UnpackedTarball/pdfium/core/fxcodec/flate/flatemodule \
-    UnpackedTarball/pdfium/core/fxcodec/icc/iccmodule \
+    UnpackedTarball/pdfium/core/fxcodec/icc/icc_transform \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2_decoder \
     UnpackedTarball/pdfium/core/fxcodec/jpeg/jpeg_common \
 ))
@@ -623,12 +624,14 @@ $(eval $(call gb_Library_add_generated_cobjects,pdfium,\
     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 \
+    UnpackedTarball/pdfium/third_party/freetype/src/src/base/ftfstype \
 ))
 endif
 
 ifneq ($(OS),WNT)
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_posix \
+    UnpackedTarball/pdfium/core/fxcrt/fx_folder_posix \
 ))
 endif
 
@@ -644,8 +647,10 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/win32/cps_printer_driver \
     UnpackedTarball/pdfium/core/fxge/win32/ctext_only_printer_driver \
     UnpackedTarball/pdfium/core/fxge/win32/cwin32_platform \
+    UnpackedTarball/pdfium/core/fxge/win32/cfx_psfonttracker \
     UnpackedTarball/pdfium/core/fxge/cfx_windowsrenderdevice \
     UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_windows \
+    UnpackedTarball/pdfium/core/fxcrt/fx_folder_windows \
     UnpackedTarball/pdfium/third_party/base/win/win_util \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_windowsrenderdevice \
 ))
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index b4c69ba00f84..fce8874af8bd 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -38,109 +38,6 @@ index 0fb627ba8..dda1fc8bc 100644
    template <
        typename Container,
 diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp 
b/core/fxcodec/jpx/cjpx_decoder.cpp
-index c66985a7f..9c1122b75 100644
---- a/core/fxcodec/jpx/cjpx_decoder.cpp
-+++ b/core/fxcodec/jpx/cjpx_decoder.cpp
-@@ -6,6 +6,8 @@
- 
- #include "core/fxcodec/jpx/cjpx_decoder.h"
- 
-+#include <string.h>
-+
- #include <algorithm>
- #include <limits>
- #include <utility>
-diff --git a/core/fxcodec/jpeg/jpegmodule.cpp 
b/core/fxcodec/jpeg/jpegmodule.cpp
-index cea0679aa..036f25003 100644
---- a/core/fxcodec/jpeg/jpegmodule.cpp
-+++ b/core/fxcodec/jpeg/jpegmodule.cpp
-@@ -7,6 +7,7 @@
- #include "core/fxcodec/jpeg/jpegmodule.h"
- 
- #include <setjmp.h>
-+#include <string.h>
- 
- #include <memory>
- #include <utility>
-diff --git a/core/fxge/dib/cfx_bitmapcomposer.cpp 
b/core/fxge/dib/cfx_bitmapcomposer.cpp
-index 6f9b42013..0f1ffae2c 100644
---- a/core/fxge/dib/cfx_bitmapcomposer.cpp
-+++ b/core/fxge/dib/cfx_bitmapcomposer.cpp
-@@ -6,6 +6,8 @@
- 
- #include "core/fxge/dib/cfx_bitmapcomposer.h"
- 
-+#include <string.h>
-+
- #include "core/fxge/cfx_cliprgn.h"
- #include "core/fxge/dib/cfx_dibitmap.h"
- 
-diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
-index d7ccf6cfa..94e8accdd 100644
---- a/core/fxge/dib/cfx_dibitmap.cpp
-+++ b/core/fxge/dib/cfx_dibitmap.cpp
-@@ -6,6 +6,8 @@
- 
- #include "core/fxge/dib/cfx_dibitmap.h"
- 
-+#include <string.h>
-+
- #include <limits>
- #include <memory>
- #include <utility>
-diff --git a/core/fxge/dib/cfx_bitmapstorer.cpp 
b/core/fxge/dib/cfx_bitmapstorer.cpp
-index f57c00eaa..45a0a180c 100644
---- a/core/fxge/dib/cfx_bitmapstorer.cpp
-+++ b/core/fxge/dib/cfx_bitmapstorer.cpp
-@@ -6,6 +6,8 @@
- 
- #include "core/fxge/dib/cfx_bitmapstorer.h"
- 
-+#include <string.h>
-+
- #include <utility>
- 
- #include "core/fxge/dib/cfx_dibitmap.h"
-diff --git a/core/fxge/cfx_cliprgn.cpp b/core/fxge/cfx_cliprgn.cpp
-index 5369d522c..d198852e3 100644
---- a/core/fxge/cfx_cliprgn.cpp
-+++ b/core/fxge/cfx_cliprgn.cpp
-@@ -6,6 +6,8 @@
- 
- #include "core/fxge/cfx_cliprgn.h"
- 
-+#include <string.h>
-+
- #include <utility>
- 
- #include "core/fxge/dib/cfx_dibitmap.h"
-diff --git a/core/fxge/dib/cfx_scanlinecompositor.cpp 
b/core/fxge/dib/cfx_scanlinecompositor.cpp
-index e8362d708..c04c6dcab 100644
---- a/core/fxge/dib/cfx_scanlinecompositor.cpp
-+++ b/core/fxge/dib/cfx_scanlinecompositor.cpp
-@@ -6,6 +6,8 @@
- 
- #include "core/fxge/dib/cfx_scanlinecompositor.h"
- 
-+#include <string.h>
-+
- #include <algorithm>
- 
- #include "core/fxge/dib/fx_dib.h"
-diff --git a/core/fxge/dib/cfx_dibbase.cpp b/core/fxge/dib/cfx_dibbase.cpp
-index 4ec0ddbf9..a1de2fbec 100644
---- a/core/fxge/dib/cfx_dibbase.cpp
-+++ b/core/fxge/dib/cfx_dibbase.cpp
-@@ -6,6 +6,8 @@
- 
- #include "core/fxge/dib/cfx_dibbase.h"
- 
-+#include <string.h>
-+
- #include <algorithm>
- #include <memory>
- #include <utility>
-diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp 
b/core/fxcodec/jpx/cjpx_decoder.cpp
 index c66985a7f..817f81dfa 100644
 --- a/core/fxcodec/jpx/cjpx_decoder.cpp
 +++ b/core/fxcodec/jpx/cjpx_decoder.cpp
@@ -153,3 +50,68 @@ index c66985a7f..817f81dfa 100644
  }
  
  void sycc_to_rgb(int offset,
+diff --git a/core/fdrm/fx_crypt_aes.cpp b/core/fdrm/fx_crypt_aes.cpp
+index f2170220b..ede18f581 100644
+--- a/core/fdrm/fx_crypt_aes.cpp
++++ b/core/fdrm/fx_crypt_aes.cpp
+@@ -437,7 +437,7 @@ const unsigned int D3[256] = {
+   (block[0] ^= *keysched++, block[1] ^= *keysched++, block[2] ^= *keysched++, 
\
+    block[3] ^= *keysched++)
+ #define MOVEWORD(i) (block[i] = newstate[i])
+-#define MAKEWORD(i)                                         \
++#define FMAKEWORD(i)                                         \
+   (newstate[i] = (E0[(block[i] >> 24) & 0xFF] ^             \
+                   E1[(block[(i + C1) % Nb] >> 16) & 0xFF] ^ \
+                   E2[(block[(i + C2) % Nb] >> 8) & 0xFF] ^  \
+@@ -458,10 +458,10 @@ void aes_encrypt_nb_4(CRYPT_aes_context* ctx, unsigned 
int* block) {
+   unsigned int newstate[4];
+   for (i = 0; i < ctx->Nr - 1; i++) {
+     ADD_ROUND_KEY_4();
+-    MAKEWORD(0);
+-    MAKEWORD(1);
+-    MAKEWORD(2);
+-    MAKEWORD(3);
++    FMAKEWORD(0);
++    FMAKEWORD(1);
++    FMAKEWORD(2);
++    FMAKEWORD(3);
+     MOVEWORD(0);
+     MOVEWORD(1);
+     MOVEWORD(2);
+@@ -478,10 +478,10 @@ void aes_encrypt_nb_4(CRYPT_aes_context* ctx, unsigned 
int* block) {
+   MOVEWORD(3);
+   ADD_ROUND_KEY_4();
+ }
+-#undef MAKEWORD
++#undef FMAKEWORD
+ #undef LASTWORD
+ 
+-#define MAKEWORD(i)                                         \
++#define FMAKEWORD(i)                                         \
+   (newstate[i] = (D0[(block[i] >> 24) & 0xFF] ^             \
+                   D1[(block[(i + C1) % Nb] >> 16) & 0xFF] ^ \
+                   D2[(block[(i + C2) % Nb] >> 8) & 0xFF] ^  \
+@@ -502,10 +502,10 @@ void aes_decrypt_nb_4(CRYPT_aes_context* ctx, unsigned 
int* block) {
+   unsigned int newstate[4];
+   for (i = 0; i < ctx->Nr - 1; i++) {
+     ADD_ROUND_KEY_4();
+-    MAKEWORD(0);
+-    MAKEWORD(1);
+-    MAKEWORD(2);
+-    MAKEWORD(3);
++    FMAKEWORD(0);
++    FMAKEWORD(1);
++    FMAKEWORD(2);
++    FMAKEWORD(3);
+     MOVEWORD(0);
+     MOVEWORD(1);
+     MOVEWORD(2);
+@@ -522,7 +522,7 @@ void aes_decrypt_nb_4(CRYPT_aes_context* ctx, unsigned 
int* block) {
+   MOVEWORD(3);
+   ADD_ROUND_KEY_4();
+ }
+-#undef MAKEWORD
++#undef FMAKEWORD
+ #undef LASTWORD
+ 
+ void aes_setup(CRYPT_aes_context* ctx, const unsigned char* key, int keylen) {
diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index f01e704c7ee4..83e1ff915b2f 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -33,13 +33,10 @@
 #include <array>
 #include <atomic>
 #include <cassert>
-#include <cctype>
 #include <cfloat>
 #include <climits>
 #include <cmath>
-#include <cstring>
-#include <cwchar>
-#include <cwctype>
+#include <ctype.h>
 #include <functional>
 #include <iterator>
 #include <limits.h>
@@ -64,6 +61,7 @@
 #include <type_traits>
 #include <utility>
 #include <vector>
+#include <wchar.h>
 #endif // PCH_LEVEL >= 1
 #if PCH_LEVEL >= 2
 #endif // PCH_LEVEL >= 2
@@ -73,6 +71,7 @@
 #include <constants/annotation_common.h>
 #include <constants/annotation_flags.h>
 #include <constants/appearance.h>
+#include <constants/ascii.h>
 #include <constants/form_fields.h>
 #include <constants/form_flags.h>
 #include <constants/page_object.h>
@@ -107,6 +106,7 @@
 #include <core/fpdfapi/font/cpdf_type3font.h>
 #include <core/fpdfapi/page/cpdf_allstates.h>
 #include <core/fpdfapi/page/cpdf_annotcontext.h>
+#include <core/fpdfapi/page/cpdf_basedcs.h>
 #include <core/fpdfapi/page/cpdf_clippath.h>
 #include <core/fpdfapi/page/cpdf_color.h>
 #include <core/fpdfapi/page/cpdf_colorspace.h>
@@ -245,7 +245,7 @@
 #include <core/fxcodec/fx_codec.h>
 #include <core/fxcodec/gif/cfx_gif.h>
 #include <core/fxcodec/gif/lzw_decompressor.h>
-#include <core/fxcodec/icc/iccmodule.h>
+#include <core/fxcodec/icc/icc_transform.h>
 #include <core/fxcodec/jbig2/JBig2_ArithDecoder.h>
 #include <core/fxcodec/jbig2/JBig2_ArithIntDecoder.h>
 #include <core/fxcodec/jbig2/JBig2_BitStream.h>
@@ -310,6 +310,7 @@
 #include <core/fxcrt/fx_codepage.h>
 #include <core/fxcrt/fx_coordinates.h>
 #include <core/fxcrt/fx_extension.h>
+#include <core/fxcrt/fx_folder.h>
 #include <core/fxcrt/fx_memory.h>
 #include <core/fxcrt/fx_memory_wrappers.h>
 #include <core/fxcrt/fx_number.h>
@@ -389,7 +390,6 @@
 #include <fpdfsdk/cpdfsdk_baannot.h>
 #include <fpdfsdk/cpdfsdk_baannothandler.h>
 #include <fpdfsdk/cpdfsdk_customaccess.h>
-#include <fpdfsdk/cpdfsdk_fieldaction.h>
 #include <fpdfsdk/cpdfsdk_filewriteadapter.h>
 #include <fpdfsdk/cpdfsdk_formfillenvironment.h>
 #include <fpdfsdk/cpdfsdk_helpers.h>
@@ -402,10 +402,11 @@
 #include <fpdfsdk/formfiller/cffl_button.h>
 #include <fpdfsdk/formfiller/cffl_checkbox.h>
 #include <fpdfsdk/formfiller/cffl_combobox.h>
+#include <fpdfsdk/formfiller/cffl_fieldaction.h>
 #include <fpdfsdk/formfiller/cffl_formfield.h>
 #include <fpdfsdk/formfiller/cffl_interactiveformfiller.h>
 #include <fpdfsdk/formfiller/cffl_listbox.h>
-#include <fpdfsdk/formfiller/cffl_privatedata.h>
+#include <fpdfsdk/formfiller/cffl_perwindowdata.h>
 #include <fpdfsdk/formfiller/cffl_pushbutton.h>
 #include <fpdfsdk/formfiller/cffl_radiobutton.h>
 #include <fpdfsdk/formfiller/cffl_textfield.h>
@@ -484,7 +485,6 @@
 #include <third_party/base/memory/aligned_memory.h>
 #include <third_party/base/no_destructor.h>
 #include <third_party/base/notreached.h>
-#include <third_party/base/numerics/ranges.h>
 #include <third_party/base/numerics/safe_conversions.h>
 #include <third_party/base/numerics/safe_math.h>
 #include <third_party/base/optional.h>
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index d015c87a469f..37fac861677a 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -69,10 +69,10 @@
                     "type": "shell"
                 },
                 {
-                    "url": 
"https://dev-www.libreoffice.org/src/pdfium-4568.tar.bz2";,
-                    "sha256": 
"b0c5725e1cdcef7f52f068fd33adf9e8d833a271c28ba5b6a5a576ef8f2bbbf4",
+                    "url": 
"https://dev-www.libreoffice.org/src/pdfium-4643.tar.bz2";,
+                    "sha256": 
"eb98a77eaaab9e9e8de541cfd18b9438dd3c538bd5ef163820353179727f5dc9",
                     "type": "file",
-                    "dest-filename": "external/tarballs/pdfium-4568.tar.bz2"
+                    "dest-filename": "external/tarballs/pdfium-4643.tar.bz2"
                 },
                 {
                     "url": 
"https://dev-www.libreoffice.org/src/0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz";,
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 0de20febea56..7d2bbdac148f 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -808,7 +808,8 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     const int nChars = FPDFTextObj_GetText(pPageObject, pTextPage, nullptr, 0);
     std::unique_ptr<sal_Unicode[]> pText(new sal_Unicode[nChars]);
 
-    const int nActualChars = FPDFTextObj_GetText(pPageObject, pTextPage, 
pText.get(), nChars);
+    const int nActualChars = FPDFTextObj_GetText(
+        pPageObject, pTextPage, reinterpret_cast<FPDF_WCHAR*>(pText.get()), 
nChars);
     if (nActualChars <= 0)
     {
         return;
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 4bd608ac6409..941186d9bd6b 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1672,7 +1672,7 @@ void PdfExportTest::testTdf115262()
         {
             unsigned long nTextSize = FPDFTextObj_GetText(pPageObject, 
pTextPage, nullptr, 0);
             std::vector<sal_Unicode> aText(nTextSize);
-            FPDFTextObj_GetText(pPageObject, pTextPage, aText.data(), 
nTextSize);
+            FPDFTextObj_GetText(pPageObject, pTextPage, 
reinterpret_cast<FPDF_WCHAR*>(aText.data()), nTextSize);
             OUString sText(aText.data(), nTextSize / 2 - 1);
             if (sText == "400")
                 nRowTop = fTop;
@@ -1707,7 +1707,7 @@ void PdfExportTest::testTdf121962()
             continue;
         unsigned long nTextSize = FPDFTextObj_GetText(pPageObject, pTextPage, 
nullptr, 0);
         std::vector<sal_Unicode> aText(nTextSize);
-        FPDFTextObj_GetText(pPageObject, pTextPage, aText.data(), nTextSize);
+        FPDFTextObj_GetText(pPageObject, pTextPage, 
reinterpret_cast<FPDF_WCHAR*>(aText.data()), nTextSize);
         OUString sText(aText.data(), nTextSize / 2 - 1);
         CPPUNIT_ASSERT(sText != "** Expression is faulty **");
     }
@@ -1738,7 +1738,7 @@ void PdfExportTest::testTdf115967()
             continue;
         unsigned long nTextSize = FPDFTextObj_GetText(pPageObject, pTextPage, 
nullptr, 2);
         std::vector<sal_Unicode> aText(nTextSize);
-        FPDFTextObj_GetText(pPageObject, pTextPage, aText.data(), nTextSize);
+        FPDFTextObj_GetText(pPageObject, pTextPage, 
reinterpret_cast<FPDF_WCHAR*>(aText.data()), nTextSize);
         OUString sChar(aText.data(), nTextSize / 2 - 1);
         sText += sChar.trim();
     }
commit 18dbd1f09fd521364850fa6ece0baba67be467be
Author:     Miklos Vajna <[email protected]>
AuthorDate: Tue Jul 13 20:28:17 2021 +0200
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Mon Jul 24 11:53:01 2023 +0200

    external: update pdfium to 4568
    
    Change-Id: I2bfd5f806281e747702d423b7e59b5f88a7bea9c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118868
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/download.lst b/download.lst
index 73a9d91ad04d..079cb850831f 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,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 := 
26a03dd60e5ed0979cdaba9cc848242895110ddfdf347d40989ce2f14020f304
-export PDFIUM_TARBALL := pdfium-4500.tar.bz2
+export PDFIUM_SHA256SUM := 
b0c5725e1cdcef7f52f068fd33adf9e8d833a271c28ba5b6a5a576ef8f2bbbf4
+export PDFIUM_TARBALL := pdfium-4568.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/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index ff355651d200..5c720f054ece 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -77,6 +77,12 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \

... etc. - the rest is truncated

Reply via email to