LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - docary.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 26 84.6 %
Date: 2012-12-27 Functions: 27 33 81.8 %
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 _DOCARY_HXX
      20             : #define _DOCARY_HXX
      21             : 
      22             : #include <com/sun/star/i18n/ForbiddenCharacters.hpp>
      23             : #include <vector>
      24             : #include <set>
      25             : #include <algorithm>
      26             : #include <o3tl/sorted_vector.hxx>
      27             : 
      28             : class SwFieldType;
      29             : class SwFmt;
      30             : class SwFrmFmt;
      31             : class SwCharFmt;
      32             : class SwTOXType;
      33             : class SwUndo;
      34             : class SwSectionFmt;
      35             : class SwNumRule;
      36             : class SwRedline;
      37             : class SwUnoCrsr;
      38             : class SwOLENode;
      39             : class SwTxtFmtColl;
      40             : class SwGrfFmtColl;
      41             : 
      42             : namespace com { namespace sun { namespace star { namespace i18n {
      43             :     struct ForbiddenCharacters;    ///< comes from the I18N UNO interface
      44             : }}}}
      45             : 
      46             : #include <swtypes.hxx>
      47             : 
      48             : /** provides some methods for generic operations on lists that contain
      49             : SwFmt* subclasses. */
      50        2278 : class SwFmtsBase
      51             : {
      52             : public:
      53             :     virtual size_t GetFmtCount() const = 0;
      54             :     virtual SwFmt* GetFmt(size_t idx) const = 0;
      55             :     virtual ~SwFmtsBase() = 0;
      56             : };
      57             : 
      58         276 : class SwGrfFmtColls : public std::vector<SwGrfFmtColl*>, public SwFmtsBase
      59             : {
      60             : public:
      61           1 :     virtual size_t GetFmtCount() const { return size(); }
      62           2 :     virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
      63             :     sal_uInt16 GetPos(const SwGrfFmtColl* pFmt) const;
      64             :     /// free's any remaining child objects
      65         204 :     virtual ~SwGrfFmtColls() {}
      66             : };
      67             : 
      68             : /// Specific frame formats (frames, DrawObjects).
      69        1174 : class SW_DLLPUBLIC SwFrmFmts : public std::vector<SwFrmFmt*>, public SwFmtsBase
      70             : {
      71             : public:
      72        3586 :     virtual size_t GetFmtCount() const { return size(); }
      73        2535 :     virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
      74             :     sal_uInt16 GetPos(const SwFrmFmt* pFmt) const;
      75             :     bool Contains(const SwFrmFmt* pFmt) const;
      76             :     /// free's any remaining child objects
      77             :     virtual ~SwFrmFmts();
      78             : };
      79             : 
      80         276 : class SwCharFmts : public std::vector<SwCharFmt*>, public SwFmtsBase
      81             : {
      82             : public:
      83       65777 :     virtual size_t GetFmtCount() const { return size(); }
      84       63575 :     virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
      85             :     sal_uInt16 GetPos(const SwCharFmt* pFmt) const;
      86             :     bool Contains(const SwCharFmt* pFmt) const;
      87             :     /// free's any remaining child objects
      88             :     virtual ~SwCharFmts();
      89             : };
      90             : 
      91         276 : class SwTxtFmtColls : public std::vector<SwTxtFmtColl*>, public SwFmtsBase
      92             : {
      93             : public:
      94      344481 :     virtual size_t GetFmtCount() const { return size(); }
      95      333141 :     virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
      96             :     sal_uInt16 GetPos(const SwTxtFmtColl* pFmt) const;
      97         204 :     virtual ~SwTxtFmtColls() {}
      98             : };
      99             : 
     100             : /// Array of Undo-history.
     101         276 : class SW_DLLPUBLIC SwSectionFmts : public std::vector<SwSectionFmt*>, public SwFmtsBase
     102             : {
     103             : public:
     104           0 :     virtual size_t GetFmtCount() const { return size(); }
     105           0 :     virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
     106             :     sal_uInt16 GetPos(const SwSectionFmt* pFmt) const;
     107             :     bool Contains(const SwSectionFmt* pFmt) const;
     108             :     /// free's any remaining child objects
     109             :     virtual ~SwSectionFmts();
     110             : };
     111             : 
     112         276 : class SwFldTypes : public std::vector<SwFieldType*> {
     113             : public:
     114             :     /// the destructor will free all objects still in the vector
     115             :     ~SwFldTypes();
     116             :     sal_uInt16 GetPos(const SwFieldType* pFieldType) const;
     117             : };
     118             : 
     119         276 : class SwTOXTypes : public std::vector<SwTOXType*> {
     120             : public:
     121             :     /// the destructor will free all objects still in the vector
     122             :     ~SwTOXTypes();
     123             :     sal_uInt16 GetPos(const SwTOXType* pTOXType) const;
     124             : };
     125             : 
     126         308 : class SW_DLLPUBLIC SwNumRuleTbl : public std::vector<SwNumRule*> {
     127             : public:
     128             :     /// the destructor will free all objects still in the vector
     129             :     ~SwNumRuleTbl();
     130             :     sal_uInt16 GetPos(const SwNumRule* pRule) const;
     131             : };
     132             : 
     133             : struct CompareSwRedlineTbl
     134             : {
     135             :     bool operator()(SwRedline* const &lhs, SwRedline* const &rhs) const;
     136             : };
     137         276 : class _SwRedlineTbl
     138             :     : public o3tl::sorted_vector<SwRedline*, CompareSwRedlineTbl,
     139             :                 o3tl::find_partialorder_ptrequals>
     140             : {
     141             : public:
     142             :     ~_SwRedlineTbl();
     143             : };
     144             : 
     145         378 : class SwRedlineTbl : private _SwRedlineTbl
     146             : {
     147             : public:
     148           0 :     bool Contains(const SwRedline* p) const { return find(const_cast<SwRedline* const>(p)) != end(); }
     149             :     sal_uInt16 GetPos(const SwRedline* p) const;
     150             : 
     151             :     bool Insert( SwRedline* p, bool bIns = true );
     152             :     bool Insert( SwRedline* p, sal_uInt16& rInsPos, bool bIns = true );
     153             :     bool InsertWithValidRanges( SwRedline* p, sal_uInt16* pInsPos = 0 );
     154             : 
     155             :     void Remove( sal_uInt16 nPos );
     156             :     bool Remove( const SwRedline* p );
     157             :     void DeleteAndDestroy( sal_uInt16 nPos, sal_uInt16 nLen = 1 );
     158             :     void DeleteAndDestroyAll();
     159             : 
     160             :     /** Search next or previous Redline with the same Seq. No.
     161             :        Search can be restricted via Lookahaed.
     162             :        Using 0 or USHRT_MAX makes search the whole array. */
     163             :     sal_uInt16 FindNextOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
     164             :     sal_uInt16 FindPrevOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
     165             :     sal_uInt16 FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
     166             :                             sal_uInt16 nLookahead = 20 ) const;
     167             :     sal_uInt16 FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
     168             :                             sal_uInt16 nLookahead = 20 ) const;
     169             : 
     170             :     using _SwRedlineTbl::size;
     171             :     using _SwRedlineTbl::operator[];
     172             :     using _SwRedlineTbl::empty;
     173             : };
     174             : 
     175         276 : class SwUnoCrsrTbl : public std::set<SwUnoCrsr*> {
     176             : public:
     177             :     /// the destructor will free all objects still in the set
     178             :     ~SwUnoCrsrTbl();
     179             : };
     180             : 
     181           0 : class SwOLENodes : public std::vector<SwOLENode*> {};
     182             : 
     183             : 
     184             : #endif  //_DOCARY_HXX
     185             : 
     186             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10