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