1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "QueryTabConnUndoAction.hxx"
21 #include "QTableConnection.hxx"
22 #include "QTableWindow.hxx"
23 #include <tools/debug.hxx>
24 #include "QueryTableView.hxx"
25 #include "QueryAddTabConnUndoAction.hxx"
26 #include "QueryTabWinShowUndoAct.hxx"
27 #include "dbu_qry.hrc"
29 using namespace dbaui
;
31 OQueryTabConnUndoAction::~OQueryTabConnUndoAction()
34 { // I have the connection -> delete
35 m_pOwner
->DeselectConn(m_pConnection
);
36 m_pConnection
.disposeAndClear();
40 OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView
* pOwner
, sal_uInt16 nCommentID
)
41 :OQueryDesignUndoAction(pOwner
, nCommentID
)
42 ,m_pConnection(nullptr)
43 ,m_bOwnerOfConn(false)
47 OQueryAddTabConnUndoAction::OQueryAddTabConnUndoAction(OQueryTableView
* pOwner
)
48 : OQueryTabConnUndoAction(pOwner
, STR_QUERY_UNDO_INSERTCONNECTION
)
52 void OQueryAddTabConnUndoAction::Undo()
54 static_cast<OQueryTableView
*>(m_pOwner
.get())->DropConnection(m_pConnection
);
58 void OQueryAddTabConnUndoAction::Redo()
60 static_cast<OQueryTableView
*>(m_pOwner
.get())->GetConnection(m_pConnection
);
64 OQueryDelTabConnUndoAction::OQueryDelTabConnUndoAction(OQueryTableView
* pOwner
)
65 : OQueryTabConnUndoAction(pOwner
, STR_QUERY_UNDO_REMOVECONNECTION
)
69 void OQueryDelTabConnUndoAction::Undo()
71 static_cast<OQueryTableView
*>(m_pOwner
.get())->GetConnection(m_pConnection
);
75 void OQueryDelTabConnUndoAction::Redo()
77 static_cast<OQueryTableView
*>(m_pOwner
.get())->DropConnection(m_pConnection
);
81 OQueryTabWinShowUndoAct::OQueryTabWinShowUndoAct(OQueryTableView
* pOwner
)
82 : OQueryTabWinUndoAct(pOwner
, STR_QUERY_UNDO_TABWINSHOW
)
86 OQueryTabWinShowUndoAct::~OQueryTabWinShowUndoAct()
90 void OQueryTabWinShowUndoAct::Undo()
92 static_cast<OQueryTableView
*>(m_pOwner
.get())->HideTabWin(m_pTabWin
, this);
96 void OQueryTabWinShowUndoAct::Redo()
98 static_cast<OQueryTableView
*>(m_pOwner
.get())->ShowTabWin(m_pTabWin
, this,true);
102 OQueryTabWinDelUndoAct::OQueryTabWinDelUndoAct(OQueryTableView
* pOwner
)
103 : OQueryTabWinUndoAct(pOwner
, STR_QUERY_UNDO_TABWINDELETE
)
107 OQueryTabWinDelUndoAct::~OQueryTabWinDelUndoAct()
111 void OQueryTabWinDelUndoAct::Undo()
113 static_cast<OQueryTableView
*>(m_pOwner
.get())->ShowTabWin( m_pTabWin
, this,true );
117 void OQueryTabWinDelUndoAct::Redo()
119 static_cast<OQueryTableView
*>(m_pOwner
.get())->HideTabWin( m_pTabWin
, this );
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */