1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <com/sun/star/i18n/ForbiddenCharacters.hpp>
26 #include <o3tl/sorted_vector.hxx>
42 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
43 struct ForbiddenCharacters
; ///< comes from the I18N UNO interface
46 #include <swtypes.hxx>
49 /** provides some methods for generic operations on lists that contain
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
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
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
84 class SwCharFmts
: public std::vector
<SwCharFmt
*>, public SwFmtsBase
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
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
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
*> {
118 /// the destructor will free all objects still in the vector
120 sal_uInt16
GetPos(const SwFieldType
* pFieldType
) const;
121 void dumpAsXml(xmlTextWriterPtr w
);
124 class SwTOXTypes
: public std::vector
<SwTOXType
*> {
126 /// the destructor will free all objects still in the vector
128 sal_uInt16
GetPos(const SwTOXType
* pTOXType
) const;
131 class SW_DLLPUBLIC SwNumRuleTbl
: public std::vector
<SwNumRule
*> {
133 /// the destructor will free all objects still in the vector
135 sal_uInt16
GetPos(const SwNumRule
* pRule
) const;
138 struct CompareSwRedlineTbl
140 bool operator()(SwRedline
* const &lhs
, SwRedline
* const &rhs
) const;
143 : public o3tl::sorted_vector
<SwRedline
*, CompareSwRedlineTbl
,
144 o3tl::find_partialorder_ptrequals
>
150 class SwRedlineTbl
: private _SwRedlineTbl
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
*> {
182 /// the destructor will free all objects still in the set
186 class SwOLENodes
: public std::vector
<SwOLENode
*> {};
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */