xref: /trunk/main/sw/source/core/inc/UndoSplitMove.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SW_UNDO_MOVE_HXX
29 #define SW_UNDO_MOVE_HXX
30 
31 #include <undobj.hxx>
32 
33 
34 class SwUndoSplitNode: public SwUndo
35 {
36     SwHistory* pHistory;
37     SwRedlineData* pRedlData;
38     sal_uLong nNode;
39     xub_StrLen nCntnt;
40     sal_Bool bTblFlag : 1;
41     sal_Bool bChkTblStt : 1;
42 
43 public:
44     SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos, sal_Bool bChkTbl );
45 
46     virtual ~SwUndoSplitNode();
47 
48     virtual void UndoImpl( ::sw::UndoRedoContext & );
49     virtual void RedoImpl( ::sw::UndoRedoContext & );
50     virtual void RepeatImpl( ::sw::RepeatContext & );
51 
52     void SetTblFlag()       { bTblFlag = sal_True; }
53 };
54 
55 
56 class SwUndoMove : public SwUndo, private SwUndRng, private SwUndoSaveCntnt
57 {
58     // nDest.. - destination range of move (after move!)
59     // nIns..  - source Position of move (after move!)
60     // nMv..   - destination position of move (before move!); for REDO
61     sal_uLong nDestSttNode, nDestEndNode, nInsPosNode, nMvDestNode;
62     xub_StrLen nDestSttCntnt, nDestEndCntnt, nInsPosCntnt, nMvDestCntnt;
63 
64     sal_uInt16 nFtnStt; // StartPos of Footnotes in History
65 
66     sal_Bool bJoinNext : 1,
67          bJoinPrev : 1,
68          bMoveRange : 1;
69 
70     bool bMoveRedlines; // use DOC_MOVEREDLINES when calling SwDoc::Move
71 
72     void DelFtn( const SwPaM& );
73 
74 public:
75     SwUndoMove( const SwPaM&, const SwPosition& );
76     SwUndoMove( SwDoc* pDoc, const SwNodeRange&, const SwNodeIndex& );
77 
78     virtual void UndoImpl( ::sw::UndoRedoContext & );
79     virtual void RedoImpl( ::sw::UndoRedoContext & );
80 
81     /// set the destination range after the move
82     void SetDestRange( const SwPaM&, const SwPosition&, sal_Bool, sal_Bool );
83     void SetDestRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd,
84                         const SwNodeIndex& rInsPos );
85 
86     sal_Bool IsMoveRange() const        { return bMoveRange; }
87     sal_uLong GetEndNode() const        { return nEndNode; }
88     sal_uLong GetDestSttNode() const    { return nDestSttNode; }
89     xub_StrLen GetDestSttCntnt() const  { return nDestSttCntnt; }
90 
91     void SetMoveRedlines( bool b )       { bMoveRedlines = b; }
92 
93 };
94 
95 #endif // SW_UNDO_MOVE_HXX
96 
97