diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-06-18 14:44:53 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-06-29 09:09:44 +0200 |
commit | 3c8fb91228d21fe0ba016831f677fcc7b7e99472 (patch) | |
tree | 23f3fcea90ad0d32f7293e31bf439f513e3c8149 /include | |
parent | 6e267f362fec03662e36641d275a42119f1798ce (diff) |
sd signature line: teach PDFDocument how to use PDFObjectCopier
This will allow using the object copier in
PDFDocument::WriteAppearanceObject(), so we can include the signature
line pdf export result in a pdf signature of the original pdf.
(cherry picked from commit f9ac4ab61fa2ebcafa8ea8957db01104a927bff2)
Conflicts:
include/vcl/filter/pdfdocument.hxx
Change-Id: Iabc508081c5820f4ca997a2d264de9bdb06f82bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97249
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/filter/pdfdocument.hxx | 13 | ||||
-rw-r--r-- | include/vcl/filter/pdfobjectcontainer.hxx | 36 |
2 files changed, 47 insertions, 2 deletions
diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx index 10ce81afa5be..70e6f79641b8 100644 --- a/include/vcl/filter/pdfdocument.hxx +++ b/include/vcl/filter/pdfdocument.hxx @@ -16,9 +16,10 @@ #include <vector> #include <tools/stream.hxx> - #include <vcl/dllapi.h> +#include <vcl/filter/pdfobjectcontainer.hxx> + namespace com { namespace sun @@ -345,7 +346,7 @@ public: * elements remember their source offset / length, and based on that it's * possible to modify the input file. */ -class VCL_DLLPUBLIC PDFDocument +class VCL_DLLPUBLIC PDFDocument : public PDFObjectContainer { /// This vector owns all elements. std::vector<std::unique_ptr<PDFElement>> m_aElements; @@ -392,6 +393,7 @@ class VCL_DLLPUBLIC PDFDocument public: PDFDocument(); + virtual ~PDFDocument(); PDFDocument& operator=(const PDFDocument&) = delete; PDFDocument(const PDFDocument&) = delete; /// @name Low-level functions, to be used by PDFElement subclasses. @@ -437,6 +439,13 @@ public: /// Remove the nth signature from read document in the edit buffer. bool RemoveSignature(size_t nPosition); //@} + + /// See vcl::PDFObjectContainer::createObject(). + sal_Int32 createObject() override; + /// See vcl::PDFObjectContainer::updateObject(). + bool updateObject(sal_Int32 n) override; + /// See vcl::PDFObjectContainer::writeBuffer(). + bool writeBuffer(const void* pBuffer, sal_uInt64 nBytes) override; }; } // namespace pdfio diff --git a/include/vcl/filter/pdfobjectcontainer.hxx b/include/vcl/filter/pdfobjectcontainer.hxx new file mode 100644 index 000000000000..ca4898737e10 --- /dev/null +++ b/include/vcl/filter/pdfobjectcontainer.hxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sal/types.h> + +namespace vcl +{ +/// Allows creating, updating and writing PDF objects in a container. +class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI PDFObjectContainer +{ +public: + /* adds an entry to m_aObjects and returns its index+1, + * sets the offset to ~0 + */ + virtual sal_Int32 createObject() = 0; + /* sets the offset of object n to the current position of output file+1 + */ + virtual bool updateObject(sal_Int32 n) = 0; + + // Write pBuffer to the end of the output. + virtual bool writeBuffer(const void* pBuffer, sal_uInt64 nBytes) = 0; + +protected: + ~PDFObjectContainer() noexcept = default; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |