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 : #ifndef DBAUI_QUERYTABWINUNDOACT_HXX
20 : #define DBAUI_QUERYTABWINUNDOACT_HXX
21 :
22 : #include "QueryDesignUndoAction.hxx"
23 : #include <vector>
24 : #include <algorithm>
25 :
26 : namespace dbaui
27 : {
28 : // ================================================================================================
29 : // OQueryTabWinUndoAct - Undo-Basisklasse fuer alles, was mit Einfuegen/Entfernen von TabWIns zu tun hat zu tun hat
30 :
31 : class OQueryTableWindow;
32 : class OTableConnection;
33 : class OQueryTableView;
34 : class OQueryTabWinUndoAct : public OQueryDesignUndoAction
35 : {
36 : protected:
37 : ::std::vector<OTableConnection*> m_vTableConnection;
38 : OQueryTableWindow* m_pTabWin;
39 : sal_Bool m_bOwnerOfObjects;
40 : // bin ich alleiniger Eigentuemer der verwalteten Objekte ? (aendert sich mit jedem Redo oder Undo)
41 :
42 : public:
43 : OQueryTabWinUndoAct(OQueryTableView* pOwner, sal_uInt16 nCommentID);
44 : virtual ~OQueryTabWinUndoAct();
45 :
46 0 : void SetOwnership(sal_Bool bTakeIt) { m_bOwnerOfObjects = bTakeIt; }
47 :
48 :
49 : virtual void Undo() = 0;
50 : virtual void Redo() = 0;
51 :
52 : // Zugriff auf das TabWin
53 0 : void SetTabWin(OQueryTableWindow* pTW) { m_pTabWin = pTW; }
54 : // anschliessend sollte das SetOwnership aufgerufen werden
55 :
56 : // Zugriff auf die verwalteten Connections
57 : sal_uInt16 ConnCount() { return (sal_uInt16)m_vTableConnection.size(); }
58 :
59 0 : ::std::vector<OTableConnection*>* GetTabConnList() { return &m_vTableConnection; }
60 :
61 0 : void InsertConnection( OTableConnection* pConnection ) { m_vTableConnection.push_back(pConnection); }
62 : void RemoveConnection( OTableConnection* pConnection )
63 : {
64 : m_vTableConnection.erase(::std::remove(m_vTableConnection.begin(),m_vTableConnection.end(),pConnection),m_vTableConnection.end());
65 : }
66 : };
67 :
68 :
69 : }
70 : #endif // DBAUI_QUERYTABWINUNDOACT_HXX
71 :
72 :
73 :
74 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|