Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / querydesign / QueryTabConnUndoAction.cxx
blobe3b6cd0e94bbf1e34a8d155c2257e8e49da897ee
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <QueryTableView.hxx>
23 #include "QueryAddTabConnUndoAction.hxx"
24 #include "QueryTabWinShowUndoAct.hxx"
25 #include <strings.hrc>
27 using namespace dbaui;
29 OQueryTabConnUndoAction::~OQueryTabConnUndoAction()
31 if (m_bOwnerOfConn)
32 { // I have the connection -> delete
33 m_pOwner->DeselectConn(m_pConnection);
34 m_pConnection.disposeAndClear();
38 OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView* pOwner, TranslateId pCommentID)
39 : OQueryDesignUndoAction(pOwner, pCommentID)
40 , m_pConnection(nullptr)
41 , m_bOwnerOfConn(false)
45 OQueryAddTabConnUndoAction::OQueryAddTabConnUndoAction(OQueryTableView* pOwner)
46 : OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_INSERTCONNECTION)
50 void OQueryAddTabConnUndoAction::Undo()
52 static_cast<OQueryTableView*>(m_pOwner.get())->DropConnection(m_pConnection);
53 SetOwnership(true);
56 void OQueryAddTabConnUndoAction::Redo()
58 static_cast<OQueryTableView*>(m_pOwner.get())->GetConnection(m_pConnection);
59 SetOwnership(false);
62 OQueryDelTabConnUndoAction::OQueryDelTabConnUndoAction(OQueryTableView* pOwner)
63 : OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_REMOVECONNECTION)
67 void OQueryDelTabConnUndoAction::Undo()
69 static_cast<OQueryTableView*>(m_pOwner.get())->GetConnection(m_pConnection);
70 SetOwnership(false);
73 void OQueryDelTabConnUndoAction::Redo()
75 static_cast<OQueryTableView*>(m_pOwner.get())->DropConnection(m_pConnection);
76 SetOwnership(true);
79 OQueryTabWinShowUndoAct::OQueryTabWinShowUndoAct(OQueryTableView* pOwner)
80 : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINSHOW)
84 OQueryTabWinShowUndoAct::~OQueryTabWinShowUndoAct() {}
86 void OQueryTabWinShowUndoAct::Undo()
88 static_cast<OQueryTableView*>(m_pOwner.get())->HideTabWin(m_pTabWin, this);
89 SetOwnership(true);
92 void OQueryTabWinShowUndoAct::Redo()
94 static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin(m_pTabWin, this, true);
95 SetOwnership(false);
98 OQueryTabWinDelUndoAct::OQueryTabWinDelUndoAct(OQueryTableView* pOwner)
99 : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINDELETE)
103 OQueryTabWinDelUndoAct::~OQueryTabWinDelUndoAct() {}
105 void OQueryTabWinDelUndoAct::Undo()
107 static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin(m_pTabWin, this, true);
108 SetOwnership(false);
111 void OQueryTabWinDelUndoAct::Redo()
113 static_cast<OQueryTableView*>(m_pOwner.get())->HideTabWin(m_pTabWin, this);
114 SetOwnership(true);
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */