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 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_dbaccess.hxx" 26 #ifndef DBAUI_QUERYTABCONNUNDOACTION_HXX 27 #include "QueryTabConnUndoAction.hxx" 28 #endif 29 #ifndef DBAUI_QUERYTABLECONNECTION_HXX 30 #include "QTableConnection.hxx" 31 #endif 32 #ifndef _TOOLS_DEBUG_HXX 33 #include <tools/debug.hxx> 34 #endif 35 #ifndef DBAUI_QUERYTABLEVIEW_HXX 36 #include "QueryTableView.hxx" 37 #endif 38 #ifndef DBAUI_QUERYADDTABCONNUNDOACTION_HXX 39 #include "QueryAddTabConnUndoAction.hxx" 40 #endif 41 #ifndef DBAUI_QUERYTABWINSHOWUNDOACT_HXX 42 #include "QueryTabWinShowUndoAct.hxx" 43 #endif 44 #ifndef _DBU_QRY_HRC_ 45 #include "dbu_qry.hrc" 46 #endif 47 48 using namespace dbaui; 49 50 DBG_NAME(OQueryTabConnUndoAction) 51 // ------------------------------------------------------------------------------------------------ 52 OQueryTabConnUndoAction::~OQueryTabConnUndoAction() 53 { 54 DBG_DTOR(OQueryTabConnUndoAction,NULL); 55 if (m_bOwnerOfConn) 56 { // ich besitze die Connection -> loeschen 57 m_pOwner->DeselectConn(m_pConnection); 58 delete m_pConnection; 59 } 60 } 61 62 // ------------------------------------------------------------------------------------------------ 63 OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView* pOwner, sal_uInt16 nCommentID) 64 :OQueryDesignUndoAction(pOwner, nCommentID) 65 ,m_pConnection(NULL) 66 ,m_bOwnerOfConn(sal_False) 67 { 68 DBG_CTOR(OQueryTabConnUndoAction,NULL); 69 } 70 // ----------------------------------------------------------------------------- 71 OQueryAddTabConnUndoAction::OQueryAddTabConnUndoAction(OQueryTableView* pOwner) 72 : OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_INSERTCONNECTION) 73 { 74 } 75 // ----------------------------------------------------------------------------- 76 void OQueryAddTabConnUndoAction::Undo() 77 { 78 static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection); 79 SetOwnership(sal_True); 80 } 81 // ----------------------------------------------------------------------------- 82 void OQueryAddTabConnUndoAction::Redo() 83 { 84 static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection); 85 SetOwnership(sal_False); 86 } 87 // ----------------------------------------------------------------------------- 88 OQueryDelTabConnUndoAction::OQueryDelTabConnUndoAction(OQueryTableView* pOwner) 89 : OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_REMOVECONNECTION) 90 { 91 } 92 // ----------------------------------------------------------------------------- 93 void OQueryDelTabConnUndoAction::Undo() 94 { 95 static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection); 96 SetOwnership(sal_False); 97 } 98 // ----------------------------------------------------------------------------- 99 void OQueryDelTabConnUndoAction::Redo() 100 { 101 static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection); 102 SetOwnership(sal_True); 103 } 104 // ----------------------------------------------------------------------------- 105 OQueryTabWinShowUndoAct::OQueryTabWinShowUndoAct(OQueryTableView* pOwner) 106 : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINSHOW) 107 { 108 } 109 // ----------------------------------------------------------------------------- 110 OQueryTabWinShowUndoAct::~OQueryTabWinShowUndoAct() 111 { 112 } 113 // ----------------------------------------------------------------------------- 114 void OQueryTabWinShowUndoAct::Undo() 115 { 116 static_cast<OQueryTableView*>(m_pOwner)->HideTabWin(m_pTabWin, this); 117 SetOwnership(sal_True); 118 } 119 // ----------------------------------------------------------------------------- 120 void OQueryTabWinShowUndoAct::Redo() 121 { 122 static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin(m_pTabWin, this,sal_True); 123 SetOwnership(sal_False); 124 } 125 // ----------------------------------------------------------------------------- 126 OQueryTabWinDelUndoAct::OQueryTabWinDelUndoAct(OQueryTableView* pOwner) 127 : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINDELETE) 128 { 129 } 130 // ----------------------------------------------------------------------------- 131 OQueryTabWinDelUndoAct::~OQueryTabWinDelUndoAct() 132 { 133 } 134 // ----------------------------------------------------------------------------- 135 void OQueryTabWinDelUndoAct::Undo() 136 { 137 static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin( m_pTabWin, this,sal_True ); 138 SetOwnership(sal_False); 139 } 140 // ----------------------------------------------------------------------------- 141 void OQueryTabWinDelUndoAct::Redo() 142 { 143 static_cast<OQueryTableView*>(m_pOwner)->HideTabWin( m_pTabWin, this ); 144 SetOwnership(sal_True); 145 } 146 // ----------------------------------------------------------------------------- 147