xref: /aoo42x/main/sd/inc/undo/undoobjects.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 _SD_UNDOOBJECTS_HXX
29 #define _SD_UNDOOBJECTS_HXX
30 
31 #include <svx/svdundo.hxx>
32 #include <svx/svdpage.hxx>
33 #include <svx/svdobj.hxx>
34 #include "pres.hxx"
35 
36 class SdrObjUserCall;
37 class SdPage;
38 
39 namespace sd
40 {
41 	class UndoManager;
42 
43 ///////////////////////////////////////////////////////////////////////
44 
45 class UndoRemovePresObjectImpl
46 {
47 protected:
48 	UndoRemovePresObjectImpl( SdrObject& rObject );
49 	virtual ~UndoRemovePresObjectImpl();
50 
51 	virtual void Undo();
52 	virtual void Redo();
53 
54 private:
55 	SfxUndoAction*	mpUndoUsercall;
56 	SfxUndoAction*	mpUndoAnimation;
57 	SfxUndoAction*	mpUndoPresObj;
58 };
59 
60 ///////////////////////////////////////////////////////////////////////
61 
62 class UndoRemoveObject : public SdrUndoRemoveObj, public UndoRemovePresObjectImpl
63 {
64 public:
65 	UndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect );
66 
67 	virtual void Undo();
68 	virtual void Redo();
69 
70 private:
71 	SdrObjectWeakRef mxSdrObject;
72 };
73 
74 ///////////////////////////////////////////////////////////////////////
75 
76 class UndoDeleteObject : public SdrUndoDelObj, public UndoRemovePresObjectImpl
77 {
78 public:
79 	UndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect );
80 
81 	virtual void Undo();
82 	virtual void Redo();
83 
84 private:
85 	SdrObjectWeakRef mxSdrObject;
86 };
87 
88 ///////////////////////////////////////////////////////////////////////
89 
90 class UndoReplaceObject : public SdrUndoReplaceObj, public UndoRemovePresObjectImpl
91 {
92 public:
93 	UndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect );
94 
95 	virtual void Undo();
96 	virtual void Redo();
97 
98 private:
99 	SdrObjectWeakRef mxSdrObject;
100 };
101 
102 ///////////////////////////////////////////////////////////////////////
103 
104 class UndoObjectSetText : public SdrUndoObjSetText
105 {
106 public:
107 	UndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText );
108 	virtual ~UndoObjectSetText();
109 
110 	virtual void Undo();
111 	virtual void Redo();
112 
113 private:
114 	SfxUndoAction* mpUndoAnimation;
115 	bool			mbNewEmptyPresObj;
116 	SdrObjectWeakRef mxSdrObject;
117 };
118 
119 //////////////////////////////////////////////////////////////////////////////
120 // Undo for SdrObject::SetUserCall()
121 
122 class UndoObjectUserCall : public SdrUndoObj
123 {
124 public:
125 	UndoObjectUserCall(SdrObject& rNewObj);
126 
127 	virtual void Undo();
128 	virtual void Redo();
129 
130 protected:
131 	SdrObjUserCall*	mpOldUserCall;
132 	SdrObjUserCall*	mpNewUserCall;
133 	SdrObjectWeakRef mxSdrObject;
134 };
135 
136 //////////////////////////////////////////////////////////////////////////////
137 // Undo for SdPage::InsertPresObj() and SdPage::RemovePresObj()
138 
139 class UndoObjectPresentationKind : public SdrUndoObj
140 {
141 public:
142 	UndoObjectPresentationKind(SdrObject& rObject);
143 
144 	virtual void Undo();
145 	virtual void Redo();
146 
147 protected:
148 	PresObjKind meOldKind;
149 	PresObjKind meNewKind;
150 	SdrPageWeakRef mxPage;
151 	SdrObjectWeakRef mxSdrObject;
152 };
153 
154 //////////////////////////////////////////////////////////////////////////////
155 // Restores correct position and size for presentation shapes with user call
156 // on undo
157 
158 class UndoAutoLayoutPosAndSize : public SfxUndoAction
159 {
160 public:
161 	UndoAutoLayoutPosAndSize( SdPage& rPage );
162 
163 	virtual void Undo();
164 	virtual void Redo();
165 
166 protected:
167 	SdrPageWeakRef mxPage;
168 };
169 
170 //////////////////////////////////////////////////////////////////////////////
171 
172 class UndoGeoObject : public SdrUndoGeoObj
173 {
174 public:
175 	UndoGeoObject( SdrObject& rNewObj );
176 
177 	virtual void Undo();
178 	virtual void Redo();
179 
180 protected:
181 	SdrPageWeakRef mxPage;
182 	SdrObjectWeakRef mxSdrObject;
183 };
184 
185 //////////////////////////////////////////////////////////////////////////////
186 
187 class UndoAttrObject : public SdrUndoAttrObj
188 {
189 public:
190 	UndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText );
191 
192 	virtual void Undo();
193 	virtual void Redo();
194 
195 protected:
196 	SdrPageWeakRef mxPage;
197 	SdrObjectWeakRef mxSdrObject;
198 };
199 
200 } // namespace sd
201 
202 #endif	   // _SD_UNDOOBJECTS_HXX
203