LCOV - code coverage report
Current view: top level - sw/source/core/inc - mvsave.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 6 10 60.0 %
Date: 2014-04-11 Functions: 5 9 55.6 %
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             :             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             : 
      75             : #define SAVEFLY 1
      76             : #define SAVEFLY_SPLIT 2
      77             : 
      78             : void _DelBookmarks(const SwNodeIndex& rStt,
      79             :     const SwNodeIndex& rEnd,
      80             :     ::std::vector< ::sw::mark::SaveBookmark> * SaveBkmk =0,
      81             :     const SwIndex* pSttIdx =0,
      82             :     const SwIndex* pEndIdx =0);
      83             : void _SaveCntntIdx( SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
      84             :                     std::vector<sal_uLong>& rSaveArr, sal_uInt8 nSaveFly = 0 );
      85             : void _RestoreCntntIdx( SwDoc* pDoc, std::vector<sal_uLong>& rSaveArr,
      86             :                         sal_uLong nNode, sal_Int32 nOffset = 0,
      87             :                         bool bAuto = false );
      88             : void _RestoreCntntIdx( std::vector<sal_uLong>& rSaveArr, const SwNode& rNd,
      89             :                         sal_Int32 nLen, sal_Int32 nCorrLen );
      90             : 
      91             : /** data structure to temporarily hold fly anchor positions relative to some
      92             :  *  location. */
      93             : struct _SaveFly
      94             : {
      95             :     sal_uLong nNdDiff;              /// relative node difference
      96             :     SwFrmFmt* pFrmFmt;          /// the fly's frame format
      97             :     bool bInsertPosition;   /// if true, anchor _at_ insert position
      98             : 
      99           0 :     _SaveFly( sal_uLong nNodeDiff, SwFrmFmt* pFmt, bool bInsert )
     100           0 :         : nNdDiff( nNodeDiff ), pFrmFmt( pFmt ), bInsertPosition( bInsert )
     101           0 :     { }
     102             : };
     103             : 
     104             : typedef ::std::deque< _SaveFly > _SaveFlyArr;
     105             : 
     106             : void _RestFlyInRange( _SaveFlyArr& rArr, const SwNodeIndex& rSttIdx,
     107             :                       const SwNodeIndex* pInsPos );
     108             : void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr );
     109             : void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
     110             :                        _SaveFlyArr& rArr, sal_Bool bMoveAllFlys );
     111             : 
     112             : void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
     113             :                     const SwNodeIndex& rPtNdIdx );
     114             : 
     115             : class SwDataChanged
     116             : {
     117             :     const SwPaM* pPam;
     118             :     const SwPosition* pPos;
     119             :     SwDoc* pDoc;
     120             :     sal_uLong nNode;
     121             :     sal_Int32 nCntnt;
     122             : 
     123             : public:
     124             :     SwDataChanged( const SwPaM& rPam );
     125             :     SwDataChanged( SwDoc* pDoc, const SwPosition& rPos );
     126             :     ~SwDataChanged();
     127             : 
     128             :     sal_uLong GetNode() const           { return nNode; }
     129        1194 :     sal_Int32 GetCntnt() const { return nCntnt; }
     130             : };
     131             : 
     132             : // Funktions-Deklaration damit auch alles unter der CrsrShell mal die
     133             : // Crsr verschieben kann
     134             : // die Funktionen rufen nicht die SwDoc::Corr - Methoden!
     135             : 
     136             :     // Setzt alle PaMs im Bereich vom Range nach NewPos
     137             : void PaMCorrAbs( const SwPaM& rRange,
     138             :                  const SwPosition& rNewPos );
     139             : 
     140             :     // Setzt alle PaMs in OldNode auf relative Pos
     141             : void PaMCorrRel( const SwNodeIndex &rOldNode,
     142             :                  const SwPosition &rNewPos,
     143             :                  const sal_Int32 nOffset = 0 );
     144             : 
     145             : // Hilfsklasse zum kopieren von absatzgebundenen Flys. Durch die Sortierung
     146             : // nach der Ordnungsnummer wird versucht die layout seitige Anordnung
     147             : // bei zu behalten
     148             : class _ZSortFly
     149             : {
     150             :     const SwFrmFmt* pFmt;
     151             :     const SwFmtAnchor* pAnchor;
     152             :     sal_uInt32 nOrdNum;
     153             : 
     154             : public:
     155             :     _ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAnchor,
     156             :                 sal_uInt32 nArrOrdNum );
     157             :     _ZSortFly& operator=( const _ZSortFly& rCpy )
     158             :     {
     159             :         pFmt = rCpy.pFmt, pAnchor = rCpy.pAnchor, nOrdNum = rCpy.nOrdNum;
     160             :         return *this;
     161             :     }
     162             : 
     163             :     bool operator==( const _ZSortFly& ) const { return false; }
     164         592 :     bool operator<( const _ZSortFly& rCmp ) const
     165         592 :         { return nOrdNum < rCmp.nOrdNum; }
     166             : 
     167        4296 :     const SwFrmFmt* GetFmt() const              { return pFmt; }
     168         171 :     const SwFmtAnchor* GetAnchor() const        { return pAnchor; }
     169             : };
     170             : 
     171             : class SwTblNumFmtMerge
     172             : {
     173             :     SvNumberFormatter* pNFmt;
     174             : public:
     175             :     SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest );
     176             :     ~SwTblNumFmtMerge();
     177             : };
     178             : 
     179             : class _SaveRedlEndPosForRestore
     180             : {
     181             :     std::vector<SwPosition*>* pSavArr;
     182             :     SwNodeIndex* pSavIdx;
     183             :     sal_Int32 nSavCntnt;
     184             : 
     185             :     void _Restore();
     186             : public:
     187             :     _SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx, sal_Int32 nCntnt );
     188             :     ~_SaveRedlEndPosForRestore();
     189         289 :     void Restore() { if( pSavArr ) _Restore(); }
     190             : };
     191             : 
     192             : #endif // INCLUDED_SW_SOURCE_CORE_INC_MVSAVE_HXX
     193             : 
     194             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10