1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #ifndef INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
11 #define INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
14 #include <tools/gen.hxx>
15 #include <tools/stream.hxx>
16 #include <tools/color.hxx>
17 #include <vcl/graph.hxx>
18 #include <basegfx/range/b2drectangle.hxx>
19 #include <com/sun/star/util/DateTime.hpp>
21 #include <vcl/pdf/PDFAnnotationSubType.hxx>
22 #include <vcl/pdf/PDFAnnotationMarker.hxx>
24 namespace com::sun::star::uno
26 template <typename
> class Sequence
;
32 /// Fills the rBitmaps vector with rendered pages.
33 VCL_DLLPUBLIC
size_t RenderPDFBitmaps(const void* pBuffer
, int nSize
,
34 std::vector
<BitmapEx
>& rBitmaps
, size_t nFirstPage
= 0,
35 int nPages
= 1, const basegfx::B2DTuple
* pSizeHint
= nullptr);
37 /// Imports a PDF stream into rGraphic as VectorGraphicData.
38 VCL_DLLPUBLIC
bool ImportPDF(SvStream
& rStream
, Graphic
& rGraphic
);
40 struct PDFGraphicAnnotation
45 basegfx::B2DRectangle maRectangle
; // In HMM
46 css::util::DateTime maDateTime
;
50 pdf::PDFAnnotationSubType meSubType
;
51 std::shared_ptr
<pdf::PDFAnnotationMarker
> mpMarker
;
54 class PDFGraphicResult
60 std::vector
<PDFGraphicAnnotation
> maAnnotations
;
63 PDFGraphicResult(Graphic aGraphic
, Size
const& rSize
,
64 std::vector
<PDFGraphicAnnotation
> aAnnotations
)
65 : maGraphic(std::move(aGraphic
))
67 , maAnnotations(std::move(aAnnotations
))
71 const Graphic
& GetGraphic() const { return maGraphic
; }
72 const Size
& GetSize() const { return maSize
; }
73 const std::vector
<PDFGraphicAnnotation
>& GetAnnotations() const { return maAnnotations
; }
76 /// Import PDF as Graphic images (1 per page), but not loaded yet.
77 /// Returns the number of pages read.
78 VCL_DLLPUBLIC
size_t ImportPDFUnloaded(const OUString
& rURL
,
79 std::vector
<PDFGraphicResult
>& rGraphics
);
82 #endif // INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */