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_RELATION_TABLEVIEW_HXX
28 #define DBAUI_RELATION_TABLEVIEW_HXX
29 
30 #include "JoinTableView.hxx"
31 #include <comphelper/containermultiplexer.hxx>
32 #include <cppuhelper/basemutex.hxx>
33 #include <rtl/ref.hxx>
34 
35 namespace dbaui
36 {
37 	class ORelationDesignView;
38 	class ORelationTableView :  public ::cppu::BaseMutex
39                             ,   public OJoinTableView
40                             ,   public ::comphelper::OContainerListener
41 	{
42 		OTableConnection*				 m_pExistingConnection; // is set when a connection was draged on an existing connection
43         TTableConnectionData::value_type m_pCurrentlyTabConnData; // set when we creating a connection with more than one keycolumn
44         ::rtl::Reference< comphelper::OContainerListenerAdapter>
45                                          m_pContainerListener;
46         bool                             m_bInRemove;
47 
48 		virtual void ConnDoubleClicked( OTableConnection* pConnection );
49 		virtual void AddTabWin(const ::rtl::OUString& _rComposedName, const ::rtl::OUString& rWinName, sal_Bool bNewTable = sal_False);
50 
51 		virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData);
52 
53         /** determines whether the classes Init method should accept a query name, or only table names
54         */
55         virtual bool    allowQueries() const;
56 
57         // OContainerListener
58         virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
59 	    virtual void _elementRemoved( const  ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
60 	    virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
61 
62 	public:
63 		ORelationTableView( Window* pParent, ORelationDesignView* pView );
64 		virtual ~ORelationTableView();
65 
66 		virtual void RemoveTabWin( OTableWindow* pTabWin );
67 		virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest);
68 		virtual bool RemoveConnection(OTableConnection* pConn,sal_Bool _bDelete);
69 
70 		virtual void ReSync();
71 
72 		void AddNewRelation();
73 			// reisst den Dialog fuer eine voellig neue Relation hoch
74 		// wird vom AddTabDlg benutzt, um festzustellen, ob noch Tabellen hinzugefuegt werden duerfen
75 		virtual sal_Bool IsAddAllowed();
76 
77 		virtual void lookForUiActivities();
78 	};
79 }
80 #endif // DBAUI_RELATION_TABLEVIEW_HXX
81 
82 
83