xref: /AOO41X/main/dbaccess/source/ui/tabledesign/TableUndo.hxx (revision 2e2212a7c22e96cf6f6fab0dd042c34a45a64bd6)
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 #ifndef DBAUI_TABLEUNDO_HXX
24 #define DBAUI_TABLEUNDO_HXX
25 
26 #ifndef DBAUI_GENERALUNDO_HXX
27 #include "GeneralUndo.hxx"
28 #endif
29 #ifndef _SV_MULTISEL_HXX
30 #include <tools/multisel.hxx>
31 #endif
32 
33 #include <vector>
34 
35 #ifndef _COM_SUN_STAR_UNO_ANY_H_
36 #include <com/sun/star/uno/Any.h>
37 #endif
38 #ifndef DBAUI_TYPEINFO_HXX
39 #include "TypeInfo.hxx"
40 #endif
41 
42 namespace dbaui
43 {
44     //========================================================================
45     class OTableRowView;
46     class OTableRow;
47     class OTableDesignUndoAct : public OCommentUndoAction
48     {
49     protected:
50         OTableRowView* m_pTabDgnCtrl;
51 
52         virtual void    Undo();
53         virtual void    Redo();
54     public:
55         TYPEINFO();
56         OTableDesignUndoAct( OTableRowView* pOwner ,sal_uInt16 nCommentID);
57         virtual ~OTableDesignUndoAct();
58     };
59 
60     //========================================================================
61     class OTableEditorCtrl;
62     class OTableEditorUndoAct : public OTableDesignUndoAct
63     {
64     protected:
65         OTableEditorCtrl* pTabEdCtrl;
66 
67     public:
68         TYPEINFO();
69         OTableEditorUndoAct( OTableEditorCtrl* pOwner,sal_uInt16 nCommentID );
70         virtual ~OTableEditorUndoAct();
71     };
72 
73 
74     //========================================================================
75     class OTableDesignCellUndoAct : public OTableDesignUndoAct
76     {
77     protected:
78         sal_uInt16  m_nCol;
79         long    m_nRow;
80         ::com::sun::star::uno::Any  m_sOldText;
81         ::com::sun::star::uno::Any  m_sNewText;
82 
83         virtual void    Undo();
84         virtual void    Redo();
85     public:
86         TYPEINFO();
87         OTableDesignCellUndoAct( OTableRowView* pOwner, long nRowID, sal_uInt16 nColumn );
88         virtual ~OTableDesignCellUndoAct();
89     };
90 
91     class OTypeInfo;
92     //========================================================================
93     class OTableEditorTypeSelUndoAct : public OTableEditorUndoAct
94     {
95     protected:
96         sal_uInt16          m_nCol;
97         long            m_nRow;
98         TOTypeInfoSP    m_pOldType;
99         TOTypeInfoSP    m_pNewType;
100 
101         virtual void    Undo();
102         virtual void    Redo();
103     public:
104         TYPEINFO();
105         OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, long nRowID, sal_uInt16 nColumn, const TOTypeInfoSP& _pOldType );
106         virtual ~OTableEditorTypeSelUndoAct();
107     };
108 
109     //========================================================================
110     class OTableEditorDelUndoAct : public OTableEditorUndoAct
111     {
112     protected:
113         ::std::vector< ::boost::shared_ptr<OTableRow> > m_aDeletedRows;
114 
115         virtual void    Undo();
116         virtual void    Redo();
117     public:
118         TYPEINFO();
119         OTableEditorDelUndoAct( OTableEditorCtrl* pOwner );
120         virtual ~OTableEditorDelUndoAct();
121     };
122 
123     //========================================================================
124     class OTableEditorInsUndoAct : public OTableEditorUndoAct
125     {
126     protected:
127         ::std::vector< ::boost::shared_ptr<OTableRow> > m_vInsertedRows;
128         long                        m_nInsPos;
129 
130         virtual void    Undo();
131         virtual void    Redo();
132     public:
133         TYPEINFO();
134         OTableEditorInsUndoAct( OTableEditorCtrl* pOwner,
135                                 long nInsertPosition,
136                                 const ::std::vector<  ::boost::shared_ptr<OTableRow> >& _vInsertedRows);
137         virtual ~OTableEditorInsUndoAct();
138     };
139 
140     //========================================================================
141     class OTableEditorInsNewUndoAct : public OTableEditorUndoAct
142     {
143     protected:
144         long m_nInsPos;
145         long m_nInsRows;
146 
147         virtual void    Undo();
148         virtual void    Redo();
149     public:
150         TYPEINFO();
151         OTableEditorInsNewUndoAct( OTableEditorCtrl* pOwner, long nInsertPosition, long nInsertedRows );
152         virtual ~OTableEditorInsNewUndoAct();
153     };
154 
155     //========================================================================
156     class OPrimKeyUndoAct : public OTableEditorUndoAct
157     {
158     protected:
159         MultiSelection      m_aDelKeys,
160                             m_aInsKeys;
161         sal_Bool                m_bActPrimKeySet;
162         OTableEditorCtrl* m_pEditorCtrl;
163 
164         virtual void    Undo();
165         virtual void    Redo();
166     public:
167         TYPEINFO();
168         OPrimKeyUndoAct( OTableEditorCtrl* pOwner, MultiSelection aDeletedKeys, MultiSelection aInsertedKeys );
169         virtual ~OPrimKeyUndoAct();
170     };
171 }
172 #endif // DBAUI_TABLEUNDO_HXX
173 
174 
175