diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-04-29 00:37:13 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-04-29 00:37:13 +0000 |
commit | 15605b628826392909b2230fd4716d43a61df365 (patch) | |
tree | ed45ef8adf87c295cff4cf7b47ecc7379b4c7fc1 /Build | |
parent | 10c5552e2b11fc8e7718bf5160ec6972b5943eef (diff) |
poppler 0.64.0
git-svn-id: svn://tug.org/texlive/trunk@47480 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
78 files changed, 2234 insertions, 974 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README index 31492ab6cb6..acf5c6363d4 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -49,7 +49,7 @@ mpfr 4.0.1 - checked 10feb18 pixman 0.34.0 - checked 04feb16 http://cairographics.org/releases/ -poppler 0.63.0 - checked 18mar18 +poppler 0.64.0 - checked 29apr18 http://poppler.freedesktop.org/ - used by luatex and xetex (requires C++11) diff --git a/Build/source/libs/poppler/ChangeLog b/Build/source/libs/poppler/ChangeLog index df54026e7b3..c2d5e879036 100644 --- a/Build/source/libs/poppler/ChangeLog +++ b/Build/source/libs/poppler/ChangeLog @@ -1,3 +1,8 @@ +2018-04-29 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + Import poppler-0.64.0. + * version.ac: Adjust. + 2018-03-18 Akira Kakuto <kakuto@fuk.kindai.ac.jp> Import poppler-0.63.0. diff --git a/Build/source/libs/poppler/TLpatches/ChangeLog b/Build/source/libs/poppler/TLpatches/ChangeLog index 07ce34b738b..da5e7d61d5a 100644 --- a/Build/source/libs/poppler/TLpatches/ChangeLog +++ b/Build/source/libs/poppler/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2018-04-29 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * patch-03-time: Adapted. + * patch-05-w32: Removed. + 2018-04-01 Mojca Miklavec <mojca.miklavec.lists@gmail.com> * patch-03-time: Adapted. diff --git a/Build/source/libs/poppler/TLpatches/TL-Changes b/Build/source/libs/poppler/TLpatches/TL-Changes index 1eb93580e20..613955906ac 100644 --- a/Build/source/libs/poppler/TLpatches/TL-Changes +++ b/Build/source/libs/poppler/TLpatches/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the poppler-0.63.0 tree as obtained from: +Changes applied to the poppler-0.64.0 tree as obtained from: http://poppler.freedesktop.org/ Removed unused dirs: @@ -11,7 +11,7 @@ General idea: update version.ac mv poppler-src poppler-prev tar xf poppler-*.tar.gz -mv poppler-0.62.0 poppler-src +mv poppler-0.64.0 poppler-src cd poppler-src svn status >/tmp/s svn add # the ? lines diff --git a/Build/source/libs/poppler/TLpatches/patch-03-time b/Build/source/libs/poppler/TLpatches/patch-03-time index ba6835a0587..c359f154292 100644 --- a/Build/source/libs/poppler/TLpatches/patch-03-time +++ b/Build/source/libs/poppler/TLpatches/patch-03-time @@ -1,39 +1,7 @@ -https://bugs.freedesktop.org/show_bug.cgi?id=105766 - -diff -ur poppler-0.63.0/goo/gfile.cc poppler-src/goo/gfile.cc ---- poppler-0.63.0/goo/gfile.cc -+++ poppler-src/goo/gfile.cc -@@ -34,9 +34,7 @@ - - #include <config.h> - --#ifdef _WIN32 --# include <time.h> --#else -+#ifndef _WIN32 - # if defined(MACOS) - # include <sys/stat.h> - # elif !defined(ACORN) -@@ -44,7 +42,6 @@ - # include <sys/stat.h> - # include <fcntl.h> - # endif --# include <time.h> - # include <limits.h> - # include <string.h> - # if !defined(VMS) && !defined(ACORN) && !defined(MACOS) -diff -ur poppler-0.63.0/goo/gfile.h poppler-src/goo/gfile.h ---- poppler-0.63.0/goo/gfile.h -+++ poppler-src/goo/gfile.h -@@ -37,6 +37,7 @@ - #include <stdio.h> - #include <stdlib.h> - #include <stddef.h> -+#include <time.h> - extern "C" { - #if defined(_WIN32) - # include <sys/stat.h> -@@ -49,8 +50,6 @@ +diff -ur poppler-0.64.0/goo/gfile.h poppler-src/goo/gfile.h +--- poppler-0.64.0/goo/gfile.h Wed Apr 18 03:04:26 2018 ++++ poppler-src/goo/gfile.h Thu Apr 26 11:27:12 2018 +@@ -51,8 +51,6 @@ # include <windows.h> # endif #elif defined(ACORN) @@ -42,10 +10,10 @@ diff -ur poppler-0.63.0/goo/gfile.h poppler-src/goo/gfile.h #else # include <unistd.h> # include <sys/types.h> -diff -ur poppler-0.63.0/poppler/Form.h poppler-src/poppler/Form.h ---- poppler-0.63.0/poppler/Form.h -+++ poppler-src/poppler/Form.h -@@ -33,6 +33,7 @@ +diff -ur poppler-0.64.0/poppler/Form.h poppler-src/poppler/Form.h +--- poppler-0.64.0/poppler/Form.h Wed Apr 18 03:04:26 2018 ++++ poppler-src/poppler/Form.h Wed Apr 25 18:40:18 2018 +@@ -36,6 +36,7 @@ #include <set> #include <vector> diff --git a/Build/source/libs/poppler/TLpatches/patch-05-w32 b/Build/source/libs/poppler/TLpatches/patch-05-w32 deleted file mode 100644 index 5e7b9368743..00000000000 --- a/Build/source/libs/poppler/TLpatches/patch-05-w32 +++ /dev/null @@ -1,22 +0,0 @@ -$ diff -u gfile.cc.orig gfile.cc ---- gfile.cc.orig 2018-03-21 13:21:12.635648536 +0100 -+++ gfile.cc 2018-03-21 12:16:05.000000000 +0100 -@@ -65,6 +65,8 @@ - #define PATH_MAX 1024 - #endif - -+#ifndef _WIN32 -+ - namespace { - - template< typename... > -@@ -99,6 +101,8 @@ - - } - -+#endif -+ - //------------------------------------------------------------------------ - - GooString *getCurrentDir() { - diff --git a/Build/source/libs/poppler/configure b/Build/source/libs/poppler/configure index a13a2298e3b..2a559884919 100755 --- a/Build/source/libs/poppler/configure +++ b/Build/source/libs/poppler/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.63.0. +# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.64.0. # # Report bugs to <tex-k@tug.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='poppler (TeX Live)' PACKAGE_TARNAME='poppler--tex-live-' -PACKAGE_VERSION='0.63.0' -PACKAGE_STRING='poppler (TeX Live) 0.63.0' +PACKAGE_VERSION='0.64.0' +PACKAGE_STRING='poppler (TeX Live) 0.64.0' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1307,7 +1307,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures poppler (TeX Live) 0.63.0 to adapt to many kinds of systems. +\`configure' configures poppler (TeX Live) 0.64.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1374,7 +1374,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of poppler (TeX Live) 0.63.0:";; + short | recursive ) echo "Configuration of poppler (TeX Live) 0.64.0:";; esac cat <<\_ACEOF @@ -1487,7 +1487,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -poppler (TeX Live) configure 0.63.0 +poppler (TeX Live) configure 0.64.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2134,7 +2134,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by poppler (TeX Live) $as_me 0.63.0, which was +It was created by poppler (TeX Live) $as_me 0.64.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4057,7 +4057,7 @@ fi # Define the identity of the package. PACKAGE='poppler--tex-live-' - VERSION='0.63.0' + VERSION='0.64.0' # Some tools Automake needs. @@ -7647,7 +7647,7 @@ ac_config_headers="$ac_config_headers poppler-config.h:poppler-src/poppler/poppl cat >>confdefs.h <<_ACEOF -#define POPPLER_VERSION "0.63.0" +#define POPPLER_VERSION "0.64.0" _ACEOF @@ -8341,7 +8341,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by poppler (TeX Live) $as_me 0.63.0, which was +This file was extended by poppler (TeX Live) $as_me 0.64.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8407,7 +8407,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -poppler (TeX Live) config.status 0.63.0 +poppler (TeX Live) config.status 0.64.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/poppler/poppler-src/CMakeLists.txt b/Build/source/libs/poppler/poppler-src/CMakeLists.txt index eecd41fb9a3..ac186d537e3 100644 --- a/Build/source/libs/poppler/poppler-src/CMakeLists.txt +++ b/Build/source/libs/poppler/poppler-src/CMakeLists.txt @@ -30,7 +30,7 @@ if (ECM_FOUND) endif() set(POPPLER_MAJOR_VERSION "0") -set(POPPLER_MINOR_VERSION "63") +set(POPPLER_MINOR_VERSION "64") set(POPPLER_MICRO_VERSION "0") set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}") @@ -46,6 +46,7 @@ option(ENABLE_SPLASH "Build the Splash graphics backend." ON) option(ENABLE_UTILS "Compile poppler command line utils." ON) option(ENABLE_CPP "Compile poppler cpp wrapper." ON) option(ENABLE_GLIB "Compile poppler glib wrapper." ON) +option(ENABLE_GOBJECT_INTROSPECTION "Whether to generate GObject introspection." ON) option(ENABLE_GTK_DOC "Whether to generate glib API documentation." OFF) option(ENABLE_QT5 "Compile poppler qt5 wrapper." ON) set(ENABLE_LIBOPENJPEG "openjpeg2" CACHE STRING "Use libopenjpeg for JPX streams. Possible values: openjpeg2, unmaintained, none. 'unmaintained' gives you the internal unmaintained decoder. Use at your own risk. 'none' compiles no JPX decoder at all. Default: openjpeg2") @@ -88,10 +89,13 @@ endif() if(WIN32) set(_default_fontconfiguration "win32") +elseif(ANDROID) + # on android we don't have fontconfig and we don't want window-specific code + set(_default_fontconfiguration "generic") else() set(_default_fontconfiguration "fontconfig") endif() -set(FONT_CONFIGURATION "${_default_fontconfiguration}" CACHE STRING "The font configuration backend (win32|fontconfig).") +set(FONT_CONFIGURATION "${_default_fontconfiguration}" CACHE STRING "The font configuration backend (win32|generic|fontconfig).") string(TOLOWER "${FONT_CONFIGURATION}" font_configuration) set(WITH_FONTCONFIGURATION_WIN32 OFF) set(WITH_FONTCONFIGURATION_FONTCONFIG OFF) @@ -99,6 +103,8 @@ if(font_configuration STREQUAL "win32") set(WITH_FONTCONFIGURATION_WIN32 ON) elseif(font_configuration STREQUAL "fontconfig") set(WITH_FONTCONFIGURATION_FONTCONFIG ON) +elseif(font_configuration STREQUAL "generic") + message(STATUS "no fontconfig or win32 specific code") else() message(FATAL_ERROR "Invalid font configuration setting: ${FONT_CONFIGURATION}") endif() @@ -167,9 +173,11 @@ if(CAIRO_FOUND) endif() endif() if(ENABLE_GLIB) - # Check for introspection - macro_optional_find_package(GObjectIntrospection 0.9.12) - set(HAVE_INTROSPECTION ${INTROSPECTION_FOUND}) + if(ENABLE_GOBJECT_INTROSPECTION) + # Check for introspection + macro_optional_find_package(GObjectIntrospection 0.9.12) + set(HAVE_INTROSPECTION ${INTROSPECTION_FOUND}) + endif() set(POPPLER_GLIB_DISABLE_DEPRECATED "${POPPLER_GLIB_DISABLE_DEPRECATED} -DG_DISABLE_DEPRECATED") set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES} -DG_DISABLE_SINGLE_INCLUDES") macro_optional_find_package(GTK) @@ -483,7 +491,7 @@ add_library(poppler STATIC ${poppler_SRCS}) else() add_library(poppler ${poppler_SRCS}) endif() -set_target_properties(poppler PROPERTIES VERSION 74.0.0 SOVERSION 74) +set_target_properties(poppler PROPERTIES VERSION 75.0.0 SOVERSION 75) if(MINGW) get_target_property(POPPLER_SOVERSION poppler SOVERSION) set_target_properties(poppler PROPERTIES SUFFIX "-${POPPLER_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") diff --git a/Build/source/libs/poppler/poppler-src/ChangeLog b/Build/source/libs/poppler/poppler-src/ChangeLog index 3a1a061026c..af6eed92a68 100644 --- a/Build/source/libs/poppler/poppler-src/ChangeLog +++ b/Build/source/libs/poppler/poppler-src/ChangeLog @@ -1,3 +1,930 @@ +commit 4d851d16aa6a2a9f00b60091a2ef810be1a571ea +Author: Albert Astals Cid <aacid@kde.org> +Date: Tue Apr 17 20:04:26 2018 +0200 + + poppler 0.64.0 + + CMakeLists.txt | 4 ++-- + NEWS | 33 +++++++++++++++++++++++++++++++++ + cpp/Doxyfile | 2 +- + qt5/src/CMakeLists.txt | 2 +- + qt5/src/Doxyfile | 2 +- + 5 files changed, 38 insertions(+), 5 deletions(-) + +commit 1dcf335a8e212fdfd18bad1f56a743504f653cf5 +Author: Albert Astals Cid <aacid@kde.org> +Date: Tue Apr 17 16:21:33 2018 +0200 + + qt5: Don't need this friend declaration + + qt5/src/poppler-link.h | 1 - + 1 file changed, 1 deletion(-) + +commit 281d5cbd33521c823f1602f3d0c1e2ad9a4ab1d2 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Apr 6 15:34:57 2018 +0200 + + Object::getName return const char instead of char + + poppler/Form.cc | 2 +- + poppler/Form.h | 2 +- + poppler/Gfx.cc | 20 ++++++++++---------- + poppler/Gfx.h | 14 +++++++------- + poppler/GfxFont.cc | 4 ++-- + poppler/Link.cc | 6 +++--- + poppler/Link.h | 2 +- + poppler/MarkedContentOutputDev.cc | 2 +- + poppler/MarkedContentOutputDev.h | 2 +- + poppler/Movie.cc | 2 +- + poppler/Object.h | 2 +- + poppler/OutputDev.cc | 6 +++--- + poppler/OutputDev.h | 6 +++--- + poppler/Rendition.cc | 2 +- + poppler/Stream.cc | 2 +- + poppler/Stream.h | 2 +- + 16 files changed, 38 insertions(+), 38 deletions(-) + +commit 8fe1a5b96e5ad7dac60dd0f198b3c8b18fb3c5bb +Author: Andre Heinecke <aheinecke@intevation.de> +Date: Tue Apr 17 10:02:40 2018 +0200 + + Fix parsing of focus out actions + + The key is uppercase B with lowercase L. Not I. + + poppler/Annot.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 3636ccbaece6706ef86dfab9303c3f164e68ffe2 +Author: Albert Astals Cid <aacid@kde.org> +Date: Tue Apr 17 10:57:06 2018 +0200 + + pdfsig: Don't use fixed buffer size for path + + utils/pdfsig.cc | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +commit 17c7e3b0e1801a8643712013eb3b106c802e0faa +Author: Albert Astals Cid <aacid@kde.org> +Date: Tue Apr 17 11:02:29 2018 +0200 + + utils: Move numberOfCharacters to shared file + + utils/numberofcharacters.h | 26 ++++++++++++++++++++++++++ + utils/pdftocairo.cc | 13 +------------ + utils/pdftoppm.cc | 13 +------------ + 3 files changed, 28 insertions(+), 24 deletions(-) + +commit 73ab9930810ae83998467ec859f3ee3984548cbd +Author: Albert Astals Cid <aacid@kde.org> +Date: Tue Apr 17 10:46:46 2018 +0200 + + pdfsig: Add -dump to manpage + + utils/pdfsig.1 | 3 +++ + 1 file changed, 3 insertions(+) + +commit bdece3bb0c115576d23e76dc29ee43f04aafdee0 +Author: Chinmoy Ranjan Pradhan <chinmoyrp65@protonmail.com> +Date: Tue Apr 17 10:45:15 2018 +0200 + + pdfsig: Add -dump which writes signatures to disk + + Bug #104881 + + poppler/Form.cc | 8 +++++++- + poppler/Form.h | 7 +++++-- + utils/pdfsig.cc | 33 +++++++++++++++++++++++++++++++-- + 3 files changed, 43 insertions(+), 5 deletions(-) + +commit 97aa11bf135421c1f87f2a46e2f597626f503f10 +Author: Oliver Sander <oliver.sander@tu-dresden.de> +Date: Fri Mar 23 22:04:11 2018 +0100 + + Document method drawImageMask + + poppler/OutputDev.h | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +commit ae4349620863a42ae569f1ce05461bb27340c4ea +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Apr 16 22:49:54 2018 +0200 + + Make the second parseAction variant private + + poppler/Link.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 444d9d8de5d4f8d627084405e1583b6d6d3900c7 +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Apr 16 22:28:18 2018 +0200 + + Simplify LinkAction::parseAction a bit + + After the discussion on the mailing list, also using unique_ptr was + wrong + + poppler/Link.cc | 22 +++++++++++----------- + poppler/Link.h | 5 +++-- + 2 files changed, 14 insertions(+), 13 deletions(-) + +commit 88c99f1f6f4faf31faabccd35d9d094958020ebc +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Apr 16 17:59:35 2018 +0200 + + Fix crash on malformed documents + + In GfxGouraudTriangleShading::parse + + Bug #106061 + + poppler/GfxState.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit df8a4ee51e18a39f85568c4122e5edd8c03d61df +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Apr 16 17:46:10 2018 +0200 + + Make it so we copy seenNextActions a bit less + + poppler/Link.cc | 20 +++++++++++--------- + poppler/Link.h | 3 ++- + 2 files changed, 13 insertions(+), 10 deletions(-) + +commit bd9fb431941916174e1c3b2201bf5f422bcf61bd +Author: Aleix Pol <aleixpol@kde.org> +Date: Mon Apr 16 16:38:09 2018 +0200 + + Make it possible to build poppler on Android without fontconfig + + Didn't manage to make fontconfig build, still nice to have poppler + available. + + CMakeLists.txt | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +commit 34a44e5b95230b1ed03bb030e9963d0187b01951 +Author: Aleix Pol <aleixpol@kde.org> +Date: Mon Apr 16 16:35:47 2018 +0200 + + Do not assume that iconv is in /usr/include + + We find it explicitly because it may be elsewhere. + + cpp/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +commit bdd8db389c7b09cd9042267f36214f809e4c5f60 +Author: Andre Heinecke <aheinecke@intevation.de> +Date: Mon Apr 16 17:13:05 2018 +0200 + + Add support for Next actions following an action + + Next actions are action dictionaries or an array + of action dictonaries. "Next" is an entry in the + general action dictionary. + + These actions are supposed to be performed after each other. + So that a single button press can for example + both trigger a Hide action and a JavaScript action. + + poppler/Link.cc | 72 + +++++++++++++++++++++++++++++++++++++++++- + poppler/Link.h | 18 +++++++++-- + qt5/src/poppler-link-private.h | 9 ++++++ + qt5/src/poppler-link.cc | 7 +++- + qt5/src/poppler-link.h | 11 ++++++- + qt5/src/poppler-page.cc | 14 ++++++++ + 6 files changed, 125 insertions(+), 6 deletions(-) + +commit ab72205dd14efe9c5c8d12e6b1ae538208bce168 +Author: Andre Heinecke <aheinecke@intevation.de> +Date: Mon Apr 16 16:31:38 2018 +0200 + + Add support for hide action + + The hide action can be used to show / hide fields. + + poppler/Link.cc | 29 +++++++++++++++++++++++++++++ + poppler/Link.h | 35 +++++++++++++++++++++++++++++++++++ + qt5/src/poppler-annotation.cc | 6 ++++++ + qt5/src/poppler-link-private.h | 17 +++++++++++++++++ + qt5/src/poppler-link.cc | 28 ++++++++++++++++++++++++++++ + qt5/src/poppler-link.h | 39 + ++++++++++++++++++++++++++++++++++++++- + qt5/src/poppler-page.cc | 11 +++++++++++ + 7 files changed, 164 insertions(+), 1 deletion(-) + +commit 022ccd4e1c61f4e89c7ffad83d9a5a896f65dc40 +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Apr 16 16:22:55 2018 +0200 + + GfxGouraudTriangleShading::parse: Fix memory leak on malformed files + + Bug #106059 + + poppler/GfxState.cc | 3 +++ + 1 file changed, 3 insertions(+) + +commit 776257d0c20d4e3ae8d66683ab0f087bf6fc7b0f +Author: Albert Astals Cid <aacid@kde.org> +Date: Wed Apr 11 00:44:41 2018 +0200 + + Fix leaks in GfxPatchMeshShading::parse with malformed documents + + Bug #105969 + + poppler/GfxState.cc | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +commit d80e7aac3366f93865581a783751abb528c120b3 +Author: Albert Astals Cid <aacid@kde.org> +Date: Wed Apr 11 00:32:35 2018 +0200 + + Make GfxGouraudTriangleShading::parse more accepting of malformed + documents + + Bug #105972 + + poppler/GfxState.cc | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +commit fee13e935e4c9eaadff434436eaceeb13afcfc13 +Author: Oliver Sander <oliver.sander@tu-dresden.de> +Date: Fri Mar 23 22:24:42 2018 +0100 + + Implement Type3 font support for ArthurOutputDev + + qt5/src/ArthurOutputDev.cc | 177 + ++++++++++++++++++++++++++++++++++++++++----- + qt5/src/ArthurOutputDev.h | 16 ++-- + qt5/src/poppler-page.cc | 4 +- + 3 files changed, 170 insertions(+), 27 deletions(-) + +commit 79c588912f41aa6ee81ea058e7e649199a252f90 +Author: Oliver Sander <oliver.sander@tu-dresden.de> +Date: Sun Mar 25 21:38:27 2018 +0200 + + Do not make ArthurOutputDev::startPage fill the page with white + + qt5/src/ArthurOutputDev.cc | 13 +------------ + 1 file changed, 1 insertion(+), 12 deletions(-) + +commit 8c8c0034ae88c06616ace5e5ead71318f04311cf +Author: Oliver Sander <oliver.sander@tu-dresden.de> +Date: Sat Apr 7 23:45:50 2018 +0200 + + Implement ArthurOutputDev::drawImageMask + + Bug #105531 + + Also temporarily disable type3 fonts since it seems they're not + properly + supported + + qt5/src/ArthurOutputDev.cc | 91 + +++++++++++++++------------------------------- + qt5/src/ArthurOutputDev.h | 2 +- + 2 files changed, 30 insertions(+), 63 deletions(-) + +commit 3e0408966ccdd713de7795ce7992888b3896b49c +Author: Andre Heinecke <aheinecke@intevation.de> +Date: Thu Mar 22 14:53:19 2018 +0100 + + Qt5: Allow setting of visibility + + Extends Qt5 API to allow setting visibility flags + + qt5/src/poppler-form.cc | 11 +++++++++++ + qt5/src/poppler-form.h | 6 ++++++ + 2 files changed, 17 insertions(+) + +commit b4127fb1c45fe5dcabe3751f0b40029405224f49 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Apr 6 23:08:15 2018 +0200 + + Add some more const + + const is always good :) + + cpp/poppler-embedded-file.cpp | 13 ++-- + cpp/poppler-private.cpp | 4 +- + cpp/poppler-private.h | 3 +- + cpp/poppler-toc-private.h | 4 +- + cpp/poppler-toc.cpp | 9 +-- + glib/poppler-action.cc | 50 +++++++-------- + glib/poppler-document.cc | 8 +-- + glib/poppler-layer.cc | 2 +- + glib/poppler-media.cc | 4 +- + glib/poppler-movie.cc | 2 +- + glib/poppler-private.h | 6 +- + goo/GooList.cc | 16 ++++- + goo/GooList.h | 8 +-- + poppler/FileSpec.cc | 10 +-- + poppler/FileSpec.h | 26 ++++---- + poppler/Function.h | 2 +- + poppler/Link.cc | 26 ++++---- + poppler/Link.h | 138 + ++++++++++++++++++++-------------------- + poppler/Movie.cc | 12 ++-- + poppler/Movie.h | 26 ++++---- + poppler/OptionalContent.cc | 8 +-- + poppler/OptionalContent.h | 14 ++-- + poppler/Outline.cc | 10 +-- + poppler/Outline.h | 20 +++--- + poppler/Rendition.cc | 4 +- + poppler/Rendition.h | 18 +++--- + poppler/Sound.cc | 6 +- + poppler/Sound.h | 18 +++--- + qt5/src/poppler-document.cc | 4 +- + qt5/src/poppler-embeddedfile.cc | 10 +-- + qt5/src/poppler-link.cc | 4 +- + qt5/src/poppler-media.cc | 2 +- + qt5/src/poppler-movie.cc | 4 +- + qt5/src/poppler-optcontent.cc | 4 +- + qt5/src/poppler-private.cc | 24 +++---- + qt5/src/poppler-private.h | 8 +-- + qt5/src/poppler-sound.cc | 2 +- + utils/HtmlFonts.cc | 4 +- + utils/HtmlFonts.h | 2 +- + utils/HtmlOutputDev.cc | 12 ++-- + utils/HtmlOutputDev.h | 4 +- + utils/pdfdetach.cc | 2 +- + 42 files changed, 285 insertions(+), 268 deletions(-) + +commit a8e93f46df9feb7f7241826307af51befdb25d9e +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Fri Apr 6 09:02:28 2018 +0200 + + Make Object return const GooString pointer + + This helps making sure noone is changing strings that belong to + objects without us realizing. + + In fact noone was doing except an ifdef for windows, fixed it to + not modify the dict contents anymore + + glib/poppler-action.cc | 2 +- + poppler/Annot.cc | 6 +++--- + poppler/FileSpec.cc | 4 +++- + poppler/Form.cc | 6 +++--- + poppler/GfxFont.cc | 4 ++-- + poppler/GfxState.cc | 3 ++- + poppler/Link.cc | 3 ++- + poppler/Object.h | 3 ++- + poppler/Outline.cc | 3 ++- + poppler/PDFDoc.cc | 3 ++- + poppler/Parser.cc | 4 +++- + poppler/Stream.cc | 2 +- + poppler/StructElement.cc | 3 ++- + qt5/src/poppler-document.cc | 6 +++--- + qt5/src/poppler-embeddedfile.cc | 5 +++-- + qt5/src/poppler-optcontent.cc | 3 ++- + qt5/src/poppler-qt5.h | 2 +- + qt5/tests/check_dateConversion.cpp | 4 ++-- + test/pdf-fullrewrite.cc | 4 ++-- + utils/pdfinfo.cc | 7 ++++--- + utils/pdftohtml.cc | 5 +++-- + utils/pdftotext.cc | 5 +++-- + utils/pdfunite.cc | 5 +++-- + 23 files changed, 54 insertions(+), 38 deletions(-) + +commit 07180b86786cce95df4e2433a7cf3e006749a0f5 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Fri Apr 6 13:03:16 2018 +0200 + + Gfx: Make two functions take const GooString * + + poppler/Gfx.cc | 8 ++++---- + poppler/Gfx.h | 4 ++-- + 2 files changed, 6 insertions(+), 6 deletions(-) + +commit c4af5981ab2a5f42a9a1194bb5929c2151fc2674 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Fri Apr 6 13:00:12 2018 +0200 + + OutputDev: change functions taking GooString * to make it const + + People that use poppler core, beware of the signature change! + + poppler/CairoOutputDev.cc | 5 +++-- + poppler/CairoOutputDev.h | 5 +++-- + poppler/OutputDev.h | 7 ++++--- + poppler/PSOutputDev.cc | 4 ++-- + poppler/PSOutputDev.h | 2 +- + poppler/TextOutputDev.cc | 7 ++++--- + poppler/TextOutputDev.h | 7 ++++--- + utils/HtmlOutputDev.cc | 5 +++-- + utils/HtmlOutputDev.h | 5 +++-- + 9 files changed, 27 insertions(+), 20 deletions(-) + +commit 5fc6d9fcb41966b85dc67117531c81ec89f42f20 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Apr 6 12:50:18 2018 +0200 + + PageAttrs and Page getLastModified return const GooString * + + poppler/Page.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit a801b46e1e792b5d0a34f97de870c485e0ef312a +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Fri Apr 6 12:48:18 2018 +0200 + + PSOuputDev writePSString and writePSTextLine take const + + poppler/PSOutputDev.cc | 4 ++-- + poppler/PSOutputDev.h | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +commit eb6de58de5ef8c2ddeeed386e0b8b498b945797f +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Apr 6 12:47:12 2018 +0200 + + PDFDoc::writeString take const GooString pointer + + poppler/PDFDoc.cc | 2 +- + poppler/PDFDoc.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 853b2251d4e11f14cd891bf1b6095ee36683d161 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Apr 6 12:46:06 2018 +0200 + + OCDisplayNode take const GooString pointer + + poppler/OptionalContent.cc | 4 ++-- + poppler/OptionalContent.h | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +commit 0a8311929ba599d7b0a35e83b1f5dec4a3c9da06 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Fri Apr 6 12:44:43 2018 +0200 + + GfxFont::getNextChar take const char pointer + + poppler/GfxFont.cc | 4 ++-- + poppler/GfxFont.h | 6 +++--- + 2 files changed, 5 insertions(+), 5 deletions(-) + +commit 0e35441513bdce2471113b937bccb8928c7c9d9f +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Fri Apr 6 12:42:29 2018 +0200 + + FormFieldText::tokenizeDA take const GooString + + poppler/Form.cc | 2 +- + poppler/Form.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit ba91b95f6e504cce08825e83a567a554ac846e39 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Apr 6 12:41:44 2018 +0200 + + dateStringToTime take const GooString + + poppler/DateInfo.cc | 4 ++-- + poppler/DateInfo.h | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +commit 9bfe4b43216bce4e702d7d8f61fc7cb9acdbb8f6 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Apr 6 12:40:53 2018 +0200 + + CMap::getCID take const char + + poppler/CMap.cc | 4 ++-- + poppler/CMap.h | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +commit 690ea9e5c900268556431df71bdac38f5e74dc36 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Fri Apr 6 12:39:35 2018 +0200 + + GooString::insert make pointer const + + goo/GooString.cc | 2 +- + goo/GooString.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit f3551055dab57eb0bc544070b15c6a7435585003 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Apr 6 12:19:54 2018 +0200 + + Introduce AutoFreeMemStream + + This is done by turning the old MemStream implementation to a new + template implementation in BaseMemStream + and inheriting from it MemStream for const char * and + AutoFreeMemStream for char *. + + This way we make clear one frees the data and the other does not, + while also removing the ugly setNeedsFree in MemStream + + poppler/Annot.cc | 16 ++++++--------- + poppler/SplashOutputDev.cc | 3 +-- + poppler/Stream.h | 51 + +++++++++++++++++++++++++++------------------- + 3 files changed, 37 insertions(+), 33 deletions(-) + +commit 4cc89c79f58cb416aae8396190a788e1398113ff +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Apr 6 12:11:55 2018 +0200 + + Move MemStream implementation to header + + Will be useful in next step where we turn it into a template + + poppler/Stream.cc | 83 -------------------------------------------------- + poppler/Stream.h | 91 + +++++++++++++++++++++++++++++++++++++++++++++++++------ + 2 files changed, 81 insertions(+), 93 deletions(-) + +commit 8821c04f36cb737776cd9077a46f1a9f86ca54e7 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Wed Apr 4 10:20:52 2018 +0200 + + Workaround form field text not being drawn on broken files + + Try drawing with the form appearance instead of the field apparance + if drawing with the field appearance fails + + Bug #103245 + + poppler/Annot.cc | 88 + +++++++++++++++++++++++++++++++++++--------------------- + poppler/Annot.h | 24 +++++++++------- + 2 files changed, 68 insertions(+), 44 deletions(-) + +commit afb053d652cc1f670465d471f671652b112dbf51 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 11:48:11 2018 +0200 + + Annot: Move appearBuf construction to a new class + + Previously we had appearBuf construction functions in Annot itself + which was a bit + confusing. Some functions like writeString took appearBuf as + parameter, some + other did not. By moving it out to a new class and making all the + input parameters const + pointers we make it clear the construction of appearBuf doesn't have + any other side + effect on Annot itself or any other class + + I'm leaving the functions in their old place to minimize the diff + so it's easier to read. + I'll move them in a follow up commit + + poppler/Annot.cc | 528 + ++++++++++++++++++++++++++++--------------------------- + poppler/Annot.h | 73 +++++--- + 2 files changed, 321 insertions(+), 280 deletions(-) + +commit 0a79dc3036111e86a11bd290057da6674da3b311 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 18:15:33 2018 +0200 + + Add some more const + + glib/poppler-action.cc | 14 +++++------ + glib/poppler-annot.cc | 18 +++++++-------- + glib/poppler-document.cc | 2 +- + glib/poppler-form-field.cc | 4 ++-- + glib/poppler-private.h | 2 +- + poppler/Annot.cc | 16 ++++++------- + poppler/Annot.h | 54 + +++++++++++++++++++++---------------------- + poppler/Catalog.cc | 5 ++-- + poppler/Catalog.h | 5 ++-- + poppler/Form.cc | 6 ++--- + poppler/Form.h | 6 ++--- + poppler/Link.h | 23 +++++++++--------- + poppler/PDFDoc.h | 3 ++- + poppler/UTF.cc | 3 ++- + poppler/UTF.h | 3 ++- + qt5/src/poppler-annotation.cc | 5 ++-- + qt5/src/poppler-document.cc | 9 +++++++- + qt5/src/poppler-form.cc | 4 ++-- + qt5/src/poppler-page.cc | 2 +- + qt5/src/poppler-private.cc | 4 ++-- + qt5/src/poppler-private.h | 4 ++-- + qt5/src/poppler-qt5.h | 7 ++++++ + utils/JSInfo.cc | 7 +++--- + utils/JSInfo.h | 3 ++- + 24 files changed, 116 insertions(+), 93 deletions(-) + +commit b60de1700d95d022ec0d1676886b0442cb763473 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 16:03:54 2018 +0200 + + Introduce a const version of GfxResources::lookupFont + + poppler/Gfx.cc | 13 +++++++++++-- + poppler/Gfx.h | 5 ++++- + poppler/GfxFont.cc | 2 +- + poppler/GfxFont.h | 2 +- + 4 files changed, 17 insertions(+), 5 deletions(-) + +commit 6bb508acd9a79671e5e9defc7b92a943fb880cda +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 14:19:51 2018 +0200 + + More const in GfxFont methods + + poppler/GfxFont.h | 10 +++++----- + poppler/PSOutputDev.cc | 2 +- + poppler/PSOutputDev.h | 2 +- + poppler/SplashOutputDev.cc | 11 ++++++----- + qt5/src/ArthurOutputDev.cc | 3 ++- + 5 files changed, 15 insertions(+), 13 deletions(-) + +commit 390109044bdef1ba67c2339bffaf11b38261854d +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 13:00:59 2018 +0200 + + Fix windows build + + poppler/GlobalParamsWin.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit f75c0f5c3f9d63334cc21e0ab68f1af45d0037cc +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 12:58:34 2018 +0200 + + Make GfxFont::getName const + + glib/poppler-structure-element.cc | 2 +- + poppler/FontInfo.cc | 3 ++- + poppler/GfxFont.h | 2 +- + poppler/GlobalParams.cc | 6 +++--- + poppler/PSOutputDev.cc | 6 ++++-- + poppler/PSOutputDev.h | 3 ++- + utils/HtmlFonts.cc | 3 ++- + 7 files changed, 15 insertions(+), 10 deletions(-) + +commit a669ad5cfb28cdfcfe38bbce39fbf8c6fc3102d9 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 12:55:39 2018 +0200 + + buildFcPattern: Don't modify the actual name of the font + + When doing the '-' to ' ' replacement to build the fc pattern + + poppler/GlobalParams.cc | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +commit 4f9b3d8d8d17863873a8a399ff3fe212d247b236 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 12:37:40 2018 +0200 + + Make some GfxFont methods const + + poppler/GfxFont.cc | 8 ++++---- + poppler/GfxFont.h | 16 ++++++++-------- + 2 files changed, 12 insertions(+), 12 deletions(-) + +commit 2bf6f2275c49f94e84f935653d6c42f6b5f9b364 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 12:21:38 2018 +0200 + + Make some Form methods const + + glib/poppler-form-field.cc | 6 +++--- + poppler/Annot.cc | 4 ++-- + poppler/Form.cc | 18 +++++++++--------- + poppler/Form.h | 32 ++++++++++++++++---------------- + qt5/src/poppler-form.cc | 3 ++- + 5 files changed, 32 insertions(+), 31 deletions(-) + +commit 6f2bc64e09b7f5e5be6962840ede40369b78fd5e +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 12:25:17 2018 +0200 + + Make AnnotWidget::drawText and Annot::layoutText input GooString const + + poppler/Annot.cc | 9 +++++---- + poppler/Annot.h | 5 +++-- + 2 files changed, 8 insertions(+), 6 deletions(-) + +commit 5e7931c4c9fdaba8b3343d04eda6e9eb2a2e3dcd +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 12:23:21 2018 +0200 + + Make _poppler_goo_string_to_utf8 input param const + + glib/poppler-document.cc | 2 +- + glib/poppler-private.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 3fdb7ea7b6a1ed4add2fbc6dca7a38b27fc79f45 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 12:21:11 2018 +0200 + + Make UnicodeParsedString input const + + qt5/src/poppler-private.cc | 5 +++-- + qt5/src/poppler-private.h | 3 ++- + 2 files changed, 5 insertions(+), 3 deletions(-) + +commit 4b96c8399102a36e542c9da3b34650c26ccdda3c +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 12:19:07 2018 +0200 + + Make pdfDocEncodingToUTF16 input param const + + poppler/Form.cc | 5 +++-- + poppler/Form.h | 1 + + poppler/PDFDocEncoding.h | 2 +- + 3 files changed, 5 insertions(+), 3 deletions(-) + +commit 5804259f22d4d42ed7c37c9efb613910248cd1d4 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 11:58:50 2018 +0200 + + GfxFont::getToUnicode -> const + + And we don't need to do the inc/dec ref dance in Annot + since the GfxFont is still alive while we use it and there's + no other users to getToUnicode that may keep the CharCodeToUnicode + for longer time than the GfxFont live + + poppler/Annot.cc | 5 ++--- + poppler/GfxFont.cc | 12 ++++-------- + poppler/GfxFont.h | 7 ++++--- + 3 files changed, 10 insertions(+), 14 deletions(-) + +commit 1eb06156855758e4b1da2adc0334d84d3f857fb1 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 11:56:57 2018 +0200 + + CharCodeToUnicode::mapToCharCode -> const + + poppler/CharCodeToUnicode.cc | 3 ++- + poppler/CharCodeToUnicode.h | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +commit 2a49511517678b7e05660bb9a35a614c83229b66 +Author: Albert Astals Cid <albert.astals.cid@kdab.com> +Date: Thu Apr 5 11:50:23 2018 +0200 + + Add some const to GooHash and GooString + + goo/GooHash.cc | 7 ++++--- + goo/GooHash.h | 7 ++++--- + goo/GooString.cc | 7 ++++--- + goo/GooString.h | 7 ++++--- + 4 files changed, 16 insertions(+), 12 deletions(-) + +commit e491e935ea355d48519cf0a14e4b060655850675 +Author: Evangelos Foutras <evangelos@foutrelis.com> +Date: Mon Apr 2 16:09:34 2018 +0300 + + Fix PDFDoc::checkHeader() for PDFs smaller than 1 KiB + + The fix for bug 104502 made it so PDFDoc::checkHeader() would print a + warning and return immediatelly if it encounters an EOF while reading + the first 1024 bytes. + + Some PDF files can be smaller than 1024 bytes, for example those used + by pdf2djvu's test suite. The latter would fail due to the unexpected + warnings. + + Change the behavior of PDFDoc::checkHeader() when encountering an EOF + so it processes the data it has read so far instead of aborting early. + + https://bugs.freedesktop.org/show_bug.cgi?id=105674 + + poppler/PDFDoc.cc | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +commit c19469f2a80ebc09bef3fbd603034e43c4a707cd +Author: Mojca Miklavec <mojca@macports.org> +Date: Mon Apr 2 12:52:35 2018 +0200 + + Fix build on some platforms + + We need to include time.h in gfile.h + + Bug #105766 + + goo/gfile.cc | 6 ++---- + goo/gfile.h | 2 ++ + 2 files changed, 4 insertions(+), 4 deletions(-) + +commit c7a317635cfc6934e975e846335e37a68d6b3876 +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Mar 26 16:10:05 2018 +0200 + + glib: less deprecated calls + + And increate gdk pixbuf requirement to the version i think we + actually require + + cmake/modules/FindGTK.cmake | 2 +- + glib/demo/annots.c | 2 +- + glib/demo/selections.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +commit 7a708ffd374cd18e9e4bfe8a8e95c02184a074ba +Author: Oliver Sander <oliver.sander@tu-dresden.de> +Date: Wed Mar 28 00:00:35 2018 +0200 + + Implement ArthurOutputDev::axialShadedFill + + qt5/src/ArthurOutputDev.cc | 128 + ++++++++++++++++++++++++++++++++++++++++++++- + qt5/src/ArthurOutputDev.h | 9 +++- + 2 files changed, 135 insertions(+), 2 deletions(-) + +commit 5e7aef9df36a07c82b0ab40f80fd8464840f6424 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Mar 23 15:34:56 2018 +0100 + + PSOutputDev: move i declaration to the for + + poppler/PSOutputDev.cc | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +commit 79789ed3d2798fb34f1c82d950e03a4d41e197de +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Mar 23 19:58:16 2018 +0100 + + Annot: setColor -> setDrawColor + + to differentiate from the setColor that actually changes the annot + color + + poppler/Annot.cc | 60 + ++++++++++++++++++++++++++++---------------------------- + poppler/Annot.h | 2 +- + 2 files changed, 31 insertions(+), 31 deletions(-) + +commit e34e187934e3654989b6af5177f345032623dd9b +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Mar 23 19:57:39 2018 +0100 + + SplashOutputDev: make getMatteColor static + + poppler/SplashOutputDev.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit c14dfa44a70ce32bbe1268ddff6106cab3f33bc2 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Mar 23 19:56:12 2018 +0100 + + HtmlOutputDev: don't pass catalog around to not use it + + utils/HtmlOutputDev.cc | 13 ++++++------- + utils/HtmlOutputDev.h | 4 ++-- + 2 files changed, 8 insertions(+), 9 deletions(-) + +commit 92c51751a87b31c4bafa7b0146f745b3008ec9fc +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Mar 23 19:55:42 2018 +0100 + + JPEG2000Stream.cc: no need to store indexed + + we only use it in one function + + poppler/JPEG2000Stream.cc | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +commit 46543272dbe7655821e1c794ca3cc22e8cb4cef9 +Author: Albert Astals Cid <aacid@kde.org> +Date: Tue Mar 20 23:44:23 2018 +0100 + + gfile: Fix windows build + + goo/gfile.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +commit 327c342a932d8df731ec02a6b22792004206c2db +Author: Andre Heinecke <aheinecke@intevation.de> +Date: Tue Mar 20 23:07:15 2018 +0100 + + Add read only setter for form fields + + Read only is modifiable from AcroForm scripts. + + poppler/Form.cc | 32 ++++++++++++++++++++++++++++++++ + poppler/Form.h | 4 +++- + qt5/src/poppler-form.cc | 6 ++++++ + qt5/src/poppler-form.h | 7 +++++++ + 4 files changed, 48 insertions(+), 1 deletion(-) + +commit 4798ef5298bcfcfadf8e1d66f9200e3c9eee2248 +Author: Carlos Garcia Campos <cgarcia@igalia.com> +Date: Mon Mar 19 11:16:03 2018 +0100 + + build: bring back the option to disable GObject introspection + + It was available with autotools, but we lost it when switching + to cmake. + + CMakeLists.txt | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + commit f26285f361478219ea9d3c6de1529ecd5ff96ac9 Author: Albert Astals Cid <aacid@kde.org> Date: Sun Mar 18 19:23:49 2018 +0100 diff --git a/Build/source/libs/poppler/poppler-src/NEWS b/Build/source/libs/poppler/poppler-src/NEWS index 8b0af2243c6..7acec550d87 100644 --- a/Build/source/libs/poppler/poppler-src/NEWS +++ b/Build/source/libs/poppler/poppler-src/NEWS @@ -1,3 +1,36 @@ +Release 0.64.0 + core: + * Workaround form field text not being drawn on broken files. Bug #103245 + * Add read only setter for form fields + * Add support for Link Hide action + * Add support for Next actions in Links + * Fix parsing of Annot focus out actions + * Fix PDFDoc::checkHeader() for PDFs smaller than 1 KiB. Bug #105674 + * Add const to several classes and members + * gfile: Fix build on some platforms + * Fix issues with on malformed documents. Bug #105972, #105969, #106059, #106061 + * Several small code improvements + + qt5: + * Allow setting of Form visibility status + * Allow setting of Form read only status + * Add support for Link Hide action + * Add support for Next actions in Links + * ArthurOutputDev: Implement axialShadedFill + * ArthurOutputDev: Implement drawImageMask. Bug #105531 + * ArthurOutputDev: Implement Type3 font support + + utils: + * pdfsig: Add -dump which writes signatures to disk. Bug #104881 + + glib: + * less deprecated calls + + build system: + * bring back the option to disable GObject introspection + * Add iconv include dir when compiling + * Make it possible to build poppler without fontconfig. Default for Android + Release 0.63.0 core: * CairoOutputDev: support embedding CCITT image data. Bug #103399 diff --git a/Build/source/libs/poppler/poppler-src/goo/GooHash.cc b/Build/source/libs/poppler/poppler-src/goo/GooHash.cc index cd39a5aee3f..620803eb603 100644 --- a/Build/source/libs/poppler/poppler-src/goo/GooHash.cc +++ b/Build/source/libs/poppler/poppler-src/goo/GooHash.cc @@ -14,6 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -154,7 +155,7 @@ void *GooHash::lookup(GooString *key) { return p->val.p; } -int GooHash::lookupInt(GooString *key) { +int GooHash::lookupInt(const GooString *key) { GooHashBucket *p; int h; @@ -351,7 +352,7 @@ void GooHash::expand() { gfree(oldTab); } -GooHashBucket *GooHash::find(GooString *key, int *h) { +GooHashBucket *GooHash::find(const GooString *key, int *h) { GooHashBucket *p; if (unlikely(!key)) @@ -378,7 +379,7 @@ GooHashBucket *GooHash::find(const char *key, int *h) { return nullptr; } -int GooHash::hash(GooString *key) { +int GooHash::hash(const GooString *key) { const char *p; unsigned int h; int i; diff --git a/Build/source/libs/poppler/poppler-src/goo/GooHash.h b/Build/source/libs/poppler/poppler-src/goo/GooHash.h index eda19e31409..57f883c6898 100644 --- a/Build/source/libs/poppler/poppler-src/goo/GooHash.h +++ b/Build/source/libs/poppler/poppler-src/goo/GooHash.h @@ -14,6 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -45,7 +46,7 @@ public: void replace(GooString *key, void *val); void replace(GooString *key, int val); void *lookup(GooString *key); - int lookupInt(GooString *key); + int lookupInt(const GooString *key); void *lookup(const char *key); int lookupInt(const char *key); void *remove(GooString *key); @@ -63,9 +64,9 @@ private: GooHash& operator=(const GooHash &other); void expand(); - GooHashBucket *find(GooString *key, int *h); + GooHashBucket *find(const GooString *key, int *h); GooHashBucket *find(const char *key, int *h); - int hash(GooString *key); + int hash(const GooString *key); int hash(const char *key); GBool deleteKeys; // set if key strings should be deleted diff --git a/Build/source/libs/poppler/poppler-src/goo/GooList.cc b/Build/source/libs/poppler/poppler-src/goo/GooList.cc index 6ce4952dc6a..e0e4875bad9 100644 --- a/Build/source/libs/poppler/poppler-src/goo/GooList.cc +++ b/Build/source/libs/poppler/poppler-src/goo/GooList.cc @@ -6,6 +6,20 @@ // //======================================================================== +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + #include <config.h> #ifdef USE_GCC_PRAGMAS @@ -39,7 +53,7 @@ GooList::~GooList() { gfree(data); } -GooList *GooList::copy() { +GooList *GooList::copy() const { GooList *ret; ret = new GooList(length); diff --git a/Build/source/libs/poppler/poppler-src/goo/GooList.h b/Build/source/libs/poppler/poppler-src/goo/GooList.h index c83a0e36a8a..a0bc525d8da 100644 --- a/Build/source/libs/poppler/poppler-src/goo/GooList.h +++ b/Build/source/libs/poppler/poppler-src/goo/GooList.h @@ -13,7 +13,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2012, 2018 Albert Astals Cid <aacid@kde.org> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -48,16 +48,16 @@ public: //----- general // Get the number of elements. - int getLength() { return length; } + int getLength() const { return length; } // Returns a (shallow) copy of this list. - GooList *copy(); + GooList *copy() const; //----- ordered list support // Return the <i>th element. // Assumes 0 <= i < length. - void *get(int i) { return data[i]; } + void *get(int i) const { return data[i]; } // Replace the <i>th element. // Assumes 0 <= i < length. diff --git a/Build/source/libs/poppler/poppler-src/goo/GooString.cc b/Build/source/libs/poppler/poppler-src/goo/GooString.cc index d67b8752622..0cf32a3a6d7 100644 --- a/Build/source/libs/poppler/poppler-src/goo/GooString.cc +++ b/Build/source/libs/poppler/poppler-src/goo/GooString.cc @@ -26,6 +26,7 @@ // Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // Copyright (C) 2015 William Bader <williambader@hotmail.com> // Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -206,7 +207,7 @@ GooString::GooString(const char *sA, int lengthA) { Set(sA, lengthA); } -GooString::GooString(GooString *str, int idx, int lengthA) { +GooString::GooString(const GooString *str, int idx, int lengthA) { s = nullptr; length = 0; assert(idx + lengthA <= str->length); @@ -268,7 +269,7 @@ GooString *GooString::append(char c) { return append((const char*)&c, 1); } -GooString *GooString::append(GooString *str) { +GooString *GooString::append(const GooString *str) { return append(str->getCString(), str->getLength()); } @@ -739,7 +740,7 @@ GooString *GooString::insert(int i, char c) { return insert(i, (const char*)&c, 1); } -GooString *GooString::insert(int i, GooString *str) { +GooString *GooString::insert(int i, const GooString *str) { return insert(i, str->getCString(), str->getLength()); } @@ -789,7 +790,7 @@ GooString *GooString::lowerCase() { return this; } -int GooString::cmp(GooString *str) const { +int GooString::cmp(const GooString *str) const { int n1, n2, i, x; char *p1, *p2; diff --git a/Build/source/libs/poppler/poppler-src/goo/GooString.h b/Build/source/libs/poppler/poppler-src/goo/GooString.h index 49f2888eb28..87fd5a8559b 100644 --- a/Build/source/libs/poppler/poppler-src/goo/GooString.h +++ b/Build/source/libs/poppler/poppler-src/goo/GooString.h @@ -23,6 +23,7 @@ // Copyright (C) 2015 Adam Reichold <adam.reichold@t-online.de> // Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com> // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -64,7 +65,7 @@ public: GooString(const char *sA, int lengthA); // Create a string from <lengthA> chars at <idx> in <str>. - GooString(GooString *str, int idx, int lengthA); + GooString(const GooString *str, int idx, int lengthA); // Set content of a string to <newStr>. If <newLen> is CALC_STRING_LEN, then // length of the string will be calculated with strlen(). Otherwise we assume @@ -132,7 +133,7 @@ public: // Append a character or string. GooString *append(char c); - GooString *append(GooString *str); + GooString *append(const GooString *str); GooString *append(const char *str, int lengthA=CALC_STRING_LEN); // Append a formatted string. @@ -141,7 +142,7 @@ public: // Insert a character or string. GooString *insert(int i, char c); - GooString *insert(int i, GooString *str); + GooString *insert(int i, const GooString *str); GooString *insert(int i, const char *str, int lengthA=CALC_STRING_LEN); // Delete a character or range of characters. @@ -152,7 +153,7 @@ public: GooString *lowerCase(); // Compare two strings: -1:< 0:= +1:> - int cmp(GooString *str) const; + int cmp(const GooString *str) const; int cmpN(GooString *str, int n) const; int cmp(const char *sA) const; int cmpN(const char *sA, int n) const; diff --git a/Build/source/libs/poppler/poppler-src/goo/gfile.cc b/Build/source/libs/poppler/poppler-src/goo/gfile.cc index 0c425319b6f..381a0ce265d 100644 --- a/Build/source/libs/poppler/poppler-src/goo/gfile.cc +++ b/Build/source/libs/poppler/poppler-src/goo/gfile.cc @@ -26,6 +26,7 @@ // Copyright (C) 2013 Peter Breitenlohner <peb@mppmu.mpg.de> // Copyright (C) 2013, 2017 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2017 Christoph Cullmann <cullmann@kde.org> +// Copyright (C) 2018 Mojca Miklavec <mojca@macports.org> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git diff --git a/Build/source/libs/poppler/poppler-src/goo/gfile.h b/Build/source/libs/poppler/poppler-src/goo/gfile.h index 436947b273f..25595aae6d4 100644 --- a/Build/source/libs/poppler/poppler-src/goo/gfile.h +++ b/Build/source/libs/poppler/poppler-src/goo/gfile.h @@ -24,6 +24,7 @@ // Copyright (C) 2014 Peter Breitenlohner <peb@mppmu.mpg.de> // Copyright (C) 2017 Christoph Cullmann <cullmann@kde.org> // Copyright (C) 2017 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2018 Mojca Miklavec <mojca@macports.org> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git diff --git a/Build/source/libs/poppler/poppler-src/poppler/Annot.cc b/Build/source/libs/poppler/poppler-src/poppler/Annot.cc index 15c86a05789..9549856076f 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Annot.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Annot.cc @@ -15,7 +15,7 @@ // // Copyright (C) 2006 Scott Turner <scotty1024@mac.com> // Copyright (C) 2007, 2008 Julien Rebetez <julienr@svn.gnome.org> -// Copyright (C) 2007-2013, 2015-2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2007-2013, 2015-2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2007-2013 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2007, 2008 Iñigo MartÃnez <inigomartinez@gmail.com> // Copyright (C) 2007 Jeff Muizelaar <jeff@infidigm.net> @@ -36,6 +36,8 @@ // Copyright (C) 2015 Philipp Reinkemeier <philipp.reinkemeier@offis.de> // Copyright (C) 2015 Tamas Szekeres <szekerest@gmail.com> // Copyright (C) 2017 Hans-Ulrich Jüttner <huj@froreich-bioscientia.de> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich +// Copyright 2018 Andre Heinecke <aheinecke@intevation.de> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -113,7 +115,7 @@ // = (4 * (sqrt(2) - 1) / 3) * r #define bezierCircle 0.55228475 -static AnnotLineEndingStyle parseAnnotLineEndingStyle(GooString *string) { +static AnnotLineEndingStyle parseAnnotLineEndingStyle(const GooString *string) { if (string != nullptr) { if (!string->cmp("Square")) { return annotLineEndingSquare; @@ -220,7 +222,7 @@ static LinkAction* getAdditionalAction(Annot::AdditionalActionsType type, Object type == Annot::actionMousePressed ? "D" : type == Annot::actionMouseReleased ? "U" : type == Annot::actionFocusIn ? "Fo" : - type == Annot::actionFocusOut ? "BI" : + type == Annot::actionFocusOut ? "Bl" : type == Annot::actionPageOpening ? "PO" : type == Annot::actionPageClosing ? "PC" : type == Annot::actionPageVisible ? "PV" : @@ -1201,7 +1203,6 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) { appearStreams = nullptr; appearBBox = nullptr; appearState = nullptr; - appearBuf = nullptr; fontSize = 0; appearance.setToNull(); @@ -1609,10 +1610,10 @@ Annot::~Annot() { #endif } -void Annot::setColor(AnnotColor *color, GBool fill) { - const double *values = color->getValues(); +void AnnotAppearanceBuilder::setDrawColor(const AnnotColor *drawColor, GBool fill) { + const double *values = drawColor->getValues(); - switch (color->getSpace()) { + switch (drawColor->getSpace()) { case AnnotColor::colorCMYK: appearBuf->appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:c}\n", values[0], values[1], values[2], values[3], @@ -1634,7 +1635,7 @@ void Annot::setColor(AnnotColor *color, GBool fill) { } } -void Annot::setLineStyleForBorder(AnnotBorder *border) { +void AnnotAppearanceBuilder::setLineStyleForBorder(const AnnotBorder *border) { int i, dashLength; double *dash; @@ -1656,7 +1657,7 @@ void Annot::setLineStyleForBorder(AnnotBorder *border) { // Draw an (approximate) circle of radius <r> centered at (<cx>, <cy>). // If <fill> is true, the circle is filled; otherwise it is stroked. -void Annot::drawCircle(double cx, double cy, double r, GBool fill) { +void AnnotAppearanceBuilder::drawCircle(double cx, double cy, double r, GBool fill) { appearBuf->appendf("{0:.2f} {1:.2f} m\n", cx + r, cy); appearBuf->appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", @@ -1680,7 +1681,7 @@ void Annot::drawCircle(double cx, double cy, double r, GBool fill) { // Draw the top-left half of an (approximate) circle of radius <r> // centered at (<cx>, <cy>). -void Annot::drawCircleTopLeft(double cx, double cy, double r) { +void AnnotAppearanceBuilder::drawCircleTopLeft(double cx, double cy, double r) { double r2; r2 = r / sqrt(2.0); @@ -1705,7 +1706,7 @@ void Annot::drawCircleTopLeft(double cx, double cy, double r) { // Draw the bottom-right half of an (approximate) circle of radius <r> // centered at (<cx>, <cy>). -void Annot::drawCircleBottomRight(double cx, double cy, double r) { +void AnnotAppearanceBuilder::drawCircleBottomRight(double cx, double cy, double r) { double r2; r2 = r / sqrt(2.0); @@ -1728,7 +1729,7 @@ void Annot::drawCircleBottomRight(double cx, double cy, double r) { appearBuf->append("S\n"); } -Object Annot::createForm(double *bbox, GBool transparencyGroup, Dict *resDict) { +Object Annot::createForm(const GooString *appearBuf, double *bbox, GBool transparencyGroup, Dict *resDict) { Dict *appearDict = new Dict(xref); appearDict->set("Length", Object(appearBuf->getLength())); appearDict->set("Subtype", Object(objName, "Form")); @@ -1747,10 +1748,9 @@ Object Annot::createForm(double *bbox, GBool transparencyGroup, Dict *resDict) { if (resDict) appearDict->set("Resources", Object(resDict)); - MemStream *mStream = new MemStream(copyString(appearBuf->getCString()), 0, + Stream *mStream = new AutoFreeMemStream(copyString(appearBuf->getCString()), 0, appearBuf->getLength(), Object(appearDict)); - mStream->setNeedFree(gTrue); - return Object(static_cast<Stream*>(mStream)); + return Object(mStream); } Dict *Annot::createResourcesDict(const char *formName, Object &&formStream, @@ -2098,11 +2098,11 @@ void AnnotText::initialize(PDFDoc *docA, Dict *dict) { obj1 = dict->lookup("StateModel"); if (obj1.isString()) { - GooString *modelName = obj1.getString(); + const GooString *modelName = obj1.getString(); Object obj2 = dict->lookup("State"); if (obj2.isString()) { - GooString *stateName = obj2.getString(); + const GooString *stateName = obj2.getString(); if (!stateName->cmp("Marked")) { state = stateMarked; @@ -2435,32 +2435,32 @@ void AnnotText::draw(Gfx *gfx, GBool printing) { if (appearance.isNull()) { ca = opacity; - appearBuf = new GooString (); + AnnotAppearanceBuilder appearBuilder; - appearBuf->append ("q\n"); + appearBuilder.append ("q\n"); if (color) - setColor(color, gTrue); + appearBuilder.setDrawColor(color, gTrue); else - appearBuf->append ("1 1 1 rg\n"); + appearBuilder.append ("1 1 1 rg\n"); if (!icon->cmp("Note")) - appearBuf->append (ANNOT_TEXT_AP_NOTE); + appearBuilder.append (ANNOT_TEXT_AP_NOTE); else if (!icon->cmp("Comment")) - appearBuf->append (ANNOT_TEXT_AP_COMMENT); + appearBuilder.append (ANNOT_TEXT_AP_COMMENT); else if (!icon->cmp("Key")) - appearBuf->append (ANNOT_TEXT_AP_KEY); + appearBuilder.append (ANNOT_TEXT_AP_KEY); else if (!icon->cmp("Help")) - appearBuf->append (ANNOT_TEXT_AP_HELP); + appearBuilder.append (ANNOT_TEXT_AP_HELP); else if (!icon->cmp("NewParagraph")) - appearBuf->append (ANNOT_TEXT_AP_NEW_PARAGRAPH); + appearBuilder.append (ANNOT_TEXT_AP_NEW_PARAGRAPH); else if (!icon->cmp("Paragraph")) - appearBuf->append (ANNOT_TEXT_AP_PARAGRAPH); + appearBuilder.append (ANNOT_TEXT_AP_PARAGRAPH); else if (!icon->cmp("Insert")) - appearBuf->append (ANNOT_TEXT_AP_INSERT); + appearBuilder.append (ANNOT_TEXT_AP_INSERT); else if (!icon->cmp("Cross")) - appearBuf->append (ANNOT_TEXT_AP_CROSS); + appearBuilder.append (ANNOT_TEXT_AP_CROSS); else if (!icon->cmp("Circle")) - appearBuf->append (ANNOT_TEXT_AP_CIRCLE); - appearBuf->append ("Q\n"); + appearBuilder.append (ANNOT_TEXT_AP_CIRCLE); + appearBuilder.append ("Q\n"); // Force 24x24 rectangle PDFRectangle fixedRect(rect->x1, rect->y2 - 24, rect->x1 + 24, rect->y2); @@ -2468,16 +2468,14 @@ void AnnotText::draw(Gfx *gfx, GBool printing) { double bbox[4]; appearBBox->getBBoxRect(bbox); if (ca == 1) { - appearance = createForm(bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); } else { - Object aStream = createForm(bbox, gTrue, nullptr); - delete appearBuf; + Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); + GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, gFalse, resDict); } - delete appearBuf; } // draw the appearance stream @@ -2859,12 +2857,12 @@ void AnnotFreeText::generateFreeTextAppearance() { double borderWidth, ca = opacity; - appearBuf = new GooString (); - appearBuf->append ("q\n"); + AnnotAppearanceBuilder appearBuilder; + appearBuilder.append ("q\n"); borderWidth = border->getWidth(); if (borderWidth > 0) - setLineStyleForBorder(border); + appearBuilder.setLineStyleForBorder(border); // Box size const double width = rect->x2 - rect->x1; @@ -2887,29 +2885,29 @@ void AnnotFreeText::generateFreeTextAppearance() GBool doStroke = (borderWidth != 0); if (doFill || doStroke) { if (doStroke) { - setColor(fontcolor, gFalse); // Border color: same as font color + appearBuilder.setDrawColor(fontcolor, gFalse); // Border color: same as font color } - appearBuf->appendf ("{0:.2f} {0:.2f} {1:.2f} {2:.2f} re\n", borderWidth/2, width-borderWidth, height-borderWidth); + appearBuilder.appendf ("{0:.2f} {0:.2f} {1:.2f} {2:.2f} re\n", borderWidth/2, width-borderWidth, height-borderWidth); if (doFill) { - setColor(color, gTrue); - appearBuf->append(doStroke ? "B\n" : "f\n"); + appearBuilder.setDrawColor(color, gTrue); + appearBuilder.append(doStroke ? "B\n" : "f\n"); } else { - appearBuf->append("S\n"); + appearBuilder.append("S\n"); } } // Setup text clipping const double textmargin = borderWidth * 2; const double textwidth = width - 2*textmargin; - appearBuf->appendf ("{0:.2f} {0:.2f} {1:.2f} {2:.2f} re W n\n", textmargin, textwidth, height - 2*textmargin); + appearBuilder.appendf ("{0:.2f} {0:.2f} {1:.2f} {2:.2f} re W n\n", textmargin, textwidth, height - 2*textmargin); Dict *fontResDict = new Dict(xref); GfxFont *font = createAnnotDrawFont(xref, fontResDict); // Set font state - setColor(fontcolor, gTrue); - appearBuf->appendf ("BT 1 0 0 1 {0:.2f} {1:.2f} Tm\n", textmargin, height - textmargin - fontsize * font->getDescent()); - appearBuf->appendf ("/AnnotDrawFont {0:.2f} Tf\n", fontsize); + appearBuilder.setDrawColor(fontcolor, gTrue); + appearBuilder.appendf ("BT 1 0 0 1 {0:.2f} {1:.2f} Tm\n", textmargin, height - textmargin - fontsize * font->getDescent()); + appearBuilder.appendf ("/AnnotDrawFont {0:.2f} Tf\n", fontsize); int i = 0; double xposPrev = 0; @@ -2929,15 +2927,15 @@ void AnnotFreeText::generateFreeTextAppearance() xpos = 0; break; } - appearBuf->appendf("{0:.2f} {1:.2f} Td\n", xpos - xposPrev, -fontsize); - writeString(&out, appearBuf); - appearBuf->append("Tj\n"); + appearBuilder.appendf("{0:.2f} {1:.2f} Td\n", xpos - xposPrev, -fontsize); + appearBuilder.writeString(out); + appearBuilder.append("Tj\n"); xposPrev = xpos; } font->decRefCnt(); delete fontcolor; - appearBuf->append ("ET Q\n"); + appearBuilder.append ("ET Q\n"); double bbox[4]; bbox[0] = bbox[1] = 0; @@ -2945,16 +2943,14 @@ void AnnotFreeText::generateFreeTextAppearance() bbox[3] = rect->y2 - rect->y1; if (ca == 1) { - appearance = createForm(bbox, gFalse, fontResDict); + appearance = createForm(appearBuilder.buffer(), bbox, gFalse, fontResDict); } else { - Object aStream = createForm(bbox, gTrue, fontResDict); - delete appearBuf; + Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, fontResDict); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); + GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, gFalse, resDict); } - delete appearBuf; } void AnnotFreeText::draw(Gfx *gfx, GBool printing) { @@ -3233,13 +3229,13 @@ void AnnotLine::generateLineAppearance() double borderWidth, ca = opacity; appearBBox = new AnnotAppearanceBBox(rect); - appearBuf = new GooString (); - appearBuf->append ("q\n"); + AnnotAppearanceBuilder appearBuilder; + appearBuilder.append ("q\n"); if (color) { - setColor(color, gFalse); + appearBuilder.setDrawColor(color, gFalse); } - setLineStyleForBorder(border); + appearBuilder.setLineStyleForBorder(border); borderWidth = border->getWidth(); appearBBox->setBorderWidth(std::max(1., borderWidth)); @@ -3297,19 +3293,19 @@ void AnnotLine::generateLineAppearance() // Draw main segment matr.transform (0, leaderLineLength, &tx, &ty); - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", tx, ty); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", tx, ty); appearBBox->extendTo (tx, ty); if (captionwidth != 0 && actualCaptionPos == captionPosInline) { // Break in the middle matr.transform ((main_len-captionwidth)/2 - captionhmargin, leaderLineLength, &tx, &ty); - appearBuf->appendf ("{0:.2f} {1:.2f} l S\n", tx, ty); + appearBuilder.appendf ("{0:.2f} {1:.2f} l S\n", tx, ty); matr.transform ((main_len+captionwidth)/2 + captionhmargin, leaderLineLength, &tx, &ty); - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", tx, ty); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", tx, ty); } matr.transform (main_len, leaderLineLength, &tx, &ty); - appearBuf->appendf ("{0:.2f} {1:.2f} l S\n", tx, ty); + appearBuilder.appendf ("{0:.2f} {1:.2f} l S\n", tx, ty); appearBBox->extendTo (tx, ty); // TODO: Line endings @@ -3337,10 +3333,10 @@ void AnnotLine::generateLineAppearance() appearBBox->extendTo (tx, ty); // Setup text state (reusing transformed top-left coord) - appearBuf->appendf ("0 g BT /AnnotDrawFont {0:.2f} Tf\n", fontsize); // Font color: black - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} Tm\n", + appearBuilder.appendf ("0 g BT /AnnotDrawFont {0:.2f} Tf\n", fontsize); // Font color: black + appearBuilder.appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} Tm\n", matr.m[0], matr.m[1], matr.m[2], matr.m[3], tx, ty); - appearBuf->appendf ("0 {0:.2f} Td\n", -fontsize * font->getDescent()); + appearBuilder.appendf ("0 {0:.2f} Td\n", -fontsize * font->getDescent()); // Draw text int i = 0; double xposPrev = 0; @@ -3350,12 +3346,12 @@ void AnnotLine::generateLineAppearance() layoutText(contents, &out, &i, font, &linewidth, 0, nullptr, gFalse); linewidth *= fontsize; xpos = (captionwidth - linewidth) / 2; - appearBuf->appendf("{0:.2f} {1:.2f} Td\n", xpos - xposPrev, -fontsize); - writeString(&out, appearBuf); - appearBuf->append ("Tj\n"); + appearBuilder.appendf("{0:.2f} {1:.2f} Td\n", xpos - xposPrev, -fontsize); + appearBuilder.writeString(out); + appearBuilder.append ("Tj\n"); xposPrev = xpos; } - appearBuf->append ("ET\n"); + appearBuilder.append ("ET\n"); font->decRefCnt(); } @@ -3364,35 +3360,33 @@ void AnnotLine::generateLineAppearance() double sign = leaderLineLength >= 0 ? 1 : -1; if (ll_len != 0) { matr.transform (0, 0, &tx, &ty); - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", tx, ty); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", tx, ty); appearBBox->extendTo (tx, ty); matr.transform (0, sign*ll_len, &tx, &ty); - appearBuf->appendf ("{0:.2f} {1:.2f} l S\n", tx, ty); + appearBuilder.appendf ("{0:.2f} {1:.2f} l S\n", tx, ty); appearBBox->extendTo (tx, ty); matr.transform (main_len, 0, &tx, &ty); - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", tx, ty); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", tx, ty); appearBBox->extendTo (tx, ty); matr.transform (main_len, sign*ll_len, &tx, &ty); - appearBuf->appendf ("{0:.2f} {1:.2f} l S\n", tx, ty); + appearBuilder.appendf ("{0:.2f} {1:.2f} l S\n", tx, ty); appearBBox->extendTo (tx, ty); } - appearBuf->append ("Q\n"); + appearBuilder.append ("Q\n"); double bbox[4]; appearBBox->getBBoxRect(bbox); if (ca == 1) { - appearance = createForm(bbox, gFalse, fontResDict); + appearance = createForm(appearBuilder.buffer(), bbox, gFalse, fontResDict); } else { - Object aStream = createForm(bbox, gTrue, fontResDict); - delete appearBuf; + Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, fontResDict); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); + GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, gFalse, resDict); } - delete appearBuf; } void AnnotLine::draw(Gfx *gfx, GBool printing) { @@ -3554,8 +3548,8 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { GBool blendMultiply = gTrue; ca = opacity; - appearBuf = new GooString (); - appearBuf->append ("q\n"); + AnnotAppearanceBuilder appearBuilder; + appearBuilder.append ("q\n"); /* Adjust BBox */ delete appearBBox; @@ -3570,9 +3564,9 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { switch (type) { case typeUnderline: if (color) { - setColor(color, gFalse); + appearBuilder.setDrawColor(color, gFalse); } - appearBuf->append ("[] 0 d 1 w\n"); + appearBuilder.append ("[] 0 d 1 w\n"); for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) { double x3, y3, x4, y4; @@ -3582,17 +3576,17 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { x4 = quadrilaterals->getX4(i); y4 = quadrilaterals->getY4(i); - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x3, y3); - appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x4, y4); - appearBuf->append ("S\n"); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", x3, y3); + appearBuilder.appendf ("{0:.2f} {1:.2f} l\n", x4, y4); + appearBuilder.append ("S\n"); } break; case typeStrikeOut: if (color) { - setColor(color, gFalse); + appearBuilder.setDrawColor(color, gFalse); } blendMultiply = gFalse; - appearBuf->append ("[] 0 d 1 w\n"); + appearBuilder.append ("[] 0 d 1 w\n"); for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) { double x1, y1, x2, y2; @@ -3608,16 +3602,16 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { x4 = quadrilaterals->getX4(i); y4 = quadrilaterals->getY4(i); - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", (x1+x3)/2., (y1+y3)/2.); - appearBuf->appendf ("{0:.2f} {1:.2f} l\n", (x2+x4)/2., (y2+y4)/2.); - appearBuf->append ("S\n"); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", (x1+x3)/2., (y1+y3)/2.); + appearBuilder.appendf ("{0:.2f} {1:.2f} l\n", (x2+x4)/2., (y2+y4)/2.); + appearBuilder.append ("S\n"); } break; case typeSquiggly: if (color) { - setColor(color, gFalse); + appearBuilder.setDrawColor(color, gFalse); } - appearBuf->append ("[] 0 d 1 w\n"); + appearBuilder.append ("[] 0 d 1 w\n"); for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) { double x1, y1, x2, y3; @@ -3629,20 +3623,20 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { y3 = quadrilaterals->getY3(i); h6 = (y1 - y3) / 6.0; - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x1, y3+h6); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", x1, y3+h6); bool down = false; do { down = !down; // Zigzag line x1 += 2; - appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x1, y3 + (down ? 0 : h6)); + appearBuilder.appendf ("{0:.2f} {1:.2f} l\n", x1, y3 + (down ? 0 : h6)); } while (x1 < x2); - appearBuf->append ("S\n"); + appearBuilder.append ("S\n"); } break; default: case typeHighlight: if (color) - setColor(color, gTrue); + appearBuilder.setDrawColor(color, gTrue); double biggestBorder = 0; for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) { @@ -3663,41 +3657,36 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { biggestBorder = h4; } - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x3, y3); - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", x3, y3); + appearBuilder.appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", x3 - h4, y3 + h4, x1 - h4, y1 - h4, x1, y1); - appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x2, y2); - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + appearBuilder.appendf ("{0:.2f} {1:.2f} l\n", x2, y2); + appearBuilder.appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", x2 + h4, y2 - h4, x4 + h4, y4 + h4, x4, y4); - appearBuf->append ("f\n"); + appearBuilder.append ("f\n"); } appearBBox->setBorderWidth(biggestBorder); break; } - appearBuf->append ("Q\n"); + appearBuilder.append ("Q\n"); - Object aStream; double bbox[4]; bbox[0] = appearBBox->getPageXMin(); bbox[1] = appearBBox->getPageYMin(); bbox[2] = appearBBox->getPageXMax(); bbox[3] = appearBBox->getPageYMax(); - aStream = createForm(bbox, gTrue, nullptr); - delete appearBuf; + Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); + GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", 1, blendMultiply ? "Multiply" : nullptr); if (ca == 1) { - appearance = createForm(bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, gFalse, resDict); } else { - aStream = createForm(bbox, gTrue, resDict); - delete appearBuf; + aStream = createForm(&appearBuf, bbox, gTrue, resDict); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); Dict *resDict2 = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(bbox, gFalse, resDict2); + appearance = createForm(&appearBuf, bbox, gFalse, resDict2); } - delete appearBuf; } // draw the appearance stream @@ -3829,8 +3818,8 @@ LinkAction* AnnotWidget::getFormAdditionalAction(FormAdditionalActionsType type) // TODO: Handle surrogate pairs in UTF-16. // Should be able to generate output for any CID-keyed font. // Doesn't handle vertical fonts--should it? -void Annot::layoutText(GooString *text, GooString *outBuf, int *i, - GfxFont *font, double *width, double widthLimit, +void Annot::layoutText(const GooString *text, GooString *outBuf, int *i, + const GfxFont *font, double *width, double widthLimit, int *charCount, GBool noReencode) { CharCode c; @@ -3906,13 +3895,12 @@ void Annot::layoutText(GooString *text, GooString *outBuf, int *i, if (noReencode) { outBuf->append(uChar); } else { - CharCodeToUnicode *ccToUnicode = font->getToUnicode(); + const CharCodeToUnicode *ccToUnicode = font->getToUnicode(); if (!ccToUnicode) { // This assumes an identity CMap. outBuf->append((uChar >> 8) & 0xff); outBuf->append(uChar & 0xff); } else if (ccToUnicode->mapToCharCode(&uChar, &c, 1)) { - ccToUnicode->decRefCnt(); if (font->isCIDFont()) { // TODO: This assumes an identity CMap. It should be extended to // handle the general case. @@ -3923,7 +3911,6 @@ void Annot::layoutText(GooString *text, GooString *outBuf, int *i, outBuf->append(c); } } else { - ccToUnicode->decRefCnt(); error(errSyntaxError, -1, "AnnotWidget::layoutText, cannot convert U+{0:04uX}", uChar); } } @@ -4025,15 +4012,15 @@ void Annot::layoutText(GooString *text, GooString *outBuf, int *i, // Copy the given string to appearBuf, adding parentheses around it and // escaping characters as appropriate. -void Annot::writeString(GooString *str, GooString *appearBuf) +void AnnotAppearanceBuilder::writeString(const GooString &str) { char c; int i; appearBuf->append('('); - for (i = 0; i < str->getLength(); ++i) { - c = str->getChar(i); + for (i = 0; i < str.getLength(); ++i) { + c = str.getChar(i); if (c == '(' || c == ')' || c == '\\') { appearBuf->append('\\'); appearBuf->append(c); @@ -4048,24 +4035,26 @@ void Annot::writeString(GooString *str, GooString *appearBuf) } // Draw the variable text or caption for a field. -void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resources, +bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da, const GfxResources *resources, + const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, GBool multiline, int comb, int quadding, GBool txField, GBool forceZapfDingbats, + XRef *xref, bool *addedDingbatsResource, GBool password) { GooList *daToks; GooString *tok, *convertedText; - GfxFont *font; + const GfxFont *font; double dx, dy; double fontSize, fontSize2, borderWidth, x, xPrev, y, w, wMax; int tfPos, tmPos, i, j; int rot; GBool freeText = gFalse; // true if text should be freed before return - GBool freeFont = gFalse; + GfxFont *fontToFree = nullptr; //~ if there is no MK entry, this should use the existing content stream, //~ and only replace the marked content portion of it //~ (this is only relevant for Tx fields) - + // parse the default appearance string tfPos = tmPos = -1; if (da) { @@ -4096,6 +4085,10 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc // force ZapfDingbats if (forceZapfDingbats) { + assert(xref != nullptr); + assert(addedDingbatsResource != nullptr); + *addedDingbatsResource = false; + if (tfPos >= 0) { tok = (GooString *)daToks->get(tfPos); if (tok->cmp("/ZaDb")) { @@ -4118,10 +4111,10 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc r.num = -1; r.gen = -1; Dict *d = new Dict(xref); - font = new Gfx8BitFont(xref, "ZaDb", r, new GooString("ZapfDingbats"), fontType1, r, d); + fontToFree = new Gfx8BitFont(xref, "ZaDb", r, new GooString("ZapfDingbats"), fontType1, r, d); delete d; - freeFont = gTrue; - addDingbatsResource = gTrue; + font = fontToFree; + *addedDingbatsResource = true; } else { error(errSyntaxError, -1, "Unknown font in field's DA string"); } @@ -4138,7 +4131,7 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc if (daToks) { deleteGooList(daToks, GooString); } - return; + return false; } // get the border width @@ -4152,9 +4145,10 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc else len = text->getLength(); - text = new GooString; + GooString *newText = new GooString; for (i = 0; i < len; ++i) - text->append('*'); + newText->append('*'); + text = newText; freeText = gTrue; } @@ -4201,7 +4195,7 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc y = dy - 3; i = 0; while (i < text->getLength()) { - layoutText(text, convertedText, &i, font, &w, wMax / fontSize, nullptr, + Annot::layoutText(text, convertedText, &i, font, &w, wMax / fontSize, nullptr, forceZapfDingbats); y -= fontSize; } @@ -4248,7 +4242,7 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc i = 0; xPrev = 0; while (i < text->getLength()) { - layoutText(text, convertedText, &i, font, &w, wMax / fontSize, nullptr, + Annot::layoutText(text, convertedText, &i, font, &w, wMax / fontSize, nullptr, forceZapfDingbats); w *= fontSize; @@ -4268,7 +4262,7 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc // draw the line appearBuf->appendf("{0:.2f} {1:.2f} Td\n", x - xPrev, -fontSize); - writeString(convertedText, appearBuf); + writeString(*convertedText); appearBuf->append(" Tj\n"); // next line @@ -4301,7 +4295,7 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc } i = 0; - layoutText(text, convertedText, &i, font, nullptr, 0.0, &charCount, + Annot::layoutText(text, convertedText, &i, font, nullptr, 0.0, &charCount, forceZapfDingbats); if (charCount > comb) charCount = comb; @@ -4364,10 +4358,9 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc x = 0.5 * (w - dx); appearBuf->appendf("{0:.2f} 0 Td\n", x - xPrev + w); - GooString *charBuf = new GooString(s, n); - writeString(charBuf, appearBuf); + GooString charBuf(s, n); + writeString(charBuf); appearBuf->append(" Tj\n"); - delete charBuf; i++; s += n; @@ -4378,7 +4371,7 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc // regular (non-comb) formatting } else { i = 0; - layoutText(text, convertedText, &i, font, &w, 0.0, nullptr, + Annot::layoutText(text, convertedText, &i, font, &w, 0.0, nullptr, forceZapfDingbats); // compute font autosize @@ -4435,7 +4428,7 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc } // write the text string - writeString(convertedText, appearBuf); + writeString(*convertedText); appearBuf->append(" Tj\n"); } } @@ -4452,17 +4445,19 @@ void AnnotWidget::drawText(GooString *text, GooString *da, GfxResources *resourc delete text; } delete convertedText; - if (freeFont) { - font->decRefCnt(); + if (fontToFree) { + fontToFree->decRefCnt(); } + + return true; } // Draw the variable text or caption for a field. -void AnnotWidget::drawListBox(FormFieldChoice *fieldChoice, - GooString *da, GfxResources *resources, int quadding) { +bool AnnotAppearanceBuilder::drawListBox(const FormFieldChoice *fieldChoice, const AnnotBorder *border, const PDFRectangle *rect, + const GooString *da, const GfxResources *resources, int quadding) { GooList *daToks; GooString *tok, *convertedText; - GfxFont *font; + const GfxFont *font; double fontSize, fontSize2, borderWidth, x, y, w, wMax; int tfPos, tmPos, i, j; @@ -4519,7 +4514,7 @@ void AnnotWidget::drawListBox(FormFieldChoice *fieldChoice, if (daToks) { deleteGooList(daToks, GooString); } - return; + return false; } convertedText = new GooString; @@ -4538,9 +4533,9 @@ void AnnotWidget::drawListBox(FormFieldChoice *fieldChoice, deleteGooList(daToks, GooString); } delete convertedText; - return; + return false; } - layoutText(fieldChoice->getChoice(i), convertedText, &j, font, &w, 0.0, nullptr, gFalse); + Annot::layoutText(fieldChoice->getChoice(i), convertedText, &j, font, &w, 0.0, nullptr, gFalse); if (w > wMax) { wMax = w; } @@ -4578,7 +4573,7 @@ void AnnotWidget::drawListBox(FormFieldChoice *fieldChoice, // compute text width and start position j = 0; - layoutText(fieldChoice->getChoice(i), convertedText, &j, font, &w, 0.0, nullptr, gFalse); + Annot::layoutText(fieldChoice->getChoice(i), convertedText, &j, font, &w, 0.0, nullptr, gFalse); w *= fontSize; switch (quadding) { case quaddingLeftJustified: @@ -4621,7 +4616,7 @@ void AnnotWidget::drawListBox(FormFieldChoice *fieldChoice, } // write the text string - writeString(convertedText, appearBuf); + writeString(*convertedText); appearBuf->append(" Tj\n"); // cleanup @@ -4637,27 +4632,29 @@ void AnnotWidget::drawListBox(FormFieldChoice *fieldChoice, } delete convertedText; + + return true; } -void AnnotWidget::drawBorder() { +void AnnotAppearanceBuilder::drawFieldBorder(const FormField *field, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect) { int dashLength; double *dash; AnnotColor adjustedColor; - double w = border->getWidth(); + const double w = border->getWidth(); - AnnotColor *aColor = appearCharacs->getBorderColor(); + const AnnotColor *aColor = appearCharacs->getBorderColor(); if (!aColor) aColor = appearCharacs->getBackColor(); if (!aColor) return; - double dx = rect->x2 - rect->x1; - double dy = rect->y2 - rect->y1; + const double dx = rect->x2 - rect->x1; + const double dy = rect->y2 - rect->y1; // radio buttons with no caption have a round border - GBool hasCaption = appearCharacs->getNormalCaption() != nullptr; + const GBool hasCaption = appearCharacs->getNormalCaption() != nullptr; if (field->getType() == formButton && - static_cast<FormFieldButton*>(field)->getButtonType() == formButtonRadio && !hasCaption) { + static_cast<const FormFieldButton*>(field)->getButtonType() == formButtonRadio && !hasCaption) { double r = 0.5 * (dx < dy ? dx : dy); switch (border->getStyle()) { case AnnotBorder::borderDashed: @@ -4672,21 +4669,21 @@ void AnnotWidget::drawBorder() { case AnnotBorder::borderSolid: case AnnotBorder::borderUnderlined: appearBuf->appendf("{0:.2f} w\n", w); - setColor(aColor, gFalse); + setDrawColor(aColor, gFalse); drawCircle(0.5 * dx, 0.5 * dy, r - 0.5 * w, gFalse); break; case AnnotBorder::borderBeveled: case AnnotBorder::borderInset: appearBuf->appendf("{0:.2f} w\n", 0.5 * w); - setColor(aColor, gFalse); + setDrawColor(aColor, gFalse); drawCircle(0.5 * dx, 0.5 * dy, r - 0.25 * w, gFalse); adjustedColor = AnnotColor(*aColor); adjustedColor.adjustColor(border->getStyle() == AnnotBorder::borderBeveled ? 1 : -1); - setColor(&adjustedColor, gFalse); + setDrawColor(&adjustedColor, gFalse); drawCircleTopLeft(0.5 * dx, 0.5 * dy, r - 0.75 * w); adjustedColor = AnnotColor(*aColor); adjustedColor.adjustColor(border->getStyle() == AnnotBorder::borderBeveled ? -1 : 1); - setColor(&adjustedColor, gFalse); + setDrawColor(&adjustedColor, gFalse); drawCircleBottomRight(0.5 * dx, 0.5 * dy, r - 0.75 * w); break; } @@ -4703,7 +4700,7 @@ void AnnotWidget::drawBorder() { // fallthrough case AnnotBorder::borderSolid: appearBuf->appendf("{0:.2f} w\n", w); - setColor(aColor, gFalse); + setDrawColor(aColor, gFalse); appearBuf->appendf("{0:.2f} {0:.2f} {1:.2f} {2:.2f} re s\n", 0.5 * w, dx - w, dy - w); break; @@ -4711,7 +4708,7 @@ void AnnotWidget::drawBorder() { case AnnotBorder::borderInset: adjustedColor = AnnotColor(*aColor); adjustedColor.adjustColor(border->getStyle() == AnnotBorder::borderBeveled ? 1 : -1); - setColor(&adjustedColor, gTrue); + setDrawColor(&adjustedColor, gTrue); appearBuf->append("0 0 m\n"); appearBuf->appendf("0 {0:.2f} l\n", dy); appearBuf->appendf("{0:.2f} {1:.2f} l\n", dx, dy); @@ -4721,7 +4718,7 @@ void AnnotWidget::drawBorder() { appearBuf->append("f\n"); adjustedColor = AnnotColor(*aColor); adjustedColor.adjustColor(border->getStyle() == AnnotBorder::borderBeveled ? -1 : 1); - setColor(&adjustedColor, gTrue); + setDrawColor(&adjustedColor, gTrue); appearBuf->append("0 0 m\n"); appearBuf->appendf("{0:.2f} 0 l\n", dx); appearBuf->appendf("{0:.2f} {1:.2f} l\n", dx, dy); @@ -4732,7 +4729,7 @@ void AnnotWidget::drawBorder() { break; case AnnotBorder::borderUnderlined: appearBuf->appendf("{0:.2f} w\n", w); - setColor(aColor, gFalse); + setDrawColor(aColor, gFalse); appearBuf->appendf("0 0 m {0:.2f} 0 l s\n", dx); break; } @@ -4743,104 +4740,132 @@ void AnnotWidget::drawBorder() { } } -void AnnotWidget::drawFormFieldButton(GfxResources *resources, GooString *da) { - GooString *caption = nullptr; +bool AnnotAppearanceBuilder::drawFormField(const FormField *field, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, const GooString *appearState, XRef *xref, bool *addedDingbatsResource) +{ + // draw the field contents + switch (field->getType()) { + case formButton: + return drawFormFieldButton(static_cast<const FormFieldButton *>(field), resources, da, border, appearCharacs, rect, appearState, xref, addedDingbatsResource); + break; + case formText: + return drawFormFieldText(static_cast<const FormFieldText *>(field), form, resources, da, border, appearCharacs, rect); + case formChoice: + return drawFormFieldChoice(static_cast<const FormFieldChoice *>(field), form, resources, da, border, appearCharacs, rect); + break; + case formSignature: + //~unimp + break; + case formUndef: + default: + error(errSyntaxError, -1, "Unknown field type"); + } + + return false; +} + + +bool AnnotAppearanceBuilder::drawFormFieldButton(const FormFieldButton *field, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, const GooString *appearState, XRef *xref, bool *addedDingbatsResource) { + const GooString *caption = nullptr; if (appearCharacs) caption = appearCharacs->getNormalCaption(); - switch (static_cast<FormFieldButton *>(field)->getButtonType()) { + switch (field->getButtonType()) { case formButtonRadio: { //~ Acrobat doesn't draw a caption if there is no AP dict (?) if (appearState && appearState->cmp("Off") != 0 && - static_cast<FormFieldButton *>(field)->getState(appearState->getCString())) { + field->getState(appearState->getCString())) { if (caption) { - drawText(caption, da, resources, gFalse, 0, fieldQuadCenter, - gFalse, gTrue); + return drawText(caption, da, resources, border, appearCharacs, rect, gFalse, 0, fieldQuadCenter, gFalse, gTrue, xref, addedDingbatsResource, gFalse); } else if (appearCharacs) { - AnnotColor *aColor = appearCharacs->getBorderColor(); + const AnnotColor *aColor = appearCharacs->getBorderColor(); if (aColor) { - double dx = rect->x2 - rect->x1; - double dy = rect->y2 - rect->y1; - setColor(aColor, gTrue); + const double dx = rect->x2 - rect->x1; + const double dy = rect->y2 - rect->y1; + setDrawColor(aColor, gTrue); drawCircle(0.5 * dx, 0.5 * dy, 0.2 * (dx < dy ? dx : dy), gTrue); } + return true; } } } break; case formButtonPush: if (caption) - drawText(caption, da, resources, gFalse, 0, fieldQuadCenter, gFalse, gFalse); + return drawText(caption, da, resources, border, appearCharacs, rect, gFalse, 0, fieldQuadCenter, gFalse, gFalse, xref, addedDingbatsResource, gFalse); break; case formButtonCheck: if (appearState && appearState->cmp("Off") != 0) { if (!caption) { GooString checkMark("3"); - drawText(&checkMark, da, resources, gFalse, 0, fieldQuadCenter, gFalse, gTrue); + return drawText(&checkMark, da, resources, border, appearCharacs, rect, gFalse, 0, fieldQuadCenter, gFalse, gTrue, xref, addedDingbatsResource, gFalse); } else { - drawText(caption, da, resources, gFalse, 0, fieldQuadCenter, gFalse, gTrue); + return drawText(caption, da, resources, border, appearCharacs, rect, gFalse, 0, fieldQuadCenter, gFalse, gTrue, xref, addedDingbatsResource, gFalse); } } break; } + + return true; } -void AnnotWidget::drawFormFieldText(GfxResources *resources, GooString *da) { +bool AnnotAppearanceBuilder::drawFormFieldText(const FormFieldText *fieldText, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect) { VariableTextQuadding quadding; - GooString *contents; - FormFieldText *fieldText = static_cast<FormFieldText *>(field); + const GooString *contents; contents = fieldText->getContent(); if (contents) { - quadding = field->hasTextQuadding() ? field->getTextQuadding() : form->getTextQuadding(); + quadding = fieldText->hasTextQuadding() ? fieldText->getTextQuadding() : form->getTextQuadding(); int comb = 0; if (fieldText->isComb()) comb = fieldText->getMaxLen(); - drawText(contents, da, resources, - fieldText->isMultiline(), comb, quadding, gTrue, gFalse, fieldText->isPassword()); + return drawText(contents, da, resources, border, appearCharacs, rect, + fieldText->isMultiline(), comb, quadding, gTrue, gFalse, nullptr, nullptr, fieldText->isPassword()); } + + return true; } -void AnnotWidget::drawFormFieldChoice(GfxResources *resources, GooString *da) { - GooString *selected; +bool AnnotAppearanceBuilder::drawFormFieldChoice(const FormFieldChoice *fieldChoice, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect) { + const GooString *selected; VariableTextQuadding quadding; - FormFieldChoice *fieldChoice = static_cast<FormFieldChoice *>(field); - quadding = field->hasTextQuadding() ? field->getTextQuadding() : form->getTextQuadding(); + quadding = fieldChoice->hasTextQuadding() ? fieldChoice->getTextQuadding() : form->getTextQuadding(); if (fieldChoice->isCombo()) { selected = fieldChoice->getSelectedChoice(); if (selected) { - drawText(selected, da, resources, gFalse, 0, quadding, gTrue, gFalse); + return drawText(selected, da, resources, border, appearCharacs, rect, gFalse, 0, quadding, gTrue, gFalse, nullptr, nullptr, gFalse); //~ Acrobat draws a popup icon on the right side } // list box } else { - drawListBox(fieldChoice, da, resources, quadding); + return drawListBox(fieldChoice, border, rect, da, resources, quadding); } + + return true; } -void AnnotWidget::generateFieldAppearance() { +void AnnotWidget::generateFieldAppearance(bool *addedDingbatsResource) { GfxResources *resources; - GooString *da; + const GooString *da; - appearBuf = new GooString (); + AnnotAppearanceBuilder appearBuilder; // draw the background if (appearCharacs) { - AnnotColor *aColor = appearCharacs->getBackColor(); + const AnnotColor *aColor = appearCharacs->getBackColor(); if (aColor) { - setColor(aColor, gTrue); - appearBuf->appendf("0 0 {0:.2f} {1:.2f} re f\n", + appearBuilder.setDrawColor(aColor, gTrue); + appearBuilder.appendf("0 0 {0:.2f} {1:.2f} re f\n", rect->x2 - rect->x1, rect->y2 - rect->y1); } } // draw the border if (appearCharacs && border && border->getWidth() > 0) - drawBorder(); + appearBuilder.drawFieldBorder(field, border, appearCharacs, rect); da = field->getDefaultAppearance(); if (!da) @@ -4848,25 +4873,13 @@ void AnnotWidget::generateFieldAppearance() { resources = form->getDefaultResources(); - // draw the field contents - switch (field->getType()) { - case formButton: - drawFormFieldButton(resources, da); - break; - case formText: - drawFormFieldText(resources, da); - break; - case formChoice: - drawFormFieldChoice(resources, da); - break; - case formSignature: - //~unimp - break; - case formUndef: - default: - error(errSyntaxError, -1, "Unknown field type"); + const bool success = appearBuilder.drawFormField(field, form, resources, da, border, appearCharacs, rect, appearState, xref, addedDingbatsResource); + if (!success && da != form->getDefaultAppearance()) { + da = form->getDefaultAppearance(); + appearBuilder.drawFormField(field, form, resources, da, border, appearCharacs, rect, appearState, xref, addedDingbatsResource); } + const GooString *appearBuf = appearBuilder.buffer(); // build the appearance stream dictionary Dict *appearDict = new Dict(xref); appearDict->add(copyString("Length"), Object(appearBuf->getLength())); @@ -4885,12 +4898,9 @@ void AnnotWidget::generateFieldAppearance() { } // build the appearance stream - MemStream *appearStream = new MemStream(copyString(appearBuf->getCString()), 0, + Stream *appearStream = new AutoFreeMemStream(copyString(appearBuf->getCString()), 0, appearBuf->getLength(), Object(appearDict)); - appearance = Object(static_cast<Stream*>(appearStream)); - delete appearBuf; - - appearStream->setNeedFree(gTrue); + appearance = Object(appearStream); } void AnnotWidget::updateAppearanceStream() @@ -4907,7 +4917,9 @@ void AnnotWidget::updateAppearanceStream() return; // Create the new appearance - generateFieldAppearance(); + bool dummyAddDingbatsResource = false; // This is only update so if we didn't need to add + // the dingbats resource we should not need it now + generateFieldAppearance(&dummyAddDingbatsResource); // Fetch the appearance stream we've just created Object obj1 = appearance.fetch(xref); @@ -4938,14 +4950,14 @@ void AnnotWidget::draw(Gfx *gfx, GBool printing) { return; annotLocker(); - addDingbatsResource = gFalse; + bool addDingbatsResource = false; // Only construct the appearance stream when // - annot doesn't have an AP or // - NeedAppearances is true if (field) { if (appearance.isNull() || (form && form->getNeedAppearances())) - generateFieldAppearance(); + generateFieldAppearance(&addDingbatsResource); } // draw the appearance stream @@ -5039,7 +5051,7 @@ void AnnotMovie::draw(Gfx *gfx, GBool printing) { movie->getAspect(&width, &height); if (width != -1 && height != -1 && !poster.isNone()) { - appearBuf = new GooString (); + GooString *appearBuf = new GooString (); appearBuf->append ("q\n"); appearBuf->appendf ("{0:d} 0 0 {1:d} 0 0 cm\n", width, height); appearBuf->append ("/MImg Do\n"); @@ -5071,13 +5083,12 @@ void AnnotMovie::draw(Gfx *gfx, GBool printing) { formDict->set("Matrix", Object(matrix)); formDict->set("Resources", Object(resDict)); - MemStream *mStream = new MemStream(copyString(appearBuf->getCString()), 0, + Stream *mStream = new AutoFreeMemStream(copyString(appearBuf->getCString()), 0, appearBuf->getLength(), Object(formDict)); - mStream->setNeedFree(gTrue); delete appearBuf; Dict *dict = new Dict(gfx->getXRef()); - dict->set("FRM", Object(static_cast<Stream*>(mStream))); + dict->set("FRM", Object(mStream)); Dict *resDict2 = new Dict(gfx->getXRef()); resDict2->set("XObject", Object(dict)); @@ -5096,7 +5107,7 @@ void AnnotMovie::draw(Gfx *gfx, GBool printing) { bbox[0] = bbox[1] = 0; bbox[2] = width; bbox[3] = height; - appearance = createForm(bbox, gFalse, resDict2); + appearance = createForm(appearBuf, bbox, gFalse, resDict2); delete appearBuf; } } @@ -5327,19 +5338,19 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) { if (appearance.isNull()) { ca = opacity; - appearBuf = new GooString (); - appearBuf->append ("q\n"); + AnnotAppearanceBuilder appearBuilder; + appearBuilder.append ("q\n"); if (color) - setColor(color, gFalse); + appearBuilder.setDrawColor(color, gFalse); double borderWidth = border->getWidth(); - setLineStyleForBorder(border); + appearBuilder.setLineStyleForBorder(border); if (interiorColor) - setColor(interiorColor, gTrue); + appearBuilder.setDrawColor(interiorColor, gTrue); if (type == typeSquare) { - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} re\n", + appearBuilder.appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} re\n", borderWidth / 2.0, borderWidth / 2.0, (rect->x2 - rect->x1) - borderWidth, (rect->y2 - rect->y1) - borderWidth); @@ -5354,14 +5365,14 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) { x1 = b; y1 = height / 2.0; - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x1, y1); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", x1, y1); y1 += height / 4.0; x2 = width / 4.0; y2 = height - b; x3 = width / 2.0; y3 = y2; - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + appearBuilder.appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", x1, y1, x2, y2, x3, y3); x2 = width - b; y2 = y1; @@ -5369,7 +5380,7 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) { y1 = y3; x3 = x2; y3 = height / 2.0; - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + appearBuilder.appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", x1, y1, x2, y2, x3, y3); x2 = x1; @@ -5378,7 +5389,7 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) { y1 = height / 4.0; x3 = width / 2.0; y3 = b; - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + appearBuilder.appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", x1, y1, x2, y2, x3, y3); x2 = b; @@ -5387,32 +5398,30 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) { y1 = b; x3 = b; y3 = height / 2.0; - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + appearBuilder.appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", x1, y1, x2, y2, x3, y3); } if (interiorColor && interiorColor->getSpace() != AnnotColor::colorTransparent) - appearBuf->append ("b\n"); + appearBuilder.append ("b\n"); else - appearBuf->append ("S\n"); + appearBuilder.append ("S\n"); - appearBuf->append ("Q\n"); + appearBuilder.append ("Q\n"); double bbox[4]; bbox[0] = bbox[1] = 0; bbox[2] = rect->x2 - rect->x1; bbox[3] = rect->y2 - rect->y1; if (ca == 1) { - appearance = createForm(bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); } else { - Object aStream = createForm(bbox, gTrue, nullptr); - delete appearBuf; + Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); + GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, gFalse, resDict); } - delete appearBuf; } // draw the appearance stream @@ -5624,55 +5633,53 @@ void AnnotPolygon::draw(Gfx *gfx, GBool printing) { appearBBox = new AnnotAppearanceBBox(rect); ca = opacity; - appearBuf = new GooString (); - appearBuf->append ("q\n"); + AnnotAppearanceBuilder appearBuilder; + appearBuilder.append ("q\n"); if (color) { - setColor(color, gFalse); + appearBuilder.setDrawColor(color, gFalse); } - setLineStyleForBorder(border); + appearBuilder.setLineStyleForBorder(border); appearBBox->setBorderWidth(std::max(1., border->getWidth())); if (interiorColor) { - setColor(interiorColor, gTrue); + appearBuilder.setDrawColor(interiorColor, gTrue); } if (vertices->getCoordsLength() != 0) { - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", vertices->getX(0) - rect->x1, vertices->getY(0) - rect->y1); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", vertices->getX(0) - rect->x1, vertices->getY(0) - rect->y1); appearBBox->extendTo (vertices->getX(0) - rect->x1, vertices->getY(0) - rect->y1); for (int i = 1; i < vertices->getCoordsLength(); ++i) { - appearBuf->appendf ("{0:.2f} {1:.2f} l\n", vertices->getX(i) - rect->x1, vertices->getY(i) - rect->y1); + appearBuilder.appendf ("{0:.2f} {1:.2f} l\n", vertices->getX(i) - rect->x1, vertices->getY(i) - rect->y1); appearBBox->extendTo (vertices->getX(i) - rect->x1, vertices->getY(i) - rect->y1); } if (type == typePolygon) { if (interiorColor && interiorColor->getSpace() != AnnotColor::colorTransparent) { - appearBuf->append ("b\n"); + appearBuilder.append ("b\n"); } else { - appearBuf->append ("s\n"); + appearBuilder.append ("s\n"); } } else { - appearBuf->append ("S\n"); + appearBuilder.append ("S\n"); } } - appearBuf->append ("Q\n"); + appearBuilder.append ("Q\n"); double bbox[4]; appearBBox->getBBoxRect(bbox); if (ca == 1) { - appearance = createForm(bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); } else { - Object aStream = createForm(bbox, gTrue, nullptr); - delete appearBuf; + Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); + GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, gFalse, resDict); } - delete appearBuf; } // draw the appearance stream @@ -5842,46 +5849,44 @@ void AnnotInk::draw(Gfx *gfx, GBool printing) { appearBBox = new AnnotAppearanceBBox(rect); ca = opacity; - appearBuf = new GooString (); - appearBuf->append ("q\n"); + AnnotAppearanceBuilder appearBuilder; + appearBuilder.append ("q\n"); if (color) { - setColor(color, gFalse); + appearBuilder.setDrawColor(color, gFalse); } - setLineStyleForBorder(border); + appearBuilder.setLineStyleForBorder(border); appearBBox->setBorderWidth(std::max(1., border->getWidth())); for (int i = 0; i < inkListLength; ++i) { const AnnotPath * path = inkList[i]; if (path && path->getCoordsLength() != 0) { - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", path->getX(0) - rect->x1, path->getY(0) - rect->y1); + appearBuilder.appendf ("{0:.2f} {1:.2f} m\n", path->getX(0) - rect->x1, path->getY(0) - rect->y1); appearBBox->extendTo (path->getX(0) - rect->x1, path->getY(0) - rect->y1); for (int j = 1; j < path->getCoordsLength(); ++j) { - appearBuf->appendf ("{0:.2f} {1:.2f} l\n", path->getX(j) - rect->x1, path->getY(j) - rect->y1); + appearBuilder.appendf ("{0:.2f} {1:.2f} l\n", path->getX(j) - rect->x1, path->getY(j) - rect->y1); appearBBox->extendTo (path->getX(j) - rect->x1, path->getY(j) - rect->y1); } - appearBuf->append ("S\n"); + appearBuilder.append ("S\n"); } } - appearBuf->append ("Q\n"); + appearBuilder.append ("Q\n"); double bbox[4]; appearBBox->getBBoxRect(bbox); if (ca == 1) { - appearance = createForm(bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); } else { - Object aStream = createForm(bbox, gTrue, nullptr); - delete appearBuf; + Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); + GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, gFalse, resDict); } - delete appearBuf; } // draw the appearance stream @@ -6061,37 +6066,35 @@ void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) { if (appearance.isNull()) { ca = opacity; - appearBuf = new GooString (); + AnnotAppearanceBuilder appearBuilder; - appearBuf->append ("q\n"); + appearBuilder.append ("q\n"); if (color) - setColor(color, gTrue); + appearBuilder.setDrawColor(color, gTrue); else - appearBuf->append ("1 1 1 rg\n"); + appearBuilder.append ("1 1 1 rg\n"); if (!name->cmp("PushPin")) - appearBuf->append (ANNOT_FILE_ATTACHMENT_AP_PUSHPIN); + appearBuilder.append (ANNOT_FILE_ATTACHMENT_AP_PUSHPIN); else if (!name->cmp("Paperclip")) - appearBuf->append (ANNOT_FILE_ATTACHMENT_AP_PAPERCLIP); + appearBuilder.append (ANNOT_FILE_ATTACHMENT_AP_PAPERCLIP); else if (!name->cmp("Graph")) - appearBuf->append (ANNOT_FILE_ATTACHMENT_AP_GRAPH); + appearBuilder.append (ANNOT_FILE_ATTACHMENT_AP_GRAPH); else if (!name->cmp("Tag")) - appearBuf->append (ANNOT_FILE_ATTACHMENT_AP_TAG); - appearBuf->append ("Q\n"); + appearBuilder.append (ANNOT_FILE_ATTACHMENT_AP_TAG); + appearBuilder.append ("Q\n"); double bbox[4]; bbox[0] = bbox[1] = 0; bbox[2] = bbox[3] = 24; if (ca == 1) { - appearance = createForm (bbox, gFalse, nullptr); + appearance = createForm (appearBuilder.buffer(), bbox, gFalse, nullptr); } else { - Object aStream = createForm (bbox, gTrue, nullptr); - delete appearBuf; + Object aStream = createForm (appearBuilder.buffer(), bbox, gTrue, nullptr); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); + GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, gFalse, resDict); } - delete appearBuf; } // draw the appearance stream @@ -6216,33 +6219,31 @@ void AnnotSound::draw(Gfx *gfx, GBool printing) { if (appearance.isNull()) { ca = opacity; - appearBuf = new GooString (); + AnnotAppearanceBuilder appearBuilder; - appearBuf->append ("q\n"); + appearBuilder.append ("q\n"); if (color) - setColor(color, gTrue); + appearBuilder.setDrawColor(color, gTrue); else - appearBuf->append ("1 1 1 rg\n"); + appearBuilder.append ("1 1 1 rg\n"); if (!name->cmp("Speaker")) - appearBuf->append (ANNOT_SOUND_AP_SPEAKER); + appearBuilder.append (ANNOT_SOUND_AP_SPEAKER); else if (!name->cmp("Mic")) - appearBuf->append (ANNOT_SOUND_AP_MIC); - appearBuf->append ("Q\n"); + appearBuilder.append (ANNOT_SOUND_AP_MIC); + appearBuilder.append ("Q\n"); double bbox[4]; bbox[0] = bbox[1] = 0; bbox[2] = bbox[3] = 24; if (ca == 1) { - appearance = createForm(bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); } else { - Object aStream = createForm(bbox, gTrue, nullptr); - delete appearBuf; + Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); - appearBuf = new GooString ("/GS0 gs\n/Fm0 Do"); + GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, gFalse, resDict); } - delete appearBuf; } // draw the appearance stream @@ -6580,7 +6581,7 @@ AnnotRichMedia::Asset::~Asset() delete name; } -GooString* AnnotRichMedia::Asset::getName() const { +const GooString* AnnotRichMedia::Asset::getName() const { return name; } @@ -6679,7 +6680,7 @@ AnnotRichMedia::Instance* AnnotRichMedia::Configuration::getInstance(int index) return instances[index]; } -GooString* AnnotRichMedia::Configuration::getName() const { +const GooString* AnnotRichMedia::Configuration::getName() const { return name; } @@ -6740,7 +6741,7 @@ AnnotRichMedia::Params::~Params() delete flashVars; } -GooString* AnnotRichMedia::Params::getFlashVars() const { +const GooString* AnnotRichMedia::Params::getFlashVars() const { return flashVars; } @@ -6913,3 +6914,37 @@ Annots::~Annots() { } gfree(annots); } + + +//------------------------------------------------------------------------ +// AnnotAppearanceBuilder +//------------------------------------------------------------------------ + +AnnotAppearanceBuilder::AnnotAppearanceBuilder() + : appearBuf(new GooString()) +{ +} + +AnnotAppearanceBuilder::~AnnotAppearanceBuilder() +{ + delete appearBuf; +} + +void AnnotAppearanceBuilder::append(const char *text) +{ + appearBuf->append(text); +} + +void AnnotAppearanceBuilder::appendf(const char *fmt, ...) GOOSTRING_FORMAT +{ + va_list argList; + + va_start(argList, fmt); + appearBuf->appendfv(fmt, argList); + va_end(argList); +} + +const GooString *AnnotAppearanceBuilder::buffer() const +{ + return appearBuf; +} diff --git a/Build/source/libs/poppler/poppler-src/poppler/Annot.h b/Build/source/libs/poppler/poppler-src/poppler/Annot.h index 860d95e9a73..c1acc0658e2 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Annot.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Annot.h @@ -26,6 +26,7 @@ // Copyright (C) 2012, 2015 Tobias Koenig <tokoe@kdab.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -51,6 +52,8 @@ class PDFDoc; class Form; class FormWidget; class FormField; +class FormFieldButton; +class FormFieldText; class FormFieldChoice; class PDFRectangle; class Movie; @@ -444,14 +447,14 @@ public: AnnotAppearanceCharacs(const AnnotAppearanceCharacs &) = delete; AnnotAppearanceCharacs& operator=(const AnnotAppearanceCharacs &) = delete; - int getRotation() { return rotation; } - AnnotColor *getBorderColor() { return borderColor; } - AnnotColor *getBackColor() { return backColor; } - GooString *getNormalCaption() { return normalCaption; } - GooString *getRolloverCaption() { return rolloverCaption; } - GooString *getAlternateCaption() { return alternateCaption; } - AnnotIconFit *getIconFit() { return iconFit; } - AnnotAppearanceCharacsTextPos getPosition() { return position; } + int getRotation() const { return rotation; } + const AnnotColor *getBorderColor() const { return borderColor; } + const AnnotColor *getBackColor() const { return backColor; } + const GooString *getNormalCaption() const { return normalCaption; } + const GooString *getRolloverCaption() const { return rolloverCaption; } + const GooString *getAlternateCaption() const { return alternateCaption; } + const AnnotIconFit *getIconFit() const { return iconFit; } + AnnotAppearanceCharacsTextPos getPosition() const { return position; } protected: @@ -495,6 +498,49 @@ private: }; //------------------------------------------------------------------------ +// AnnotAppearanceBuilder +//------------------------------------------------------------------------ + +class AnnotAppearanceBuilder { +public: + AnnotAppearanceBuilder(); + ~AnnotAppearanceBuilder(); + + AnnotAppearanceBuilder(const AnnotAppearanceBuilder &) = delete; + AnnotAppearanceBuilder& operator=(const AnnotAppearanceBuilder &) = delete; + + void setDrawColor(const AnnotColor *color, GBool fill); + void setLineStyleForBorder(const AnnotBorder *border); + void drawCircle(double cx, double cy, double r, GBool fill); + void drawCircleTopLeft(double cx, double cy, double r); + void drawCircleBottomRight(double cx, double cy, double r); + void drawFieldBorder(const FormField *field, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect); + bool drawFormField(const FormField *field, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, const GooString *appearState, XRef *xref, bool *addedDingbatsResource); + + void writeString(const GooString &str); + + void append(const char *text); + void appendf(const char *fmt, ...) GOOSTRING_FORMAT; + + const GooString *buffer() const; + +private: + bool drawListBox(const FormFieldChoice *fieldChoice, const AnnotBorder *border, const PDFRectangle *rect, + const GooString *da, const GfxResources *resources, int quadding); + bool drawFormFieldButton(const FormFieldButton *field, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, const GooString *appearState, XRef *xref, bool *addedDingbatsResource); + bool drawFormFieldText(const FormFieldText *fieldText, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect); + bool drawFormFieldChoice(const FormFieldChoice *fieldChoice, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect); + bool drawText(const GooString *text, const GooString *da, const GfxResources *resources, + const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, + GBool multiline, int comb, int quadding, + GBool txField, GBool forceZapfDingbats, + XRef *xref, bool *addedDingbatsResource, // xref and addedDingbatsResource both must not be null if forceZapfDingbats is passed + GBool password); + + GooString *appearBuf; +}; + +//------------------------------------------------------------------------ // Annot //------------------------------------------------------------------------ @@ -617,13 +663,13 @@ public: AnnotSubtype getType() const { return type; } PDFRectangle *getRect() const { return rect; } void getRect(double *x1, double *y1, double *x2, double *y2) const; - GooString *getContents() const { return contents; } + const GooString *getContents() const { return contents; } int getPageNum() const { return page; } - GooString *getName() const { return name; } - GooString *getModified() const { return modified; } + const GooString *getName() const { return name; } + const GooString *getModified() const { return modified; } Guint getFlags() const { return flags; } AnnotAppearance *getAppearStreams() const { return appearStreams; } - GooString *getAppearState() const { return appearState; } + const GooString *getAppearState() const { return appearState; } AnnotBorder *getBorder() const { return border; } AnnotColor *getColor() const { return color; } int getTreeKey() const { return treeKey; } @@ -633,6 +679,10 @@ public: // Check if point is inside the annot rectangle. GBool inRect(double x, double y) const; + static void layoutText(const GooString *text, GooString *outBuf, int *i, const GfxFont *font, + double *width, double widthLimit, int *charCount, + GBool noReencode); + private: void readArrayNum(Object *pdfArray, int key, double *value); // write vStr[i:j[ in appearBuf @@ -644,16 +694,7 @@ private: protected: virtual ~Annot(); virtual void removeReferencedObjects(); // Called by Page::removeAnnot - void setColor(AnnotColor *color, GBool fill); - void setLineStyleForBorder(AnnotBorder *border); - void drawCircle(double cx, double cy, double r, GBool fill); - void drawCircleTopLeft(double cx, double cy, double r); - void drawCircleBottomRight(double cx, double cy, double r); - void layoutText(GooString *text, GooString *outBuf, int *i, GfxFont *font, - double *width, double widthLimit, int *charCount, - GBool noReencode); - void writeString(GooString *str, GooString *appearBuf); - Object createForm(double *bbox, GBool transparencyGroup, Dict *resDict); + Object createForm(const GooString *appearBuf, double *bbox, GBool transparencyGroup, Dict *resDict); Dict *createResourcesDict(const char *formName, Object &&formStream, const char *stateName, double opacity, const char *blendMode); GBool isVisible(GBool printing); @@ -691,7 +732,6 @@ protected: PDFDoc *doc; XRef *xref; // the xref table for this PDF file Ref ref; // object ref identifying this annotation - GooString *appearBuf; AnnotBorder *border; // Border, BS AnnotColor *color; // C double fontSize; @@ -742,13 +782,13 @@ public: ~AnnotMarkup(); // getters - GooString *getLabel() const { return label; } + const GooString *getLabel() const { return label; } AnnotPopup *getPopup() const { return popup; } double getOpacity() const { return opacity; } // getRC - GooString *getDate() const { return date; } + const GooString *getDate() const { return date; } int getInReplyToID() const { return inReplyTo.num; } - GooString *getSubject() const { return subject; } + const GooString *getSubject() const { return subject; } AnnotMarkupReplyType getReplyTo() const { return replyTo; } AnnotExternalDataType getExData() const { return exData; } @@ -805,7 +845,7 @@ public: // getters GBool getOpen() const { return open; } - GooString *getIcon() const { return icon; } + const GooString *getIcon() const { return icon; } AnnotTextState getState() const { return state; } void setOpen(GBool openA); @@ -836,7 +876,7 @@ class AnnotMovie: public Annot { void draw(Gfx *gfx, GBool printing) override; - GooString* getTitle() { return title; } + const GooString* getTitle() const { return title; } Movie* getMovie() { return movie; } private: @@ -858,7 +898,7 @@ class AnnotScreen: public Annot { AnnotScreen(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotScreen(); - GooString* getTitle() { return title; } + const GooString* getTitle() const { return title; } AnnotAppearanceCharacs *getAppearCharacs() { return appearCharacs; } LinkAction* getAction() { return action; } // The caller should now delete the result @@ -947,10 +987,10 @@ public: void setIntent(AnnotFreeTextIntent new_intent); // getters - GooString *getAppearanceString() const { return appearanceString; } + const GooString *getAppearanceString() const { return appearanceString; } AnnotFreeTextQuadding getQuadding() const { return quadding; } // return rc - GooString *getStyleString() const { return styleString; } + const GooString *getStyleString() const { return styleString; } AnnotCalloutLine *getCalloutLine() const { return calloutLine; } AnnotFreeTextIntent getIntent() const { return intent; } AnnotBorderEffect *getBorderEffect() const { return borderEffect; } @@ -1096,7 +1136,7 @@ public: void setIcon(GooString *new_icon); // getters - GooString *getIcon() const { return icon; } + const GooString *getIcon() const { return icon; } private: @@ -1266,7 +1306,7 @@ public: // getters Object *getFile() { return &file; } - GooString *getName() const { return name; } + const GooString *getName() const { return name; } private: @@ -1294,7 +1334,7 @@ public: // getters Sound *getSound() { return sound; } - GooString *getName() const { return name; } + const GooString *getName() const { return name; } private: @@ -1327,11 +1367,7 @@ public: void draw(Gfx *gfx, GBool printing) override; - void drawBorder(); - void drawFormFieldButton(GfxResources *resources, GooString *da); - void drawFormFieldText(GfxResources *resources, GooString *da); - void drawFormFieldChoice(GfxResources *resources, GooString *da); - void generateFieldAppearance (); + void generateFieldAppearance (bool *addDingbatsResource); void updateAppearanceStream (); AnnotWidgetHighlightMode getMode() { return mode; } @@ -1345,13 +1381,6 @@ private: void initialize(PDFDoc *docA, Dict *dict); - void drawText(GooString *text, GooString *da, GfxResources *resources, - GBool multiline, int comb, int quadding, - GBool txField, GBool forceZapfDingbats, - GBool password=false); - void drawListBox(FormFieldChoice *fieldChoice, - GooString *da, GfxResources *resources, int quadding); - Form *form; FormField *field; // FormField object for this annotation AnnotWidgetHighlightMode mode; // H (Default I) @@ -1361,7 +1390,6 @@ private: // inherited from Annot // AnnotBorderBS border; // BS Dict *parent; // Parent - GBool addDingbatsResource; Ref updatedAppearanceStream; // {-1,-1} if updateAppearanceStream has never been called }; @@ -1438,7 +1466,7 @@ public: Params(const Params &) = delete; Params& operator=(const Params &) = delete; - GooString* getFlashVars() const; + const GooString* getFlashVars() const; private: // optional @@ -1485,7 +1513,7 @@ public: Configuration& operator=(const Configuration &) = delete; Type getType() const; - GooString* getName() const; + const GooString* getName() const; int getInstancesCount() const; Instance* getInstance(int index) const; @@ -1507,7 +1535,7 @@ public: Asset(const Asset &) = delete; Asset& operator=(const Asset &) = delete; - GooString* getName() const; + const GooString* getName() const; Object* getFileSpec() const; private: diff --git a/Build/source/libs/poppler/poppler-src/poppler/CMap.cc b/Build/source/libs/poppler/poppler-src/poppler/CMap.cc index 45b4502eb79..01bff352a08 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/CMap.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/CMap.cc @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2008 Koji Otani <sho@bbr.jp> -// Copyright (C) 2008, 2009, 2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2008, 2009, 2017, 2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2013 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // @@ -478,7 +478,7 @@ GBool CMap::match(GooString *collectionA, GooString *cMapNameA) { return !collection->cmp(collectionA) && !cMapName->cmp(cMapNameA); } -CID CMap::getCID(char *s, int len, CharCode *c, int *nUsed) { +CID CMap::getCID(const char *s, int len, CharCode *c, int *nUsed) { CMapVectorEntry *vec; CharCode cc; int n, i; diff --git a/Build/source/libs/poppler/poppler-src/poppler/CMap.h b/Build/source/libs/poppler/poppler-src/poppler/CMap.h index d1a47e0744d..eb9893ac5b4 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/CMap.h +++ b/Build/source/libs/poppler/poppler-src/poppler/CMap.h @@ -89,7 +89,7 @@ public: // Return the CID corresponding to the character code starting at // <s>, which contains <len> bytes. Sets *<c> to the char code, and // *<nUsed> to the number of bytes used by the char code. - CID getCID(char *s, int len, CharCode *c, int *nUsed); + CID getCID(const char *s, int len, CharCode *c, int *nUsed); // Return the writing mode (0=horizontal, 1=vertical). int getWMode() { return wMode; } diff --git a/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc index f0c4b040ab1..18124b8f8ea 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc @@ -29,6 +29,7 @@ // Copyright (C) 2012 Patrick Pfeifer <p2000@mailinator.com> // Copyright (C) 2012, 2015, 2016 Jason Crain <jason@aquaticape.us> // Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -1379,7 +1380,7 @@ void CairoOutputDev::fillToStrokePathClip(GfxState *state) { cairo_restore (cairo); } -void CairoOutputDev::beginString(GfxState *state, GooString *s) +void CairoOutputDev::beginString(GfxState *state, const GooString *s) { int len = s->getLength(); @@ -1588,7 +1589,7 @@ void CairoOutputDev::endTextObject(GfxState *state) { } } -void CairoOutputDev::beginActualText(GfxState *state, GooString *text) +void CairoOutputDev::beginActualText(GfxState *state, const GooString *text) { if (this->text) actualText->begin(state, text); diff --git a/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.h index ffcb5151e55..6ee6f9e8ee3 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.h @@ -24,6 +24,7 @@ // Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // Copyright (C) 2016 Jason Crain <jason@aquaticape.us> // Copyright (C) 2018 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -191,13 +192,13 @@ public: void eoClip(GfxState *state) override; //----- text drawing - void beginString(GfxState *state, GooString *s) override; + void beginString(GfxState *state, const GooString *s) override; void endString(GfxState *state) override; void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, Unicode *u, int uLen) override; - void beginActualText(GfxState *state, GooString *text) override; + void beginActualText(GfxState *state, const GooString *text) override; void endActualText(GfxState *state) override; GBool beginType3Char(GfxState *state, double x, double y, diff --git a/Build/source/libs/poppler/poppler-src/poppler/Catalog.cc b/Build/source/libs/poppler/poppler-src/poppler/Catalog.cc index c423dea28f0..d259bda6b9c 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Catalog.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Catalog.cc @@ -33,6 +33,7 @@ // Copyright (C) 2014 Ed Porras <ed@moto-research.com> // Copyright (C) 2015 Even Rouault <even.rouault@spatialys.com> // Copyright (C) 2016 Masamichi Hosoda <trueroad@trueroad.jp> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -382,7 +383,7 @@ int Catalog::findPage(int num, int gen) { return 0; } -LinkDest *Catalog::findDest(GooString *name) { +LinkDest *Catalog::findDest(const GooString *name) { // try named destination dictionary then name tree if (getDests()->isDict()) { Object obj1 = getDests()->dictLookup(name->getCString()); @@ -684,7 +685,7 @@ int NameTree::Entry::cmp(const void *voidKey, const void *voidEntry) return key->cmp(&entry->name); } -Object NameTree::lookup(GooString *name) +Object NameTree::lookup(const GooString *name) { Entry **entry; diff --git a/Build/source/libs/poppler/poppler-src/poppler/Catalog.h b/Build/source/libs/poppler/poppler-src/poppler/Catalog.h index 4acb67fcf1d..0467159a2d4 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Catalog.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Catalog.h @@ -26,6 +26,7 @@ // Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 José Aliste <jaliste@src.gnome.org> // Copyright (C) 2016 Masamichi Hosoda <trueroad@trueroad.jp> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -73,7 +74,7 @@ public: NameTree& operator=(const NameTree &) = delete; void init(XRef *xref, Object *tree); - Object lookup(GooString *name); + Object lookup(const GooString *name); int numEntries() { return length; }; // iterator accessor, note it returns a pointer to the internal object, do not free nor delete it Object *getValue(int i); @@ -154,7 +155,7 @@ public: // Find a named destination. Returns the link destination, or // NULL if <name> is not a destination. - LinkDest *findDest(GooString *name); + LinkDest *findDest(const GooString *name); Object *getDests(); diff --git a/Build/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc b/Build/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc index 17df0292c69..7e0cd895ae8 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc @@ -25,6 +25,7 @@ // Copyright (C) 2014 Jiri Slaby <jirislaby@gmail.com> // Copyright (C) 2015 Marek Kasik <mkasik@redhat.com> // Copyright (C) 2017 Jean Ghali <jghali@libertysurf.fr> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -635,7 +636,7 @@ int CharCodeToUnicode::mapToUnicode(CharCode c, Unicode **u) { return 0; } -int CharCodeToUnicode::mapToCharCode(Unicode* u, CharCode *c, int usize) { +int CharCodeToUnicode::mapToCharCode(Unicode* u, CharCode *c, int usize) const { //look for charcode in map if (usize == 1 || (usize > 1 && !(*u & ~0xff))) { if (isIdentity) { diff --git a/Build/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h b/Build/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h index 13572217aed..02b92dcb55c 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h +++ b/Build/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h @@ -19,6 +19,7 @@ // Copyright (C) 2007 Koji Otani <sho@bbr.jp> // Copyright (C) 2008, 2011, 2012, 2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -96,7 +97,7 @@ public: int mapToUnicode(CharCode c, Unicode **u); // Map a Unicode to CharCode. - int mapToCharCode(Unicode* u, CharCode *c, int usize); + int mapToCharCode(Unicode* u, CharCode *c, int usize) const; // Return the mapping's length, i.e., one more than the max char // code supported by the mapping. diff --git a/Build/source/libs/poppler/poppler-src/poppler/DateInfo.cc b/Build/source/libs/poppler/poppler-src/poppler/DateInfo.cc index 532e0070f07..b2251004e8f 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/DateInfo.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/DateInfo.cc @@ -2,7 +2,7 @@ // // DateInfo.cc // -// Copyright (C) 2008 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2008, 2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2015 André Guerreiro <aguerreiro1985@gmail.com> // Copyright (C) 2015 André Esser <bepandre@hotmail.com> @@ -117,7 +117,7 @@ GooString *timeToDateString(time_t *timet) { } // Convert PDF date string to time. Returns -1 if conversion fails. -time_t dateStringToTime(GooString *dateString) { +time_t dateStringToTime(const GooString *dateString) { int year, mon, day, hour, min, sec, tz_hour, tz_minute; char tz; struct tm tm; diff --git a/Build/source/libs/poppler/poppler-src/poppler/DateInfo.h b/Build/source/libs/poppler/poppler-src/poppler/DateInfo.h index 468dd93bae6..90570d4248a 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/DateInfo.h +++ b/Build/source/libs/poppler/poppler-src/poppler/DateInfo.h @@ -2,7 +2,7 @@ // // DateInfo.h // -// Copyright (C) 2008 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2008, 2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2015 André Guerreiro <aguerreiro1985@gmail.com> // Copyright (C) 2015 André Esser <bepandre@hotmail.com> @@ -38,6 +38,6 @@ GooString *timeToDateString(time_t *timet); /* Convert PDF date string to time. * Returns -1 if conversion fails. */ -time_t dateStringToTime(GooString *dateString); +time_t dateStringToTime(const GooString *dateString); #endif diff --git a/Build/source/libs/poppler/poppler-src/poppler/FileSpec.cc b/Build/source/libs/poppler/poppler-src/poppler/FileSpec.cc index 89894e238dc..2628c363193 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/FileSpec.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/FileSpec.cc @@ -7,8 +7,9 @@ // // Copyright (C) 2008-2009 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> -// Copyright (C) 2012, 2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2012, 2017, 2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2012 Hib Eris <hib@hiberis.nl> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -27,7 +28,7 @@ #include "FileSpec.h" -EmbFile::EmbFile(Object *efStream) +EmbFile::EmbFile(const Object *efStream) { m_size = -1; m_createDate = nullptr; @@ -99,7 +100,7 @@ GBool EmbFile::save2(FILE *f) { return gTrue; } -FileSpec::FileSpec(Object *fileSpecA) +FileSpec::FileSpec(const Object *fileSpecA) { ok = gTrue; fileName = nullptr; @@ -171,7 +172,7 @@ GooString *FileSpec::getFileNameForPlatform() return platformFileName; } -Object getFileSpecName (Object *fileSpec) +Object getFileSpecName (const Object *fileSpec) { if (fileSpec->isString()) { return fileSpec->copy(); @@ -202,7 +203,7 @@ Object getFileSpecName (Object *fileSpec) return Object(); } -Object getFileSpecNameForPlatform (Object *fileSpec) +Object getFileSpecNameForPlatform (const Object *fileSpec) { if (fileSpec->isString()) { return fileSpec->copy(); @@ -234,7 +235,7 @@ Object getFileSpecNameForPlatform (Object *fileSpec) // system-dependent path manipulation #ifdef _WIN32 int i, j; - GooString *name = fileName.getString(); + GooString *name = fileName.getString()->copy(); // "//...." --> "\...." // "/x/...." --> "x:\...." // "/server/share/...." --> "\\server\share\...." @@ -274,6 +275,7 @@ Object getFileSpecNameForPlatform (Object *fileSpec) name->del(i); } } + fileName = Object(name); #endif /* _WIN32 */ return fileName; diff --git a/Build/source/libs/poppler/poppler-src/poppler/FileSpec.h b/Build/source/libs/poppler/poppler-src/poppler/FileSpec.h index 28394650543..f40f77054fb 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/FileSpec.h +++ b/Build/source/libs/poppler/poppler-src/poppler/FileSpec.h @@ -24,20 +24,20 @@ class EmbFile { public: - EmbFile(Object *efStream); + EmbFile(const Object *efStream); ~EmbFile(); EmbFile(const EmbFile &) = delete; EmbFile& operator=(const EmbFile &) = delete; - int size() { return m_size; } - GooString *modDate() { return m_modDate; } - GooString *createDate() { return m_createDate; } - GooString *checksum() { return m_checksum; } - GooString *mimeType() { return m_mimetype; } + int size() const { return m_size; } + const GooString *modDate() const { return m_modDate; } + const GooString *createDate() const { return m_createDate; } + const GooString *checksum() const { return m_checksum; } + const GooString *mimeType() const { return m_mimetype; } Object *streamObject() { return &m_objStr; } Stream *stream() { return isOk() ? m_objStr.getStream() : NULL; } - GBool isOk() { return m_objStr.isStream(); } + GBool isOk() const { return m_objStr.isStream(); } GBool save(const char *path); private: @@ -53,17 +53,17 @@ private: class FileSpec { public: - FileSpec(Object *fileSpec); + FileSpec(const Object *fileSpec); ~FileSpec(); FileSpec(const FileSpec &) = delete; FileSpec& operator=(const FileSpec &) = delete; - GBool isOk() { return ok; } + GBool isOk() const { return ok; } - GooString *getFileName() const { return fileName; } + const GooString *getFileName() const { return fileName; } GooString *getFileNameForPlatform(); - GooString *getDescription() const { return desc; } + const GooString *getDescription() const { return desc; } EmbFile *getEmbeddedFile(); private: @@ -78,7 +78,7 @@ private: GooString *desc; // Desc }; -Object getFileSpecName (Object *fileSpec); -Object getFileSpecNameForPlatform (Object *fileSpec); +Object getFileSpecName (const Object *fileSpec); +Object getFileSpecNameForPlatform (const Object *fileSpec); #endif /* FILE_SPEC_H */ diff --git a/Build/source/libs/poppler/poppler-src/poppler/FontInfo.cc b/Build/source/libs/poppler/poppler-src/poppler/FontInfo.cc index 15019eba55c..18f21f40aff 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/FontInfo.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/FontInfo.cc @@ -12,6 +12,7 @@ // Copyright (C) 2010, 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2011 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -153,7 +154,7 @@ void FontInfoScanner::scanFonts(XRef *xrefA, Dict *resDict, GooList *fontsList) } FontInfo::FontInfo(GfxFont *font, XRef *xref) { - GooString *origName; + const GooString *origName; fontRef = *font->getID(); diff --git a/Build/source/libs/poppler/poppler-src/poppler/Form.cc b/Build/source/libs/poppler/poppler-src/poppler/Form.cc index 11b16c9158b..2f5a48e127d 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Form.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Form.cc @@ -19,6 +19,9 @@ // Copyright 2015 André Esser <bepandre@hotmail.com> // Copyright 2017 Hans-Ulrich Jüttner <huj@froreich-bioscientia.de> // Copyright 2017 Bernd Kuhls <berndkuhls@hotmail.com> +// Copyright 2018 Andre Heinecke <aheinecke@intevation.de> +// Copyright 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich +// Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@protonmail.com> // //======================================================================== @@ -55,12 +58,12 @@ #include "Lexer.h" //return a newly allocated char* containing an UTF16BE string of size length -char* pdfDocEncodingToUTF16 (GooString* orig, int* length) +char* pdfDocEncodingToUTF16 (const GooString* orig, int* length) { //double size, a unicode char takes 2 char, add 2 for the unicode marker *length = 2+2*orig->getLength(); char *result = new char[(*length)]; - char *cstring = orig->getCString(); + const char *cstring = orig->getCString(); //unicode marker result[0] = (char)0xfe; result[1] = (char)0xff; @@ -135,6 +138,11 @@ bool FormWidget::isReadOnly() const return field->isReadOnly(); } +void FormWidget::setReadOnly(bool value) +{ + return field->setReadOnly(value); +} + int FormWidget::encodeID (unsigned pageNum, unsigned fieldNum) { return (pageNum << 4*sizeof(unsigned)) + fieldNum; @@ -146,7 +154,7 @@ void FormWidget::decodeID (unsigned id, unsigned* pageNum, unsigned* fieldNum) *fieldNum = (id << 4*sizeof(unsigned)) >> 4*sizeof(unsigned); } -GooString *FormWidget::getPartialName() const { +const GooString *FormWidget::getPartialName() const { return field->getPartialName(); } @@ -155,11 +163,11 @@ void FormWidget::setPartialName(const GooString &name) field->setPartialName(name); } -GooString *FormWidget::getAlternateUiName() const { +const GooString *FormWidget::getAlternateUiName() const { return field->getAlternateUiName(); } -GooString *FormWidget::getMappingName() const { +const GooString *FormWidget::getMappingName() const { return field->getMappingName(); } @@ -260,7 +268,7 @@ FormWidgetText::FormWidgetText (PDFDoc *docA, Object *aobj, unsigned num, Ref re type = formText; } -GooString* FormWidgetText::getContent () +const GooString* FormWidgetText::getContent () const { return parent()->getContent(); } @@ -346,7 +354,7 @@ FormWidgetChoice::~FormWidgetChoice() { } -bool FormWidgetChoice::_checkRange (int i) +bool FormWidgetChoice::_checkRange (int i) const { if (i < 0 || i >= parent()->getNumChoices()) { error(errInternal, -1, "FormWidgetChoice::_checkRange i out of range : {0:d}", i); @@ -372,7 +380,7 @@ void FormWidgetChoice::deselectAll () parent()->deselectAll(); } -GooString* FormWidgetChoice::getEditChoice () +const GooString* FormWidgetChoice::getEditChoice () const { if (!hasEdit()) { error(errInternal, -1, "FormFieldChoice::getEditChoice called on a non-editable choice\n"); @@ -387,7 +395,7 @@ void FormWidgetChoice::updateWidgetAppearance() widget->updateAppearanceStream(); } -bool FormWidgetChoice::isSelected (int i) +bool FormWidgetChoice::isSelected (int i) const { if (!_checkRange(i)) return false; return parent()->isSelected(i); @@ -403,12 +411,12 @@ void FormWidgetChoice::setEditChoice (GooString* new_content) parent()->setEditChoice(new_content); } -int FormWidgetChoice::getNumChoices() +int FormWidgetChoice::getNumChoices() const { return parent()->getNumChoices(); } -GooString* FormWidgetChoice::getChoice(int i) +const GooString* FormWidgetChoice::getChoice(int i) const { return parent()->getChoice(i); } @@ -454,6 +462,11 @@ FormWidgetSignature::FormWidgetSignature(PDFDoc *docA, Object *aobj, unsigned nu type = formSignature; } +const GooString *FormWidgetSignature::getSignature() const +{ + return static_cast<FormFieldSignature*>(field)->getSignature(); +} + SignatureInfo *FormWidgetSignature::validateSignature(bool doVerifyCert, bool forceRevalidation, time_t validationTime) { return static_cast<FormFieldSignature*>(field)->validateSignature(doVerifyCert, forceRevalidation, validationTime); @@ -847,7 +860,7 @@ FormWidget* FormField::findWidgetByRef (Ref aref) GooString* FormField::getFullyQualifiedName() { Object obj1; Object parent; - GooString *parent_name; + const GooString *parent_name; GooString *full_name; GBool unicode_encoded = gFalse; @@ -939,6 +952,32 @@ void FormField::updateChildrenAppearance() } } +void FormField::setReadOnly (bool value) +{ + if (value == readOnly) { + return; + } + + readOnly = value; + + Dict* dict = obj.getDict(); + + const Object obj1 = Form::fieldLookup(dict, "Ff"); + int flags = 0; + if (obj1.isInt()) { + flags = obj1.getInt(); + } + if (value) { + flags |= 1; + } else { + flags &= ~1; + } + + dict->set("Ff", Object(flags)); + xref->setModifiedObject(&obj, ref); + updateChildrenAppearance(); +} + //------------------------------------------------------------------------ // FormFieldButton //------------------------------------------------------------------------ @@ -1050,7 +1089,7 @@ GBool FormFieldButton::setState(char *state) if (!isOn && noAllOff) return gFalse; // Don't allow to set all radio to off - char *current = getAppearanceState(); + const char *current = getAppearanceState(); GBool currentFound = gFalse, newFound = gFalse; for (int i = 0; i < numChildren; i++) { @@ -1089,7 +1128,7 @@ GBool FormFieldButton::setState(char *state) return gTrue; } -GBool FormFieldButton::getState(char *state) { +GBool FormFieldButton::getState(const char *state) const { if (appearanceState.isName(state)) return gTrue; @@ -1241,7 +1280,7 @@ void FormFieldText::setTextFontSize(int fontSize) } } -int FormFieldText::tokenizeDA(GooString* da, GooList* daToks, const char* searchTok) +int FormFieldText::tokenizeDA(const GooString* da, GooList* daToks, const char* searchTok) { int idx = -1; if(da && daToks) { @@ -1271,7 +1310,7 @@ int FormFieldText::parseDA(GooList* daToks) if (obj.isDict()) { Object objDA(obj.dictLookup("DA")); if (objDA.isString()) { - GooString* da = objDA.getString(); + const GooString* da = objDA.getString(); idx = tokenizeDA(da, daToks, "Tf") - 1; } } @@ -1546,7 +1585,7 @@ void FormFieldChoice::setEditChoice (GooString* new_content) updateSelection(); } -GooString* FormFieldChoice::getEditChoice () +const GooString* FormFieldChoice::getEditChoice () const { return editedChoice; } @@ -1561,7 +1600,7 @@ int FormFieldChoice::getNumSelected () return cnt; } -GooString *FormFieldChoice::getSelectedChoice() { +const GooString *FormFieldChoice::getSelectedChoice() const { if (edit && editedChoice) return editedChoice; @@ -1614,7 +1653,7 @@ void FormFieldSignature::parseInfo() // retrieve SigningTime Object time_of_signing = sig_dict.dictLookup("M"); if (time_of_signing.isString()) { - GooString *time_str = time_of_signing.getString(); + const GooString *time_str = time_of_signing.getString(); signature_info->setSigningTime(dateStringToTime(time_str)); // Put this information directly in SignatureInfo object } diff --git a/Build/source/libs/poppler/poppler-src/poppler/Form.h b/Build/source/libs/poppler/poppler-src/poppler/Form.h index 297929b5d1c..bb93ac9047f 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Form.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Form.h @@ -15,6 +15,9 @@ // Copyright 2015 André Esser <bepandre@hotmail.com> // Copyright 2017 Roland Hieber <r.hieber@pengutronix.de> // Copyright 2017 Hans-Ulrich Jüttner <huj@froreich-bioscientia.de> +// Copyright 2018 Andre Heinecke <aheinecke@intevation.de> +// Copyright 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich +// Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@protonmail.com> // //======================================================================== @@ -110,15 +113,16 @@ public: double getFontSize() const; - GooString *getPartialName() const; + const GooString *getPartialName() const; void setPartialName(const GooString &name); - GooString *getAlternateUiName() const; - GooString *getMappingName() const; + const GooString *getAlternateUiName() const; + const GooString *getMappingName() const; GooString *getFullyQualifiedName(); GBool isModified () const; bool isReadOnly() const; + void setReadOnly(bool value); LinkAction *getActivationAction(); // The caller should not delete the result LinkAction *getAdditionalAction(Annot::FormAdditionalActionsType type); // The caller should delete the result @@ -193,7 +197,7 @@ class FormWidgetText: public FormWidget { public: FormWidgetText(PDFDoc *docA, Object *dict, unsigned num, Ref ref, FormField *p); //return the field's content (UTF16BE) - GooString* getContent() ; + const GooString* getContent() const; //return a copy of the field's content (UTF16BE) GooString* getContentCopy(); @@ -228,9 +232,9 @@ public: FormWidgetChoice(PDFDoc *docA, Object *dict, unsigned num, Ref ref, FormField *p); ~FormWidgetChoice(); - int getNumChoices(); + int getNumChoices() const; //return the display name of the i-th choice (UTF16BE) - GooString* getChoice(int i); + const GooString* getChoice(int i) const; //select the i-th choice void select (int i); @@ -244,10 +248,10 @@ public: //only work for editable combo box, set the user-entered text as the current choice void setEditChoice(GooString* new_content); - GooString* getEditChoice (); + const GooString* getEditChoice () const; void updateWidgetAppearance() override; - bool isSelected (int i); + bool isSelected (int i) const; bool isCombo () const; bool hasEdit () const; @@ -256,7 +260,7 @@ public: bool commitOnSelChange () const; bool isListBox () const; protected: - bool _checkRange (int i); + bool _checkRange (int i) const; FormFieldChoice *parent() const; }; @@ -281,6 +285,8 @@ public: // if the check passed (and the checked file size as output parameter in checkedFileSize) // otherwise a nullptr is returned GooString* getCheckedSignature(Goffset *checkedFileSize); + + const GooString *getSignature() const; }; //------------------------------------------------------------------------ @@ -297,11 +303,11 @@ public: virtual ~FormField(); // Accessors. - FormFieldType getType() { return type; } + FormFieldType getType() const { return type; } Object* getObj() { return &obj; } Ref getRef() { return ref; } - void setReadOnly (bool b) { readOnly = b; } + void setReadOnly (bool b); bool isReadOnly () const { return readOnly; } GooString* getDefaultAppearance() const { return defaultAppearance; } @@ -369,15 +375,15 @@ class FormFieldButton: public FormField { public: FormFieldButton(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents); - FormButtonType getButtonType () { return btype; } + FormButtonType getButtonType () const { return btype; } bool noToggleToOff () const { return noAllOff; } // returns gTrue if the state modification is accepted GBool setState (char *state); - GBool getState(char *state); + GBool getState(const char *state) const; - char *getAppearanceState() { return appearanceState.isName() ? appearanceState.getName() : NULL; } + const char *getAppearanceState() const { return appearanceState.isName() ? appearanceState.getName() : nullptr; } void fillChildrenSiblingsID () override; @@ -415,7 +421,7 @@ class FormFieldText: public FormField { public: FormFieldText(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents); - GooString* getContent () { return content; } + const GooString* getContent () const { return content; } GooString* getContentCopy (); void setContentCopy (GooString* new_content); ~FormFieldText(); @@ -439,7 +445,7 @@ public: void print(int indent = 0); #endif - static int tokenizeDA(GooString* daString, GooList* daToks, const char* searchTok); + static int tokenizeDA(const GooString* daString, GooList* daToks, const char* searchTok); protected: int parseDA(GooList* daToks); @@ -465,11 +471,11 @@ public: ~FormFieldChoice(); - int getNumChoices() { return numChoices; } - GooString* getChoice(int i) { return choices ? choices[i].optionName : NULL; } - GooString* getExportVal (int i) { return choices ? choices[i].exportVal : NULL; } + int getNumChoices() const { return numChoices; } + const GooString* getChoice(int i) const { return choices ? choices[i].optionName : NULL; } + const GooString* getExportVal (int i) const { return choices ? choices[i].exportVal : NULL; } // For multi-select choices it returns the first one - GooString* getSelectedChoice(); + const GooString* getSelectedChoice() const; //select the i-th choice void select (int i); @@ -483,9 +489,9 @@ public: //only work for editable combo box, set the user-entered text as the current choice void setEditChoice(GooString* new_content); - GooString* getEditChoice (); + const GooString* getEditChoice () const; - bool isSelected (int i) { return choices[i].selected; } + bool isSelected (int i) const { return choices[i].selected; } int getNumSelected (); @@ -538,7 +544,7 @@ public: ~FormFieldSignature(); Object* getByteRange() { return &byte_range; } - GooString* getSignature() { return signature; } + const GooString* getSignature() const { return signature; } private: void parseInfo(); diff --git a/Build/source/libs/poppler/poppler-src/poppler/Function.h b/Build/source/libs/poppler/poppler-src/poppler/Function.h index 65b532518c2..10adf7051c9 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Function.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Function.h @@ -240,7 +240,7 @@ public: void transform(double *in, double *out) override; GBool isOk() override { return ok; } - GooString *getCodeString() { return codeString; } + const GooString *getCodeString() const { return codeString; } private: diff --git a/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc b/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc index 4f6c33f8e50..08132072f88 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Gfx.cc @@ -38,7 +38,7 @@ // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2012 Lu Wang <coolwanglu@gmail.com> // Copyright (C) 2014 Jason Crain <jason@aquaticape.us> -// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich +// Copyright (C) 2017, 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -375,9 +375,10 @@ GfxResources::~GfxResources() { delete fonts; } -GfxFont *GfxResources::lookupFont(char *name) { +GfxFont *GfxResources::doLookupFont(const char *name) const +{ GfxFont *font; - GfxResources *resPtr; + const GfxResources *resPtr; for (resPtr = this; resPtr; resPtr = resPtr->next) { if (resPtr->fonts) { @@ -389,7 +390,15 @@ GfxFont *GfxResources::lookupFont(char *name) { return nullptr; } -Object GfxResources::lookupXObject(char *name) { +GfxFont *GfxResources::lookupFont(const char *name) { + return doLookupFont(name); +} + +const GfxFont *GfxResources::lookupFont(const char *name) const { + return doLookupFont(name); +} + +Object GfxResources::lookupXObject(const char *name) { GfxResources *resPtr; for (resPtr = this; resPtr; resPtr = resPtr->next) { @@ -403,7 +412,7 @@ Object GfxResources::lookupXObject(char *name) { return Object(objNull); } -Object GfxResources::lookupXObjectNF(char *name) { +Object GfxResources::lookupXObjectNF(const char *name) { GfxResources *resPtr; for (resPtr = this; resPtr; resPtr = resPtr->next) { @@ -417,7 +426,7 @@ Object GfxResources::lookupXObjectNF(char *name) { return Object(objNull); } -Object GfxResources::lookupMarkedContentNF(char *name) { +Object GfxResources::lookupMarkedContentNF(const char *name) { GfxResources *resPtr; for (resPtr = this; resPtr; resPtr = resPtr->next) { @@ -445,7 +454,7 @@ Object GfxResources::lookupColorSpace(const char *name) { return Object(objNull); } -GfxPattern *GfxResources::lookupPattern(char *name, OutputDev *out, GfxState *state) { +GfxPattern *GfxResources::lookupPattern(const char *name, OutputDev *out, GfxState *state) { GfxResources *resPtr; GfxPattern *pattern; @@ -468,7 +477,7 @@ GfxPattern *GfxResources::lookupPattern(char *name, OutputDev *out, GfxState *st return nullptr; } -GfxShading *GfxResources::lookupShading(char *name, OutputDev *out, GfxState *state) { +GfxShading *GfxResources::lookupShading(const char *name, OutputDev *out, GfxState *state) { GfxResources *resPtr; GfxShading *shading; @@ -485,7 +494,7 @@ GfxShading *GfxResources::lookupShading(char *name, OutputDev *out, GfxState *st return nullptr; } -Object GfxResources::lookupGState(char *name) { +Object GfxResources::lookupGState(const char *name) { Object obj = lookupGStateNF(name); if (obj.isNull()) return Object(objNull); @@ -502,7 +511,7 @@ Object GfxResources::lookupGState(char *name) { return obj; } -Object GfxResources::lookupGStateNF(char *name) { +Object GfxResources::lookupGStateNF(const char *name) { GfxResources *resPtr; for (resPtr = this; resPtr; resPtr = resPtr->next) { @@ -3870,7 +3879,7 @@ void Gfx::opShowSpaceText(Object args[], int numArgs) { } } -void Gfx::doShowText(GooString *s) { +void Gfx::doShowText(const GooString *s) { GfxFont *font; int wMode; double riseX, riseY; @@ -3884,7 +3893,7 @@ void Gfx::doShowText(GooString *s) { Dict *resDict; Parser *oldParser; GfxState *savedState; - char *p; + const char *p; int render; GBool patternFill; int len, n, uLen, nChars, nSpaces, i; @@ -4123,7 +4132,7 @@ void Gfx::doShowText(GooString *s) { } // NB: this is only called when ocState is false. -void Gfx::doIncCharCount(GooString *s) { +void Gfx::doIncCharCount(const GooString *s) { if (out->needCharCount()) { out->incCharCount(s->getLength()); } @@ -4134,7 +4143,7 @@ void Gfx::doIncCharCount(GooString *s) { //------------------------------------------------------------------------ void Gfx::opXObject(Object args[], int numArgs) { - char *name; + const char *name; if (!ocState && !out->needCharCount()) { return; @@ -5022,11 +5031,11 @@ void Gfx::opBeginMarkedContent(Object args[], int numArgs) { pushMarkedContent(); OCGs *contentConfig = catalog->getOptContentConfig(); - char* name0 = args[0].getName(); + const char* name0 = args[0].getName(); if ( strncmp( name0, "OC", 2) == 0 && contentConfig) { if ( numArgs >= 2 ) { if (args[1].isName()) { - char* name1 = args[1].getName(); + const char* name1 = args[1].getName(); MarkedContentStack *mc = mcStack; mc->kind = gfxMCOptionalContent; Object markedContent = res->lookupMarkedContentNF( name1 ); diff --git a/Build/source/libs/poppler/poppler-src/poppler/Gfx.h b/Build/source/libs/poppler/poppler-src/poppler/Gfx.h index 8e2f66ccfcb..2ea0d9faf15 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Gfx.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Gfx.h @@ -22,6 +22,7 @@ // Copyright (C) 2010 David Benjamin <davidben@mit.edu> // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2013 Fabio D'Urso <fabiodurso@hotmail.it> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -115,19 +116,21 @@ public: GfxResources(const GfxResources &) = delete; GfxResources& operator=(const GfxResources &other) = delete; - GfxFont *lookupFont(char *name); - Object lookupXObject(char *name); - Object lookupXObjectNF(char *name); - Object lookupMarkedContentNF(char *name); + GfxFont *lookupFont(const char *name); + const GfxFont *lookupFont(const char *name) const; + Object lookupXObject(const char *name); + Object lookupXObjectNF(const char *name); + Object lookupMarkedContentNF(const char *name); Object lookupColorSpace(const char *name); - GfxPattern *lookupPattern(char *name, OutputDev *out, GfxState *state); - GfxShading *lookupShading(char *name, OutputDev *out, GfxState *state); - Object lookupGState(char *name); - Object lookupGStateNF(char *name); + GfxPattern *lookupPattern(const char *name, OutputDev *out, GfxState *state); + GfxShading *lookupShading(const char *name, OutputDev *out, GfxState *state); + Object lookupGState(const char *name); + Object lookupGStateNF(const char *name); GfxResources *getNext() { return next; } private: + GfxFont *doLookupFont(const char *name) const; GfxFontDict *fonts; Object xObjDict; @@ -358,8 +361,8 @@ private: void opMoveShowText(Object args[], int numArgs); void opMoveSetShowText(Object args[], int numArgs); void opShowSpaceText(Object args[], int numArgs); - void doShowText(GooString *s); - void doIncCharCount(GooString *s); + void doShowText(const GooString *s); + void doIncCharCount(const GooString *s); // XObject operators void opXObject(Object args[], int numArgs); diff --git a/Build/source/libs/poppler/poppler-src/poppler/GfxFont.cc b/Build/source/libs/poppler/poppler-src/poppler/GfxFont.cc index df0328b5297..0ab78ad53a7 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/GfxFont.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/GfxFont.cc @@ -32,6 +32,7 @@ // Copyright (C) 2012, 2017 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013-2016, 2018 Jason Crain <jason@aquaticape.us> // Copyright (C) 2014 Olly Betts <olly@survex.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -870,7 +871,7 @@ const char *GfxFont::getAlternateName(const char *name) { // Parse character names of the form 'Axx', 'xx', 'Ann', 'ABnn', or // 'nn', where 'A' and 'B' are any letters, 'xx' is two hex digits, // and 'nn' is decimal digits. -static GBool parseNumericName(char *s, GBool hex, unsigned int *u) { +static GBool parseNumericName(const char *s, GBool hex, unsigned int *u) { char *endptr; // Strip leading alpha characters. @@ -1553,9 +1554,9 @@ static int parseCharName(char *charName, Unicode *uBuf, int uLen, return 0; } -int Gfx8BitFont::getNextChar(char *s, int len, CharCode *code, +int Gfx8BitFont::getNextChar(const char *s, int len, CharCode *code, Unicode **u, int *uLen, - double *dx, double *dy, double *ox, double *oy) { + double *dx, double *dy, double *ox, double *oy) const { CharCode c; *code = c = (CharCode)(*s & 0xff); @@ -1565,8 +1566,7 @@ int Gfx8BitFont::getNextChar(char *s, int len, CharCode *code, return 1; } -CharCodeToUnicode *Gfx8BitFont::getToUnicode() { - ctu->incRefCnt(); +const CharCodeToUnicode *Gfx8BitFont::getToUnicode() const { return ctu; } @@ -2051,9 +2051,9 @@ GfxCIDFont::~GfxCIDFont() { } } -int GfxCIDFont::getNextChar(char *s, int len, CharCode *code, +int GfxCIDFont::getNextChar(const char *s, int len, CharCode *code, Unicode **u, int *uLen, - double *dx, double *dy, double *ox, double *oy) { + double *dx, double *dy, double *ox, double *oy) const { CID cid; CharCode dummy; double w, h, vx, vy; @@ -2125,10 +2125,7 @@ int GfxCIDFont::getWMode() { return cMap ? cMap->getWMode() : 0; } -CharCodeToUnicode *GfxCIDFont::getToUnicode() { - if (ctu) { - ctu->incRefCnt(); - } +const CharCodeToUnicode *GfxCIDFont::getToUnicode() const { return ctu; } @@ -2324,7 +2321,7 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) { } else { error(errSyntaxError, -1, "Unknown character collection {0:t}\n", getCollection()); - if ((ctu = getToUnicode()) != nullptr) { + if (ctu) { CharCode cid; for (cid = 0;cid < n ;cid++) { Unicode *ucode; @@ -2337,7 +2334,6 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) { humap[cid*N_UCS_CANDIDATES+i] = 0; } } - ctu->decRefCnt(); } } // map CID -> Unicode -> GID @@ -2395,7 +2391,7 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) { return codeToGID; } -double GfxCIDFont::getWidth(CID cid) { +double GfxCIDFont::getWidth(CID cid) const { double w; int a, b, m; @@ -2419,7 +2415,7 @@ double GfxCIDFont::getWidth(CID cid) { return w; } -double GfxCIDFont::getWidth (char* s, int len) { +double GfxCIDFont::getWidth (char* s, int len) const { int nUsed; CharCode c; @@ -2482,7 +2478,7 @@ GfxFontDict::~GfxFontDict() { gfree(fonts); } -GfxFont *GfxFontDict::lookup(char *tag) { +GfxFont *GfxFontDict::lookup(const char *tag) { int i; for (i = 0; i < numFonts; ++i) { @@ -2506,7 +2502,7 @@ public: h *= 16777619; } - void hash(char *p, int n) { + void hash(const char *p, int n) { int i; for (i = 0; i < n; ++i) { hash(p[i]); @@ -2531,8 +2527,8 @@ int GfxFontDict::hashFontObject(Object *obj) { void GfxFontDict::hashFontObject1(Object *obj, FNVHash *h) { Object obj2; - GooString *s; - char *p; + const GooString *s; + const char *p; double r; int n, i; diff --git a/Build/source/libs/poppler/poppler-src/poppler/GfxFont.h b/Build/source/libs/poppler/poppler-src/poppler/GfxFont.h index c2d881e7b59..1ae0608b9bd 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/GfxFont.h +++ b/Build/source/libs/poppler/poppler-src/poppler/GfxFont.h @@ -23,6 +23,7 @@ // Copyright (C) 2011, 2012, 2014 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2015, 2018 Jason Crain <jason@aquaticape.us> // Copyright (C) 2015 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -189,30 +190,30 @@ public: void decRefCnt(); // Get font tag. - GooString *getTag() { return tag; } + const GooString *getTag() const { return tag; } // Get font dictionary ID. - Ref *getID() { return &id; } + const Ref *getID() const { return &id; } // Does this font match the tag? - GBool matches(char *tagA) { return !tag->cmp(tagA); } + GBool matches(const char *tagA) const { return !tag->cmp(tagA); } // Get font family name. GooString *getFamily() { return family; } // Get font stretch. - Stretch getStretch() { return stretch; } + Stretch getStretch() const { return stretch; } // Get font weight. - Weight getWeight() { return weight; } + Weight getWeight() const { return weight; } // Get the original font name (ignornig any munging that might have // been done to map to a canonical Base-14 font name). - GooString *getName() { return name; } + const GooString *getName() const { return name; } // Get font type. - GfxFontType getType() { return type; } - virtual GBool isCIDFont() { return gFalse; } + GfxFontType getType() const { return type; } + virtual GBool isCIDFont() const { return gFalse; } // Get embedded font ID, i.e., a ref for the font file stream. // Returns false if there is no embedded font. @@ -242,7 +243,7 @@ public: GBool isBold() { return flags & fontBold; } // Return the Unicode map. - virtual CharCodeToUnicode *getToUnicode() = 0; + virtual const CharCodeToUnicode *getToUnicode() const = 0; // Return the font matrix. double *getFontMatrix() { return fontMat; } @@ -273,9 +274,9 @@ public: // is the number of entries available in <u>, and <uLen> is set to // the number actually used. Returns the number of bytes used by // the char code. - virtual int getNextChar(char *s, int len, CharCode *code, + virtual int getNextChar(const char *s, int len, CharCode *code, Unicode **u, int *uLen, - double *dx, double *dy, double *ox, double *oy) = 0; + double *dx, double *dy, double *ox, double *oy) const = 0; // Does this font have a toUnicode map? GBool hasToUnicodeCMap() { return hasToUnicode; } @@ -329,15 +330,15 @@ public: Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, GfxFontType typeA, Ref embFontIDA, Dict *fontDict); - int getNextChar(char *s, int len, CharCode *code, + int getNextChar(const char *s, int len, CharCode *code, Unicode **u, int *uLen, - double *dx, double *dy, double *ox, double *oy) override; + double *dx, double *dy, double *ox, double *oy) const override; // Return the encoding. char **getEncoding() { return enc; } // Return the Unicode map. - CharCodeToUnicode *getToUnicode() override; + const CharCodeToUnicode *getToUnicode() const override; // Return the character name associated with <code>. char *getCharName(int code) { return enc[code]; } @@ -392,17 +393,17 @@ public: GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, GfxFontType typeA, Ref embFontIDA, Dict *fontDict); - GBool isCIDFont() override { return gTrue; } + GBool isCIDFont() const override { return gTrue; } - int getNextChar(char *s, int len, CharCode *code, + int getNextChar(const char *s, int len, CharCode *code, Unicode **u, int *uLen, - double *dx, double *dy, double *ox, double *oy) override; + double *dx, double *dy, double *ox, double *oy) const override; // Return the writing mode (0=horizontal, 1=vertical). int getWMode() override; // Return the Unicode map. - CharCodeToUnicode *getToUnicode() override; + const CharCodeToUnicode *getToUnicode() const override; // Get the collection name (<registry>-<ordering>). GooString *getCollection(); @@ -414,14 +415,14 @@ public: int *getCodeToGIDMap(FoFiTrueType *ff, int *length); - double getWidth(char* s, int len); + double getWidth(char* s, int len) const; private: ~GfxCIDFont(); int mapCodeToGID(FoFiTrueType *ff, int cmapi, Unicode unicode, GBool wmode); - double getWidth(CID cid); // Get width of a character. + double getWidth(CID cid) const; // Get width of a character. GooString *collection; // collection name CMap *cMap; // char code --> CID @@ -451,7 +452,7 @@ public: GfxFontDict& operator=(const GfxFontDict &) = delete; // Get the specified font. - GfxFont *lookup(char *tag); + GfxFont *lookup(const char *tag); // Iterative access. int getNumFonts() { return numFonts; } diff --git a/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc b/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc index 4cf8d8e32e0..5d7cc6baa24 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc @@ -30,6 +30,7 @@ // Copyright (C) 2015 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2016 Marek Kasik <mkasik@redhat.com> // Copyright (C) 2017 Oliver Sander <oliver.sander@tu-dresden.de> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -43,6 +44,7 @@ #endif #include <algorithm> +#include <memory> #include <stddef.h> #include <math.h> #include <string.h> @@ -2481,7 +2483,7 @@ GfxColorSpace *GfxIndexedColorSpace::parse(GfxResources *res, Array *arr, Output GfxColorSpace *baseA; int indexHighA; Object obj1; - char *s; + const char *s; int i, j; if (arr->getLength() != 4) { @@ -4914,10 +4916,17 @@ GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse(GfxResources *res, i } } delete bitBuf; - if (typeA == 5 && nVerticesA > 0) { + if (typeA == 5 && nVerticesA > 0 && vertsPerRow > 0) { nRows = nVerticesA / vertsPerRow; nTrianglesA = (nRows - 1) * 2 * (vertsPerRow - 1); - trianglesA = (int (*)[3])gmallocn(nTrianglesA * 3, sizeof(int)); + trianglesA = (int (*)[3])gmallocn_checkoverflow(nTrianglesA * 3, sizeof(int)); + if (unlikely(!trianglesA)) { + gfree(verticesA); + for (i = 0; i < nFuncsA; ++i) { + delete funcsA[i]; + } + return nullptr; + } k = 0; for (i = 0; i < nRows - 1; ++i) { for (j = 0; j < vertsPerRow - 1; ++j) { @@ -5100,7 +5109,6 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di Guint xi, yi; double c[4][gfxColorMaxComps]; Guint ci; - GfxShadingBitBuf *bitBuf; Object obj1; int i, j; @@ -5178,7 +5186,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di nPatchesA = 0; patchesA = nullptr; patchesSize = 0; - bitBuf = new GfxShadingBitBuf(str); + std::unique_ptr<GfxShadingBitBuf> bitBuf(new GfxShadingBitBuf(str)); while (1) { if (!bitBuf->getBits(flagBits, &flag)) { break; @@ -5274,6 +5282,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di break; case 1: if (nPatchesA == 0) { + gfree(patchesA); return nullptr; } p->x[0][0] = patchesA[nPatchesA-1].x[0][3]; @@ -5309,6 +5318,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di break; case 2: if (nPatchesA == 0) { + gfree(patchesA); return nullptr; } p->x[0][0] = patchesA[nPatchesA-1].x[3][3]; @@ -5344,6 +5354,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di break; case 3: if (nPatchesA == 0) { + gfree(patchesA); return nullptr; } p->x[0][0] = patchesA[nPatchesA-1].x[3][0]; @@ -5422,6 +5433,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di break; case 1: if (nPatchesA == 0) { + gfree(patchesA); return nullptr; } p->x[0][0] = patchesA[nPatchesA-1].x[0][3]; @@ -5465,6 +5477,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di break; case 2: if (nPatchesA == 0) { + gfree(patchesA); return nullptr; } p->x[0][0] = patchesA[nPatchesA-1].x[3][3]; @@ -5508,6 +5521,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di break; case 3: if (nPatchesA == 0) { + gfree(patchesA); return nullptr; } p->x[0][0] = patchesA[nPatchesA-1].x[3][0]; @@ -5554,7 +5568,6 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di ++nPatchesA; bitBuf->flushBits(); } - delete bitBuf; if (typeA == 6) { for (i = 0; i < nPatchesA; ++i) { diff --git a/Build/source/libs/poppler/poppler-src/poppler/GlobalParams.cc b/Build/source/libs/poppler/poppler-src/poppler/GlobalParams.cc index 50b7eee2b5a..cbb15eb18a8 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/GlobalParams.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/GlobalParams.cc @@ -37,6 +37,7 @@ // Copyright (C) 2013, 2014 Jason Crain <jason@aquaticape.us> // Copyright (C) 2017 Christoph Cullmann <cullmann@kde.org> // Copyright (C) 2017 Jean Ghali <jghali@libertysurf.fr> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -262,7 +263,7 @@ public: ~SysFontList(); SysFontList(const SysFontList &) = delete; SysFontList& operator=(const SysFontList &) = delete; - SysFontInfo *find(GooString *name, GBool isFixedWidth, GBool exact); + SysFontInfo *find(const GooString *name, GBool isFixedWidth, GBool exact); #ifdef _WIN32 void scanWindowsFonts(GooString *winFontDir); @@ -288,7 +289,7 @@ SysFontList::~SysFontList() { deleteGooList(fonts, SysFontInfo); } -SysFontInfo *SysFontList::find(GooString *name, GBool fixedWidth, GBool exact) { +SysFontInfo *SysFontList::find(const GooString *name, GBool fixedWidth, GBool exact) { GooString *name2; GBool bold, italic, oblique; SysFontInfo *fi; @@ -953,7 +954,7 @@ static const char *getFontLang(GfxFont *font) return lang; } -static FcPattern *buildFcPattern(GfxFont *font, GooString *base14Name) +static FcPattern *buildFcPattern(GfxFont *font, const GooString *base14Name) { int weight = -1, slant = -1, @@ -965,12 +966,13 @@ static FcPattern *buildFcPattern(GfxFont *font, GooString *base14Name) FcPattern *p; // this is all heuristics will be overwritten if font had proper info - name = (base14Name == nullptr) ? font->getName()->getCString() : base14Name->getCString(); - + GooString copiedNameGooString(((base14Name == nullptr) ? font->getName() : base14Name)->getCString()); + name = copiedNameGooString.getCString(); + modifiers = strchr (name, ','); if (modifiers == nullptr) modifiers = strchr (name, '-'); - + // remove the - from the names, for some reason, Fontconfig does not // understand "MS-Mincho" but does with "MS Mincho" int len = strlen(name); @@ -1106,7 +1108,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, SysFontInfo *fi = nullptr; FcPattern *p=nullptr; GooString *path = nullptr; - GooString *fontName = font->getName(); + const GooString *fontName = font->getName(); GooString substituteName; if (!fontName) return nullptr; lockGlobalParams; diff --git a/Build/source/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc b/Build/source/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc index 1734f6eb9a6..072d0fbbb1b 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc @@ -10,6 +10,7 @@ // Copyright (C) 2013 Dmytro Morgun <lztoad@gmail.com> // Copyright (C) 2017 Christoph Cullmann <cullmann@kde.org> // Copyright (C) 2017, 2018 Albert Astals Cid <aacid@kde.org> + // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich TODO: instead of a fixed mapping defined in displayFontTab, it could scan the whole fonts directory, parse TTF files and build font @@ -553,7 +554,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, GooString *base14Name) { SysFontInfo *fi; GooString *path = nullptr; - GooString *fontName = font->getName(); + const GooString *fontName = font->getName(); if (!fontName) return nullptr; lockGlobalParams; setupBaseFonts(nullptr); diff --git a/Build/source/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc b/Build/source/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc index 93793d16960..cb88b26d601 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc @@ -4,7 +4,7 @@ // // A JPX stream decoder using OpenJPEG // -// Copyright 2008-2010, 2012, 2017 Albert Astals Cid <aacid@kde.org> +// Copyright 2008-2010, 2012, 2017, 2018 Albert Astals Cid <aacid@kde.org> // Copyright 2011 Daniel Glöckner <daniel-gl@gmx.net> // Copyright 2014, 2016 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright 2013, 2014 Adrian Johnson <ajohnson@redneon.com> @@ -39,7 +39,6 @@ struct JPXStreamPrivate { int ccounter; int npixels; int ncomps; - GBool indexed; GBool inited; int smaskInData; void init2(OPJ_CODEC_FORMAT format, unsigned char *data, int length, GBool indexed); @@ -81,7 +80,6 @@ JPXStream::JPXStream(Stream *strA) : FilterStream(strA) { priv->image = nullptr; priv->npixels = 0; priv->ncomps = 0; - priv->indexed = gFalse; } JPXStream::~JPXStream() { @@ -223,9 +221,10 @@ void JPXStream::init() int bufSize = BUFFER_INITIAL_SIZE; if (oLen.isInt()) bufSize = oLen.getInt(); + GBool indexed = gFalse; if (cspace.isArray() && cspace.arrayGetLength() > 0) { - Object cstype = cspace.arrayGet(0); - if (cstype.isName("Indexed")) priv->indexed = gTrue; + const Object cstype = cspace.arrayGet(0); + if (cstype.isName("Indexed")) indexed = gTrue; } priv->smaskInData = 0; @@ -233,7 +232,7 @@ void JPXStream::init() int length = 0; unsigned char *buf = str->toUnsignedChars(&length, bufSize); - priv->init2(OPJ_CODEC_JP2, buf, length, priv->indexed); + priv->init2(OPJ_CODEC_JP2, buf, length, indexed); gfree(buf); if (priv->image) { @@ -264,7 +263,7 @@ void JPXStream::init() sgndcorr = 1 << (priv->image->comps[0].prec - 1); for (int i = 0; i < priv->npixels; i++) { int r = priv->image->comps[component].data[i]; - *(cdata++) = adjustComp(r, adjust, depth, sgndcorr, priv->indexed); + *(cdata++) = adjustComp(r, adjust, depth, sgndcorr, indexed); } } } else { diff --git a/Build/source/libs/poppler/poppler-src/poppler/Link.cc b/Build/source/libs/poppler/poppler-src/poppler/Link.cc index 326cfb97903..4a20752c1d4 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Link.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Link.cc @@ -16,10 +16,12 @@ // Copyright (C) 2006, 2008 Pino Toscano <pino@kde.org> // Copyright (C) 2007, 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2008 Hugo Mercier <hmercier31@gmail.com> -// Copyright (C) 2008-2010, 2012-2014, 2016, 2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2008-2010, 2012-2014, 2016-2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> // Copyright (C) 2009 Ilya Gorenbein <igorenbein@finjan.com> // Copyright (C) 2012 Tobias Koening <tobias.koenig@kdab.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich +// Copyright (C) 2018 Intevation GmbH <intevation@intevation.de> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -50,8 +52,14 @@ //------------------------------------------------------------------------ // LinkAction //------------------------------------------------------------------------ +LinkAction::LinkAction() : nextActionList(nullptr) { +} + +LinkAction::~LinkAction() { + delete nextActionList; +} -LinkAction *LinkAction::parseDest(Object *obj) { +LinkAction *LinkAction::parseDest(const Object *obj) { LinkAction *action; action = new LinkGoTo(obj); @@ -62,7 +70,14 @@ LinkAction *LinkAction::parseDest(Object *obj) { return action; } -LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { +LinkAction *LinkAction::parseAction(const Object *obj, const GooString *baseURI) +{ + std::set<int> seenNextActions; + return parseAction(obj, baseURI, &seenNextActions); +} + +LinkAction *LinkAction::parseAction(const Object *obj, const GooString *baseURI, + std::set<int> *seenNextActions) { LinkAction *action; if (!obj->isDict()) { @@ -119,6 +134,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { } else if (obj2.isName("SetOCGState")) { action = new LinkOCGState(obj); + // Hide action + } else if (obj2.isName("Hide")) { + action = new LinkHide(obj); + // unknown action } else if (obj2.isName()) { action = new LinkUnknown(obj2.getName()); @@ -134,14 +153,73 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { delete action; return nullptr; } + + if (!action) { + return nullptr; + } + + // parse the next actions + const Object nextObj = obj->dictLookup("Next"); + GooList *actionList = nullptr; + if (nextObj.isDict()) { + + // Prevent circles in the tree by checking the ref against used refs in + // our current tree branch. + const Object nextRefObj = obj->dictLookupNF("Next"); + if (nextRefObj.isRef()) { + const Ref ref = nextRefObj.getRef(); + if (!seenNextActions->insert(ref.num).second) { + error(errSyntaxWarning, -1, "parseAction: Circular next actions detected."); + return action; + } + } + + actionList = new GooList(1); + actionList->append(parseAction(&nextObj, nullptr, seenNextActions)); + } else if (nextObj.isArray()) { + const Array *a = nextObj.getArray(); + const int n = a->getLength(); + actionList = new GooList(n); + for (int i = 0; i < n; ++i) { + const Object obj3 = a->get(i); + if (!obj3.isDict()) { + error(errSyntaxWarning, -1, "parseAction: Next array does not contain only dicts"); + continue; + } + + // Similar circle check as above. + const Object obj3Ref = a->getNF(i); + if (obj3Ref.isRef()) { + const Ref ref = obj3Ref.getRef(); + if (!seenNextActions->insert(ref.num).second) { + error(errSyntaxWarning, -1, "parseAction: Circular next actions detected in array."); + return action; + } + } + + actionList->append(parseAction(&obj3, nullptr, seenNextActions)); + } + } + + action->setNextActions(actionList); + return action; } +const GooList *LinkAction::nextActions() const { + return nextActionList; +} + +void LinkAction::setNextActions(GooList *actions) { + delete nextActionList; + nextActionList = actions; +} + //------------------------------------------------------------------------ // LinkDest //------------------------------------------------------------------------ -LinkDest::LinkDest(Array *a) { +LinkDest::LinkDest(const Array *a) { // initialize fields left = bottom = right = top = zoom = 0; changeLeft = changeTop = changeZoom = gFalse; @@ -339,7 +417,7 @@ LinkDest::LinkDest(Array *a) { return; } -LinkDest::LinkDest(LinkDest *dest) { +LinkDest::LinkDest(const LinkDest *dest) { kind = dest->kind; pageIsRef = dest->pageIsRef; if (pageIsRef) @@ -361,7 +439,7 @@ LinkDest::LinkDest(LinkDest *dest) { // LinkGoTo //------------------------------------------------------------------------ -LinkGoTo::LinkGoTo(Object *destObj) { +LinkGoTo::LinkGoTo(const Object *destObj) { dest = nullptr; namedDest = nullptr; @@ -441,7 +519,7 @@ LinkGoToR::~LinkGoToR() { // LinkLaunch //------------------------------------------------------------------------ -LinkLaunch::LinkLaunch(Object *actionObj) { +LinkLaunch::LinkLaunch(const Object *actionObj) { fileName = nullptr; params = nullptr; @@ -489,8 +567,8 @@ LinkLaunch::~LinkLaunch() { // LinkURI //------------------------------------------------------------------------ -LinkURI::LinkURI(Object *uriObj, GooString *baseURI) { - GooString *uri2; +LinkURI::LinkURI(const Object *uriObj, const GooString *baseURI) { + const GooString *uri2; int n; char c; @@ -538,7 +616,7 @@ LinkURI::~LinkURI() { // LinkNamed //------------------------------------------------------------------------ -LinkNamed::LinkNamed(Object *nameObj) { +LinkNamed::LinkNamed(const Object *nameObj) { name = nullptr; if (nameObj->isName()) { name = new GooString(nameObj->getName()); @@ -555,7 +633,7 @@ LinkNamed::~LinkNamed() { // LinkMovie //------------------------------------------------------------------------ -LinkMovie::LinkMovie(Object *obj) { +LinkMovie::LinkMovie(const Object *obj) { annotRef.num = -1; annotTitle = nullptr; @@ -576,7 +654,7 @@ LinkMovie::LinkMovie(Object *obj) { tmp = obj->dictLookup("Operation"); if (tmp.isName()) { - char *name = tmp.getName(); + const char *name = tmp.getName(); if (!strcmp(name, "Play")) { operation = operationTypePlay; @@ -603,7 +681,7 @@ LinkMovie::~LinkMovie() { // LinkSound //------------------------------------------------------------------------ -LinkSound::LinkSound(Object *soundObj) { +LinkSound::LinkSound(const Object *soundObj) { volume = 1.0; sync = gFalse; repeat = gFalse; @@ -645,7 +723,7 @@ LinkSound::~LinkSound() { // LinkRendition //------------------------------------------------------------------------ -LinkRendition::LinkRendition(Object *obj) { +LinkRendition::LinkRendition(const Object *obj) { operation = NoRendition; media = nullptr; js = nullptr; @@ -742,7 +820,7 @@ LinkJavaScript::~LinkJavaScript() { //------------------------------------------------------------------------ // LinkOCGState //------------------------------------------------------------------------ -LinkOCGState::LinkOCGState(Object *obj) { +LinkOCGState::LinkOCGState(const Object *obj) { stateList = new GooList(); preserveRB = gTrue; @@ -756,7 +834,7 @@ LinkOCGState::LinkOCGState(Object *obj) { if (stList) stateList->append(stList); - char *name = obj2.getName(); + const char *name = obj2.getName(); stList = new StateList(); stList->list = new GooList(); if (!strcmp (name, "ON")) { @@ -810,10 +888,34 @@ LinkOCGState::StateList::~StateList() { } //------------------------------------------------------------------------ +// LinkHide +//------------------------------------------------------------------------ + +LinkHide::LinkHide(const Object *hideObj) { + targetName = nullptr; + show = false; // Default + + if (hideObj->isDict()) { + const Object targetObj = hideObj->dictLookup("T"); + if (targetObj.isString()) { + targetName = targetObj.getString()->copy(); + } + const Object shouldHide = hideObj->dictLookup("H"); + if (shouldHide.isBool()) { + show = !shouldHide.getBool(); + } + } +} + +LinkHide::~LinkHide() { + delete targetName; +} + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ -LinkUnknown::LinkUnknown(char *actionA) { +LinkUnknown::LinkUnknown(const char *actionA) { action = new GooString(actionA); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/Link.h b/Build/source/libs/poppler/poppler-src/poppler/Link.h index 05892cff43a..3dbe57fd2e0 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Link.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Link.h @@ -18,6 +18,8 @@ // Copyright (C) 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2012 Tobias Koening <tobias.koenig@kdab.com> // Copyright (C) 2018 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich +// Copyright (C) 2018 Intevation GmbH <intevation@intevation.de> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -32,6 +34,8 @@ #endif #include "Object.h" +#include <memory> +#include <set> class GooString; class GooList; @@ -57,30 +61,43 @@ enum LinkActionKind { actionSound, // sound action actionJavaScript, // JavaScript action actionOCGState, // Set-OCG-State action + actionHide, // Hide action actionUnknown // anything else }; class LinkAction { public: - LinkAction() = default; + LinkAction(); LinkAction(const LinkAction &) = delete; LinkAction& operator=(const LinkAction &other) = delete; // Destructor. - virtual ~LinkAction() {} + virtual ~LinkAction(); // Was the LinkAction created successfully? - virtual GBool isOk() = 0; + virtual GBool isOk() const = 0; // Check link action type. - virtual LinkActionKind getKind() = 0; + virtual LinkActionKind getKind() const = 0; // Parse a destination (old-style action) name, string, or array. - static LinkAction *parseDest(Object *obj); + static LinkAction *parseDest(const Object *obj); // Parse an action dictionary. - static LinkAction *parseAction(Object *obj, GooString *baseURI = NULL); + static LinkAction *parseAction(const Object *obj, const GooString *baseURI = nullptr); + + // A List of the next actions to execute in order. + // The list contains pointer to LinkAction objects. + const GooList *nextActions() const; + + // Sets the next action list. Takes ownership of the actions. + void setNextActions(GooList *actions); + +private: + static LinkAction *parseAction(const Object *obj, const GooString *baseURI, std::set<int> *seenNextActions); + + GooList *nextActionList; }; //------------------------------------------------------------------------ @@ -102,27 +119,27 @@ class LinkDest { public: // Build a LinkDest from the array. - LinkDest(Array *a); + LinkDest(const Array *a); // Copy a LinkDest. - LinkDest *copy() { return new LinkDest(this); } + LinkDest *copy() const { return new LinkDest(this); } // Was the LinkDest created successfully? - GBool isOk() { return ok; } + GBool isOk() const { return ok; } // Accessors. - LinkDestKind getKind() { return kind; } - GBool isPageRef() { return pageIsRef; } - int getPageNum() { return pageNum; } - Ref getPageRef() { return pageRef; } - double getLeft() { return left; } - double getBottom() { return bottom; } - double getRight() { return right; } - double getTop() { return top; } - double getZoom() { return zoom; } - GBool getChangeLeft() { return changeLeft; } - GBool getChangeTop() { return changeTop; } - GBool getChangeZoom() { return changeZoom; } + LinkDestKind getKind() const { return kind; } + GBool isPageRef() const { return pageIsRef; } + int getPageNum() const { return pageNum; } + Ref getPageRef() const { return pageRef; } + double getLeft() const { return left; } + double getBottom() const { return bottom; } + double getRight() const { return right; } + double getTop() const { return top; } + double getZoom() const { return zoom; } + GBool getChangeLeft() const { return changeLeft; } + GBool getChangeTop() const { return changeTop; } + GBool getChangeZoom() const { return changeZoom; } private: @@ -141,7 +158,7 @@ private: // destFitV/BV use changeLeft GBool ok; // set if created successfully - LinkDest(LinkDest *dest); + LinkDest(const LinkDest *dest); }; //------------------------------------------------------------------------ @@ -152,18 +169,18 @@ class LinkGoTo: public LinkAction { public: // Build a LinkGoTo from a destination (dictionary, name, or string). - LinkGoTo(Object *destObj); + LinkGoTo(const Object *destObj); // Destructor. ~LinkGoTo(); // Was the LinkGoTo created successfully? - GBool isOk() override { return dest || namedDest; } + GBool isOk() const override { return dest || namedDest; } // Accessors. - LinkActionKind getKind() override { return actionGoTo; } - LinkDest *getDest() { return dest; } - GooString *getNamedDest() { return namedDest; } + LinkActionKind getKind() const override { return actionGoTo; } + const LinkDest *getDest() const { return dest; } + const GooString *getNamedDest() const { return namedDest; } private: @@ -188,13 +205,13 @@ public: ~LinkGoToR(); // Was the LinkGoToR created successfully? - GBool isOk() override { return fileName && (dest || namedDest); } + GBool isOk() const override { return fileName && (dest || namedDest); } // Accessors. - LinkActionKind getKind() override { return actionGoToR; } - GooString *getFileName() { return fileName; } - LinkDest *getDest() { return dest; } - GooString *getNamedDest() { return namedDest; } + LinkActionKind getKind() const override { return actionGoToR; } + const GooString *getFileName() const { return fileName; } + const LinkDest *getDest() const { return dest; } + const GooString *getNamedDest() const { return namedDest; } private: @@ -213,18 +230,18 @@ class LinkLaunch: public LinkAction { public: // Build a LinkLaunch from an action dictionary. - LinkLaunch(Object *actionObj); + LinkLaunch(const Object *actionObj); // Destructor. ~LinkLaunch(); // Was the LinkLaunch created successfully? - GBool isOk() override { return fileName != NULL; } + GBool isOk() const override { return fileName != NULL; } // Accessors. - LinkActionKind getKind() override { return actionLaunch; } - GooString *getFileName() { return fileName; } - GooString *getParams() { return params; } + LinkActionKind getKind() const override { return actionLaunch; } + const GooString *getFileName() const { return fileName; } + const GooString *getParams() const { return params; } private: @@ -240,17 +257,17 @@ class LinkURI: public LinkAction { public: // Build a LinkURI given the URI (string) and base URI. - LinkURI(Object *uriObj, GooString *baseURI); + LinkURI(const Object *uriObj, const GooString *baseURI); // Destructor. ~LinkURI(); // Was the LinkURI created successfully? - GBool isOk() override { return uri != NULL; } + GBool isOk() const override { return uri != NULL; } // Accessors. - LinkActionKind getKind() override { return actionURI; } - GooString *getURI() { return uri; } + LinkActionKind getKind() const override { return actionURI; } + const GooString *getURI() const { return uri; } private: @@ -265,14 +282,14 @@ class LinkNamed: public LinkAction { public: // Build a LinkNamed given the action name. - LinkNamed(Object *nameObj); + LinkNamed(const Object *nameObj); ~LinkNamed(); - GBool isOk() override { return name != NULL; } + GBool isOk() const override { return name != NULL; } - LinkActionKind getKind() override { return actionNamed; } - GooString *getName() { return name; } + LinkActionKind getKind() const override { return actionNamed; } + const GooString *getName() const { return name; } private: @@ -294,21 +311,21 @@ public: operationTypeStop }; - LinkMovie(Object *obj); + LinkMovie(const Object *obj); ~LinkMovie(); - GBool isOk() override { return annotRef.num >= 0 || annotTitle != NULL; } - LinkActionKind getKind() override { return actionMovie; } + GBool isOk() const override { return annotRef.num >= 0 || annotTitle != NULL; } + LinkActionKind getKind() const override { return actionMovie; } // a movie action stores either an indirect reference to a movie annotation // or the movie annotation title - GBool hasAnnotRef() { return annotRef.num >= 0; } - GBool hasAnnotTitle() { return annotTitle != NULL; } - Ref *getAnnotRef() { return &annotRef; } - GooString *getAnnotTitle() { return annotTitle; } + GBool hasAnnotRef() const { return annotRef.num >= 0; } + GBool hasAnnotTitle() const { return annotTitle != NULL; } + const Ref *getAnnotRef() const { return &annotRef; } + const GooString *getAnnotTitle() const { return annotTitle; } - OperationType getOperation() { return operation; } + OperationType getOperation() const { return operation; } private: @@ -336,25 +353,25 @@ public: ResumeRendition }; - LinkRendition(Object *Obj); + LinkRendition(const Object *Obj); ~LinkRendition(); - GBool isOk() override { return true; } + GBool isOk() const override { return true; } - LinkActionKind getKind() override { return actionRendition; } + LinkActionKind getKind() const override { return actionRendition; } - GBool hasRenditionObject() { return renditionObj.isDict(); } - Object* getRenditionObject() { return &renditionObj; } + GBool hasRenditionObject() const { return renditionObj.isDict(); } + const Object* getRenditionObject() const { return &renditionObj; } - GBool hasScreenAnnot() { return screenRef.isRef(); } - Ref getScreenAnnot() { return screenRef.getRef(); } + GBool hasScreenAnnot() const { return screenRef.isRef(); } + Ref getScreenAnnot() const { return screenRef.getRef(); } - RenditionOperation getOperation() { return operation; } + RenditionOperation getOperation() const { return operation; } - MediaRendition* getMedia() { return media; } + const MediaRendition* getMedia() const { return media; } - GooString *getScript() { return js; } + const GooString *getScript() const { return js; } private: @@ -374,19 +391,19 @@ private: class LinkSound: public LinkAction { public: - LinkSound(Object *soundObj); + LinkSound(const Object *soundObj); ~LinkSound(); - GBool isOk() override { return sound != NULL; } + GBool isOk() const override { return sound != NULL; } - LinkActionKind getKind() override { return actionSound; } + LinkActionKind getKind() const override { return actionSound; } - double getVolume() { return volume; } - GBool getSynchronous() { return sync; } - GBool getRepeat() { return repeat; } - GBool getMix() { return mix; } - Sound *getSound() { return sound; } + double getVolume() const { return volume; } + GBool getSynchronous() const { return sync; } + GBool getRepeat() const { return repeat; } + GBool getMix() const { return mix; } + Sound *getSound() const { return sound; } private: @@ -409,10 +426,10 @@ public: ~LinkJavaScript(); - GBool isOk() override { return js != NULL; } + GBool isOk() const override { return js != NULL; } - LinkActionKind getKind() override { return actionJavaScript; } - GooString *getScript() { return js; } + LinkActionKind getKind() const override { return actionJavaScript; } + const GooString *getScript() const { return js; } private: @@ -424,13 +441,13 @@ private: //------------------------------------------------------------------------ class LinkOCGState: public LinkAction { public: - LinkOCGState(Object *obj); + LinkOCGState(const Object *obj); ~LinkOCGState(); - GBool isOk() override { return stateList != NULL; } + GBool isOk() const override { return stateList != NULL; } - LinkActionKind getKind() override { return actionOCGState; } + LinkActionKind getKind() const override { return actionOCGState; } enum State { On, Off, Toggle}; struct StateList { @@ -442,8 +459,8 @@ public: GooList *list; }; - GooList *getStateList() { return stateList; } - GBool getPreserveRB() { return preserveRB; } + const GooList *getStateList() const { return stateList; } + GBool getPreserveRB() const { return preserveRB; } private: GooList *stateList; @@ -451,6 +468,39 @@ private: }; //------------------------------------------------------------------------ +// LinkHide +//------------------------------------------------------------------------ + +class LinkHide: public LinkAction { +public: + LinkHide(const Object *hideObj); + + ~LinkHide(); + + GBool isOk() const override { return targetName != nullptr; } + LinkActionKind getKind() const override { return actionHide; } + + // According to spec the target can be either: + // a) A text string containing the fully qualified name of the target + // field. + // b) An indirect reference to an annotation dictionary. + // c) An array of "such dictionaries or text strings". + // + // While b / c appear to be very uncommon and can't easily be + // created with Adobe Acrobat DC. So only support hide + // actions with named targets (yet). + GBool hasTargetName() const { return targetName != nullptr; } + const GooString *getTargetName() const { return targetName; } + + // Should this action show or hide. + GBool isShowAction() const { return show; } + +private: + GooString *targetName; + GBool show; +}; + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ @@ -458,17 +508,17 @@ class LinkUnknown: public LinkAction { public: // Build a LinkUnknown with the specified action type. - LinkUnknown(char *actionA); + LinkUnknown(const char *actionA); // Destructor. ~LinkUnknown(); // Was the LinkUnknown create successfully? - GBool isOk() override { return action != NULL; } + GBool isOk() const override { return action != NULL; } // Accessors. - LinkActionKind getKind() override { return actionUnknown; } - GooString *getAction() { return action; } + LinkActionKind getKind() const override { return actionUnknown; } + const GooString *getAction() const { return action; } private: diff --git a/Build/source/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.cc index 4920ad32526..ddaa2d80a2e 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.cc @@ -69,7 +69,7 @@ void MarkedContentOutputDev::endPage() } -void MarkedContentOutputDev::beginMarkedContent(char *name, Dict *properties) +void MarkedContentOutputDev::beginMarkedContent(const char *name, Dict *properties) { int id = -1; if (properties) diff --git a/Build/source/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.h index e2b69aede5a..a1b1178cd95 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.h @@ -109,7 +109,7 @@ public: CharCode c, int nBytes, Unicode *u, int uLen) override; - void beginMarkedContent(char *name, Dict *properties) override; + void beginMarkedContent(const char *name, Dict *properties) override; void endMarkedContent(GfxState *state) override; const TextSpanArray& getTextSpans() const; diff --git a/Build/source/libs/poppler/poppler-src/poppler/Movie.cc b/Build/source/libs/poppler/poppler-src/poppler/Movie.cc index 3cc922ff378..82d7f3f5452 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Movie.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Movie.cc @@ -6,7 +6,7 @@ // Hugo Mercier <hmercier31[at]gmail.com> (c) 2008 // Pino Toscano <pino@kde.org> (c) 2008 // Carlos Garcia Campos <carlosgc@gnome.org> (c) 2010 -// Albert Astals Cid <aacid@kde.org> (c) 2010, 2017 +// Albert Astals Cid <aacid@kde.org> (c) 2010, 2017, 2018 // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ MovieActivationParameters::MovieActivationParameters() { MovieActivationParameters::~MovieActivationParameters() { } -void MovieActivationParameters::parseMovieActivation(Object* aDict) { +void MovieActivationParameters::parseMovieActivation(const Object* aDict) { Object obj1 = aDict->dictLookup("Start"); if (obj1.isNull()) { if (obj1.isInt()) { @@ -125,7 +125,7 @@ void MovieActivationParameters::parseMovieActivation(Object* aDict) { obj1 = aDict->dictLookup("Mode"); if (obj1.isName()) { - char* name = obj1.getName(); + const char* name = obj1.getName(); if (!strcmp(name, "Once")) { repeatMode = repeatModeOnce; } else if (!strcmp(name, "Open")) { @@ -172,7 +172,7 @@ void MovieActivationParameters::parseMovieActivation(Object* aDict) { } } -void Movie::parseMovie (Object *movieDict) { +void Movie::parseMovie (const Object *movieDict) { fileName = nullptr; rotationAngle = 0; width = -1; @@ -230,7 +230,7 @@ Movie::~Movie() { delete fileName; } -Movie::Movie(Object *movieDict) { +Movie::Movie(const Object *movieDict) { ok = gTrue; if (movieDict->isDict()) @@ -239,7 +239,7 @@ Movie::Movie(Object *movieDict) { ok = gFalse; } -Movie::Movie(Object *movieDict, Object *aDict) { +Movie::Movie(const Object *movieDict, const Object *aDict) { ok = gTrue; if (movieDict->isDict()) { @@ -274,6 +274,6 @@ void Movie::getFloatingWindowSize(int *widthA, int *heightA) *heightA = int(height * double(MA.znum) / MA.zdenum); } -Movie* Movie::copy() { +Movie* Movie::copy() const { return new Movie(*this); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/Movie.h b/Build/source/libs/poppler/poppler-src/poppler/Movie.h index 65379167da1..5c7f79136c5 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Movie.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Movie.h @@ -33,7 +33,7 @@ struct MovieActivationParameters { ~MovieActivationParameters(); // parse from a "Movie Activation" dictionary - void parseMovieActivation(Object* actObj); + void parseMovieActivation(const Object* actObj); enum MovieRepeatMode { repeatModeOnce, @@ -70,30 +70,30 @@ struct MovieActivationParameters { class Movie { public: - Movie(Object *objMovie, Object *objAct); - Movie(Object *objMovie); + Movie(const Object *objMovie, const Object *objAct); + Movie(const Object *objMovie); Movie(const Movie &movie); ~Movie(); Movie& operator=(const Movie &) = delete; - GBool isOk() { return ok; } - MovieActivationParameters* getActivationParameters() { return &MA; } + GBool isOk() const { return ok; } + const MovieActivationParameters* getActivationParameters() const { return &MA; } - GooString* getFileName() { return fileName; } + const GooString* getFileName() const { return fileName; } - Gushort getRotationAngle() { return rotationAngle; } - void getAspect (int *widthA, int *heightA) { *widthA = width; *heightA = height; } + Gushort getRotationAngle() const { return rotationAngle; } + void getAspect (int *widthA, int *heightA) const { *widthA = width; *heightA = height; } - Object getPoster() { return poster.copy(); } - GBool getShowPoster() { return showPoster; } + Object getPoster() const { return poster.copy(); } + GBool getShowPoster() const { return showPoster; } - GBool getUseFloatingWindow() { return MA.floatingWindow; } + GBool getUseFloatingWindow() const { return MA.floatingWindow; } void getFloatingWindowSize(int *width, int *height); - Movie* copy(); + Movie* copy() const ; private: - void parseMovie (Object *movieDict); + void parseMovie (const Object *movieDict); GBool ok; diff --git a/Build/source/libs/poppler/poppler-src/poppler/Object.h b/Build/source/libs/poppler/poppler-src/poppler/Object.h index 87f1b24adc0..97978f46528 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Object.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Object.h @@ -22,6 +22,7 @@ // Copyright (C) 2013, 2017, 2018 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com> // Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -236,12 +237,12 @@ public: } return type == objInt ? (double)intg : type == objInt64 ? (double)int64g : real; } - GooString *getString() const { OBJECT_TYPE_CHECK(objString); return string; } + const GooString *getString() const { OBJECT_TYPE_CHECK(objString); return string; } // After takeString() the only method that should be called for the object is free() // because the object it's not expected to have a NULL string. GooString *takeString() { OBJECT_TYPE_CHECK(objString); GooString *s = string; string = nullptr; return s; } - char *getName() const { OBJECT_TYPE_CHECK(objName); return cString; } + const char *getName() const { OBJECT_TYPE_CHECK(objName); return cString; } Array *getArray() const { OBJECT_TYPE_CHECK(objArray); return array; } Dict *getDict() const { OBJECT_TYPE_CHECK(objDict); return dict; } Stream *getStream() const { OBJECT_TYPE_CHECK(objStream); return stream; } diff --git a/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.cc b/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.cc index b42ae56f879..8376a0e4e4f 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.cc @@ -5,7 +5,7 @@ // Copyright 2007 Brad Hards <bradh@kde.org> // Copyright 2008 Pino Toscano <pino@kde.org> // Copyright 2008, 2010 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright 2008, 2010, 2011, 2017 Albert Astals Cid <aacid@kde.org> +// Copyright 2008, 2010, 2011, 2017, 2018 Albert Astals Cid <aacid@kde.org> // Copyright 2008 Mark Kaplan <mkaplan@finjan.com> // // Released under the GPL (version 2, or later, at your option) @@ -133,7 +133,7 @@ OCGs::~OCGs() } -bool OCGs::hasOCGs() +bool OCGs::hasOCGs() const { return ( optionalContentGroups->getLength() > 0 ); } @@ -374,7 +374,7 @@ OptionalContentGroup::OptionalContentGroup(GooString *label) m_state = On; } -GooString* OptionalContentGroup::getName() const +const GooString* OptionalContentGroup::getName() const { return m_name; } @@ -447,7 +447,7 @@ OCDisplayNode::OCDisplayNode() { children = nullptr; } -OCDisplayNode::OCDisplayNode(GooString *nameA) { +OCDisplayNode::OCDisplayNode(const GooString *nameA) { name = new GooString(nameA); ocg = nullptr; children = nullptr; @@ -489,13 +489,13 @@ OCDisplayNode::~OCDisplayNode() { } } -int OCDisplayNode::getNumChildren() { +int OCDisplayNode::getNumChildren() const { if (!children) { return 0; } return children->getLength(); } -OCDisplayNode *OCDisplayNode::getChild(int idx) { +OCDisplayNode *OCDisplayNode::getChild(int idx) const { return (OCDisplayNode *)children->get(idx); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.h b/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.h index a8c05b30f85..ea5618e4374 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.h +++ b/Build/source/libs/poppler/poppler-src/poppler/OptionalContent.h @@ -39,9 +39,9 @@ public: OCGs& operator=(const OCGs &) = delete; // Is OCGS valid? - GBool isOk() { return ok; } + GBool isOk() const { return ok; } - bool hasOCGs(); + bool hasOCGs() const; GooList *getOCGs() const { return optionalContentGroups; } OptionalContentGroup* findOcgByRef( const Ref &ref); @@ -96,7 +96,7 @@ public: OptionalContentGroup(const OptionalContentGroup &) = delete; OptionalContentGroup& operator=(const OptionalContentGroup &) = delete; - GooString* getName() const; + const GooString* getName() const; Ref getRef() const; void setRef(const Ref ref); @@ -127,14 +127,14 @@ public: OCDisplayNode(const OCDisplayNode &) = delete; OCDisplayNode& operator=(const OCDisplayNode &) = delete; - GooString *getName() { return name; } - OptionalContentGroup *getOCG() { return ocg; } - int getNumChildren(); - OCDisplayNode *getChild(int idx); + const GooString *getName() const { return name; } + const OptionalContentGroup *getOCG() const { return ocg; } + int getNumChildren() const; + OCDisplayNode *getChild(int idx) const; private: - OCDisplayNode(GooString *nameA); + OCDisplayNode(const GooString *nameA); OCDisplayNode(OptionalContentGroup *ocgA); void addChild(OCDisplayNode *child); void addChildren(GooList *childrenA); diff --git a/Build/source/libs/poppler/poppler-src/poppler/Outline.cc b/Build/source/libs/poppler/poppler-src/poppler/Outline.cc index bc8768f1501..c6b12dc0366 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Outline.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Outline.cc @@ -14,10 +14,11 @@ // under GPL version 2 or later // // Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com> -// Copyright (C) 2008, 2016, 2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2008, 2016-2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Nick Jones <nick.jones@network-box.com> // Copyright (C) 2016 Jason Crain <jason@aquaticape.us> // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -41,7 +42,7 @@ //------------------------------------------------------------------------ -Outline::Outline(Object *outlineObj, XRef *xref) { +Outline::Outline(const Object *outlineObj, XRef *xref) { items = nullptr; if (!outlineObj->isDict()) { return; @@ -58,7 +59,7 @@ Outline::~Outline() { //------------------------------------------------------------------------ -OutlineItem::OutlineItem(Dict *dict, int refNumA, OutlineItem *parentA, XRef *xrefA) { +OutlineItem::OutlineItem(const Dict *dict, int refNumA, OutlineItem *parentA, XRef *xrefA) { Object obj1; refNum = refNumA; @@ -71,7 +72,7 @@ OutlineItem::OutlineItem(Dict *dict, int refNumA, OutlineItem *parentA, XRef *xr obj1 = dict->lookup("Title"); if (obj1.isString()) { - GooString *s = obj1.getString(); + const GooString *s = obj1.getString(); titleLen = TextStringToUCS4(s, &title); } else { titleLen = 0; @@ -110,7 +111,7 @@ OutlineItem::~OutlineItem() { } } -GooList *OutlineItem::readItemList(OutlineItem *parent, Object *firstItemRef, XRef *xrefA) { +GooList *OutlineItem::readItemList(OutlineItem *parent, const Object *firstItemRef, XRef *xrefA) { GooList *items = new GooList(); char* alreadyRead = (char *)gmalloc(xrefA->getNumObjects()); @@ -122,7 +123,7 @@ GooList *OutlineItem::readItemList(OutlineItem *parent, Object *firstItemRef, XR parentO = parentO->parent; } - Object *p = firstItemRef; + const Object *p = firstItemRef; while (p->isRef() && (p->getRefNum() >= 0) && (p->getRefNum() < xrefA->getNumObjects()) && diff --git a/Build/source/libs/poppler/poppler-src/poppler/Outline.h b/Build/source/libs/poppler/poppler-src/poppler/Outline.h index 1584ddcb129..a6e9e79ab62 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Outline.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Outline.h @@ -41,13 +41,13 @@ class LinkAction; class Outline { public: - Outline(Object *outlineObj, XRef *xref); + Outline(const Object *outlineObj, XRef *xref); ~Outline(); Outline(const Outline &) = delete; Outline& operator=(const Outline &) = delete; - GooList *getItems() { return items; } + const GooList *getItems() const { return items; } private: @@ -60,23 +60,23 @@ private: class OutlineItem { public: - OutlineItem(Dict *dict, int refNumA, OutlineItem *parentA, XRef *xrefA); + OutlineItem(const Dict *dict, int refNumA, OutlineItem *parentA, XRef *xrefA); ~OutlineItem(); OutlineItem(const OutlineItem &) = delete; OutlineItem& operator=(const OutlineItem &) = delete; - static GooList *readItemList(OutlineItem *parent, Object *firstItemRef, XRef *xrefA); + static GooList *readItemList(OutlineItem *parent, const Object *firstItemRef, XRef *xrefA); void open(); void close(); - Unicode *getTitle() { return title; } - int getTitleLength() { return titleLen; } - LinkAction *getAction() { return action; } - GBool isOpen() { return startsOpen; } - GBool hasKids() { return firstRef.isRef(); } - GooList *getKids() { return kids; } + const Unicode *getTitle() const { return title; } + int getTitleLength() const { return titleLen; } + const LinkAction *getAction() const { return action; } + GBool isOpen() const { return startsOpen; } + GBool hasKids() const { return firstRef.isRef(); } + const GooList *getKids() const { return kids; } private: diff --git a/Build/source/libs/poppler/poppler-src/poppler/OutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/OutputDev.cc index 8afa7052894..6d42fd42f38 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/OutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/OutputDev.cc @@ -160,13 +160,13 @@ void OutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, void OutputDev::endMarkedContent(GfxState *state) { } -void OutputDev::beginMarkedContent(char *name, Dict *properties) { +void OutputDev::beginMarkedContent(const char *name, Dict *properties) { } -void OutputDev::markPoint(char *name) { +void OutputDev::markPoint(const char *name) { } -void OutputDev::markPoint(char *name, Dict *properties) { +void OutputDev::markPoint(const char *name, Dict *properties) { } diff --git a/Build/source/libs/poppler/poppler-src/poppler/OutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/OutputDev.h index aca84cdab5e..9dc4c3e005d 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/OutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/OutputDev.h @@ -23,7 +23,8 @@ // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2012 William Bader <williambader@hotmail.com> -// Copyright (C) 2017 Oliver Sander <oliver.sander@tu-dresden.de> +// Copyright (C) 2017, 2018 Oliver Sander <oliver.sander@tu-dresden.de> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -247,7 +248,7 @@ public: //----- text drawing virtual void beginStringOp(GfxState * /*state*/) {} virtual void endStringOp(GfxState * /*state*/) {} - virtual void beginString(GfxState * /*state*/, GooString * /*s*/) {} + virtual void beginString(GfxState * /*state*/, const GooString * /*s*/) {} virtual void endString(GfxState * /*state*/) {} // Draw one glyph at a specified position @@ -263,7 +264,7 @@ public: double /*dx*/, double /*dy*/, double /*originX*/, double /*originY*/, CharCode /*code*/, int /*nBytes*/, Unicode * /*u*/, int /*uLen*/) {} - virtual void drawString(GfxState * /*state*/, GooString * /*s*/) {} + virtual void drawString(GfxState * /*state*/, const GooString * /*s*/) {} virtual GBool beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, CharCode /*code*/, Unicode * /*u*/, int /*uLen*/); @@ -271,10 +272,15 @@ public: virtual void beginTextObject(GfxState * /*state*/) {} virtual void endTextObject(GfxState * /*state*/) {} virtual void incCharCount(int /*nChars*/) {} - virtual void beginActualText(GfxState * /*state*/, GooString * /*text*/ ) {} + virtual void beginActualText(GfxState * /*state*/, const GooString * /*text*/ ) {} virtual void endActualText(GfxState * /*state*/) {} //----- image drawing + // Draw an image mask. An image mask is a one-bit-per-pixel image, where each pixel + // can only be 'fill color' or 'transparent'. + // + // If 'invert' is false, a sample value of 0 marks the page with the current color, + // and a 1 leaves the previous contents unchanged. If 'invert' is true, these meanings are reversed. virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool interpolate, GBool inlineImg); @@ -303,9 +309,9 @@ public: //----- grouping operators virtual void endMarkedContent(GfxState *state); - virtual void beginMarkedContent(char *name, Dict *properties); - virtual void markPoint(char *name); - virtual void markPoint(char *name, Dict *properties); + virtual void beginMarkedContent(const char *name, Dict *properties); + virtual void markPoint(const char *name); + virtual void markPoint(const char *name, Dict *properties); diff --git a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc index 6789c39f19d..631f9a70782 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc @@ -38,6 +38,8 @@ // Copyright (C) 2017 Jean Ghali <jghali@libertysurf.fr> // Copyright (C) 2017 Fredrik Fornwall <fredrik@fornwall.net> // Copyright (C) 2018 Ben Timby <btimby@gmail.com> +// Copyright (C) 2018 Evangelos Foutras <evangelos@foutrelis.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -409,24 +411,30 @@ void PDFDoc::checkHeader() { char *p; char *tokptr; int i; - int c; + int bytesRead; pdfMajorVersion = 0; pdfMinorVersion = 0; + + // read up to headerSearchSize bytes from the beginning of the document for (i = 0; i < headerSearchSize; ++i) { - if ((c = str->getChar()) == EOF) { - error(errSyntaxWarning, -1, "EOF while reading header (continuing anyway)"); - return; - } + const int c = str->getChar(); + if (c == EOF) + break; hdrBuf[i] = c; } - hdrBuf[headerSearchSize] = '\0'; - for (i = 0; i < headerSearchSize - 5; ++i) { + bytesRead = i; + hdrBuf[bytesRead] = '\0'; + + // find the start of the PDF header if it exists and parse the version + bool headerFound = false; + for (i = 0; i < bytesRead - 5; ++i) { if (!strncmp(&hdrBuf[i], "%PDF-", 5)) { + headerFound = true; break; } } - if (i >= headerSearchSize - 5) { + if (!headerFound) { error(errSyntaxWarning, -1, "May not be a PDF file (continuing anyway)"); return; } @@ -676,7 +684,7 @@ GooString *PDFDoc::getDocInfoStringEntry(const char *key) { } static GBool -get_id (GooString *encodedidstring, GooString *id) { +get_id (const GooString *encodedidstring, GooString *id) { const char *encodedid = encodedidstring->getCString(); char pdfid[pdfIdLength + 1]; int n; @@ -1178,7 +1186,7 @@ void PDFDoc::writeRawStream (Stream* str, OutStream* outStr) outStr->printf("\r\nendstream\r\n"); } -void PDFDoc::writeString (GooString* s, OutStream* outStr, Guchar *fileKey, +void PDFDoc::writeString (const GooString* s, OutStream* outStr, Guchar *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen) { // Encrypt string if encryption is enabled diff --git a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h index 5af547778c4..1678d1678e9 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h +++ b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.h @@ -30,6 +30,7 @@ // Copyright (C) 2015 André Guerreiro <aguerreiro1985@gmail.com> // Copyright (C) 2015 André Esser <bepandre@hotmail.com> // Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -192,7 +193,7 @@ public: // Find a named destination. Returns the link destination, or // NULL if <name> is not a destination. - LinkDest *findDest(GooString *name) + LinkDest *findDest(const GooString *name) { return catalog->findDest(name); } // Process the links for a page. @@ -329,7 +330,7 @@ private: static void writeRawStream (Stream* str, OutStream* outStr); void writeXRefTableTrailer (Goffset uxrefOffset, XRef *uxref, GBool writeAllEntries, int uxrefSize, OutStream* outStr, GBool incrUpdate); - static void writeString (GooString* s, OutStream* outStr, Guchar *fileKey, + static void writeString (const GooString* s, OutStream* outStr, Guchar *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen); void saveIncrementalUpdate (OutStream* outStr); void saveCompleteRewrite (OutStream* outStr); diff --git a/Build/source/libs/poppler/poppler-src/poppler/PDFDocEncoding.h b/Build/source/libs/poppler/poppler-src/poppler/PDFDocEncoding.h index 4f0840bb28a..eed599fa366 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PDFDocEncoding.h +++ b/Build/source/libs/poppler/poppler-src/poppler/PDFDocEncoding.h @@ -29,6 +29,6 @@ class GooString; extern Unicode pdfDocEncoding[256]; -char* pdfDocEncodingToUTF16 (GooString* orig, int* length); +char* pdfDocEncodingToUTF16 (const GooString* orig, int* length); #endif diff --git a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc index 2f55557c14d..c755caa4a9e 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc @@ -31,6 +31,7 @@ // Copyright (C) 2014 Till Kamppeter <till.kamppeter@gmail.com> // Copyright (C) 2015 Marek Kasik <mkasik@redhat.com> // Copyright (C) 2016 Caolán McNamara <caolanm@redhat.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -1535,7 +1536,6 @@ void PSOutputDev::writeHeader(const std::vector<int> &pages, int pageRotate, char *psTitle) { PSOutPaperSize *size; double x1, y1, x2, y2; - int i; switch (mode) { case psModePS: @@ -1581,7 +1581,7 @@ void PSOutputDev::writeHeader(const std::vector<int> &pages, switch (mode) { case psModePS: - for (i = 0; i < paperSizes->getLength(); ++i) { + for (int i = 0; i < paperSizes->getLength(); ++i) { size = (PSOutPaperSize *)paperSizes->get(i); writePSFmt("%%{0:s} {1:t} {2:d} {3:d} 0 () ()\n", i==0 ? "DocumentMedia:" : "+", size->name, size->w, size->h); @@ -2866,8 +2866,9 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName, // Make a unique PS font name, based on the names given in the PDF // font object, and an object ID (font file object for -GooString *PSOutputDev::makePSFontName(GfxFont *font, Ref *id) { - GooString *psName, *s; +GooString *PSOutputDev::makePSFontName(GfxFont *font, const Ref *id) { + GooString *psName; + const GooString *s; if ((s = font->getEmbeddedFontName())) { psName = filterPSName(s); @@ -5007,13 +5008,13 @@ void PSOutputDev::doPath(GfxPath *path) { } } -void PSOutputDev::drawString(GfxState *state, GooString *s) { +void PSOutputDev::drawString(GfxState *state, const GooString *s) { GfxFont *font; int wMode; int *codeToGID; GooString *s2; double dx, dy, originX, originY; - char *p; + const char *p; UnicodeMap *uMap; CharCode code; Unicode *u; @@ -7433,7 +7434,7 @@ void PSOutputDev::writePSFmt(const char *fmt, ...) { va_end(args); } -void PSOutputDev::writePSString(GooString *s) { +void PSOutputDev::writePSString(const GooString *s) { Guchar *p; int n, line; char buf[8]; @@ -7479,7 +7480,7 @@ void PSOutputDev::writePSName(const char *s) { } } -GooString *PSOutputDev::filterPSName(GooString *name) { +GooString *PSOutputDev::filterPSName(const GooString *name) { GooString *name2; char buf[8]; int i; @@ -7578,7 +7579,7 @@ GooString* PSOutputDev::filterPSLabel(GooString *label, GBool *needParens) { } // Write a DSC-compliant <textline>. -void PSOutputDev::writePSTextLine(GooString *s) { +void PSOutputDev::writePSTextLine(const GooString *s) { int i, j, step; int c; diff --git a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h index 330b81b3ab2..e0d6910acd3 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h @@ -24,6 +24,7 @@ // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2011, 2014, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -252,7 +253,7 @@ public: void clipToStrokePath(GfxState *state) override; //----- text drawing - void drawString(GfxState *state, GooString *s) override; + void drawString(GfxState *state, const GooString *s) override; void beginTextObject(GfxState *state) override; void endTextObject(GfxState *state) override; @@ -372,7 +373,7 @@ private: GBool needVerticalMetrics); void setupEmbeddedOpenTypeCFFFont(GfxFont *font, Ref *id, GooString *psName); void setupType3Font(GfxFont *font, GooString *psName, Dict *parentResDict); - GooString *makePSFontName(GfxFont *font, Ref *id); + GooString *makePSFontName(GfxFont *font, const Ref *id); void setupImages(Dict *resDict); void setupImage(Ref id, Stream *str, GBool mask); void setupForms(Dict *resDict); @@ -422,7 +423,7 @@ private: double *x1, double *y1); #endif void cvtFunction(Function *func, GBool invertPSFunction = gFalse); - GooString *filterPSName(GooString *name); + GooString *filterPSName(const GooString *name); // Write the document-level setup. void writeDocSetup(PDFDoc *doc, Catalog *catalog, const std::vector<int> &pages, GBool duplexA); @@ -431,10 +432,10 @@ private: void writePS(const char *s); void writePSBuf(const char *s, int len); void writePSFmt(const char *fmt, ...); - void writePSString(GooString *s); + void writePSString(const GooString *s); void writePSName(const char *s); GooString *filterPSLabel(GooString *label, GBool *needParens=nullptr); - void writePSTextLine(GooString *s); + void writePSTextLine(const GooString *s); PSLevel level; // PostScript level (1, 2, separation) PSOutMode mode; // PostScript mode (PS, EPS, form) diff --git a/Build/source/libs/poppler/poppler-src/poppler/Page.h b/Build/source/libs/poppler/poppler-src/poppler/Page.h index 615707917e4..7151ee5b25c 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Page.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Page.h @@ -91,9 +91,9 @@ public: PDFRectangle *getTrimBox() { return &trimBox; } PDFRectangle *getArtBox() { return &artBox; } int getRotate() { return rotate; } - GooString *getLastModified() + const GooString *getLastModified() const { return lastModified.isString() - ? lastModified.getString() : (GooString *)NULL; } + ? lastModified.getString() : nullptr; } Dict *getBoxColorInfo() { return boxColorInfo.isDict() ? boxColorInfo.getDict() : (Dict *)NULL; } Dict *getGroup() @@ -171,7 +171,7 @@ public: PDFRectangle *getTrimBox() { return attrs->getTrimBox(); } PDFRectangle *getArtBox() { return attrs->getArtBox(); } int getRotate() { return attrs->getRotate(); } - GooString *getLastModified() { return attrs->getLastModified(); } + const GooString *getLastModified() const { return attrs->getLastModified(); } Dict *getBoxColorInfo() { return attrs->getBoxColorInfo(); } Dict *getGroup() { return attrs->getGroup(); } Stream *getMetadata() { return attrs->getMetadata(); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/Parser.cc b/Build/source/libs/poppler/poppler-src/poppler/Parser.cc index dc777b02447..869e94ad0c8 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Parser.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Parser.cc @@ -19,6 +19,7 @@ // Copyright (C) 2012 Hib Eris <hib@hiberis.nl> // Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -71,7 +72,8 @@ Object Parser::getObj(GBool simpleOnly, Object obj; Stream *str; DecryptStream *decrypt; - GooString *s, *s2; + const GooString *s; + GooString *s2; int c; // refill buffer after inline image data diff --git a/Build/source/libs/poppler/poppler-src/poppler/Rendition.cc b/Build/source/libs/poppler/poppler-src/poppler/Rendition.cc index f090a99a0f0..b74aca49316 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Rendition.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Rendition.cc @@ -7,7 +7,7 @@ // Pino Toscano <pino@kde.org> (c) 2008 // Carlos Garcia Campos <carlosgc@gnome.org> (c) 2010 // Tobias Koenig <tobias.koenig@kdab.com> (c) 2012 -// Albert Astals Cid <aacid@kde.org> (C) 2017 +// Albert Astals Cid <aacid@kde.org> (C) 2017, 2018 // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -177,7 +177,7 @@ void MediaParameters::parseMediaPlayParameters(Object* obj) { if (tmp.isDict()) { Object oname = tmp.dictLookup("S"); if (oname.isName()) { - char* name = oname.getName(); + const char* name = oname.getName(); if (!strcmp(name, "F")) duration = -1; // infinity else if (!strcmp(name, "T")) { @@ -371,7 +371,7 @@ void MediaRendition::outputToFile(FILE* fp) { } -MediaRendition* MediaRendition::copy() +MediaRendition* MediaRendition::copy() const { return new MediaRendition(*this); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/Rendition.h b/Build/source/libs/poppler/poppler-src/poppler/Rendition.h index d84505ffa24..cfe571704ae 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Rendition.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Rendition.h @@ -123,21 +123,21 @@ class MediaRendition { ~MediaRendition(); MediaRendition& operator=(const MediaRendition &) = delete; - GBool isOk () { return ok; } + GBool isOk () const { return ok; } - MediaParameters* getMHParameters() { return &MH; } - MediaParameters* getBEParameters() { return &BE; } + const MediaParameters* getMHParameters() const { return &MH; } + const MediaParameters* getBEParameters() const { return &BE; } - GooString* getContentType() { return contentType; } - GooString* getFileName() { return fileName; } + const GooString* getContentType() const { return contentType; } + const GooString* getFileName() const { return fileName; } - GBool getIsEmbedded() { return isEmbedded; } - Stream* getEmbbededStream() { return isEmbedded ? embeddedStreamObject.getStream() : nullptr; } - Object* getEmbbededStreamObject() { return isEmbedded ? &embeddedStreamObject : nullptr; } + GBool getIsEmbedded() const { return isEmbedded; } + Stream* getEmbbededStream() const { return isEmbedded ? embeddedStreamObject.getStream() : nullptr; } + const Object* getEmbbededStreamObject() const { return isEmbedded ? &embeddedStreamObject : nullptr; } // write embedded stream to file void outputToFile(FILE*); - MediaRendition* copy(); + MediaRendition* copy() const; private: GBool ok; diff --git a/Build/source/libs/poppler/poppler-src/poppler/Sound.cc b/Build/source/libs/poppler/poppler-src/poppler/Sound.cc index 4a59d3fe04a..aa2ac8f21ad 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Sound.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Sound.cc @@ -1,6 +1,6 @@ /* Sound.cc - an object that holds the sound structure * Copyright (C) 2006-2007, Pino Toscano <pino@kde.org> - * Copyright (C) 2009, 2017, Albert Astals Cid <aacid@kde.org> + * Copyright (C) 2009, 2017, 2018, Albert Astals Cid <aacid@kde.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ Sound *Sound::parseSound(Object *obj) } } -Sound::Sound(Object *obj, bool readAttrs) +Sound::Sound(const Object *obj, bool readAttrs) { streamObj = obj->copy(); @@ -116,7 +116,7 @@ Stream *Sound::getStream() return streamObj.getStream(); } -Sound *Sound::copy() +Sound *Sound::copy() const { Sound *newsound = new Sound(&streamObj, false); diff --git a/Build/source/libs/poppler/poppler-src/poppler/Sound.h b/Build/source/libs/poppler/poppler-src/poppler/Sound.h index e88de4d62f9..ae8d0ceed85 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Sound.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Sound.h @@ -50,21 +50,21 @@ public: Sound(const Sound &) = delete; Sound& operator=(const Sound &) = delete; - Object *getObject() { return &streamObj; } + const Object *getObject() const { return &streamObj; } Stream *getStream(); - SoundKind getSoundKind() { return kind; } - GooString *getFileName() { return fileName; } - double getSamplingRate() { return samplingRate; } - int getChannels() { return channels; } - int getBitsPerSample() { return bitsPerSample; } - SoundEncoding getEncoding() { return encoding; } + SoundKind getSoundKind() const { return kind; } + const GooString *getFileName() const { return fileName; } + double getSamplingRate() const { return samplingRate; } + int getChannels() const { return channels; } + int getBitsPerSample() const { return bitsPerSample; } + SoundEncoding getEncoding() const { return encoding; } - Sound *copy(); + Sound *copy() const; private: // Create a sound. The Object obj is ensured to be a Stream with a Dict - Sound(Object *obj, bool readAttrs = true); + Sound(const Object *obj, bool readAttrs = true); Object streamObj; SoundKind kind; diff --git a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc index efc0aaece1e..73963302b00 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc @@ -38,6 +38,7 @@ // Copyright (C) 2015 Kenji Uno <ku@digitaldolphins.jp> // Copyright (C) 2016 Takahiro Hashimoto <kenya888.en@gmail.com> // Copyright (C) 2017 Even Rouault <even.rouault@spatialys.com> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -1196,7 +1197,7 @@ static const SplashBlendFunc splashOutBlendFuncs[] = { class SplashOutFontFileID: public SplashFontFileID { public: - SplashOutFontFileID(Ref *rA) { r = *rA; } + SplashOutFontFileID(const Ref *rA) { r = *rA; } ~SplashOutFontFileID() {} @@ -1222,14 +1223,14 @@ struct T3FontCacheTag { class T3FontCache { public: - T3FontCache(Ref *fontID, double m11A, double m12A, + T3FontCache(const Ref *fontID, double m11A, double m12A, double m21A, double m22A, int glyphXA, int glyphYA, int glyphWA, int glyphHA, GBool aa, GBool validBBoxA); ~T3FontCache(); T3FontCache(const T3FontCache &) = delete; T3FontCache& operator=(const T3FontCache &) = delete; - GBool matches(Ref *idA, double m11A, double m12A, + GBool matches(const Ref *idA, double m11A, double m12A, double m21A, double m22A) { return fontID.num == idA->num && fontID.gen == idA->gen && m11 == m11A && m12 == m12A && m21 == m21A && m22 == m22A; } @@ -1246,7 +1247,7 @@ public: T3FontCacheTag *cacheTags; // cache tags, i.e., char codes }; -T3FontCache::T3FontCache(Ref *fontIDA, double m11A, double m12A, +T3FontCache::T3FontCache(const Ref *fontIDA, double m11A, double m12A, double m21A, double m22A, int glyphXA, int glyphYA, int glyphWA, int glyphHA, GBool validBBoxA, GBool aa) { @@ -2501,7 +2502,7 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { GfxFont *gfxFont; - Ref *fontID; + const Ref *fontID; double *ctm, *bbox; T3FontCache *t3Font; T3GlyphStack *t3gs; @@ -3978,8 +3979,7 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, maskStr->reset(); maskStr->doGetChars(maskWidth * maskHeight, data); maskStr->close(); - maskStr = new MemStream((char *)data, 0, maskWidth * maskHeight, maskStr->getDictObject()->copy()); - ((MemStream *) maskStr)->setNeedFree(gTrue); + maskStr = new AutoFreeMemStream((char *)data, 0, maskWidth * maskHeight, maskStr->getDictObject()->copy()); } imgMaskData.imgStr = new ImageStream(maskStr, maskWidth, maskColorMap->getNumPixelComps(), diff --git a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h index 3a5883c421a..3a1b594e409 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h @@ -407,7 +407,7 @@ private: SplashPattern *getColor(GfxCMYK *cmyk); SplashPattern *getColor(GfxColor *deviceN); #endif - void getMatteColor( SplashColorMode colorMode, GfxImageColorMap *colorMap, GfxColor * matteColor, SplashColor splashMatteColor); + static void getMatteColor( SplashColorMode colorMode, GfxImageColorMap *colorMap, GfxColor * matteColor, SplashColor splashMatteColor); void setOverprintMask(GfxColorSpace *colorSpace, GBool overprintFlag, int overprintMode, GfxColor *singleColor, GBool grayIndexed = gFalse); SplashPath *convertPath(GfxState *state, GfxPath *path, diff --git a/Build/source/libs/poppler/poppler-src/poppler/Stream.cc b/Build/source/libs/poppler/poppler-src/poppler/Stream.cc index 0602c7bb556..15a6a9f9aa1 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Stream.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Stream.cc @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net> -// Copyright (C) 2006-2010, 2012-2014, 2016, 2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006-2010, 2012-2014, 2016, 2017, 2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com> // Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net> // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> @@ -208,7 +208,7 @@ Stream *Stream::addFilters(Dict *dict, int recursion) { return str; } -Stream *Stream::makeFilter(char *name, Stream *str, Object *params, int recursion, Dict *dict) { +Stream *Stream::makeFilter(const char *name, Stream *str, Object *params, int recursion, Dict *dict) { int pred; // parameters int colors; int bits; @@ -951,89 +951,6 @@ void CachedFileStream::moveStart(Goffset delta) } //------------------------------------------------------------------------ -// MemStream -//------------------------------------------------------------------------ - -MemStream::MemStream(char *bufA, Goffset startA, Goffset lengthA, Object &&dictA): - BaseStream(std::move(dictA), lengthA) { - buf = bufA; - start = startA; - length = lengthA; - bufEnd = buf + start + length; - bufPtr = buf + start; - needFree = gFalse; -} - -MemStream::~MemStream() { - if (needFree) { - gfree(buf); - } -} - -BaseStream *MemStream::copy() { - return new MemStream(buf, start, length, dict.copy()); -} - -Stream *MemStream::makeSubStream(Goffset startA, GBool limited, - Goffset lengthA, Object &&dictA) { - MemStream *subStr; - Goffset newLength; - - if (!limited || startA + lengthA > start + length) { - newLength = start + length - startA; - } else { - newLength = lengthA; - } - subStr = new MemStream(buf, startA, newLength, std::move(dictA)); - return subStr; -} - -void MemStream::reset() { - bufPtr = buf + start; -} - -void MemStream::close() { -} - -int MemStream::getChars(int nChars, Guchar *buffer) { - int n; - - if (nChars <= 0) { - return 0; - } - if (bufEnd - bufPtr < nChars) { - n = (int)(bufEnd - bufPtr); - } else { - n = nChars; - } - memcpy(buffer, bufPtr, n); - bufPtr += n; - return n; -} - -void MemStream::setPos(Goffset pos, int dir) { - Guint i; - - if (dir >= 0) { - i = pos; - } else { - i = start + length - pos; - } - if (i < start) { - i = start; - } else if (i > start + length) { - i = start + length; - } - bufPtr = buf + i; -} - -void MemStream::moveStart(Goffset delta) { - start += delta; - length -= delta; - bufPtr = buf + start; -} - -//------------------------------------------------------------------------ // EmbedStream //------------------------------------------------------------------------ diff --git a/Build/source/libs/poppler/poppler-src/poppler/Stream.h b/Build/source/libs/poppler/poppler-src/poppler/Stream.h index b58da825cea..a3faccd9b75 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Stream.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Stream.h @@ -238,7 +238,7 @@ private: virtual GBool hasGetChars() { return false; } virtual int getChars(int nChars, Guchar *buffer); - Stream *makeFilter(char *name, Stream *str, Object *params, int recursion = 0, Dict *dict = nullptr); + Stream *makeFilter(const char *name, Stream *str, Object *params, int recursion = 0, Dict *dict = nullptr); int ref; // reference count #ifdef MULTITHREADED @@ -567,45 +567,125 @@ private: // MemStream //------------------------------------------------------------------------ -class MemStream: public BaseStream { +template<typename T> +class BaseMemStream: public BaseStream { public: - MemStream(char *bufA, Goffset startA, Goffset lengthA, Object &&dictA); - ~MemStream(); - BaseStream *copy() override; - Stream *makeSubStream(Goffset start, GBool limited, - Goffset lengthA, Object &&dictA) override; + BaseMemStream(T *bufA, Goffset startA, Goffset lengthA, Object &&dictA) : BaseStream(std::move(dictA), lengthA) { + buf = bufA; + start = startA; + length = lengthA; + bufEnd = buf + start + length; + bufPtr = buf + start; + } + + BaseStream *copy() override { + return new BaseMemStream(buf, start, length, dict.copy()); + } + + Stream *makeSubStream(Goffset startA, GBool limited, Goffset lengthA, Object &&dictA) override { + Goffset newLength; + + if (!limited || startA + lengthA > start + length) { + newLength = start + length - startA; + } else { + newLength = lengthA; + } + return new BaseMemStream(buf, startA, newLength, std::move(dictA)); + } + StreamKind getKind() override { return strWeird; } - void reset() override; - void close() override; + + void reset() override { + bufPtr = buf + start; + } + + void close() override { } + int getChar() override { return (bufPtr < bufEnd) ? (*bufPtr++ & 0xff) : EOF; } + int lookChar() override { return (bufPtr < bufEnd) ? (*bufPtr & 0xff) : EOF; } + Goffset getPos() override { return (int)(bufPtr - buf); } - void setPos(Goffset pos, int dir = 0) override; + + void setPos(Goffset pos, int dir = 0) override { + Guint i; + + if (dir >= 0) { + i = pos; + } else { + i = start + length - pos; + } + if (i < start) { + i = start; + } else if (i > start + length) { + i = start + length; + } + bufPtr = buf + i; + } + Goffset getStart() override { return start; } - void moveStart(Goffset delta) override; - //if needFree = true, the stream will delete buf when it is destroyed - //otherwise it will not touch it. Default value is false - virtual void setNeedFree (GBool val) { needFree = val; } + void moveStart(Goffset delta) override { + start += delta; + length -= delta; + bufPtr = buf + start; + } int getUnfilteredChar () override { return getChar(); } + void unfilteredReset () override { reset (); } +protected: + T *buf; + private: GBool hasGetChars() override { return true; } - int getChars(int nChars, Guchar *buffer) override; - char *buf; + int getChars(int nChars, Guchar *buffer) override { + int n; + + if (nChars <= 0) { + return 0; + } + if (bufEnd - bufPtr < nChars) { + n = (int)(bufEnd - bufPtr); + } else { + n = nChars; + } + memcpy(buffer, bufPtr, n); + bufPtr += n; + return n; + } + Goffset start; - char *bufEnd; - char *bufPtr; - GBool needFree; + T *bufEnd; + T *bufPtr; +}; + +class MemStream : public BaseMemStream<const char> +{ +public: + MemStream(const char *bufA, Goffset startA, Goffset lengthA, Object &&dictA) + : BaseMemStream(bufA, startA, lengthA, std::move(dictA)) + { } +}; + +class AutoFreeMemStream : public BaseMemStream<char> +{ +public: + AutoFreeMemStream(char *bufA, Goffset startA, Goffset lengthA, Object &&dictA) + : BaseMemStream(bufA, startA, lengthA, std::move(dictA)) + { } + + ~AutoFreeMemStream() + { gfree(buf); } }; + //------------------------------------------------------------------------ // EmbedStream // diff --git a/Build/source/libs/poppler/poppler-src/poppler/StructElement.cc b/Build/source/libs/poppler/poppler-src/poppler/StructElement.cc index 5bf3a33f446..d87cb20cc98 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/StructElement.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/StructElement.cc @@ -9,6 +9,7 @@ // Copyright 2014, 2017, 2018 Albert Astals Cid <aacid@kde.org> // Copyright 2015 Dmytro Morgun <lztoad@gmail.com> // Copyright 2018 Adrian Johnson <ajohnson@redneon.com> +// Copyright 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // //======================================================================== @@ -777,7 +778,7 @@ Attribute *Attribute::parseUserProperty(Dict *property) obj = property->lookup("N"); if (obj.isString()) { - GooString *s = obj.getString(); + const GooString *s = obj.getString(); name = s->getCString(); nameLen = s->getLength(); } else if (obj.isName()) diff --git a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc index 4397e49718c..4a3070af7c0 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc @@ -36,6 +36,7 @@ // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Ed Catmur <ed@catmur.co.uk> // Copyright (C) 2016 Khaled Hosny <khaledhosny@eglug.org> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -5518,7 +5519,7 @@ void ActualText::addChar(GfxState *state, double x, double y, actualTextNBytes += nBytes; } -void ActualText::begin(GfxState *state, GooString *text) { +void ActualText::begin(GfxState *state, const GooString *text) { if (actualText) delete actualText; actualText = new GooString(text); @@ -5641,7 +5642,7 @@ void TextOutputDev::updateFont(GfxState *state) { text->updateFont(state); } -void TextOutputDev::beginString(GfxState *state, GooString *s) { +void TextOutputDev::beginString(GfxState *state, const GooString *s) { } void TextOutputDev::endString(GfxState *state) { @@ -5658,7 +5659,7 @@ void TextOutputDev::incCharCount(int nChars) { text->incCharCount(nChars); } -void TextOutputDev::beginActualText(GfxState *state, GooString *text) +void TextOutputDev::beginActualText(GfxState *state, const GooString *text) { actualText->begin(state, text); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h index b5a6088c08a..092acd6730f 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/TextOutputDev.h @@ -21,6 +21,7 @@ // Copyright (C) 2010 Brian Ewins <brian.ewins@gmail.com> // Copyright (C) 2012, 2013, 2015, 2016 Jason Crain <jason@aquaticape.us> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -732,7 +733,7 @@ public: void addChar(GfxState *state, double x, double y, double dx, double dy, CharCode c, int nBytes, Unicode *u, int uLen); - void begin(GfxState *state, GooString *text); + void begin(GfxState *state, const GooString *text); void end(GfxState *state); private: @@ -812,14 +813,14 @@ public: void updateFont(GfxState *state) override; //----- text drawing - void beginString(GfxState *state, GooString *s) override; + void beginString(GfxState *state, const GooString *s) override; void endString(GfxState *state) override; void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode c, int nBytes, Unicode *u, int uLen) override; void incCharCount(int nChars) override; - void beginActualText(GfxState *state, GooString *text) override; + void beginActualText(GfxState *state, const GooString *text) override; void endActualText(GfxState *state) override; //----- path painting diff --git a/Build/source/libs/poppler/poppler-src/poppler/UTF.cc b/Build/source/libs/poppler/poppler-src/poppler/UTF.cc index da2faad1c3f..a2003bffa11 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/UTF.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/UTF.cc @@ -18,6 +18,7 @@ // Copyright (C) 2012 Hib Eris <hib@hiberis.nl> // Copyright (C) 2016, 2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2016 Jason Crain <jason@aquaticape.us> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -85,7 +86,7 @@ int UTF16toUCS4(const Unicode *utf16, int utf16Len, Unicode **ucs4) return len; } -int TextStringToUCS4(GooString *textStr, Unicode **ucs4) +int TextStringToUCS4(const GooString *textStr, Unicode **ucs4) { int i, len; const char *s; diff --git a/Build/source/libs/poppler/poppler-src/poppler/UTF.h b/Build/source/libs/poppler/poppler-src/poppler/UTF.h index 704ba4de1df..a86c056dbe6 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/UTF.h +++ b/Build/source/libs/poppler/poppler-src/poppler/UTF.h @@ -6,6 +6,7 @@ // // Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2016 Jason Crain <jason@aquaticape.us> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // //======================================================================== @@ -34,7 +35,7 @@ int UTF16toUCS4(const Unicode *utf16, int utf16_len, Unicode **ucs4_out); // ucs4 - if the number of UCS-4 characters is > 0, allocates and // returns UCS-4 string. Free with gfree. // returns number of UCS-4 characters -int TextStringToUCS4(GooString *textStr, Unicode **ucs4); +int TextStringToUCS4(const GooString *textStr, Unicode **ucs4); // check if UCS-4 character is valid bool UnicodeIsValid(Unicode ucs4); diff --git a/Build/source/libs/poppler/version.ac b/Build/source/libs/poppler/version.ac index eb247b919ef..55f517d0294 100644 --- a/Build/source/libs/poppler/version.ac +++ b/Build/source/libs/poppler/version.ac @@ -9,4 +9,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current poppler version -m4_define([poppler_version], [0.63.0]) +m4_define([poppler_version], [0.64.0]) |