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_QUERYTABWINUNDOACT_HXX
24 #define DBAUI_QUERYTABWINUNDOACT_HXX
25 
26 #ifndef DBAUI_QUERYDESIGNUNDOACTION_HXX
27 #include "QueryDesignUndoAction.hxx"
28 #endif
29 #ifndef INCLUDED_VECTOR
30 #define INCLUDED_VECTOR
31 #include <vector>
32 #endif // INCLUDED_VECTOR
33 
34 #include <algorithm>
35 
36 namespace dbaui
37 {
38 	// ================================================================================================
39 	// OQueryTabWinUndoAct - Undo-Basisklasse fuer alles, was mit Einfuegen/Entfernen von TabWIns zu tun hat zu tun hat
40 
41 	class OQueryTableWindow;
42 	class OTableConnection;
43 	class OQueryTableView;
44 	class OQueryTabWinUndoAct : public OQueryDesignUndoAction
45 	{
46 	protected:
47 		::std::vector<OTableConnection*> m_vTableConnection;
48 		OQueryTableWindow*				 m_pTabWin;
49 		sal_Bool							 m_bOwnerOfObjects;
50 			// bin ich alleiniger Eigentuemer der verwalteten Objekte ? (aendert sich mit jedem Redo oder Undo)
51 
52 	public:
53 		OQueryTabWinUndoAct(OQueryTableView* pOwner, sal_uInt16 nCommentID);
54 		virtual ~OQueryTabWinUndoAct();
55 
SetOwnership(sal_Bool bTakeIt)56 		void SetOwnership(sal_Bool bTakeIt) { m_bOwnerOfObjects = bTakeIt; }
57 
58 
59 		virtual void Undo() = 0;
60 		virtual void Redo() = 0;
61 
62 		// Zugriff auf das TabWin
SetTabWin(OQueryTableWindow * pTW)63 		void SetTabWin(OQueryTableWindow* pTW) { m_pTabWin = pTW; }
64 			// anschliessend sollte das SetOwnership aufgerufen werden
65 
66 		// Zugriff auf die verwalteten Connections
ConnCount()67 		sal_uInt16	ConnCount() { return (sal_uInt16)m_vTableConnection.size(); }
68 
GetTabConnList()69 		::std::vector<OTableConnection*>*		GetTabConnList() { return &m_vTableConnection; }
70 
InsertConnection(OTableConnection * pConnection)71 		void InsertConnection( OTableConnection* pConnection ) { m_vTableConnection.push_back(pConnection); }
RemoveConnection(OTableConnection * pConnection)72 		void RemoveConnection( OTableConnection* pConnection )
73 		{
74 			m_vTableConnection.erase(::std::remove(m_vTableConnection.begin(),m_vTableConnection.end(),pConnection),m_vTableConnection.end());
75 		}
76 	};
77 
78 
79 }
80 #endif // DBAUI_QUERYTABWINUNDOACT_HXX
81 
82 
83 
84