1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 20 #ifndef INCLUDED_SVX_E3DUNDO_HXX 21 #define INCLUDED_SVX_E3DUNDO_HXX 22 23 #include <svl/itemset.hxx> 24 #include <svx/svdundo.hxx> 25 #include <svx/obj3d.hxx> 26 #include <svx/svxdllapi.h> 27 28 /************************************************************************\ 29 |* 30 |* Base class for all 3D undo actions. 31 |* 32 \************************************************************************/ 33 class SAL_WARN_UNUSED E3dUndoAction : public SdrUndoAction 34 { 35 protected: 36 E3dObject& mrMy3DObj; 37 38 public: E3dUndoAction(E3dObject & r3DObj)39 E3dUndoAction(E3dObject &r3DObj) 40 : SdrUndoAction(r3DObj.getSdrModelFromSdrObject()), 41 mrMy3DObj(r3DObj) 42 { 43 } 44 45 virtual ~E3dUndoAction () override; 46 47 virtual bool CanRepeat(SfxRepeatTarget&) const override; 48 }; 49 50 /************************************************************************\ 51 |* 52 |* Undo for 3D rotation through the rotation matrices 53 |* 54 \************************************************************************/ 55 class SAL_WARN_UNUSED E3dRotateUndoAction final : public E3dUndoAction 56 { 57 private: 58 basegfx::B3DHomMatrix maMyOldRotation; 59 basegfx::B3DHomMatrix maMyNewRotation; 60 61 public: E3dRotateUndoAction(E3dObject & r3DObj,const basegfx::B3DHomMatrix & aOldRotation,const basegfx::B3DHomMatrix & aNewRotation)62 E3dRotateUndoAction( 63 E3dObject& r3DObj, 64 const basegfx::B3DHomMatrix &aOldRotation, 65 const basegfx::B3DHomMatrix &aNewRotation) 66 : E3dUndoAction(r3DObj), 67 maMyOldRotation(aOldRotation), 68 maMyNewRotation(aNewRotation) 69 { 70 } 71 72 virtual ~E3dRotateUndoAction () override; 73 74 virtual void Undo() override; 75 virtual void Redo() override; 76 }; 77 78 /************************************************************************\ 79 |* 80 |* Undo for 3D attributes (implemented using Set3DAttributes()) 81 |* 82 \************************************************************************/ 83 class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC E3dAttributesUndoAction final : public SdrUndoAction 84 { 85 private: 86 using SdrUndoAction::Repeat; 87 88 SdrObject& mrObject; 89 const SfxItemSet maNewSet; 90 const SfxItemSet maOldSet; 91 92 public: 93 E3dAttributesUndoAction( 94 E3dObject& rInObject, 95 const SfxItemSet& rNewSet, 96 const SfxItemSet& rOldSet); 97 98 virtual ~E3dAttributesUndoAction() override; 99 100 virtual bool CanRepeat(SfxRepeatTarget& rView) const override; 101 virtual void Undo() override; 102 virtual void Redo() override; 103 }; 104 105 #endif // INCLUDED_SVX_E3DUNDO_HXX 106 107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 108