LibreOffice Module vcl (master) 1
pdfobjectcontainer.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#pragma once
11
12#include <sal/types.h>
13#include <string_view>
14
15namespace vcl
16{
18class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI PDFObjectContainer
19{
20public:
21 /* adds an entry to m_aObjects and returns its index+1,
22 * sets the offset to ~0
23 */
24 virtual sal_Int32 createObject() = 0;
25 /* sets the offset of object n to the current position of output file+1
26 */
27 virtual bool updateObject(sal_Int32 n) = 0;
28
29 // Write pBuffer to the end of the output.
30 virtual bool writeBufferBytes(const void* pBuffer, sal_uInt64 nBytes) = 0;
31
32 // Utility method, reduces verbosity at call sites
33 bool writeBuffer(std::string_view aBuffer)
34 {
35 return writeBufferBytes(aBuffer.data(), aBuffer.size());
36 }
37
38 virtual void checkAndEnableStreamEncryption(sal_Int32 nObject) = 0;
39
40 virtual void disableStreamEncryption() = 0;
41
42protected:
43 ~PDFObjectContainer() noexcept = default;
44};
45}
46
47/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Allows creating, updating and writing PDF objects in a container.
virtual void checkAndEnableStreamEncryption(sal_Int32 nObject)=0
~PDFObjectContainer() noexcept=default
virtual bool updateObject(sal_Int32 n)=0
bool writeBuffer(std::string_view aBuffer)
virtual bool writeBufferBytes(const void *pBuffer, sal_uInt64 nBytes)=0
virtual sal_Int32 createObject()=0
virtual void disableStreamEncryption()=0
#define SAL_NO_VTABLE
std::unique_ptr< char[]> aBuffer