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 #ifndef SW_UNDO_DRAW_HXX 29 #define SW_UNDO_DRAW_HXX 30 31 #include <undobj.hxx> 32 33 #include <svx/svdundo.hxx> 34 35 36 struct SwUndoGroupObjImpl; 37 class SdrMark; 38 class SdrMarkList; 39 class SdrObject; 40 class SdrObjGroup; 41 class SdrUndoAction; 42 class SwDrawFrmFmt; 43 44 45 46 //-------------------------------------------------------------------- 47 // ----------- Undo for Draw Objects --------------------------------- 48 49 class SwSdrUndo : public SwUndo 50 { 51 SdrUndoAction* pSdrUndo; 52 SdrMarkList* pMarkList; // MarkList for all selected SdrObjects 53 public: 54 SwSdrUndo( SdrUndoAction* , const SdrMarkList* pMarkList ); 55 56 virtual ~SwSdrUndo(); 57 58 virtual void UndoImpl( ::sw::UndoRedoContext & ); 59 virtual void RedoImpl( ::sw::UndoRedoContext & ); 60 61 String GetComment() const; 62 }; 63 64 class SwUndoDrawGroup : public SwUndo 65 { 66 SwUndoGroupObjImpl* pObjArr; 67 sal_uInt16 nSize; 68 sal_Bool bDelFmt; 69 70 public: 71 SwUndoDrawGroup( sal_uInt16 nCnt ); 72 73 virtual ~SwUndoDrawGroup(); 74 75 virtual void UndoImpl( ::sw::UndoRedoContext & ); 76 virtual void RedoImpl( ::sw::UndoRedoContext & ); 77 78 void AddObj( sal_uInt16 nPos, SwDrawFrmFmt*, SdrObject* ); 79 void SetGroupFmt( SwDrawFrmFmt* ); 80 }; 81 82 // --> OD 2006-11-01 #130889# 83 // Action "ungroup drawing object" is now splitted into three parts - see 84 // method <SwDoc::UnGroupSelection(..)>: 85 // - creation for <SwDrawFrmFmt> instances for the group members of the 86 // selected group objects 87 // - intrinsic ungroup of the selected group objects 88 // - creation of <SwDrawContact> instances for the former group members and 89 // connection to the Writer layout. 90 // Thus, two undo actions (instances of <SwUndo>) are needed: 91 // - Existing class <SwUndoDrawUnGroup> takes over the part for the formats. 92 // - New class <SwUndoDrawUnGroupConnectToLayout> takes over the part for 93 // contact object. 94 class SwUndoDrawUnGroup : public SwUndo 95 { 96 SwUndoGroupObjImpl* pObjArr; 97 sal_uInt16 nSize; 98 sal_Bool bDelFmt; 99 100 public: 101 SwUndoDrawUnGroup( SdrObjGroup* ); 102 103 virtual ~SwUndoDrawUnGroup(); 104 105 virtual void UndoImpl( ::sw::UndoRedoContext & ); 106 virtual void RedoImpl( ::sw::UndoRedoContext & ); 107 108 void AddObj( sal_uInt16 nPos, SwDrawFrmFmt* ); 109 }; 110 111 // --> OD 2006-11-01 #130889# 112 class SwUndoDrawUnGroupConnectToLayout : public SwUndo 113 { 114 private: 115 std::vector< std::pair< SwDrawFrmFmt*, SdrObject* > > aDrawFmtsAndObjs; 116 117 public: 118 SwUndoDrawUnGroupConnectToLayout(); 119 120 virtual ~SwUndoDrawUnGroupConnectToLayout(); 121 122 virtual void UndoImpl( ::sw::UndoRedoContext & ); 123 virtual void RedoImpl( ::sw::UndoRedoContext & ); 124 125 void AddFmtAndObj( SwDrawFrmFmt* pDrawFrmFmt, 126 SdrObject* pDrawObject ); 127 }; 128 // <-- 129 130 131 class SwUndoDrawDelete : public SwUndo 132 { 133 SwUndoGroupObjImpl* pObjArr; 134 SdrMarkList* pMarkLst; // MarkList for all selected SdrObjects 135 sal_uInt16 nSize; 136 sal_Bool bDelFmt; 137 138 public: 139 SwUndoDrawDelete( sal_uInt16 nCnt ); 140 141 virtual ~SwUndoDrawDelete(); 142 143 virtual void UndoImpl( ::sw::UndoRedoContext & ); 144 virtual void RedoImpl( ::sw::UndoRedoContext & ); 145 146 void AddObj( sal_uInt16 nPos, SwDrawFrmFmt*, const SdrMark& ); 147 }; 148 149 #endif // SW_UNDO_DRAW_HXX 150 151