LCOV - code coverage report
Current view: top level - sw/source/core/inc - mvsave.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 8 12 66.7 %
Date: 2014-11-03 Functions: 7 12 58.3 %
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_MVSAVE_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_MVSAVE_HXX
      21             : 
      22             : #include <vcl/keycod.hxx>
      23             : #include <IDocumentMarkAccess.hxx>
      24             : #include <vector>
      25             : #include <deque>
      26             : 
      27             : namespace sfx2 {
      28             :     class MetadatableUndo;
      29             : }
      30             : 
      31             : class SvNumberFormatter;
      32             : class SwDoc;
      33             : class SwFmtAnchor;
      34             : class SwFrmFmt;
      35             : class SwIndex;
      36             : class SwNodeIndex;
      37             : class SwNodeRange;
      38             : class SwPaM;
      39             : class SwNode;
      40             : struct SwPosition;
      41             : 
      42             : namespace sw { namespace mark
      43             : {
      44             :     class IMark;
      45             : 
      46           0 :     class SaveBookmark
      47             :     {
      48             :         public:
      49             :             SaveBookmark(bool bSavePos,
      50             :                 bool bSaveOtherPos,
      51             :                 const ::sw::mark::IMark& rBkmk,
      52             :                 const SwNodeIndex& rMvPos,
      53             :                 const SwIndex* pIdx =0);
      54             :             void SetInDoc(SwDoc* pDoc,
      55             :                 const SwNodeIndex&,
      56             :                 const SwIndex* pIdx =0);
      57             :             IDocumentMarkAccess::MarkType GetOriginalBkmType() const
      58             :                 { return m_eOrigBkmType; }
      59             : 
      60             :         private:
      61             :             OUString m_aName;
      62             :             OUString m_aShortName;
      63             :             vcl::KeyCode m_aCode;
      64             :             bool m_bSavePos;
      65             :             bool m_bSaveOtherPos;
      66             :             IDocumentMarkAccess::MarkType m_eOrigBkmType;
      67             :             sal_uLong m_nNode1;
      68             :             sal_uLong m_nNode2;
      69             :             sal_Int32 m_nCntnt1;
      70             :             sal_Int32 m_nCntnt2;
      71             :             ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo;
      72             :     };
      73             : 
      74             :     /// Takes care of storing relevant attributes of an SwTxtNode before split, then restore them on the new node.
      75        7066 :     class CntntIdxStore
      76             :     {
      77             :         public:
      78             :             virtual void Clear() =0;
      79             :             virtual bool Empty() =0;
      80             :             virtual void Save(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, bool bSaveFlySplit=false) =0;
      81             :             virtual void Restore(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false) =0;
      82             :             virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen) =0;
      83        7066 :             virtual ~CntntIdxStore() {};
      84             :             static boost::shared_ptr<CntntIdxStore> Create();
      85             :     };
      86             : }}
      87             : 
      88             : void _DelBookmarks(const SwNodeIndex& rStt,
      89             :     const SwNodeIndex& rEnd,
      90             :     ::std::vector< ::sw::mark::SaveBookmark> * SaveBkmk =0,
      91             :     const SwIndex* pSttIdx =0,
      92             :     const SwIndex* pEndIdx =0);
      93             : 
      94             : /** data structure to temporarily hold fly anchor positions relative to some
      95             :  *  location. */
      96             : struct _SaveFly
      97             : {
      98             :     sal_uLong nNdDiff;      /// relative node difference
      99             :     SwFrmFmt* pFrmFmt;      /// the fly's frame format
     100             :     bool bInsertPosition;   /// if true, anchor _at_ insert position
     101             : 
     102           0 :     _SaveFly( sal_uLong nNodeDiff, SwFrmFmt* pFmt, bool bInsert )
     103           0 :         : nNdDiff( nNodeDiff ), pFrmFmt( pFmt ), bInsertPosition( bInsert )
     104           0 :     { }
     105             : };
     106             : 
     107             : typedef ::std::deque< _SaveFly > _SaveFlyArr;
     108             : 
     109             : void _RestFlyInRange( _SaveFlyArr& rArr, const SwNodeIndex& rSttIdx,
     110             :                       const SwNodeIndex* pInsPos );
     111             : void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr );
     112             : void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
     113             :                        _SaveFlyArr& rArr, bool bMoveAllFlys );
     114             : 
     115             : void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
     116             :                     const SwNodeIndex& rPtNdIdx );
     117             : 
     118             : class SwDataChanged
     119             : {
     120             :     const SwPaM* pPam;
     121             :     const SwPosition* pPos;
     122             :     SwDoc* pDoc;
     123             :     sal_uLong nNode;
     124             :     sal_Int32 nCntnt;
     125             : 
     126             : public:
     127             :     SwDataChanged( const SwPaM& rPam );
     128             :     SwDataChanged( SwDoc* pDoc, const SwPosition& rPos );
     129             :     ~SwDataChanged();
     130             : 
     131             :     sal_uLong GetNode() const           { return nNode; }
     132        3476 :     sal_Int32 GetCntnt() const { return nCntnt; }
     133             : };
     134             : 
     135             : /**
     136             :  * Function declarations so that everything below the CrsrShell can
     137             :  * move the Crsr once in a while.
     138             :  * These functions do not call the SwDoc::Corr methods!
     139             :  */
     140             : void PaMCorrAbs( const SwPaM& rRange,
     141             :                  const SwPosition& rNewPos );
     142             : 
     143             : /// Sets all PaMs in OldNode to relative Pos
     144             : void PaMCorrRel( const SwNodeIndex &rOldNode,
     145             :                  const SwPosition &rNewPos,
     146             :                  const sal_Int32 nOffset = 0 );
     147             : 
     148             : /**
     149             :  * Helper to copy paragraph-bound Flys.
     150             :  * By sorting by order number, we try to retain the layout.
     151             :  */
     152             : class _ZSortFly
     153             : {
     154             :     const SwFrmFmt* pFmt;
     155             :     const SwFmtAnchor* pAnchor;
     156             :     sal_uInt32 nOrdNum;
     157             : 
     158             : public:
     159             :     _ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAnchor,
     160             :                 sal_uInt32 nArrOrdNum );
     161             :     _ZSortFly& operator=( const _ZSortFly& rCpy )
     162             :     {
     163             :         pFmt = rCpy.pFmt, pAnchor = rCpy.pAnchor, nOrdNum = rCpy.nOrdNum;
     164             :         return *this;
     165             :     }
     166             : 
     167             :     bool operator==( const _ZSortFly& ) const { return false; }
     168        1546 :     bool operator<( const _ZSortFly& rCmp ) const
     169        1546 :         { return nOrdNum < rCmp.nOrdNum; }
     170             : 
     171        8416 :     const SwFrmFmt* GetFmt() const              { return pFmt; }
     172         840 :     const SwFmtAnchor* GetAnchor() const        { return pAnchor; }
     173             : };
     174             : 
     175             : class SwTblNumFmtMerge
     176             : {
     177             :     SvNumberFormatter* pNFmt;
     178             : public:
     179             :     SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest );
     180             :     ~SwTblNumFmtMerge();
     181             : };
     182             : 
     183             : class _SaveRedlEndPosForRestore
     184             : {
     185             :     std::vector<SwPosition*>* pSavArr;
     186             :     SwNodeIndex* pSavIdx;
     187             :     sal_Int32 nSavCntnt;
     188             : 
     189             :     void _Restore();
     190             : public:
     191             :     _SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx, sal_Int32 nCntnt );
     192             :     ~_SaveRedlEndPosForRestore();
     193         954 :     void Restore() { if( pSavArr ) _Restore(); }
     194             : };
     195             : 
     196             : #endif // INCLUDED_SW_SOURCE_CORE_INC_MVSAVE_HXX
     197             : 
     198             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10