/src/libreoffice/include/vcl/VectorGraphicSearch.hxx
Line | Count | Source |
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 | | |
11 | | #pragma once |
12 | | |
13 | | #include <vcl/graph.hxx> |
14 | | #include <vcl/dllapi.h> |
15 | | |
16 | | #include <basegfx/range/b2drectangle.hxx> |
17 | | |
18 | | #include <memory> |
19 | | |
20 | | class VectorGraphicData; |
21 | | namespace basegfx |
22 | | { |
23 | | class B2DSize; |
24 | | } |
25 | | |
26 | | enum class SearchStartPosition |
27 | | { |
28 | | Begin, |
29 | | End |
30 | | }; |
31 | | |
32 | | struct VCL_DLLPUBLIC VectorGraphicSearchOptions final |
33 | | { |
34 | | SearchStartPosition meStartPosition; |
35 | | bool mbMatchCase; |
36 | | bool mbMatchWholeWord; |
37 | | |
38 | | VectorGraphicSearchOptions() |
39 | 0 | : meStartPosition(SearchStartPosition::Begin) |
40 | 0 | , mbMatchCase(false) |
41 | 0 | , mbMatchWholeWord(false) |
42 | 0 | { |
43 | 0 | } |
44 | | |
45 | | VectorGraphicSearchOptions(SearchStartPosition eStartPosition, bool bMatchCase, |
46 | | bool bMatchWholeWord) |
47 | | : meStartPosition(eStartPosition) |
48 | | , mbMatchCase(bMatchCase) |
49 | | , mbMatchWholeWord(bMatchWholeWord) |
50 | 0 | { |
51 | 0 | } |
52 | | }; |
53 | | |
54 | | class VCL_DLLPUBLIC VectorGraphicSearch final |
55 | | { |
56 | | private: |
57 | | class Implementation; |
58 | | std::unique_ptr<Implementation> mpImplementation; |
59 | | Graphic maGraphic; |
60 | | |
61 | | bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData); |
62 | | |
63 | | public: |
64 | | VectorGraphicSearch(Graphic aGraphic); |
65 | | ~VectorGraphicSearch(); |
66 | | bool search(OUString const& rSearchString, |
67 | | VectorGraphicSearchOptions const& rOptions = VectorGraphicSearchOptions()); |
68 | | basegfx::B2DSize pageSize(); |
69 | | bool next(); |
70 | | bool previous(); |
71 | | int index(); |
72 | | std::vector<basegfx::B2DRectangle> getTextRectangles(); |
73 | | }; |
74 | | |
75 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |