tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sd / inc / undo / undoobjects.hxx
blob830ced1464aafeedba7df3859dfa8d6438a44b26
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <memory>
23 #include <svx/svdundo.hxx>
24 #include <pres.hxx>
25 #include <tools/weakbase.hxx>
26 #include <unotools/weakref.hxx>
28 class SdrObjUserCall;
29 class SdPage;
31 namespace sd
33 class UndoRemovePresObjectImpl
35 protected:
36 UndoRemovePresObjectImpl(SdrObject& rObject);
37 virtual ~UndoRemovePresObjectImpl();
39 virtual void Undo();
40 virtual void Redo();
42 private:
43 std::unique_ptr<SfxUndoAction> mpUndoUsercall;
44 std::unique_ptr<SfxUndoAction> mpUndoAnimation;
45 std::unique_ptr<SfxUndoAction> mpUndoPresObj;
48 class UndoRemoveObject final : public SdrUndoRemoveObj, public UndoRemovePresObjectImpl
50 public:
51 UndoRemoveObject(SdrObject& rObject);
53 virtual void Undo() override;
54 virtual void Redo() override;
56 private:
57 ::unotools::WeakReference<SdrObject> mxSdrObject;
60 class UndoDeleteObject final : public SdrUndoDelObj, public UndoRemovePresObjectImpl
62 public:
63 UndoDeleteObject(SdrObject& rObject, bool bOrdNumDirect);
65 virtual void Undo() override;
66 virtual void Redo() override;
68 private:
69 ::unotools::WeakReference<SdrObject> mxSdrObject;
72 class UndoReplaceObject final : public SdrUndoReplaceObj, public UndoRemovePresObjectImpl
74 public:
75 UndoReplaceObject(SdrObject& rOldObject, SdrObject& rNewObject);
77 virtual void Undo() override;
78 virtual void Redo() override;
80 private:
81 ::unotools::WeakReference<SdrObject> mxSdrObject;
84 class UndoObjectSetText final : public SdrUndoObjSetText
86 public:
87 UndoObjectSetText(SdrObject& rNewObj, sal_Int32 nText);
88 virtual ~UndoObjectSetText() override;
90 virtual void Undo() override;
91 virtual void Redo() override;
93 private:
94 std::unique_ptr<SfxUndoAction> mpUndoAnimation;
95 bool mbNewEmptyPresObj;
96 ::unotools::WeakReference<SdrObject> mxSdrObject;
99 // Undo for SdrObject::SetUserCall()
101 class UndoObjectUserCall final : public SdrUndoObj
103 public:
104 UndoObjectUserCall(SdrObject& rNewObj);
106 virtual void Undo() override;
107 virtual void Redo() override;
109 private:
110 SdrObjUserCall* mpOldUserCall;
111 SdrObjUserCall* mpNewUserCall;
112 ::unotools::WeakReference<SdrObject> mxSdrObject;
115 // Undo for SdPage::InsertPresObj() and SdPage::RemovePresObj()
117 class UndoObjectPresentationKind final : public SdrUndoObj
119 public:
120 UndoObjectPresentationKind(SdrObject& rObject);
122 virtual void Undo() override;
123 virtual void Redo() override;
125 private:
126 PresObjKind meOldKind;
127 PresObjKind meNewKind;
128 ::unotools::WeakReference<SdPage> mxPage;
129 ::unotools::WeakReference<SdrObject> mxSdrObject;
132 // Restores correct position and size for presentation shapes with user call
133 // on undo
135 class UndoAutoLayoutPosAndSize final : public SfxUndoAction
137 public:
138 UndoAutoLayoutPosAndSize(SdPage& rPage);
140 virtual void Undo() override;
141 virtual void Redo() override;
143 private:
144 ::unotools::WeakReference<SdPage> mxPage;
147 class UndoGeoObject final : public SdrUndoGeoObj
149 public:
150 UndoGeoObject(SdrObject& rNewObj);
152 virtual void Undo() override;
153 virtual void Redo() override;
155 private:
156 ::unotools::WeakReference<SdPage> mxPage;
157 ::unotools::WeakReference<SdrObject> mxSdrObject;
160 class UndoAttrObject final : public SdrUndoAttrObj
162 public:
163 UndoAttrObject(SdrObject& rObject, bool bStyleSheet1, bool bSaveText);
165 virtual void Undo() override;
166 virtual void Redo() override;
168 private:
169 ::unotools::WeakReference<SdPage> mxPage;
170 ::unotools::WeakReference<SdrObject> mxSdrObject;
173 } // namespace sd
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */