1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _OUTLUNDO_HXX
25 #define _OUTLUNDO_HXX
26 
27 #include <editeng/outliner.hxx>
28 #include <editeng/editdata.hxx>
29 #include <editeng/editund2.hxx>
30 
31 class OutlinerUndoBase : public EditUndo
32 {
33 private:
34 	Outliner*	mpOutliner;
35 
36 public:
37 				OutlinerUndoBase( sal_uInt16 nId, Outliner* pOutliner );
38 
GetOutliner() const39 	Outliner*	GetOutliner() const { return mpOutliner; }
40 };
41 
42 class OutlinerUndoChangeParaFlags : public OutlinerUndoBase
43 {
44 private:
45 	sal_uInt16		mnPara;
46 	sal_uInt16		mnOldFlags;
47 	sal_uInt16		mnNewFlags;
48 
49 	void ImplChangeFlags( sal_uInt16 nFlags );
50 
51 public:
52 	OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_uInt16 nPara, sal_uInt16 nOldDepth, sal_uInt16 nNewDepth );
53 
54 	virtual void	Undo();
55 	virtual void	Redo();
56 };
57 
58 class OutlinerUndoChangeParaNumberingRestart : public OutlinerUndoBase
59 {
60 private:
61     sal_uInt16		mnPara;
62 
63     struct ParaRestartData
64     {
65         sal_Int16       mnNumberingStartValue;
66         sal_Bool        mbParaIsNumberingRestart;
67     };
68 
69     ParaRestartData maUndoData;
70     ParaRestartData maRedoData;
71 
72     void ImplApplyData( const ParaRestartData& rData );
73 public:
74     OutlinerUndoChangeParaNumberingRestart( Outliner* pOutliner, sal_uInt16 nPara,
75         sal_Int16 nOldNumberingStartValue, sal_Int16 mnNewNumberingStartValue,
76         sal_Bool  nOldbParaIsNumberingRestart, sal_Bool nbNewParaIsNumberingRestart );
77 
78     virtual void	Undo();
79 	virtual void	Redo();
80 };
81 
82 class OutlinerUndoChangeDepth : public OutlinerUndoBase
83 {
84 	using SfxUndoAction::Repeat;
85 private:
86 	sal_uInt16 			mnPara;
87 	sal_Int16		mnOldDepth;
88 	sal_Int16		mnNewDepth;
89 
90 public:
91 					OutlinerUndoChangeDepth( Outliner* pOutliner, sal_uInt16 nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth );
92 
93 	virtual void	Undo();
94 	virtual void	Redo();
95 	virtual void 	Repeat();
96 };
97 
98 // Hilfs-Undo: Wenn es fuer eine Aktion keine OutlinerUndoAction gibst, weil
99 // die EditEngine das handelt, aber z.B. noch das Bullet neu berechnet werden muss.
100 
101 class OutlinerUndoCheckPara : public OutlinerUndoBase
102 {
103 	using SfxUndoAction::Repeat;
104 private:
105 	sal_uInt16 			mnPara;
106 
107 public:
108 					OutlinerUndoCheckPara( Outliner* pOutliner, sal_uInt16 nPara );
109 
110 	virtual void	Undo();
111 	virtual void	Redo();
112 	virtual void 	Repeat();
113 };
114 
115 
116 
117 // -------------------------------------
118 
119 
120 class OLUndoExpand : public EditUndo
121 {
122 	using SfxUndoAction::Repeat;
123 	void Restore( sal_Bool bUndo );
124 public:
125 	OLUndoExpand( Outliner* pOut, sal_uInt16 nId );
126 	~OLUndoExpand();
127 	virtual void Undo();
128 	virtual void Redo();
129 	virtual void Repeat();
130 
131 	sal_uInt16* pParas;  // 0 == nCount enthaelt Absatznummer
132 	Outliner* pOutliner;
133 	sal_uInt16 nCount;
134 };
135 
136 #endif
137