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