1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SD_INC_UNDO_UNDOOBJECTS_HXX
21 #define INCLUDED_SD_INC_UNDO_UNDOOBJECTS_HXX
24 #include <svx/svdundo.hxx>
26 #include <tools/weakbase.hxx>
34 class UndoRemovePresObjectImpl
37 UndoRemovePresObjectImpl( SdrObject
& rObject
);
38 virtual ~UndoRemovePresObjectImpl();
44 std::unique_ptr
<SfxUndoAction
> mpUndoUsercall
;
45 std::unique_ptr
<SfxUndoAction
> mpUndoAnimation
;
46 std::unique_ptr
<SfxUndoAction
> mpUndoPresObj
;
49 class UndoRemoveObject
: public SdrUndoRemoveObj
, public UndoRemovePresObjectImpl
52 UndoRemoveObject(SdrObject
& rObject
);
54 virtual void Undo() override
;
55 virtual void Redo() override
;
58 ::tools::WeakReference
<SdrObject
> mxSdrObject
;
61 class UndoDeleteObject
: public SdrUndoDelObj
, public UndoRemovePresObjectImpl
64 UndoDeleteObject( SdrObject
& rObject
, bool bOrdNumDirect
);
66 virtual void Undo() override
;
67 virtual void Redo() override
;
70 ::tools::WeakReference
<SdrObject
> mxSdrObject
;
73 class UndoReplaceObject
: public SdrUndoReplaceObj
, public UndoRemovePresObjectImpl
76 UndoReplaceObject( SdrObject
& rOldObject
, SdrObject
& rNewObject
);
78 virtual void Undo() override
;
79 virtual void Redo() override
;
82 ::tools::WeakReference
<SdrObject
> mxSdrObject
;
85 class UndoObjectSetText
: public SdrUndoObjSetText
88 UndoObjectSetText( SdrObject
& rNewObj
, sal_Int32 nText
);
89 virtual ~UndoObjectSetText() override
;
91 virtual void Undo() override
;
92 virtual void Redo() override
;
95 std::unique_ptr
<SfxUndoAction
> mpUndoAnimation
;
96 bool mbNewEmptyPresObj
;
97 ::tools::WeakReference
<SdrObject
> mxSdrObject
;
100 // Undo for SdrObject::SetUserCall()
102 class UndoObjectUserCall final
: public SdrUndoObj
105 UndoObjectUserCall(SdrObject
& rNewObj
);
107 virtual void Undo() override
;
108 virtual void Redo() override
;
111 SdrObjUserCall
* const mpOldUserCall
;
112 SdrObjUserCall
* mpNewUserCall
;
113 ::tools::WeakReference
<SdrObject
> mxSdrObject
;
116 // Undo for SdPage::InsertPresObj() and SdPage::RemovePresObj()
118 class UndoObjectPresentationKind final
: public SdrUndoObj
121 UndoObjectPresentationKind(SdrObject
& rObject
);
123 virtual void Undo() override
;
124 virtual void Redo() override
;
127 PresObjKind meOldKind
;
128 PresObjKind meNewKind
;
129 ::tools::WeakReference
<SdPage
> mxPage
;
130 ::tools::WeakReference
<SdrObject
> mxSdrObject
;
133 // Restores correct position and size for presentation shapes with user call
136 class UndoAutoLayoutPosAndSize final
: public SfxUndoAction
139 UndoAutoLayoutPosAndSize( SdPage
& rPage
);
141 virtual void Undo() override
;
142 virtual void Redo() override
;
145 ::tools::WeakReference
<SdPage
> mxPage
;
148 class UndoGeoObject final
: public SdrUndoGeoObj
151 UndoGeoObject( SdrObject
& rNewObj
);
153 virtual void Undo() override
;
154 virtual void Redo() override
;
157 ::tools::WeakReference
<SdPage
> mxPage
;
158 ::tools::WeakReference
<SdrObject
> mxSdrObject
;
161 class UndoAttrObject final
: public SdrUndoAttrObj
164 UndoAttrObject( SdrObject
& rObject
, bool bStyleSheet1
, bool bSaveText
);
166 virtual void Undo() override
;
167 virtual void Redo() override
;
170 ::tools::WeakReference
<SdPage
> mxPage
;
171 ::tools::WeakReference
<SdrObject
> mxSdrObject
;
176 #endif // INCLUDED_SD_INC_UNDO_UNDOOBJECTS_HXX
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */