xref: /trunk/main/sw/source/core/inc/UndoDraw.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SW_UNDO_DRAW_HXX
25 #define SW_UNDO_DRAW_HXX
26 
27 #include <undobj.hxx>
28 
29 #include <svx/svdundo.hxx>
30 
31 
32 struct SwUndoGroupObjImpl;
33 class SdrMark;
34 class SdrMarkList;
35 class SdrObject;
36 class SdrObjGroup;
37 class SdrUndoAction;
38 class SwDrawFrmFmt;
39 
40 
41 
42 //--------------------------------------------------------------------
43 // ----------- Undo for Draw Objects ---------------------------------
44 
45 class SwSdrUndo : public SwUndo
46 {
47     SdrUndoAction* pSdrUndo;
48     SdrMarkList* pMarkList; // MarkList for all selected SdrObjects
49 public:
50     SwSdrUndo( SdrUndoAction* , const SdrMarkList* pMarkList );
51 
52     virtual ~SwSdrUndo();
53 
54     virtual void UndoImpl( ::sw::UndoRedoContext & );
55     virtual void RedoImpl( ::sw::UndoRedoContext & );
56 
57     String GetComment() const;
58 };
59 
60 class SwUndoDrawGroup : public SwUndo
61 {
62     SwUndoGroupObjImpl* pObjArr;
63     sal_uInt16 nSize;
64     sal_Bool bDelFmt;
65 
66 public:
67     SwUndoDrawGroup( sal_uInt16 nCnt );
68 
69     virtual ~SwUndoDrawGroup();
70 
71     virtual void UndoImpl( ::sw::UndoRedoContext & );
72     virtual void RedoImpl( ::sw::UndoRedoContext & );
73 
74     void AddObj( sal_uInt16 nPos, SwDrawFrmFmt*, SdrObject* );
75     void SetGroupFmt( SwDrawFrmFmt* );
76 };
77 
78 // --> OD 2006-11-01 #130889#
79 // Action "ungroup drawing object" is now splitted into three parts - see
80 // method <SwDoc::UnGroupSelection(..)>:
81 // - creation for <SwDrawFrmFmt> instances for the group members of the
82 //   selected group objects
83 // - intrinsic ungroup of the selected group objects
84 // - creation of <SwDrawContact> instances for the former group members and
85 //   connection to the Writer layout.
86 // Thus, two undo actions (instances of <SwUndo>) are needed:
87 // - Existing class <SwUndoDrawUnGroup> takes over the part for the formats.
88 // - New class <SwUndoDrawUnGroupConnectToLayout> takes over the part for
89 //   contact object.
90 class SwUndoDrawUnGroup : public SwUndo
91 {
92     SwUndoGroupObjImpl* pObjArr;
93     sal_uInt16 nSize;
94     sal_Bool bDelFmt;
95 
96 public:
97     SwUndoDrawUnGroup( SdrObjGroup* );
98 
99     virtual ~SwUndoDrawUnGroup();
100 
101     virtual void UndoImpl( ::sw::UndoRedoContext & );
102     virtual void RedoImpl( ::sw::UndoRedoContext & );
103 
104     void AddObj( sal_uInt16 nPos, SwDrawFrmFmt* );
105 };
106 
107 // --> OD 2006-11-01 #130889#
108 class SwUndoDrawUnGroupConnectToLayout : public SwUndo
109 {
110     private:
111         std::vector< std::pair< SwDrawFrmFmt*, SdrObject* > > aDrawFmtsAndObjs;
112 
113     public:
114         SwUndoDrawUnGroupConnectToLayout();
115 
116         virtual ~SwUndoDrawUnGroupConnectToLayout();
117 
118         virtual void UndoImpl( ::sw::UndoRedoContext & );
119         virtual void RedoImpl( ::sw::UndoRedoContext & );
120 
121         void AddFmtAndObj( SwDrawFrmFmt* pDrawFrmFmt,
122                            SdrObject* pDrawObject );
123 };
124 // <--
125 
126 
127 class SwUndoDrawDelete : public SwUndo
128 {
129     SwUndoGroupObjImpl* pObjArr;
130     SdrMarkList* pMarkLst;  // MarkList for all selected SdrObjects
131     sal_uInt16 nSize;
132     sal_Bool bDelFmt;
133 
134 public:
135     SwUndoDrawDelete( sal_uInt16 nCnt );
136 
137     virtual ~SwUndoDrawDelete();
138 
139     virtual void UndoImpl( ::sw::UndoRedoContext & );
140     virtual void RedoImpl( ::sw::UndoRedoContext & );
141 
142     void AddObj( sal_uInt16 nPos, SwDrawFrmFmt*, const SdrMark& );
143 };
144 
145 #endif // SW_UNDO_DRAW_HXX
146 
147