LCOV - code coverage report
Current view: top level - sw/inc - docary.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 29 32 90.6 %
Date: 2014-11-03 Functions: 36 40 90.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_INC_DOCARY_HXX
      20             : #define INCLUDED_SW_INC_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 SwRangeRedline;
      37             : class SwExtraRedline;
      38             : class SwUnoCrsr;
      39             : class SwOLENode;
      40             : class SwTxtFmtColl;
      41             : class SwGrfFmtColl;
      42             : class SwTable;
      43             : class SwTableLine;
      44             : class SwTableBox;
      45             : 
      46             : namespace com { namespace sun { namespace star { namespace i18n {
      47             :     struct ForbiddenCharacters;    ///< comes from the I18N UNO interface
      48             : }}}}
      49             : 
      50             : #include <swtypes.hxx>
      51             : #include <ndarr.hxx>
      52             : 
      53             : /** provides some methods for generic operations on lists that contain
      54             : SwFmt* subclasses. */
      55       41774 : class SwFmtsBase
      56             : {
      57             : public:
      58             :     virtual size_t GetFmtCount() const = 0;
      59             :     virtual SwFmt* GetFmt(size_t idx) const = 0;
      60             :     virtual ~SwFmtsBase() = 0;
      61             : };
      62             : 
      63        5052 : class SwGrfFmtColls : public SwFmtsBase
      64             : {
      65             : private:
      66             :     std::vector<SwGrfFmtColl*> mvColls;
      67             : 
      68             : public:
      69         278 :     virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
      70         556 :     virtual SwFmt* GetFmt(size_t idx) const SAL_OVERRIDE { return (SwFmt*)operator[](idx); }
      71        5361 :     size_t size() const { return mvColls.size(); }
      72         556 :     SwGrfFmtColl *operator[](size_t idx) const { return mvColls[idx]; }
      73        5052 :     void push_back(SwGrfFmtColl* pColl) { mvColls.push_back(pColl); }
      74             :     void DeleteAndDestroy(int nStartIdx, int nEndIdx);
      75             :     sal_uInt16 GetPos(const SwGrfFmtColl* pFmt) const;
      76             :     /// free's any remaining child objects
      77       10090 :     virtual ~SwGrfFmtColls() {}
      78             : };
      79             : 
      80             : /// stupid base class to work around MSVC dllexport mess
      81       43091 : class SAL_DLLPUBLIC_TEMPLATE SwFrmFmts_Base : public std::vector<SwFrmFmt*> {};
      82             : 
      83             : /// Specific frame formats (frames, DrawObjects).
      84       21556 : class SW_DLLPUBLIC SwFrmFmts : public SwFrmFmts_Base, public SwFmtsBase
      85             : {
      86             : public:
      87      116938 :     virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
      88      108899 :     virtual SwFmt* GetFmt(size_t idx) const SAL_OVERRIDE { return (SwFmt*)operator[](idx); }
      89             :     sal_uInt16 GetPos(const SwFrmFmt* pFmt) const;
      90             :     bool Contains(const SwFrmFmt* pFmt) const;
      91             :     void dumpAsXml(xmlTextWriterPtr w, const char* pName) const;
      92             :     /// free's any remaining child objects
      93             :     virtual ~SwFrmFmts();
      94             : };
      95             : 
      96        5052 : class SwCharFmts : public std::vector<SwCharFmt*>, public SwFmtsBase
      97             : {
      98             : public:
      99     7254972 :     virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
     100     7312620 :     virtual SwFmt* GetFmt(size_t idx) const SAL_OVERRIDE { return (SwFmt*)operator[](idx); }
     101             :     sal_uInt16 GetPos(const SwCharFmt* pFmt) const;
     102             :     bool Contains(const SwCharFmt* pFmt) const;
     103             :     void dumpAsXml(xmlTextWriterPtr w) const;
     104             :     /// free's any remaining child objects
     105             :     virtual ~SwCharFmts();
     106             : };
     107             : 
     108        5052 : class SwTxtFmtColls : public std::vector<SwTxtFmtColl*>, public SwFmtsBase
     109             : {
     110             : public:
     111    22246189 :     virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
     112    22518745 :     virtual SwFmt* GetFmt(size_t idx) const SAL_OVERRIDE { return (SwFmt*)operator[](idx); }
     113             :     sal_uInt16 GetPos(const SwTxtFmtColl* pFmt) const;
     114             :     void dumpAsXml(xmlTextWriterPtr w) const;
     115       10090 :     virtual ~SwTxtFmtColls() {}
     116             : };
     117             : 
     118             : /// Array of Undo-history.
     119        5062 : class SW_DLLPUBLIC SwSectionFmts : public std::vector<SwSectionFmt*>, public SwFmtsBase
     120             : {
     121             : public:
     122           0 :     virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
     123           0 :     virtual SwFmt* GetFmt(size_t idx) const SAL_OVERRIDE { return (SwFmt*)operator[](idx); }
     124             :     sal_uInt16 GetPos(const SwSectionFmt* pFmt) const;
     125             :     bool Contains(const SwSectionFmt* pFmt) const;
     126             :     void dumpAsXml(xmlTextWriterPtr w) const;
     127             :     /// free's any remaining child objects
     128             :     virtual ~SwSectionFmts();
     129             : };
     130             : 
     131        5052 : class SwFldTypes : public std::vector<SwFieldType*> {
     132             : public:
     133             :     /// the destructor will free all objects still in the vector
     134             :     ~SwFldTypes();
     135             :     sal_uInt16 GetPos(const SwFieldType* pFieldType) const;
     136             :     void dumpAsXml(xmlTextWriterPtr w) const;
     137             : };
     138             : 
     139        5052 : class SwTOXTypes : public std::vector<SwTOXType*> {
     140             : public:
     141             :     /// the destructor will free all objects still in the vector
     142             :     ~SwTOXTypes();
     143             :     sal_uInt16 GetPos(const SwTOXType* pTOXType) const;
     144             : };
     145             : 
     146        5332 : class SW_DLLPUBLIC SwNumRuleTbl : public std::vector<SwNumRule*> {
     147             : public:
     148             :     /// the destructor will free all objects still in the vector
     149             :     ~SwNumRuleTbl();
     150             :     sal_uInt16 GetPos(const SwNumRule* pRule) const;
     151             :     void dumpAsXml(xmlTextWriterPtr w) const;
     152             : };
     153             : 
     154             : struct CompareSwRedlineTbl
     155             : {
     156             :     bool operator()(SwRangeRedline* const &lhs, SwRangeRedline* const &rhs) const;
     157             : };
     158        5052 : class _SwRedlineTbl
     159             :     : public o3tl::sorted_vector<SwRangeRedline*, CompareSwRedlineTbl,
     160             :                 o3tl::find_partialorder_ptrequals>
     161             : {
     162             : public:
     163             :     ~_SwRedlineTbl();
     164             : };
     165             : 
     166       10097 : class SwRedlineTbl : private _SwRedlineTbl
     167             : {
     168             : public:
     169           0 :     bool Contains(const SwRangeRedline* p) const { return find(const_cast<SwRangeRedline* const>(p)) != end(); }
     170             :     sal_uInt16 GetPos(const SwRangeRedline* p) const;
     171             : 
     172             :     bool Insert( SwRangeRedline* p, bool bIns = true );
     173             :     bool Insert( SwRangeRedline* p, sal_uInt16& rInsPos, bool bIns = true );
     174             :     bool InsertWithValidRanges( SwRangeRedline* p, sal_uInt16* pInsPos = 0 );
     175             : 
     176             :     void Remove( sal_uInt16 nPos );
     177             :     bool Remove( const SwRangeRedline* p );
     178             :     void DeleteAndDestroy( sal_uInt16 nPos, sal_uInt16 nLen = 1 );
     179             :     void DeleteAndDestroyAll();
     180             : 
     181             :     void dumpAsXml(xmlTextWriterPtr w) const;
     182             : 
     183             :     /** Search next or previous Redline with the same Seq. No.
     184             :        Search can be restricted via Lookahaed.
     185             :        Using 0 or USHRT_MAX makes search the whole array. */
     186             :     sal_uInt16 FindNextOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
     187             :     sal_uInt16 FindPrevOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
     188             :     sal_uInt16 FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
     189             :                             sal_uInt16 nLookahead = 20 ) const;
     190             :     sal_uInt16 FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
     191             :                             sal_uInt16 nLookahead = 20 ) const;
     192             : 
     193             :     /**
     194             :      Find the redline at the given position.
     195             : 
     196             :      @param tableIndex position in SwRedlineTbl to start searching at, will be updated with the index of the returned
     197             :                        redline (or the next redline after the given position if not found)
     198             :      @param next true: redline starts at position and ends after, false: redline starts before position and ends at or after
     199             :     */
     200             :     const SwRangeRedline* FindAtPosition( const SwPosition& startPosition, sal_uInt16& tableIndex, bool next = true ) const;
     201             : 
     202             :     using _SwRedlineTbl::const_iterator;
     203             :     using _SwRedlineTbl::begin;
     204             :     using _SwRedlineTbl::end;
     205             :     using _SwRedlineTbl::size;
     206             :     using _SwRedlineTbl::operator[];
     207             :     using _SwRedlineTbl::empty;
     208             : };
     209             : 
     210             : /// Table that holds 'extra' redlines, such as 'table row insert\delete', 'paragraph moves' etc...
     211        5052 : class SwExtraRedlineTbl
     212             : {
     213             : private:
     214             :     std::vector<SwExtraRedline*>    m_aExtraRedlines;
     215             : 
     216             : public:
     217             :     ~SwExtraRedlineTbl();
     218             : 
     219             :     bool Insert( SwExtraRedline* p );
     220             : 
     221             :     void DeleteAndDestroy( sal_uInt16 nPos, sal_uInt16 nLen = 1 );
     222             :     void DeleteAndDestroyAll();
     223             : 
     224             :     void dumpAsXml(xmlTextWriterPtr w) const;
     225             : 
     226        6200 :     sal_uInt16 GetSize() const                              {     return m_aExtraRedlines.size();                }
     227          72 :     SwExtraRedline* GetRedline( sal_uInt16 uIndex ) const   {     return m_aExtraRedlines.operator[]( uIndex );  }
     228             :     bool IsEmpty() const                              {     return m_aExtraRedlines.empty();               }
     229             : 
     230             :     bool DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTable, bool bSaveInUndo, sal_uInt16 nRedlineTypeToDelete );
     231             :     bool DeleteTableRowRedline ( SwDoc* pDoc, const SwTableLine& rTableLine, bool bSaveInUndo, sal_uInt16 nRedlineTypeToDelete );
     232             :     bool DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& rTableBox, bool bSaveInUndo, sal_uInt16 nRedlineTypeToDelete );
     233             : };
     234             : 
     235        5052 : class SwUnoCrsrTbl : public std::set<SwUnoCrsr*> {
     236             : public:
     237             :     /// the destructor will free all objects still in the set
     238             :     ~SwUnoCrsrTbl();
     239             : };
     240             : 
     241             : typedef std::vector<SwOLENode*> SwOLENodes;
     242             : 
     243             : #endif // INCLUDED_SW_INC_DOCARY_HXX
     244             : 
     245             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10