fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sw / inc / docary.hxx
blob6b9636ee27fdaeb8fe1e5719583a522644c7f305
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 .
19 #ifndef _DOCARY_HXX
20 #define _DOCARY_HXX
22 #include <com/sun/star/i18n/ForbiddenCharacters.hpp>
23 #include <vector>
24 #include <set>
25 #include <algorithm>
26 #include <o3tl/sorted_vector.hxx>
28 class SwFieldType;
29 class SwFmt;
30 class SwFrmFmt;
31 class SwCharFmt;
32 class SwTOXType;
33 class SwUndo;
34 class SwSectionFmt;
35 class SwNumRule;
36 class SwRedline;
37 class SwUnoCrsr;
38 class SwOLENode;
39 class SwTxtFmtColl;
40 class SwGrfFmtColl;
42 namespace com { namespace sun { namespace star { namespace i18n {
43 struct ForbiddenCharacters; ///< comes from the I18N UNO interface
44 }}}}
46 #include <swtypes.hxx>
47 #include <ndarr.hxx>
49 /** provides some methods for generic operations on lists that contain
50 SwFmt* subclasses. */
51 class SwFmtsBase
53 public:
54 virtual size_t GetFmtCount() const = 0;
55 virtual SwFmt* GetFmt(size_t idx) const = 0;
56 virtual ~SwFmtsBase() = 0;
59 class SwGrfFmtColls : public std::vector<SwGrfFmtColl*>, public SwFmtsBase
61 public:
62 virtual size_t GetFmtCount() const { return size(); }
63 virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
64 sal_uInt16 GetPos(const SwGrfFmtColl* pFmt) const;
65 /// free's any remaining child objects
66 virtual ~SwGrfFmtColls() {}
69 /// stupid base class to work around MSVC dllexport mess
70 class SAL_DLLPUBLIC_TEMPLATE SwFrmFmts_Base : public std::vector<SwFrmFmt*> {};
72 /// Specific frame formats (frames, DrawObjects).
73 class SW_DLLPUBLIC SwFrmFmts : public SwFrmFmts_Base, public SwFmtsBase
75 public:
76 virtual size_t GetFmtCount() const { return size(); }
77 virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
78 sal_uInt16 GetPos(const SwFrmFmt* pFmt) const;
79 bool Contains(const SwFrmFmt* pFmt) const;
80 /// free's any remaining child objects
81 virtual ~SwFrmFmts();
84 class SwCharFmts : public std::vector<SwCharFmt*>, public SwFmtsBase
86 public:
87 virtual size_t GetFmtCount() const { return size(); }
88 virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
89 sal_uInt16 GetPos(const SwCharFmt* pFmt) const;
90 bool Contains(const SwCharFmt* pFmt) const;
91 /// free's any remaining child objects
92 virtual ~SwCharFmts();
95 class SwTxtFmtColls : public std::vector<SwTxtFmtColl*>, public SwFmtsBase
97 public:
98 virtual size_t GetFmtCount() const { return size(); }
99 virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
100 sal_uInt16 GetPos(const SwTxtFmtColl* pFmt) const;
101 virtual ~SwTxtFmtColls() {}
104 /// Array of Undo-history.
105 class SW_DLLPUBLIC SwSectionFmts : public std::vector<SwSectionFmt*>, public SwFmtsBase
107 public:
108 virtual size_t GetFmtCount() const { return size(); }
109 virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
110 sal_uInt16 GetPos(const SwSectionFmt* pFmt) const;
111 bool Contains(const SwSectionFmt* pFmt) const;
112 /// free's any remaining child objects
113 virtual ~SwSectionFmts();
116 class SwFldTypes : public std::vector<SwFieldType*> {
117 public:
118 /// the destructor will free all objects still in the vector
119 ~SwFldTypes();
120 sal_uInt16 GetPos(const SwFieldType* pFieldType) const;
121 void dumpAsXml(xmlTextWriterPtr w);
124 class SwTOXTypes : public std::vector<SwTOXType*> {
125 public:
126 /// the destructor will free all objects still in the vector
127 ~SwTOXTypes();
128 sal_uInt16 GetPos(const SwTOXType* pTOXType) const;
131 class SW_DLLPUBLIC SwNumRuleTbl : public std::vector<SwNumRule*> {
132 public:
133 /// the destructor will free all objects still in the vector
134 ~SwNumRuleTbl();
135 sal_uInt16 GetPos(const SwNumRule* pRule) const;
138 struct CompareSwRedlineTbl
140 bool operator()(SwRedline* const &lhs, SwRedline* const &rhs) const;
142 class _SwRedlineTbl
143 : public o3tl::sorted_vector<SwRedline*, CompareSwRedlineTbl,
144 o3tl::find_partialorder_ptrequals>
146 public:
147 ~_SwRedlineTbl();
150 class SwRedlineTbl : private _SwRedlineTbl
152 public:
153 bool Contains(const SwRedline* p) const { return find(const_cast<SwRedline* const>(p)) != end(); }
154 sal_uInt16 GetPos(const SwRedline* p) const;
156 bool Insert( SwRedline* p, bool bIns = true );
157 bool Insert( SwRedline* p, sal_uInt16& rInsPos, bool bIns = true );
158 bool InsertWithValidRanges( SwRedline* p, sal_uInt16* pInsPos = 0 );
160 void Remove( sal_uInt16 nPos );
161 bool Remove( const SwRedline* p );
162 void DeleteAndDestroy( sal_uInt16 nPos, sal_uInt16 nLen = 1 );
163 void DeleteAndDestroyAll();
165 /** Search next or previous Redline with the same Seq. No.
166 Search can be restricted via Lookahaed.
167 Using 0 or USHRT_MAX makes search the whole array. */
168 sal_uInt16 FindNextOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
169 sal_uInt16 FindPrevOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
170 sal_uInt16 FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
171 sal_uInt16 nLookahead = 20 ) const;
172 sal_uInt16 FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
173 sal_uInt16 nLookahead = 20 ) const;
175 using _SwRedlineTbl::size;
176 using _SwRedlineTbl::operator[];
177 using _SwRedlineTbl::empty;
180 class SwUnoCrsrTbl : public std::set<SwUnoCrsr*> {
181 public:
182 /// the destructor will free all objects still in the set
183 ~SwUnoCrsrTbl();
186 class SwOLENodes : public std::vector<SwOLENode*> {};
189 #endif //_DOCARY_HXX
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */