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