Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "QueryTabConnUndoAction.hxx"
21 : #include "QTableConnection.hxx"
22 : #include <tools/debug.hxx>
23 : #include "QueryTableView.hxx"
24 : #include "QueryAddTabConnUndoAction.hxx"
25 : #include "QueryTabWinShowUndoAct.hxx"
26 : #include "dbu_qry.hrc"
27 :
28 : using namespace dbaui;
29 :
30 : DBG_NAME(OQueryTabConnUndoAction)
31 : // ------------------------------------------------------------------------------------------------
32 0 : OQueryTabConnUndoAction::~OQueryTabConnUndoAction()
33 : {
34 : DBG_DTOR(OQueryTabConnUndoAction,NULL);
35 0 : if (m_bOwnerOfConn)
36 : { // ich besitze die Connection -> loeschen
37 0 : m_pOwner->DeselectConn(m_pConnection);
38 0 : delete m_pConnection;
39 : }
40 0 : }
41 :
42 : // ------------------------------------------------------------------------------------------------
43 0 : OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView* pOwner, sal_uInt16 nCommentID)
44 : :OQueryDesignUndoAction(pOwner, nCommentID)
45 : ,m_pConnection(NULL)
46 0 : ,m_bOwnerOfConn(sal_False)
47 : {
48 : DBG_CTOR(OQueryTabConnUndoAction,NULL);
49 0 : }
50 : // -----------------------------------------------------------------------------
51 0 : OQueryAddTabConnUndoAction::OQueryAddTabConnUndoAction(OQueryTableView* pOwner)
52 0 : : OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_INSERTCONNECTION)
53 : {
54 0 : }
55 : // -----------------------------------------------------------------------------
56 0 : void OQueryAddTabConnUndoAction::Undo()
57 : {
58 0 : static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection);
59 0 : SetOwnership(sal_True);
60 0 : }
61 : // -----------------------------------------------------------------------------
62 0 : void OQueryAddTabConnUndoAction::Redo()
63 : {
64 0 : static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection);
65 0 : SetOwnership(sal_False);
66 0 : }
67 : // -----------------------------------------------------------------------------
68 0 : OQueryDelTabConnUndoAction::OQueryDelTabConnUndoAction(OQueryTableView* pOwner)
69 0 : : OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_REMOVECONNECTION)
70 : {
71 0 : }
72 : // -----------------------------------------------------------------------------
73 0 : void OQueryDelTabConnUndoAction::Undo()
74 : {
75 0 : static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection);
76 0 : SetOwnership(sal_False);
77 0 : }
78 : // -----------------------------------------------------------------------------
79 0 : void OQueryDelTabConnUndoAction::Redo()
80 : {
81 0 : static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection);
82 0 : SetOwnership(sal_True);
83 0 : }
84 : // -----------------------------------------------------------------------------
85 0 : OQueryTabWinShowUndoAct::OQueryTabWinShowUndoAct(OQueryTableView* pOwner)
86 0 : : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINSHOW)
87 : {
88 0 : }
89 : // -----------------------------------------------------------------------------
90 0 : OQueryTabWinShowUndoAct::~OQueryTabWinShowUndoAct()
91 : {
92 0 : }
93 : // -----------------------------------------------------------------------------
94 0 : void OQueryTabWinShowUndoAct::Undo()
95 : {
96 0 : static_cast<OQueryTableView*>(m_pOwner)->HideTabWin(m_pTabWin, this);
97 0 : SetOwnership(sal_True);
98 0 : }
99 : // -----------------------------------------------------------------------------
100 0 : void OQueryTabWinShowUndoAct::Redo()
101 : {
102 0 : static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin(m_pTabWin, this,sal_True);
103 0 : SetOwnership(sal_False);
104 0 : }
105 : // -----------------------------------------------------------------------------
106 0 : OQueryTabWinDelUndoAct::OQueryTabWinDelUndoAct(OQueryTableView* pOwner)
107 0 : : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINDELETE)
108 : {
109 0 : }
110 : // -----------------------------------------------------------------------------
111 0 : OQueryTabWinDelUndoAct::~OQueryTabWinDelUndoAct()
112 : {
113 0 : }
114 : // -----------------------------------------------------------------------------
115 0 : void OQueryTabWinDelUndoAct::Undo()
116 : {
117 0 : static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin( m_pTabWin, this,sal_True );
118 0 : SetOwnership(sal_False);
119 0 : }
120 : // -----------------------------------------------------------------------------
121 0 : void OQueryTabWinDelUndoAct::Redo()
122 : {
123 0 : static_cast<OQueryTableView*>(m_pOwner)->HideTabWin( m_pTabWin, this );
124 0 : SetOwnership(sal_True);
125 0 : }
126 : // -----------------------------------------------------------------------------
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|