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