Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / sortedobjs.hxx
blob6d524f492802cd89b2715bc3bf5f5f85b5610787
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 INCLUDED_SW_SOURCE_CORE_INC_SORTEDOBJS_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_SORTEDOBJS_HXX
22 #include <vector>
23 #include <swdllapi.h>
25 class SwAnchoredObject;
27 /** class for collecting anchored objects
29 for #i28701#
30 Anchored objects can be inserted and deleted. The entries can be directly
31 accessed via index.
32 An anchored object is inserted sorted. The sort criteria are:
33 - anchor type
34 - order 1: to-page, 2: to-fly, 3: to-paragraph|to-character|as-character
35 - anchor node
36 - wrapping style (inclusive layer)
37 - order 1: wrapping style != css::text::WrapTextMode_THROUGH and not in hell layer,
38 2: wrapping style = css::text::WrapTextMode_THROUGH or in hell layer
39 - wrapping style influence
40 - order 1: NONE_SUCCESSIVE_POSITIONED, 2: NONE_CONCURRENT_POSITIONED
41 - again anchor type
42 - order 1: to-paragraph, 2: to-character, 3: as-character
43 - anchor node position
44 - internal anchor order number
45 If one of the sort criteria attributes of an anchored object changes,
46 the sorting has to be updated - use method <Update(..)>
48 class SW_DLLPUBLIC SwSortedObjs
50 private:
51 std::vector< SwAnchoredObject* > maSortedObjLst;
53 public:
54 typedef std::vector<SwAnchoredObject*>::const_iterator const_iterator;
55 SwSortedObjs();
56 ~SwSortedObjs();
58 size_t size() const;
60 /** direct access to the entries
62 @param _nIndex
63 input parameter - index of entry, valid value range [0..size()-1]
65 SwAnchoredObject* operator[]( size_t _nIndex ) const;
66 const_iterator begin() const
67 { return maSortedObjLst.cbegin(); };
68 const_iterator end() const
69 { return maSortedObjLst.cend(); };
71 bool Insert( SwAnchoredObject& _rAnchoredObj );
73 void Remove( SwAnchoredObject& _rAnchoredObj );
75 bool Contains( const SwAnchoredObject& _rAnchoredObj ) const;
77 /** method to update the position of the given anchored object in the
78 sorted list
80 @return boolean, indicating success of the update.
82 void Update(SwAnchoredObject& _rAnchoredObj);
83 void UpdateAll();
85 /** Position of object <_rAnchoredObj> in sorted list
87 Returns the number of the list position of object <_rAnchoredObj>.
88 Returns <size()>, if object isn't contained in list.
90 @return size_t
91 Number of the list position of object <_rAnchoredObj>
93 size_t ListPosOf( const SwAnchoredObject& _rAnchoredObj ) const;
95 bool is_sorted() const;
98 #endif
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */