xref: /aoo42x/main/sd/inc/undo/undoobjects.hxx (revision 67e470da)
1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c45d927aSAndrew Rist  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c45d927aSAndrew Rist  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19*c45d927aSAndrew Rist  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SD_UNDOOBJECTS_HXX
25cdf0e10cSrcweir #define _SD_UNDOOBJECTS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svx/svdundo.hxx>
28cdf0e10cSrcweir #include <svx/svdpage.hxx>
29cdf0e10cSrcweir #include <svx/svdobj.hxx>
30cdf0e10cSrcweir #include "pres.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir class SdrObjUserCall;
33cdf0e10cSrcweir class SdPage;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace sd
36cdf0e10cSrcweir {
37cdf0e10cSrcweir 	class UndoManager;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class UndoRemovePresObjectImpl
42cdf0e10cSrcweir {
43cdf0e10cSrcweir protected:
44cdf0e10cSrcweir 	UndoRemovePresObjectImpl( SdrObject& rObject );
45cdf0e10cSrcweir 	virtual ~UndoRemovePresObjectImpl();
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	virtual void Undo();
48cdf0e10cSrcweir 	virtual void Redo();
49cdf0e10cSrcweir 
50cdf0e10cSrcweir private:
51cdf0e10cSrcweir 	SfxUndoAction*	mpUndoUsercall;
52cdf0e10cSrcweir 	SfxUndoAction*	mpUndoAnimation;
53cdf0e10cSrcweir 	SfxUndoAction*	mpUndoPresObj;
54cdf0e10cSrcweir };
55cdf0e10cSrcweir 
56cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class UndoRemoveObject : public SdrUndoRemoveObj, public UndoRemovePresObjectImpl
59cdf0e10cSrcweir {
60cdf0e10cSrcweir public:
61cdf0e10cSrcweir 	UndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	virtual void Undo();
64cdf0e10cSrcweir 	virtual void Redo();
65cdf0e10cSrcweir 
66cdf0e10cSrcweir private:
67cdf0e10cSrcweir 	SdrObjectWeakRef mxSdrObject;
68cdf0e10cSrcweir };
69cdf0e10cSrcweir 
70cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
71cdf0e10cSrcweir 
72cdf0e10cSrcweir class UndoDeleteObject : public SdrUndoDelObj, public UndoRemovePresObjectImpl
73cdf0e10cSrcweir {
74cdf0e10cSrcweir public:
75cdf0e10cSrcweir 	UndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect );
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	virtual void Undo();
78cdf0e10cSrcweir 	virtual void Redo();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir private:
81cdf0e10cSrcweir 	SdrObjectWeakRef mxSdrObject;
82cdf0e10cSrcweir };
83cdf0e10cSrcweir 
84cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
85cdf0e10cSrcweir 
86cdf0e10cSrcweir class UndoReplaceObject : public SdrUndoReplaceObj, public UndoRemovePresObjectImpl
87cdf0e10cSrcweir {
88cdf0e10cSrcweir public:
89cdf0e10cSrcweir 	UndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	virtual void Undo();
92cdf0e10cSrcweir 	virtual void Redo();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir private:
95cdf0e10cSrcweir 	SdrObjectWeakRef mxSdrObject;
96cdf0e10cSrcweir };
97cdf0e10cSrcweir 
98cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
99cdf0e10cSrcweir 
100cdf0e10cSrcweir class UndoObjectSetText : public SdrUndoObjSetText
101cdf0e10cSrcweir {
102cdf0e10cSrcweir public:
103cdf0e10cSrcweir 	UndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText );
104cdf0e10cSrcweir 	virtual ~UndoObjectSetText();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	virtual void Undo();
107cdf0e10cSrcweir 	virtual void Redo();
108cdf0e10cSrcweir 
109cdf0e10cSrcweir private:
110cdf0e10cSrcweir 	SfxUndoAction* mpUndoAnimation;
111cdf0e10cSrcweir 	bool			mbNewEmptyPresObj;
112cdf0e10cSrcweir 	SdrObjectWeakRef mxSdrObject;
113cdf0e10cSrcweir };
114cdf0e10cSrcweir 
115cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
116cdf0e10cSrcweir // Undo for SdrObject::SetUserCall()
117cdf0e10cSrcweir 
118cdf0e10cSrcweir class UndoObjectUserCall : public SdrUndoObj
119cdf0e10cSrcweir {
120cdf0e10cSrcweir public:
121cdf0e10cSrcweir 	UndoObjectUserCall(SdrObject& rNewObj);
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	virtual void Undo();
124cdf0e10cSrcweir 	virtual void Redo();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir protected:
127cdf0e10cSrcweir 	SdrObjUserCall*	mpOldUserCall;
128cdf0e10cSrcweir 	SdrObjUserCall*	mpNewUserCall;
129cdf0e10cSrcweir 	SdrObjectWeakRef mxSdrObject;
130cdf0e10cSrcweir };
131cdf0e10cSrcweir 
132cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
133cdf0e10cSrcweir // Undo for SdPage::InsertPresObj() and SdPage::RemovePresObj()
134cdf0e10cSrcweir 
135cdf0e10cSrcweir class UndoObjectPresentationKind : public SdrUndoObj
136cdf0e10cSrcweir {
137cdf0e10cSrcweir public:
138cdf0e10cSrcweir 	UndoObjectPresentationKind(SdrObject& rObject);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	virtual void Undo();
141cdf0e10cSrcweir 	virtual void Redo();
142cdf0e10cSrcweir 
143cdf0e10cSrcweir protected:
144cdf0e10cSrcweir 	PresObjKind meOldKind;
145cdf0e10cSrcweir 	PresObjKind meNewKind;
146cdf0e10cSrcweir 	SdrPageWeakRef mxPage;
147cdf0e10cSrcweir 	SdrObjectWeakRef mxSdrObject;
148cdf0e10cSrcweir };
149cdf0e10cSrcweir 
150cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
151cdf0e10cSrcweir // Restores correct position and size for presentation shapes with user call
152cdf0e10cSrcweir // on undo
153cdf0e10cSrcweir 
154cdf0e10cSrcweir class UndoAutoLayoutPosAndSize : public SfxUndoAction
155cdf0e10cSrcweir {
156cdf0e10cSrcweir public:
157cdf0e10cSrcweir 	UndoAutoLayoutPosAndSize( SdPage& rPage );
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	virtual void Undo();
160cdf0e10cSrcweir 	virtual void Redo();
161cdf0e10cSrcweir 
162cdf0e10cSrcweir protected:
163cdf0e10cSrcweir 	SdrPageWeakRef mxPage;
164cdf0e10cSrcweir };
165cdf0e10cSrcweir 
166cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
167cdf0e10cSrcweir 
168cdf0e10cSrcweir class UndoGeoObject : public SdrUndoGeoObj
169cdf0e10cSrcweir {
170cdf0e10cSrcweir public:
171cdf0e10cSrcweir 	UndoGeoObject( SdrObject& rNewObj );
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 	virtual void Undo();
174cdf0e10cSrcweir 	virtual void Redo();
175cdf0e10cSrcweir 
176cdf0e10cSrcweir protected:
177cdf0e10cSrcweir 	SdrPageWeakRef mxPage;
178cdf0e10cSrcweir 	SdrObjectWeakRef mxSdrObject;
179cdf0e10cSrcweir };
180cdf0e10cSrcweir 
181cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
182cdf0e10cSrcweir 
183cdf0e10cSrcweir class UndoAttrObject : public SdrUndoAttrObj
184cdf0e10cSrcweir {
185cdf0e10cSrcweir public:
186cdf0e10cSrcweir 	UndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText );
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	virtual void Undo();
189cdf0e10cSrcweir 	virtual void Redo();
190cdf0e10cSrcweir 
191cdf0e10cSrcweir protected:
192cdf0e10cSrcweir 	SdrPageWeakRef mxPage;
193cdf0e10cSrcweir 	SdrObjectWeakRef mxSdrObject;
194cdf0e10cSrcweir };
195cdf0e10cSrcweir 
196cdf0e10cSrcweir } // namespace sd
197cdf0e10cSrcweir 
198cdf0e10cSrcweir #endif	   // _SD_UNDOOBJECTS_HXX
199