Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / pamtyp.hxx
blobd8c1110dea8c4bacd17a7f968770ad9cc4249fc8
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_PAMTYP_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_PAMTYP_HXX
23 #include <unotools/textsearch.hxx>
25 #include <memory>
26 #include <optional>
28 class SwpHints;
29 struct SwPosition;
30 class SwPaM;
31 class SwTextAttr;
32 class SwFormat;
33 class SfxPoolItem;
34 class SwRootFrame;
35 class SwNode;
36 class SwNodeIndex;
37 class SwContentNode;
38 class SwContentIndex;
39 class SvxSearchItem;
40 enum class SwCursorSkipMode;
42 namespace i18nutil {
43 struct SearchOptions2;
46 // function prototypes for the move/find methods of SwPaM
48 void GoStartDoc( SwPosition*);
49 void GoEndDoc( SwPosition*);
50 void GoStartSection( SwPosition*);
51 void GoEndSection( SwPosition*);
52 void GoStartOfSection( SwPosition*);
53 void GoEndOfSection( SwPosition*);
54 const SwTextAttr* GetFrwrdTextHint( const SwpHints&, size_t&, sal_Int32 );
55 const SwTextAttr* GetBkwrdTextHint( const SwpHints&, size_t&, sal_Int32 );
57 bool GoNext(SwNode* pNd, SwContentIndex * pIdx, SwCursorSkipMode nMode );
58 bool GoPrevious(SwNode* pNd, SwContentIndex * pIdx, SwCursorSkipMode nMode );
59 SwContentNode* GoNextNds( SwNodeIndex * pIdx, bool );
60 SwContentNode* GoPreviousNds( SwNodeIndex * pIdx, bool );
61 SwContentNode* GoNextPos( SwPosition * pIdx, bool );
62 SwContentNode* GoPreviousPos( SwPosition * pIdx, bool );
64 // type definitions of functions
65 typedef bool (*GoNd)( SwNode*, SwContentIndex*, SwCursorSkipMode );
66 typedef SwContentNode* (*GoNds)( SwNodeIndex*, bool );
67 typedef SwContentNode* (*GoPos)( SwPosition*, bool );
68 typedef void (*GoDoc)( SwPosition* );
69 typedef void (*GoSection)( SwPosition* );
70 typedef bool (SwPosition::*CmpOp)( const SwPosition& ) const;
71 typedef const SwTextAttr* (*GetHint)( const SwpHints&, size_t&, sal_Int32 );
72 typedef bool (utl::TextSearch::*SearchText)( const OUString&, sal_Int32*,
73 sal_Int32*, css::util::SearchResult* );
74 typedef void (*MvSection)( SwPosition * );
76 struct SwMoveFnCollection
78 GoNd fnNd;
79 GoNds fnNds;
80 GoPos fnPos;
81 GoDoc fnDoc;
82 GoSection fnSections;
83 CmpOp fnCmpOp;
84 GetHint fnGetHint;
85 SearchText fnSearch;
86 MvSection fnSection;
89 // function prototype for searching
90 SwContentNode* GetNode(SwPaM&, bool&, SwMoveFnCollection const &,
91 bool bInReadOnly = false, SwRootFrame const* pLayout = nullptr);
93 namespace sw {
95 void MakeRegion(SwMoveFnCollection const & fnMove,
96 const SwPaM & rOrigRg, std::optional<SwPaM>& rDestinaton);
98 /// Search.
99 bool FindTextImpl(SwPaM & rSearchPam,
100 const i18nutil::SearchOptions2& rSearchOpt,
101 bool bSearchInNotes,
102 utl::TextSearch& rSText,
103 SwMoveFnCollection const & fnMove,
104 const SwPaM & rRegion, bool bInReadOnly,
105 SwRootFrame const* pLayout,
106 std::unique_ptr<SvxSearchItem>& xSearchItem);
107 bool FindFormatImpl(SwPaM & rSearchPam,
108 const SwFormat& rFormat,
109 SwMoveFnCollection const & fnMove,
110 const SwPaM & rRegion, bool bInReadOnly,
111 SwRootFrame const* pLayout);
112 bool FindAttrImpl(SwPaM & rSearchPam,
113 const SfxPoolItem& rAttr,
114 SwMoveFnCollection const & fnMove,
115 const SwPaM & rPam, bool bInReadOnly,
116 SwRootFrame const* pLayout);
118 } // namespace sw
120 #endif
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */