1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*96de5490SAndrew Rist  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*96de5490SAndrew Rist  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19*96de5490SAndrew Rist  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir #ifndef DBAUI_QUERYTABCONNUNDOACTION_HXX
27cdf0e10cSrcweir #include "QueryTabConnUndoAction.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef DBAUI_QUERYTABLECONNECTION_HXX
30cdf0e10cSrcweir #include "QTableConnection.hxx"
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX
33cdf0e10cSrcweir #include <tools/debug.hxx>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef DBAUI_QUERYTABLEVIEW_HXX
36cdf0e10cSrcweir #include "QueryTableView.hxx"
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef DBAUI_QUERYADDTABCONNUNDOACTION_HXX
39cdf0e10cSrcweir #include "QueryAddTabConnUndoAction.hxx"
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #ifndef DBAUI_QUERYTABWINSHOWUNDOACT_HXX
42cdf0e10cSrcweir #include "QueryTabWinShowUndoAct.hxx"
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #ifndef _DBU_QRY_HRC_
45cdf0e10cSrcweir #include "dbu_qry.hrc"
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir 
48cdf0e10cSrcweir using namespace dbaui;
49cdf0e10cSrcweir 
DBG_NAME(OQueryTabConnUndoAction)50cdf0e10cSrcweir DBG_NAME(OQueryTabConnUndoAction)
51cdf0e10cSrcweir // ------------------------------------------------------------------------------------------------
52cdf0e10cSrcweir OQueryTabConnUndoAction::~OQueryTabConnUndoAction()
53cdf0e10cSrcweir {
54cdf0e10cSrcweir 	DBG_DTOR(OQueryTabConnUndoAction,NULL);
55cdf0e10cSrcweir 	if (m_bOwnerOfConn)
56cdf0e10cSrcweir 	{	// ich besitze die Connection -> loeschen
57cdf0e10cSrcweir 		m_pOwner->DeselectConn(m_pConnection);
58cdf0e10cSrcweir 		delete m_pConnection;
59cdf0e10cSrcweir 	}
60cdf0e10cSrcweir }
61cdf0e10cSrcweir 
62cdf0e10cSrcweir // ------------------------------------------------------------------------------------------------
OQueryTabConnUndoAction(OQueryTableView * pOwner,sal_uInt16 nCommentID)63cdf0e10cSrcweir OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView* pOwner, sal_uInt16 nCommentID)
64cdf0e10cSrcweir 	:OQueryDesignUndoAction(pOwner, nCommentID)
65cdf0e10cSrcweir 	,m_pConnection(NULL)
66cdf0e10cSrcweir 	,m_bOwnerOfConn(sal_False)
67cdf0e10cSrcweir {
68cdf0e10cSrcweir 	DBG_CTOR(OQueryTabConnUndoAction,NULL);
69cdf0e10cSrcweir }
70cdf0e10cSrcweir // -----------------------------------------------------------------------------
OQueryAddTabConnUndoAction(OQueryTableView * pOwner)71cdf0e10cSrcweir OQueryAddTabConnUndoAction::OQueryAddTabConnUndoAction(OQueryTableView* pOwner)
72cdf0e10cSrcweir 	: OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_INSERTCONNECTION)
73cdf0e10cSrcweir {
74cdf0e10cSrcweir }
75cdf0e10cSrcweir // -----------------------------------------------------------------------------
Undo()76cdf0e10cSrcweir void OQueryAddTabConnUndoAction::Undo()
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection);
79cdf0e10cSrcweir 	SetOwnership(sal_True);
80cdf0e10cSrcweir }
81cdf0e10cSrcweir // -----------------------------------------------------------------------------
Redo()82cdf0e10cSrcweir void OQueryAddTabConnUndoAction::Redo()
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection);
85cdf0e10cSrcweir 	SetOwnership(sal_False);
86cdf0e10cSrcweir }
87cdf0e10cSrcweir // -----------------------------------------------------------------------------
OQueryDelTabConnUndoAction(OQueryTableView * pOwner)88cdf0e10cSrcweir OQueryDelTabConnUndoAction::OQueryDelTabConnUndoAction(OQueryTableView* pOwner)
89cdf0e10cSrcweir 	: OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_REMOVECONNECTION)
90cdf0e10cSrcweir {
91cdf0e10cSrcweir }
92cdf0e10cSrcweir // -----------------------------------------------------------------------------
Undo()93cdf0e10cSrcweir void OQueryDelTabConnUndoAction::Undo()
94cdf0e10cSrcweir {
95cdf0e10cSrcweir 	static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection);
96cdf0e10cSrcweir 	SetOwnership(sal_False);
97cdf0e10cSrcweir }
98cdf0e10cSrcweir // -----------------------------------------------------------------------------
Redo()99cdf0e10cSrcweir void OQueryDelTabConnUndoAction::Redo()
100cdf0e10cSrcweir {
101cdf0e10cSrcweir 	static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection);
102cdf0e10cSrcweir 	SetOwnership(sal_True);
103cdf0e10cSrcweir }
104cdf0e10cSrcweir // -----------------------------------------------------------------------------
OQueryTabWinShowUndoAct(OQueryTableView * pOwner)105cdf0e10cSrcweir OQueryTabWinShowUndoAct::OQueryTabWinShowUndoAct(OQueryTableView* pOwner)
106cdf0e10cSrcweir  : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINSHOW)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir }
109cdf0e10cSrcweir // -----------------------------------------------------------------------------
~OQueryTabWinShowUndoAct()110cdf0e10cSrcweir OQueryTabWinShowUndoAct::~OQueryTabWinShowUndoAct()
111cdf0e10cSrcweir {
112cdf0e10cSrcweir }
113cdf0e10cSrcweir // -----------------------------------------------------------------------------
Undo()114cdf0e10cSrcweir void OQueryTabWinShowUndoAct::Undo()
115cdf0e10cSrcweir {
116cdf0e10cSrcweir 	static_cast<OQueryTableView*>(m_pOwner)->HideTabWin(m_pTabWin, this);
117cdf0e10cSrcweir 	SetOwnership(sal_True);
118cdf0e10cSrcweir }
119cdf0e10cSrcweir // -----------------------------------------------------------------------------
Redo()120cdf0e10cSrcweir void OQueryTabWinShowUndoAct::Redo()
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin(m_pTabWin, this,sal_True);
123cdf0e10cSrcweir 	SetOwnership(sal_False);
124cdf0e10cSrcweir }
125cdf0e10cSrcweir // -----------------------------------------------------------------------------
OQueryTabWinDelUndoAct(OQueryTableView * pOwner)126cdf0e10cSrcweir OQueryTabWinDelUndoAct::OQueryTabWinDelUndoAct(OQueryTableView* pOwner)
127cdf0e10cSrcweir  : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINDELETE)
128cdf0e10cSrcweir {
129cdf0e10cSrcweir }
130cdf0e10cSrcweir // -----------------------------------------------------------------------------
~OQueryTabWinDelUndoAct()131cdf0e10cSrcweir OQueryTabWinDelUndoAct::~OQueryTabWinDelUndoAct()
132cdf0e10cSrcweir {
133cdf0e10cSrcweir }
134cdf0e10cSrcweir // -----------------------------------------------------------------------------
Undo()135cdf0e10cSrcweir void OQueryTabWinDelUndoAct::Undo()
136cdf0e10cSrcweir {
137cdf0e10cSrcweir 	static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin( m_pTabWin, this,sal_True );
138cdf0e10cSrcweir 	SetOwnership(sal_False);
139cdf0e10cSrcweir }
140cdf0e10cSrcweir // -----------------------------------------------------------------------------
Redo()141cdf0e10cSrcweir void OQueryTabWinDelUndoAct::Redo()
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	static_cast<OQueryTableView*>(m_pOwner)->HideTabWin( m_pTabWin, this );
144cdf0e10cSrcweir 	SetOwnership(sal_True);
145cdf0e10cSrcweir }
146cdf0e10cSrcweir // -----------------------------------------------------------------------------
147