Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _DOCARY_HXX
29 : : #define _DOCARY_HXX
30 : :
31 : : #include <com/sun/star/i18n/ForbiddenCharacters.hpp>
32 : : #include <vector>
33 : : #include <set>
34 : : #include <algorithm>
35 : : #include <o3tl/sorted_vector.hxx>
36 : :
37 : : class SwFieldType;
38 : : class SwFmt;
39 : : class SwFrmFmt;
40 : : class SwCharFmt;
41 : : class SwTOXType;
42 : : class SwUndo;
43 : : class SwSectionFmt;
44 : : class SwNumRule;
45 : : class SwRedline;
46 : : class SwUnoCrsr;
47 : : class SwOLENode;
48 : : class SwTxtFmtColl;
49 : : class SwGrfFmtColl;
50 : :
51 : : namespace com { namespace sun { namespace star { namespace i18n {
52 : : struct ForbiddenCharacters; // comes from the I18N UNO interface
53 : : }}}}
54 : :
55 : : #include <swtypes.hxx>
56 : :
57 : : // provides some methods for generic operations on lists that contain
58 : : // SwFmt* subclasses.
59 : 12563 : class SwFmtsBase
60 : : {
61 : : public:
62 : : virtual size_t GetFmtCount() const = 0;
63 : : virtual SwFmt* GetFmt(size_t idx) const = 0;
64 : : virtual ~SwFmtsBase() = 0;
65 : : };
66 : :
67 : 1549 : class SwGrfFmtColls : public std::vector<SwGrfFmtColl*>, public SwFmtsBase
68 : : {
69 : : public:
70 : 3 : virtual size_t GetFmtCount() const { return size(); }
71 : 6 : virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
72 : : sal_uInt16 GetPos(const SwGrfFmtColl* pFmt) const;
73 : : // free's any remaining child objects
74 [ + - # # ]: 2916 : virtual ~SwGrfFmtColls() {}
[ - + ]
75 : : };
76 : :
77 : : // Specific frame formats (frames, DrawObjects).
78 : 6367 : class SW_DLLPUBLIC SwFrmFmts : public std::vector<SwFrmFmt*>, public SwFmtsBase
79 : : {
80 : : public:
81 : 12490 : virtual size_t GetFmtCount() const { return size(); }
82 : 9004 : virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
83 : : sal_uInt16 GetPos(const SwFrmFmt* pFmt) const;
84 : : bool Contains(const SwFrmFmt* pFmt) const;
85 : : // free's any remaining child objects
86 : : virtual ~SwFrmFmts();
87 : : };
88 : :
89 : 1549 : class SwCharFmts : public std::vector<SwCharFmt*>, public SwFmtsBase
90 : : {
91 : : public:
92 : 62490 : virtual size_t GetFmtCount() const { return size(); }
93 : 60285 : virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
94 : : sal_uInt16 GetPos(const SwCharFmt* pFmt) const;
95 : : bool Contains(const SwCharFmt* pFmt) const;
96 : : // free's any remaining child objects
97 : : virtual ~SwCharFmts();
98 : : };
99 : :
100 : 1549 : class SwTxtFmtColls : public std::vector<SwTxtFmtColl*>, public SwFmtsBase
101 : : {
102 : : public:
103 : 361133 : virtual size_t GetFmtCount() const { return size(); }
104 : 364082 : virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
105 : : sal_uInt16 GetPos(const SwTxtFmtColl* pFmt) const;
106 [ + - # # ]: 2916 : virtual ~SwTxtFmtColls() {}
[ - + ]
107 : : };
108 : :
109 : : // Array of Undo-history.
110 : 1549 : class SW_DLLPUBLIC SwSectionFmts : public std::vector<SwSectionFmt*>, public SwFmtsBase
111 : : {
112 : : public:
113 : 0 : virtual size_t GetFmtCount() const { return size(); }
114 : 0 : virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
115 : : sal_uInt16 GetPos(const SwSectionFmt* pFmt) const;
116 : : bool Contains(const SwSectionFmt* pFmt) const;
117 : : // free's any remaining child objects
118 : : virtual ~SwSectionFmts();
119 : : };
120 : :
121 : 1549 : class SwFldTypes : public std::vector<SwFieldType*> {
122 : : public:
123 : : // the destructor will free all objects still in the vector
124 : : ~SwFldTypes();
125 : : sal_uInt16 GetPos(const SwFieldType* pFieldType) const;
126 : : };
127 : :
128 : 1549 : class SwTOXTypes : public std::vector<SwTOXType*> {
129 : : public:
130 : : // the destructor will free all objects still in the vector
131 : : ~SwTOXTypes();
132 : : sal_uInt16 GetPos(const SwTOXType* pTOXType) const;
133 : : };
134 : :
135 : 1654 : class SW_DLLPUBLIC SwNumRuleTbl : public std::vector<SwNumRule*> {
136 : : public:
137 : : // the destructor will free all objects still in the vector
138 : : ~SwNumRuleTbl();
139 : : sal_uInt16 GetPos(const SwNumRule* pRule) const;
140 : : };
141 : :
142 : : struct CompareSwRedlineTbl
143 : : {
144 : : bool operator()(SwRedline* const &lhs, SwRedline* const &rhs) const;
145 : : };
146 : 1549 : class _SwRedlineTbl
147 : : : public o3tl::sorted_vector<SwRedline*, CompareSwRedlineTbl,
148 : : o3tl::find_partialorder_ptrequals>
149 : : {
150 : : public:
151 : : ~_SwRedlineTbl();
152 : : };
153 : :
154 : 3007 : class SwRedlineTbl : private _SwRedlineTbl
155 : : {
156 : : public:
157 [ # # ][ # # ]: 0 : bool Contains(const SwRedline* p) const { return find(const_cast<SwRedline* const>(p)) != end(); }
158 : : sal_uInt16 GetPos(const SwRedline* p) const;
159 : :
160 : : bool Insert( SwRedline* p, bool bIns = true );
161 : : bool Insert( SwRedline* p, sal_uInt16& rInsPos, bool bIns = true );
162 : : bool InsertWithValidRanges( SwRedline* p, sal_uInt16* pInsPos = 0 );
163 : :
164 : : void Remove( sal_uInt16 nPos );
165 : : bool Remove( const SwRedline* p );
166 : : void DeleteAndDestroy( sal_uInt16 nPos, sal_uInt16 nLen = 1 );
167 : : void DeleteAndDestroyAll();
168 : :
169 : : // Search next or previous Redline with the same Seq. No.
170 : : // Search can be restricted via Lookahaed.
171 : : // Using 0 or USHRT_MAX makes search the whole array.
172 : : sal_uInt16 FindNextOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
173 : : sal_uInt16 FindPrevOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
174 : : sal_uInt16 FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
175 : : sal_uInt16 nLookahead = 20 ) const;
176 : : sal_uInt16 FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
177 : : sal_uInt16 nLookahead = 20 ) const;
178 : :
179 : : using _SwRedlineTbl::size;
180 : : using _SwRedlineTbl::operator[];
181 : : using _SwRedlineTbl::empty;
182 : : };
183 : :
184 : 1549 : class SwUnoCrsrTbl : public std::set<SwUnoCrsr*> {
185 : : public:
186 : : // the destructor will free all objects still in the set
187 : : ~SwUnoCrsrTbl();
188 : : };
189 : :
190 : 0 : class SwOLENodes : public std::vector<SwOLENode*> {};
191 : :
192 : :
193 : : #endif //_DOCARY_HXX
194 : :
195 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|