1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef DBAUI_QUERYTABWINUNDOACT_HXX 28 #define DBAUI_QUERYTABWINUNDOACT_HXX 29 30 #ifndef DBAUI_QUERYDESIGNUNDOACTION_HXX 31 #include "QueryDesignUndoAction.hxx" 32 #endif 33 #ifndef INCLUDED_VECTOR 34 #define INCLUDED_VECTOR 35 #include <vector> 36 #endif // INCLUDED_VECTOR 37 38 #include <algorithm> 39 40 namespace dbaui 41 { 42 // ================================================================================================ 43 // OQueryTabWinUndoAct - Undo-Basisklasse fuer alles, was mit Einfuegen/Entfernen von TabWIns zu tun hat zu tun hat 44 45 class OQueryTableWindow; 46 class OTableConnection; 47 class OQueryTableView; 48 class OQueryTabWinUndoAct : public OQueryDesignUndoAction 49 { 50 protected: 51 ::std::vector<OTableConnection*> m_vTableConnection; 52 OQueryTableWindow* m_pTabWin; 53 sal_Bool m_bOwnerOfObjects; 54 // bin ich alleiniger Eigentuemer der verwalteten Objekte ? (aendert sich mit jedem Redo oder Undo) 55 56 public: 57 OQueryTabWinUndoAct(OQueryTableView* pOwner, sal_uInt16 nCommentID); 58 virtual ~OQueryTabWinUndoAct(); 59 60 void SetOwnership(sal_Bool bTakeIt) { m_bOwnerOfObjects = bTakeIt; } 61 62 63 virtual void Undo() = 0; 64 virtual void Redo() = 0; 65 66 // Zugriff auf das TabWin 67 void SetTabWin(OQueryTableWindow* pTW) { m_pTabWin = pTW; } 68 // anschliessend sollte das SetOwnership aufgerufen werden 69 70 // Zugriff auf die verwalteten Connections 71 sal_uInt16 ConnCount() { return (sal_uInt16)m_vTableConnection.size(); } 72 73 ::std::vector<OTableConnection*>* GetTabConnList() { return &m_vTableConnection; } 74 75 void InsertConnection( OTableConnection* pConnection ) { m_vTableConnection.push_back(pConnection); } 76 void RemoveConnection( OTableConnection* pConnection ) 77 { 78 m_vTableConnection.erase(::std::remove(m_vTableConnection.begin(),m_vTableConnection.end(),pConnection),m_vTableConnection.end()); 79 } 80 }; 81 82 83 } 84 #endif // DBAUI_QUERYTABWINUNDOACT_HXX 85 86 87 88