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 _OUTLUNDO_HXX
29 #define _OUTLUNDO_HXX
30 
31 #include <editeng/outliner.hxx>
32 #include <editeng/editdata.hxx>
33 #include <editeng/editund2.hxx>
34 
35 class OutlinerUndoBase : public EditUndo
36 {
37 private:
38 	Outliner*	mpOutliner;
39 
40 public:
41 				OutlinerUndoBase( sal_uInt16 nId, Outliner* pOutliner );
42 
43 	Outliner*	GetOutliner() const { return mpOutliner; }
44 };
45 
46 class OutlinerUndoChangeParaFlags : public OutlinerUndoBase
47 {
48 private:
49 	sal_uInt16		mnPara;
50 	sal_uInt16		mnOldFlags;
51 	sal_uInt16		mnNewFlags;
52 
53 	void ImplChangeFlags( sal_uInt16 nFlags );
54 
55 public:
56 	OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_uInt16 nPara, sal_uInt16 nOldDepth, sal_uInt16 nNewDepth );
57 
58 	virtual void	Undo();
59 	virtual void	Redo();
60 };
61 
62 class OutlinerUndoChangeParaNumberingRestart : public OutlinerUndoBase
63 {
64 private:
65     sal_uInt16		mnPara;
66 
67     struct ParaRestartData
68     {
69         sal_Int16       mnNumberingStartValue;
70         sal_Bool        mbParaIsNumberingRestart;
71     };
72 
73     ParaRestartData maUndoData;
74     ParaRestartData maRedoData;
75 
76     void ImplApplyData( const ParaRestartData& rData );
77 public:
78     OutlinerUndoChangeParaNumberingRestart( Outliner* pOutliner, sal_uInt16 nPara,
79         sal_Int16 nOldNumberingStartValue, sal_Int16 mnNewNumberingStartValue,
80         sal_Bool  nOldbParaIsNumberingRestart, sal_Bool nbNewParaIsNumberingRestart );
81 
82     virtual void	Undo();
83 	virtual void	Redo();
84 };
85 
86 class OutlinerUndoChangeDepth : public OutlinerUndoBase
87 {
88 	using SfxUndoAction::Repeat;
89 private:
90 	sal_uInt16 			mnPara;
91 	sal_Int16		mnOldDepth;
92 	sal_Int16		mnNewDepth;
93 
94 public:
95 					OutlinerUndoChangeDepth( Outliner* pOutliner, sal_uInt16 nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth );
96 
97 	virtual void	Undo();
98 	virtual void	Redo();
99 	virtual void 	Repeat();
100 };
101 
102 // Hilfs-Undo: Wenn es fuer eine Aktion keine OutlinerUndoAction gibst, weil
103 // die EditEngine das handelt, aber z.B. noch das Bullet neu berechnet werden muss.
104 
105 class OutlinerUndoCheckPara : public OutlinerUndoBase
106 {
107 	using SfxUndoAction::Repeat;
108 private:
109 	sal_uInt16 			mnPara;
110 
111 public:
112 					OutlinerUndoCheckPara( Outliner* pOutliner, sal_uInt16 nPara );
113 
114 	virtual void	Undo();
115 	virtual void	Redo();
116 	virtual void 	Repeat();
117 };
118 
119 
120 
121 // -------------------------------------
122 
123 
124 class OLUndoExpand : public EditUndo
125 {
126 	using SfxUndoAction::Repeat;
127 	void Restore( sal_Bool bUndo );
128 public:
129 	OLUndoExpand( Outliner* pOut, sal_uInt16 nId );
130 	~OLUndoExpand();
131 	virtual void Undo();
132 	virtual void Redo();
133 	virtual void Repeat();
134 
135 	sal_uInt16* pParas;  // 0 == nCount enthaelt Absatznummer
136 	Outliner* pOutliner;
137 	sal_uInt16 nCount;
138 };
139 
140 #endif
141