xref: /aoo42x/main/svx/source/engine3d/e3dundo.cxx (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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 #include <svx/e3dundo.hxx>
31 #include <svx/svdmodel.hxx>
32 #include <editeng/outlobj.hxx>
33 #include <svx/view3d.hxx>
34 #include <svx/scene3d.hxx>
35 #include <svx/e3dsceneupdater.hxx>
36 
37 /************************************************************************/
38 
39 TYPEINIT1(E3dUndoAction, SfxUndoAction);
40 
41 /************************************************************************\
42 |*
43 |* Destruktor der Basisklasse
44 |*
45 \************************************************************************/
46 E3dUndoAction::~E3dUndoAction ()
47 {
48 }
49 
50 /************************************************************************\
51 |*
52 |* Repeat gibt es nicht
53 |*
54 \************************************************************************/
55 sal_Bool E3dUndoAction::CanRepeat(SfxRepeatTarget&) const
56 {
57 	return sal_False;
58 }
59 
60 /************************************************************************/
61 
62 TYPEINIT1(E3dRotateUndoAction, E3dUndoAction);
63 
64 /************************************************************************
65 
66 						E3dRotateUndoAction
67 
68 ************************************************************************/
69 
70 /************************************************************************\
71 |*
72 |* Undodestruktor fuer 3D-Rotation
73 |*
74 \************************************************************************/
75 E3dRotateUndoAction::~E3dRotateUndoAction ()
76 {
77 }
78 
79 /************************************************************************\
80 |*
81 |* Undo fuer 3D-Rotation ueber die Rotationsmatrizen
82 |*
83 \************************************************************************/
84 void E3dRotateUndoAction::Undo ()
85 {
86 	E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
87 	pMy3DObj->SetTransform(aMyOldRotation);
88 }
89 
90 /************************************************************************\
91 |*
92 |* Undo fuer 3D-Rotation ueber die Rotationsmatrizen
93 |*
94 \************************************************************************/
95 void E3dRotateUndoAction::Redo ()
96 {
97 	E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
98 	pMy3DObj->SetTransform(aMyNewRotation);
99 }
100 
101 /*************************************************************************
102 |*
103 |* E3dAttributesUndoAction
104 |*
105 \************************************************************************/
106 
107 TYPEINIT1(E3dAttributesUndoAction, SdrUndoAction);
108 
109 /*************************************************************************
110 |*
111 |* Konstruktor
112 |*
113 \************************************************************************/
114 E3dAttributesUndoAction::E3dAttributesUndoAction( SdrModel &rModel,
115 	E3dView*	p3dView,
116 	E3dObject*	pInObject,
117 	const SfxItemSet& rNewSet,
118 	const SfxItemSet& rOldSet,
119 	sal_Bool bUseSubObj)
120 :	SdrUndoAction( rModel ),
121 	pObject	 	 ( pInObject ),
122 	pView		 ( p3dView ),
123 	bUseSubObjects(bUseSubObj),
124 	aNewSet		 ( rNewSet ),
125 	aOldSet		 ( rOldSet )
126 {
127 }
128 
129 /*************************************************************************
130 |*
131 |* Destruktor
132 |*
133 \************************************************************************/
134 E3dAttributesUndoAction::~E3dAttributesUndoAction()
135 {
136 }
137 
138 /*************************************************************************
139 |*
140 |* Undo()
141 |* Implementiert ueber Set3DAttributes(), um die Attribute nur an einer
142 |* Stelle pflegen zu muessen!
143 |*
144 \************************************************************************/
145 void E3dAttributesUndoAction::Undo()
146 {
147 	E3DModifySceneSnapRectUpdater aUpdater(pObject);
148 	pObject->SetMergedItemSetAndBroadcast(aOldSet);
149 }
150 
151 /*************************************************************************
152 |*
153 |* Redo()
154 |*
155 \************************************************************************/
156 void E3dAttributesUndoAction::Redo()
157 {
158 	E3DModifySceneSnapRectUpdater aUpdater(pObject);
159 	pObject->SetMergedItemSetAndBroadcast(aNewSet);
160 }
161 
162 /*************************************************************************
163 |*
164 |* Mehrfaches Undo nicht moeglich
165 |*
166 \************************************************************************/
167 sal_Bool E3dAttributesUndoAction::CanRepeat(SfxRepeatTarget& /*rView*/) const
168 {
169 	return sal_False;
170 }
171 
172 /*************************************************************************
173 |*
174 |* Mehrfaches Undo nicht moeglich
175 |*
176 \************************************************************************/
177 void E3dAttributesUndoAction::Repeat()
178 {
179 }
180 
181