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 INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABWINUNDOACT_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABWINUNDOACT_HXX
21 :
22 : #include "QueryDesignUndoAction.hxx"
23 : #include <vector>
24 : #include <algorithm>
25 :
26 : namespace dbaui
27 : {
28 : // OQueryTabWinUndoAct - undo base class for all which is concerned with insert/remove TabWins
29 :
30 : class OQueryTableWindow;
31 : class OTableConnection;
32 : class OQueryTableView;
33 : class OQueryTabWinUndoAct : public OQueryDesignUndoAction
34 : {
35 : protected:
36 : ::std::vector<OTableConnection*> m_vTableConnection;
37 : OQueryTableWindow* m_pTabWin;
38 : sal_Bool m_bOwnerOfObjects;
39 : // am I the only owner of the managed objects? (changes with every redo or undo)
40 :
41 : public:
42 : OQueryTabWinUndoAct(OQueryTableView* pOwner, sal_uInt16 nCommentID);
43 : virtual ~OQueryTabWinUndoAct();
44 :
45 0 : void SetOwnership(sal_Bool bTakeIt) { m_bOwnerOfObjects = bTakeIt; }
46 :
47 : virtual void Undo() SAL_OVERRIDE = 0;
48 : virtual void Redo() SAL_OVERRIDE = 0;
49 :
50 : // access to the TabWin
51 0 : void SetTabWin(OQueryTableWindow* pTW) { m_pTabWin = pTW; }
52 : // now SetOwnership should be invoked
53 :
54 : // access to the managed connections
55 : sal_uInt16 ConnCount() { return (sal_uInt16)m_vTableConnection.size(); }
56 :
57 0 : ::std::vector<OTableConnection*>* GetTabConnList() { return &m_vTableConnection; }
58 :
59 0 : void InsertConnection( OTableConnection* pConnection ) { m_vTableConnection.push_back(pConnection); }
60 : void RemoveConnection( OTableConnection* pConnection )
61 : {
62 : m_vTableConnection.erase(::std::remove(m_vTableConnection.begin(),m_vTableConnection.end(),pConnection),m_vTableConnection.end());
63 : }
64 : };
65 :
66 : }
67 : #endif // INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYTABWINUNDOACT_HXX
68 :
69 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|