LCOV - code coverage report
Current view: top level - sw/source/core/inc - UndoTable.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 17 0.0 %
Date: 2014-04-14 Functions: 0 10 0.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             : 
      20             : #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDOTABLE_HXX
      21             : #define INCLUDED_SW_SOURCE_CORE_INC_UNDOTABLE_HXX
      22             : 
      23             : #include <undobj.hxx>
      24             : #include <vector>
      25             : #include <set>
      26             : #include <swtypes.hxx>
      27             : #include <itabenum.hxx>
      28             : #include "boost/noncopyable.hpp"
      29             : #include "boost/scoped_ptr.hpp"
      30             : 
      31             : class SfxItemSet;
      32             : 
      33             : struct SwSaveRowSpan;
      34             : class _SaveTable;
      35             : class SwDDEFieldType;
      36             : class SwUndoSaveSections;
      37             : class SwUndoMoves;
      38             : class SwUndoDelete;
      39             : class SwSelBoxes;
      40             : class SwTblToTxtSaves;
      41             : class SwTable;
      42             : class SwTableBox;
      43             : class SwStartNode;
      44             : class SwTableNode;
      45             : class SwTableAutoFmt;
      46             : class SwTableSortBoxes;
      47             : 
      48             : class SwUndoInsTbl : public SwUndo
      49             : {
      50             :     OUString sTblNm;
      51             :     SwInsertTableOptions aInsTblOpts;
      52             :     SwDDEFieldType* pDDEFldType;
      53             :     std::vector<sal_uInt16> *pColWidth;
      54             :     SwRedlineData*  pRedlData;
      55             :     SwTableAutoFmt* pAutoFmt;
      56             :     sal_uLong nSttNode;
      57             :     sal_uInt16 nRows, nCols;
      58             :     sal_uInt16 nAdjust;
      59             : 
      60             : public:
      61             :     SwUndoInsTbl( const SwPosition&, sal_uInt16 nCols, sal_uInt16 nRows,
      62             :                     sal_uInt16 eAdjust, const SwInsertTableOptions& rInsTblOpts,
      63             :                     const SwTableAutoFmt* pTAFmt, const std::vector<sal_uInt16> *pColArr,
      64             :                   const OUString & rName);
      65             : 
      66             :     virtual ~SwUndoInsTbl();
      67             : 
      68             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
      69             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
      70             :     virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
      71             : 
      72             :     virtual SwRewriter GetRewriter() const SAL_OVERRIDE;
      73             : };
      74             : 
      75             : class SwUndoTxtToTbl : public SwUndo, public SwUndRng
      76             : {
      77             :     OUString sTblNm;
      78             :     SwInsertTableOptions aInsTblOpts;
      79             :     std::vector<sal_uLong>* pDelBoxes;
      80             :     SwTableAutoFmt* pAutoFmt;
      81             :     SwHistory* pHistory;
      82             :     sal_Unicode cTrenner;
      83             :     sal_uInt16 nAdjust;
      84             :     sal_Bool bSplitEnd : 1;
      85             : 
      86             : public:
      87             :     SwUndoTxtToTbl( const SwPaM&, const SwInsertTableOptions&, sal_Unicode,
      88             :                     sal_uInt16,
      89             :                     const SwTableAutoFmt* pAFmt );
      90             : 
      91             :     virtual ~SwUndoTxtToTbl();
      92             : 
      93             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
      94             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
      95             :     virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
      96             : 
      97             :     SwHistory& GetHistory(); // will be created if necessary
      98             :     void AddFillBox( const SwTableBox& rBox );
      99             : };
     100             : 
     101             : class SwUndoTblToTxt : public SwUndo
     102             : {
     103             :     OUString sTblNm;
     104             :     SwDDEFieldType* pDDEFldType;
     105             :     _SaveTable* pTblSave;
     106             :     SwTblToTxtSaves* pBoxSaves;
     107             :     SwHistory* pHistory;
     108             :     sal_uLong nSttNd, nEndNd;
     109             :     sal_uInt16 nAdjust;
     110             :     sal_Unicode cTrenner;
     111             :     sal_uInt16 nHdlnRpt;
     112             :     sal_Bool bCheckNumFmt : 1;
     113             : 
     114             : public:
     115             :     SwUndoTblToTxt( const SwTable& rTbl, sal_Unicode cCh );
     116             : 
     117             :     virtual ~SwUndoTblToTxt();
     118             : 
     119             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     120             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     121             :     virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
     122             : 
     123             :     void SetRange( const SwNodeRange& );
     124             :     void AddBoxPos( SwDoc& rDoc, sal_uLong nNdIdx, sal_uLong nEndIdx,
     125             :                     sal_Int32 nCntntIdx = SAL_MAX_INT32);
     126             : };
     127             : 
     128             : class SwUndoAttrTbl : public SwUndo
     129             : {
     130             :     sal_uLong nSttNode;
     131             :     _SaveTable* pSaveTbl;
     132             :     sal_Bool bClearTabCol : 1;
     133             : 
     134             : public:
     135             :     SwUndoAttrTbl( const SwTableNode& rTblNd, sal_Bool bClearTabCols = sal_False );
     136             : 
     137             :     virtual ~SwUndoAttrTbl();
     138             : 
     139             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     140             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     141             : };
     142             : 
     143             : class SwUndoTblNumFmt;
     144             : 
     145             : class SwUndoTblAutoFmt : public SwUndo
     146             : {
     147             :     sal_uLong nSttNode;
     148             :     _SaveTable* pSaveTbl;
     149             :     ::std::vector< ::boost::shared_ptr<SwUndoTblNumFmt> > m_Undos;
     150             :     sal_Bool bSaveCntntAttr;
     151             :     sal_uInt16 m_nRepeatHeading;
     152             : 
     153             :     void UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext);
     154             : 
     155             : public:
     156             :     SwUndoTblAutoFmt( const SwTableNode& rTblNd, const SwTableAutoFmt& );
     157             : 
     158             :     virtual ~SwUndoTblAutoFmt();
     159             : 
     160             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     161             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     162             : 
     163             :     void SaveBoxCntnt( const SwTableBox& rBox );
     164             : };
     165             : 
     166             : class SwUndoTblNdsChg : public SwUndo, private boost::noncopyable
     167             : {
     168             :     _SaveTable* pSaveTbl;
     169             :     std::set<sal_uLong> m_Boxes;
     170             :     struct _BoxMove
     171             :     {
     172             :         sal_uLong index;    ///< Index of this box.
     173             :         bool      hasMoved; ///< Has this box been moved already.
     174           0 :         _BoxMove(sal_uLong idx, bool moved=false) : index(idx), hasMoved(moved) {};
     175           0 :         bool operator<(const _BoxMove other) const { return index < other.index; };
     176             :     };
     177             :     boost::scoped_ptr< std::set<_BoxMove> > pNewSttNds;
     178             :     boost::scoped_ptr< SwUndoSaveSections > pDelSects;
     179             :     long nMin, nMax;        // for redo of delete column
     180             :     sal_uLong nSttNode, nCurrBox;
     181             :     sal_uInt16 nCount, nRelDiff, nAbsDiff, nSetColType;
     182             :     sal_Bool bFlag;
     183             :     sal_Bool bSameHeight;                   // only used for SplitRow
     184             : 
     185             : public:
     186             :     SwUndoTblNdsChg( SwUndoId UndoId,
     187             :                     const SwSelBoxes& rBoxes,
     188             :                     const SwTableNode& rTblNd,
     189             :                     long nMn, long nMx,
     190             :                     sal_uInt16 nCnt, sal_Bool bFlg, sal_Bool bSameHeight );
     191             : 
     192             :     // for SetColWidth
     193             :     SwUndoTblNdsChg( SwUndoId UndoId, const SwSelBoxes& rBoxes,
     194             :                     const SwTableNode& rTblNd );
     195             : 
     196             :     virtual ~SwUndoTblNdsChg();
     197             : 
     198             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     199             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     200             : 
     201             :     void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld );
     202             :     void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld,
     203             :                        const SwSelBoxes& rBoxes, const std::vector<sal_uLong> &rNodeCnts );
     204             :     void SaveSection( SwStartNode* pSttNd );
     205             :     void ReNewBoxes( const SwSelBoxes& rBoxes );
     206             : 
     207           0 :     void SetColWidthParam( sal_uLong nBoxIdx, sal_uInt16 nMode, sal_uInt16 nType,
     208             :                             SwTwips nAbsDif, SwTwips nRelDif )
     209             :     {
     210           0 :         nCurrBox = nBoxIdx;
     211           0 :         nCount = nMode;
     212           0 :         nSetColType = nType;
     213           0 :         nAbsDiff = (sal_uInt16)nAbsDif;
     214           0 :         nRelDiff = (sal_uInt16)nRelDif;
     215           0 :     }
     216             : };
     217             : 
     218             : class SwUndoTblMerge : public SwUndo, private SwUndRng
     219             : {
     220             :     sal_uLong nTblNode;
     221             :     _SaveTable* pSaveTbl;
     222             :     std::set<sal_uLong> m_Boxes;
     223             :     std::vector<sal_uLong> aNewSttNds;
     224             :     SwUndoMoves* pMoves;
     225             :     SwHistory* pHistory;
     226             : 
     227             : public:
     228             :     SwUndoTblMerge( const SwPaM& rTblSel );
     229             : 
     230             :     virtual ~SwUndoTblMerge();
     231             : 
     232             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     233             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     234             : 
     235             :     void MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& rPos );
     236             : 
     237             :     void SetSelBoxes( const SwSelBoxes& rBoxes );
     238             : 
     239           0 :     void AddNewBox( sal_uLong nSttNdIdx )
     240           0 :         { aNewSttNds.push_back( nSttNdIdx ); }
     241             : 
     242             :     void SaveCollection( const SwTableBox& rBox );
     243             : };
     244             : 
     245             : class SwUndoTblNumFmt : public SwUndo
     246             : {
     247             :     SfxItemSet *pBoxSet;
     248             :     SwHistory* pHistory;
     249             :     OUString aStr, aNewFml;
     250             : 
     251             :     sal_uLong nFmtIdx, nNewFmtIdx;
     252             :     double fNum, fNewNum;
     253             :     sal_uLong nNode;
     254             :     sal_uLong nNdPos;
     255             : 
     256             :     sal_Bool bNewFmt : 1;
     257             :     sal_Bool bNewFml : 1;
     258             :     sal_Bool bNewValue : 1;
     259             : 
     260             : public:
     261             :     SwUndoTblNumFmt( const SwTableBox& rBox, const SfxItemSet* pNewSet = 0 );
     262             : 
     263             :     virtual ~SwUndoTblNumFmt();
     264             : 
     265             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     266             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     267             : 
     268           0 :     void SetNumFmt( sal_uLong nNewNumFmtIdx, const double& rNewNumber )
     269           0 :             { nFmtIdx = nNewNumFmtIdx; fNum = rNewNumber; }
     270             :     void SetBox( const SwTableBox& rBox );
     271             : };
     272             : 
     273             : class _UndoTblCpyTbl_Entries;
     274             : 
     275             : class SwUndoTblCpyTbl : public SwUndo
     276             : {
     277             :     _UndoTblCpyTbl_Entries* pArr;
     278             :     SwUndoTblNdsChg* pInsRowUndo;
     279             : 
     280             :     //b6341295: When redlining is active, PrepareRedline has to create the
     281             :     //redlining attributes for the new and the old table cell content
     282             :     SwUndo* PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox,
     283             :                 const SwPosition& rPos, bool& rJoin, bool bRedo );
     284             : 
     285             : public:
     286             :     SwUndoTblCpyTbl();
     287             : 
     288             :     virtual ~SwUndoTblCpyTbl();
     289             : 
     290             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     291             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     292             : 
     293             :     void AddBoxBefore( const SwTableBox& rBox, bool bDelCntnt );
     294             :     void AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx,
     295             :                 bool bDelCntnt );
     296             : 
     297             :     sal_Bool IsEmpty() const;
     298             :     bool InsertRow( SwTable& rTbl, const SwSelBoxes& rBoxes, sal_uInt16 nCnt );
     299             : };
     300             : 
     301             : class SwUndoCpyTbl : public SwUndo
     302             : {
     303             :     SwUndoDelete* pDel;
     304             :     sal_uLong nTblNode;
     305             : 
     306             : public:
     307             :     SwUndoCpyTbl();
     308             : 
     309             :     virtual ~SwUndoCpyTbl();
     310             : 
     311             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     312             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     313             : 
     314           0 :     void SetTableSttIdx( sal_uLong nIdx )           { nTblNode = nIdx; }
     315             : };
     316             : 
     317             : class SwUndoSplitTbl : public SwUndo
     318             : {
     319             :     sal_uLong nTblNode, nOffset;
     320             :     SwSaveRowSpan* mpSaveRowSpan; // stores row span values at the splitting row
     321             :     _SaveTable* pSavTbl;
     322             :     SwHistory* pHistory;
     323             :     sal_uInt16 nMode, nFmlEnd;
     324             :     sal_Bool bCalcNewSize;
     325             : 
     326             : public:
     327             :     SwUndoSplitTbl( const SwTableNode& rTblNd, SwSaveRowSpan* pRowSp,
     328             :             sal_uInt16 nMode, sal_Bool bCalcNewSize );
     329             : 
     330             :     virtual ~SwUndoSplitTbl();
     331             : 
     332             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     333             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     334             :     virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
     335             : 
     336           0 :     void SetTblNodeOffset( sal_uLong nIdx )     { nOffset = nIdx - nTblNode; }
     337           0 :     SwHistory* GetHistory()                 { return pHistory; }
     338             :     void SaveFormula( SwHistory& rHistory );
     339             : };
     340             : 
     341             : class SwUndoMergeTbl : public SwUndo
     342             : {
     343             :     OUString aName;
     344             :     sal_uLong nTblNode;
     345             :     _SaveTable* pSavTbl, *pSavHdl;
     346             :     SwHistory* pHistory;
     347             :     sal_uInt16 nMode;
     348             :     sal_Bool bWithPrev;
     349             : 
     350             : public:
     351             :     SwUndoMergeTbl( const SwTableNode& rTblNd, const SwTableNode& rDelTblNd,
     352             :                     sal_Bool bWithPrev, sal_uInt16 nMode );
     353             : 
     354             :     virtual ~SwUndoMergeTbl();
     355             : 
     356             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     357             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     358             :     virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
     359             : 
     360             :     void SaveFormula( SwHistory& rHistory );
     361             : };
     362             : 
     363           0 : class SwUndoTblHeadline : public SwUndo
     364             : {
     365             :     sal_uLong nTblNd;
     366             :     sal_uInt16 nOldHeadline;
     367             :     sal_uInt16 nNewHeadline;
     368             : 
     369             : public:
     370             :     SwUndoTblHeadline( const SwTable&, sal_uInt16 nOldHdl,  sal_uInt16 nNewHdl );
     371             : 
     372             :     virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     373             :     virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
     374             :     virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
     375             : };
     376             : 
     377             : #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOTABLE_HXX
     378             : 
     379             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10