1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir #ifndef DBAUI_TABLEUNDO_HXX
24cdf0e10cSrcweir #define DBAUI_TABLEUNDO_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef DBAUI_GENERALUNDO_HXX
27cdf0e10cSrcweir #include "GeneralUndo.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef _SV_MULTISEL_HXX
30cdf0e10cSrcweir #include <tools/multisel.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <vector>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_ANY_H_
36cdf0e10cSrcweir #include <com/sun/star/uno/Any.h>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef DBAUI_TYPEINFO_HXX
39cdf0e10cSrcweir #include "TypeInfo.hxx"
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace dbaui
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	//========================================================================
45cdf0e10cSrcweir 	class OTableRowView;
46cdf0e10cSrcweir 	class OTableRow;
47cdf0e10cSrcweir 	class OTableDesignUndoAct : public OCommentUndoAction
48cdf0e10cSrcweir 	{
49cdf0e10cSrcweir 	protected:
50cdf0e10cSrcweir 		OTableRowView* m_pTabDgnCtrl;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 		virtual void	Undo();
53cdf0e10cSrcweir 		virtual void	Redo();
54cdf0e10cSrcweir 	public:
55cdf0e10cSrcweir     	TYPEINFO();
56cdf0e10cSrcweir 		OTableDesignUndoAct( OTableRowView* pOwner ,sal_uInt16 nCommentID);
57cdf0e10cSrcweir 		virtual ~OTableDesignUndoAct();
58cdf0e10cSrcweir 	};
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	//========================================================================
61cdf0e10cSrcweir 	class OTableEditorCtrl;
62cdf0e10cSrcweir 	class OTableEditorUndoAct : public OTableDesignUndoAct
63cdf0e10cSrcweir 	{
64cdf0e10cSrcweir 	protected:
65cdf0e10cSrcweir 		OTableEditorCtrl* pTabEdCtrl;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	public:
68cdf0e10cSrcweir     	TYPEINFO();
69cdf0e10cSrcweir 		OTableEditorUndoAct( OTableEditorCtrl* pOwner,sal_uInt16 nCommentID );
70cdf0e10cSrcweir 		virtual ~OTableEditorUndoAct();
71cdf0e10cSrcweir 	};
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	//========================================================================
75cdf0e10cSrcweir 	class OTableDesignCellUndoAct : public OTableDesignUndoAct
76cdf0e10cSrcweir 	{
77cdf0e10cSrcweir 	protected:
78cdf0e10cSrcweir 		sal_uInt16	m_nCol;
79cdf0e10cSrcweir 		long	m_nRow;
80cdf0e10cSrcweir 		::com::sun::star::uno::Any	m_sOldText;
81cdf0e10cSrcweir 		::com::sun::star::uno::Any	m_sNewText;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 		virtual void	Undo();
84cdf0e10cSrcweir 		virtual void	Redo();
85cdf0e10cSrcweir 	public:
86cdf0e10cSrcweir     	TYPEINFO();
87cdf0e10cSrcweir 		OTableDesignCellUndoAct( OTableRowView* pOwner, long nRowID, sal_uInt16 nColumn );
88cdf0e10cSrcweir 		virtual ~OTableDesignCellUndoAct();
89cdf0e10cSrcweir 	};
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	class OTypeInfo;
92cdf0e10cSrcweir 	//========================================================================
93cdf0e10cSrcweir 	class OTableEditorTypeSelUndoAct : public OTableEditorUndoAct
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 	protected:
96cdf0e10cSrcweir 		sal_uInt16			m_nCol;
97cdf0e10cSrcweir 		long			m_nRow;
98cdf0e10cSrcweir 		TOTypeInfoSP	m_pOldType;
99cdf0e10cSrcweir 		TOTypeInfoSP	m_pNewType;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 		virtual void	Undo();
102cdf0e10cSrcweir 		virtual void	Redo();
103cdf0e10cSrcweir 	public:
104cdf0e10cSrcweir     	TYPEINFO();
105cdf0e10cSrcweir 		OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, long nRowID, sal_uInt16 nColumn, const TOTypeInfoSP& _pOldType );
106cdf0e10cSrcweir 		virtual ~OTableEditorTypeSelUndoAct();
107cdf0e10cSrcweir 	};
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	//========================================================================
110cdf0e10cSrcweir 	class OTableEditorDelUndoAct : public OTableEditorUndoAct
111cdf0e10cSrcweir 	{
112cdf0e10cSrcweir 	protected:
113cdf0e10cSrcweir 		::std::vector< ::boost::shared_ptr<OTableRow> >	m_aDeletedRows;
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 		virtual void	Undo();
116cdf0e10cSrcweir 		virtual void	Redo();
117cdf0e10cSrcweir 	public:
118cdf0e10cSrcweir     	TYPEINFO();
119cdf0e10cSrcweir 		OTableEditorDelUndoAct( OTableEditorCtrl* pOwner );
120cdf0e10cSrcweir 		virtual ~OTableEditorDelUndoAct();
121cdf0e10cSrcweir 	};
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	//========================================================================
124cdf0e10cSrcweir 	class OTableEditorInsUndoAct : public OTableEditorUndoAct
125cdf0e10cSrcweir 	{
126cdf0e10cSrcweir 	protected:
127cdf0e10cSrcweir 		::std::vector< ::boost::shared_ptr<OTableRow> >	m_vInsertedRows;
128cdf0e10cSrcweir 		long						m_nInsPos;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 		virtual void	Undo();
131cdf0e10cSrcweir 		virtual void	Redo();
132cdf0e10cSrcweir 	public:
133cdf0e10cSrcweir     	TYPEINFO();
134cdf0e10cSrcweir 		OTableEditorInsUndoAct( OTableEditorCtrl* pOwner,
135cdf0e10cSrcweir 								long nInsertPosition,
136cdf0e10cSrcweir 								const ::std::vector<  ::boost::shared_ptr<OTableRow> >& _vInsertedRows);
137cdf0e10cSrcweir 		virtual ~OTableEditorInsUndoAct();
138cdf0e10cSrcweir 	};
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	//========================================================================
141cdf0e10cSrcweir 	class OTableEditorInsNewUndoAct : public OTableEditorUndoAct
142cdf0e10cSrcweir 	{
143cdf0e10cSrcweir 	protected:
144cdf0e10cSrcweir 		long m_nInsPos;
145cdf0e10cSrcweir 		long m_nInsRows;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 		virtual void	Undo();
148cdf0e10cSrcweir 		virtual void	Redo();
149cdf0e10cSrcweir 	public:
150cdf0e10cSrcweir     	TYPEINFO();
151cdf0e10cSrcweir 		OTableEditorInsNewUndoAct( OTableEditorCtrl* pOwner, long nInsertPosition, long nInsertedRows );
152cdf0e10cSrcweir 		virtual ~OTableEditorInsNewUndoAct();
153cdf0e10cSrcweir 	};
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	//========================================================================
156cdf0e10cSrcweir 	class OPrimKeyUndoAct : public OTableEditorUndoAct
157cdf0e10cSrcweir 	{
158cdf0e10cSrcweir 	protected:
159cdf0e10cSrcweir 		MultiSelection		m_aDelKeys,
160cdf0e10cSrcweir 							m_aInsKeys;
161cdf0e10cSrcweir 		sal_Bool				m_bActPrimKeySet;
162cdf0e10cSrcweir 		OTableEditorCtrl* m_pEditorCtrl;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 		virtual void	Undo();
165cdf0e10cSrcweir 		virtual void	Redo();
166cdf0e10cSrcweir 	public:
167cdf0e10cSrcweir     	TYPEINFO();
168cdf0e10cSrcweir 		OPrimKeyUndoAct( OTableEditorCtrl* pOwner, MultiSelection aDeletedKeys, MultiSelection aInsertedKeys );
169cdf0e10cSrcweir 		virtual ~OPrimKeyUndoAct();
170cdf0e10cSrcweir 	};
171cdf0e10cSrcweir }
172cdf0e10cSrcweir #endif // DBAUI_TABLEUNDO_HXX
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 
175