LCOV - code coverage report
Current view: top level - sw/source/core/inc - sortedobjs.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 4 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : #ifndef INCLUDED_SW_SOURCE_CORE_INC_SORTEDOBJS_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_SORTEDOBJS_HXX
      21             : 
      22             : #include <sal/types.h>
      23             : #include <vector>
      24             : 
      25             : class SwAnchoredObject;
      26             : 
      27             : /** class for collecting anchored objects
      28             : 
      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 != SURROUND_THROUGHT and not in hell layer,
      38             :         2: wrapping style = SURROUND_THROUGHT 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(..)>
      47             : */
      48             : class SwSortedObjs
      49             : {
      50             :     private:
      51             :         std::vector< SwAnchoredObject* > maSortedObjLst;
      52             : 
      53             :     public:
      54             :         typedef std::vector<SwAnchoredObject*>::const_iterator const_iterator;
      55             :         SwSortedObjs();
      56             :         ~SwSortedObjs();
      57             : 
      58             :         size_t size() const;
      59             : 
      60             :         /** direct access to the entries
      61             : 
      62             :             @param _nIndex
      63             :             input parameter - index of entry, valid value range [0..size()-1]
      64             :         */
      65             :         SwAnchoredObject* operator[]( size_t _nIndex ) const;
      66         213 :         const_iterator begin() const
      67         213 :             { return maSortedObjLst.cbegin(); };
      68         213 :         const_iterator end() const
      69         213 :             { return maSortedObjLst.cend(); };
      70             : 
      71             :         bool Insert( SwAnchoredObject& _rAnchoredObj );
      72             : 
      73             :         bool Remove( SwAnchoredObject& _rAnchoredObj );
      74             : 
      75             :         bool Contains( const SwAnchoredObject& _rAnchoredObj ) const;
      76             : 
      77             :         /** method to update the position of the given anchored object in the
      78             :             sorted list
      79             : 
      80             :             @return boolean, indicating success of the update.
      81             :         */
      82             :         bool Update(SwAnchoredObject& _rAnchoredObj);
      83             :         void UpdateAll();
      84             : 
      85             :         /** Position of object <_rAnchoredObj> in sorted list
      86             : 
      87             :             Returns the number of the list position of object <_rAnchoredObj>.
      88             :             Returns <size()>, if object isn't contained in list.
      89             : 
      90             :             @return size_t
      91             :             Number of the list position of object <_rAnchoredObj>
      92             :         */
      93             :         size_t ListPosOf( const SwAnchoredObject& _rAnchoredObj ) const;
      94             : 
      95             :         bool is_sorted() const;
      96             : };
      97             : 
      98             : #endif
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11