LCOV - code coverage report
Current view: top level - sw/source/core/inc - mvsave.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 10 40.0 %
Date: 2012-08-25 Functions: 4 8 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 8 12.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef SW_MVSAVE_HXX
      29                 :            : #define SW_MVSAVE_HXX
      30                 :            : 
      31                 :            : #include <vcl/keycod.hxx>
      32                 :            : #include <IDocumentMarkAccess.hxx>
      33                 :            : #include <vector>
      34                 :            : #include <deque>
      35                 :            : 
      36                 :            : namespace sfx2 {
      37                 :            :     class MetadatableUndo;
      38                 :            : }
      39                 :            : 
      40                 :            : class SvNumberFormatter;
      41                 :            : class SwDoc;
      42                 :            : class SwFmtAnchor;
      43                 :            : class SwFrmFmt;
      44                 :            : class SwIndex;
      45                 :            : class SwNodeIndex;
      46                 :            : class SwNodeRange;
      47                 :            : class SwPaM;
      48                 :            : class SwNode;
      49                 :            : struct SwPosition;
      50                 :            : 
      51                 :            : namespace sw { namespace mark
      52                 :            : {
      53                 :            :     class IMark;
      54                 :            : 
      55   [ #  #  #  # ]:          0 :     class SaveBookmark
                 [ #  # ]
      56                 :            :     {
      57                 :            :         public:
      58                 :            :             SaveBookmark(bool bSavePos,
      59                 :            :                 bool bSaveOtherPos,
      60                 :            :                 const ::sw::mark::IMark& rBkmk,
      61                 :            :                 const SwNodeIndex& rMvPos,
      62                 :            :                 const SwIndex* pIdx =0);
      63                 :            :             void SetInDoc(SwDoc* pDoc,
      64                 :            :                 const SwNodeIndex&,
      65                 :            :                 const SwIndex* pIdx =0);
      66                 :            :             IDocumentMarkAccess::MarkType GetOriginalBkmType() const
      67                 :            :                 { return m_eOrigBkmType; }
      68                 :            : 
      69                 :            :         private:
      70                 :            :             ::rtl::OUString m_aName;
      71                 :            :             ::rtl::OUString m_aShortName;
      72                 :            :             KeyCode m_aCode;
      73                 :            :             bool m_bSavePos;
      74                 :            :             bool m_bSaveOtherPos;
      75                 :            :             IDocumentMarkAccess::MarkType m_eOrigBkmType;
      76                 :            :             sal_uLong m_nNode1;
      77                 :            :             sal_uLong m_nNode2;
      78                 :            :             xub_StrLen m_nCntnt1;
      79                 :            :             xub_StrLen m_nCntnt2;
      80                 :            :             ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo;
      81                 :            :     };
      82                 :            : }}
      83                 :            : 
      84                 :            : #define SAVEFLY 1
      85                 :            : #define SAVEFLY_SPLIT 2
      86                 :            : 
      87                 :            : void _DelBookmarks(const SwNodeIndex& rStt,
      88                 :            :     const SwNodeIndex& rEnd,
      89                 :            :     ::std::vector< ::sw::mark::SaveBookmark> * SaveBkmk =0,
      90                 :            :     const SwIndex* pSttIdx =0,
      91                 :            :     const SwIndex* pEndIdx =0);
      92                 :            : void _SaveCntntIdx( SwDoc* pDoc, sal_uLong nNode, xub_StrLen nCntnt,
      93                 :            :                     std::vector<sal_uLong>& rSaveArr, sal_uInt8 nSaveFly = 0 );
      94                 :            : void _RestoreCntntIdx( SwDoc* pDoc, std::vector<sal_uLong>& rSaveArr,
      95                 :            :                         sal_uLong nNode, xub_StrLen nOffset = 0,
      96                 :            :                         sal_Bool bAuto = sal_False );
      97                 :            : void _RestoreCntntIdx( std::vector<sal_uLong>& rSaveArr, const SwNode& rNd,
      98                 :            :                         xub_StrLen nLen, xub_StrLen nCorrLen );
      99                 :            : 
     100                 :            : 
     101                 :            : /** data structure to temporarily hold fly anchor positions relative to some
     102                 :            :  *  location. */
     103                 :            : struct _SaveFly
     104                 :            : {
     105                 :            :     sal_uLong nNdDiff;              /// relative node difference
     106                 :            :     SwFrmFmt* pFrmFmt;          /// the fly's frame format
     107                 :            :     sal_Bool bInsertPosition;   /// if true, anchor _at_ insert position
     108                 :            : 
     109                 :          0 :     _SaveFly( sal_uLong nNodeDiff, SwFrmFmt* pFmt, sal_Bool bInsert )
     110                 :          0 :         : nNdDiff( nNodeDiff ), pFrmFmt( pFmt ), bInsertPosition( bInsert )
     111                 :          0 :     { }
     112                 :            : };
     113                 :            : 
     114                 :            : typedef ::std::deque< _SaveFly > _SaveFlyArr;
     115                 :            : 
     116                 :            : void _RestFlyInRange( _SaveFlyArr& rArr, const SwNodeIndex& rSttIdx,
     117                 :            :                       const SwNodeIndex* pInsPos );
     118                 :            : void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr );
     119                 :            : void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
     120                 :            :                        _SaveFlyArr& rArr, sal_Bool bMoveAllFlys );
     121                 :            : 
     122                 :            : void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
     123                 :            :                     const SwNodeIndex& rPtNdIdx );
     124                 :            : 
     125                 :            : 
     126                 :            : class SwDataChanged
     127                 :            : {
     128                 :            :     const SwPaM* pPam;
     129                 :            :     const SwPosition* pPos;
     130                 :            :     SwDoc* pDoc;
     131                 :            :     sal_uLong nNode;
     132                 :            :     xub_StrLen nCntnt;
     133                 :            :     sal_uInt16 nType;       // Insert/Move/Delete/... (UndoIds)
     134                 :            : 
     135                 :            : public:
     136                 :            :     SwDataChanged( const SwPaM& rPam, sal_uInt16 nType );
     137                 :            :     SwDataChanged( SwDoc* pDoc, const SwPosition& rPos, sal_uInt16 nType );
     138                 :            :     ~SwDataChanged();
     139                 :            : 
     140                 :            :     sal_uLong GetNode() const           { return nNode; }
     141                 :       2050 :     xub_StrLen GetCntnt() const     { return nCntnt; }
     142                 :            : };
     143                 :            : 
     144                 :            : 
     145                 :            : // Funktions-Deklaration damit auch alles unter der CrsrShell mal die
     146                 :            : // Crsr verschieben kann
     147                 :            : // die Funktionen rufen nicht die SwDoc::Corr - Methoden!
     148                 :            : 
     149                 :            :     // Setzt alle PaMs im Bereich vom Range nach NewPos
     150                 :            : void PaMCorrAbs( const SwPaM& rRange,
     151                 :            :                  const SwPosition& rNewPos );
     152                 :            : 
     153                 :            :     // Setzt alle PaMs in OldNode auf relative Pos
     154                 :            : void PaMCorrRel( const SwNodeIndex &rOldNode,
     155                 :            :                  const SwPosition &rNewPos,
     156                 :            :                  const xub_StrLen nOffset = 0 );
     157                 :            : 
     158                 :            : 
     159                 :            : // Hilfsklasse zum kopieren von absatzgebundenen Flys. Durch die Sortierung
     160                 :            : // nach der Ordnungsnummer wird versucht die layout seitige Anordnung
     161                 :            : // bei zu behalten
     162                 :            : class _ZSortFly
     163                 :            : {
     164                 :            :     const SwFrmFmt* pFmt;
     165                 :            :     const SwFmtAnchor* pAnchor;
     166                 :            :     sal_uInt32 nOrdNum;
     167                 :            : 
     168                 :            : public:
     169                 :            :     _ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAnchor,
     170                 :            :                 sal_uInt32 nArrOrdNum );
     171                 :            :     _ZSortFly& operator=( const _ZSortFly& rCpy )
     172                 :            :     {
     173                 :            :         pFmt = rCpy.pFmt, pAnchor = rCpy.pAnchor, nOrdNum = rCpy.nOrdNum;
     174                 :            :         return *this;
     175                 :            :     }
     176                 :            : 
     177                 :            :     int operator==( const _ZSortFly& ) const { return sal_False; }
     178                 :          0 :     int operator<( const _ZSortFly& rCmp ) const
     179                 :          0 :         { return nOrdNum < rCmp.nOrdNum; }
     180                 :            : 
     181                 :         12 :     const SwFrmFmt* GetFmt() const              { return pFmt; }
     182                 :          3 :     const SwFmtAnchor* GetAnchor() const        { return pAnchor; }
     183                 :            : };
     184                 :            : 
     185                 :            : 
     186                 :            : class SwTblNumFmtMerge
     187                 :            : {
     188                 :            :     SvNumberFormatter* pNFmt;
     189                 :            : public:
     190                 :            :     SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest );
     191                 :            :     ~SwTblNumFmtMerge();
     192                 :            : };
     193                 :            : 
     194                 :            : 
     195                 :            : class _SaveRedlEndPosForRestore
     196                 :            : {
     197                 :            :     std::vector<SwPosition*>* pSavArr;
     198                 :            :     SwNodeIndex* pSavIdx;
     199                 :            :     xub_StrLen nSavCntnt;
     200                 :            : 
     201                 :            :     void _Restore();
     202                 :            : public:
     203                 :            :     _SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx, xub_StrLen nCntnt );
     204                 :            :     ~_SaveRedlEndPosForRestore();
     205         [ -  + ]:         20 :     void Restore() { if( pSavArr ) _Restore(); }
     206                 :            : };
     207                 :            : 
     208                 :            : 
     209                 :            : #endif  // SW_MVSAVE_HXX
     210                 :            : 
     211                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10