xref: /trunk/main/sw/source/core/inc/sortedobjs.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SORTEDOBJS_HXX
24 #define _SORTEDOBJS_HXX
25 class SwSortedObjsImpl;
26 class SwAnchoredObject;
27 
28 #include <sal/types.h>
29 
30 /** class for collecting anchored objects
31 
32     for #i28701#
33     Anchored objects can be inserted and deleted. The entries can be directly
34     accessed via index.
35     An anchored object is inserted sorted. The sort criteria are:
36     - anchor type
37       - order 1: to-page, 2: to-fly, 3: to-paragraph|to-character|as-character
38     - anchor node
39     - wrapping style (inclusive layer)
40       - order 1: wrapping style != SURROUND_THROUGHT and not in hell layer,
41         2: wrapping style = SURROUND_THROUGHT or in hell layer
42     - wrapping style influence
43       - order 1: NONE_SUCCESSIVE_POSITIONED, 2: NONE_CONCURRENT_POSITIONED
44     - again anchor type
45       - order 1: to-paragraph, 2: to-character, 3: as-character
46     - anchor node position
47     - internal anchor order number
48     If one of the sort criteria attributes of an anchored object changes,
49     the sorting has to be updated - use method <Update(..)>
50 
51     @author OD
52 */
53 class SwSortedObjs
54 {
55     private:
56         SwSortedObjsImpl* mpImpl;
57 
58     public:
59         SwSortedObjs();
60         ~SwSortedObjs();
61 
62         sal_uInt32 Count() const;
63 
64         /** direct access to the entries
65 
66             @param _nIndex
67             input parameter - index of entry, valid value range [0..Count()-1]
68 
69             @author OD
70         */
71         SwAnchoredObject* operator[]( sal_uInt32 _nIndex ) const;
72 
73         bool Insert( SwAnchoredObject& _rAnchoredObj );
74 
75         bool Remove( SwAnchoredObject& _rAnchoredObj );
76 
77         bool Contains( const SwAnchoredObject& _rAnchoredObj ) const;
78 
79         /** method to update the position of the given anchored object in the
80             sorted list
81 
82             OD 2004-07-01
83 
84             @author OD
85 
86             @return boolean, indicating success of the update.
87         */
88         bool Update( SwAnchoredObject& _rAnchoredObj );
89 
90         /** Position of object <_rAnchoredObj> in sorted list
91 
92             OD 2004-05-07
93             Returns the number of the list position of object <_rAnchoredObj>.
94             Returns <Count()>, if object isn't contained in list.
95 
96             @author OD
97 
98             @return sal_uInt32
99             Number of the list position of object <_rAnchoredObj>
100         */
101         sal_uInt32 ListPosOf( const SwAnchoredObject& _rAnchoredObj ) const;
102 };
103 
104 #endif
105