LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / include / vcl / pdfread.hxx
blob084bd3f913b5c759b403c40b9b2885d42d3c8281
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #ifndef INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
11 #define INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
13 #include <vector>
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;
28 class Bitmap;
30 namespace vcl
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 as a VectorGraphicData.
38 VCL_DLLPUBLIC bool
39 importPdfVectorGraphicData(SvStream& rStream,
40 std::shared_ptr<VectorGraphicData>& rVectorGraphicData);
42 /// Imports a PDF stream into rGraphic.
43 VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic);
45 struct PDFGraphicAnnotation
47 OUString maAuthor;
48 OUString maText;
50 basegfx::B2DRectangle maRectangle; // In HMM
51 css::util::DateTime maDateTime;
53 Color maColor;
55 pdf::PDFAnnotationSubType meSubType;
56 std::shared_ptr<pdf::PDFAnnotationMarker> mpMarker;
59 class PDFGraphicResult
61 Graphic maGraphic;
62 // Size in HMM
63 Size maSize;
65 std::vector<PDFGraphicAnnotation> maAnnotations;
67 public:
68 PDFGraphicResult(Graphic aGraphic, Size const& rSize,
69 std::vector<PDFGraphicAnnotation> aAnnotations)
70 : maGraphic(std::move(aGraphic))
71 , maSize(rSize)
72 , maAnnotations(std::move(aAnnotations))
76 const Graphic& GetGraphic() const { return maGraphic; }
77 const Size& GetSize() const { return maSize; }
78 const std::vector<PDFGraphicAnnotation>& GetAnnotations() const { return maAnnotations; }
81 /// Import PDF as Graphic images (1 per page), but not loaded yet.
82 /// Returns the number of pages read.
83 VCL_DLLPUBLIC size_t ImportPDFUnloaded(const OUString& rURL,
84 std::vector<PDFGraphicResult>& rGraphics);
87 #endif // INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */