1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef DBAUI_RELATION_TABLEVIEW_HXX
24 #define DBAUI_RELATION_TABLEVIEW_HXX
25 
26 #include "JoinTableView.hxx"
27 #include <comphelper/containermultiplexer.hxx>
28 #include <cppuhelper/basemutex.hxx>
29 #include <rtl/ref.hxx>
30 
31 namespace dbaui
32 {
33 	class ORelationDesignView;
34 	class ORelationTableView :  public ::cppu::BaseMutex
35                             ,   public OJoinTableView
36                             ,   public ::comphelper::OContainerListener
37 	{
38 		OTableConnection*				 m_pExistingConnection; // is set when a connection was draged on an existing connection
39         TTableConnectionData::value_type m_pCurrentlyTabConnData; // set when we creating a connection with more than one keycolumn
40         ::rtl::Reference< comphelper::OContainerListenerAdapter>
41                                          m_pContainerListener;
42         bool                             m_bInRemove;
43 
44 		virtual void ConnDoubleClicked( OTableConnection* pConnection );
45 		virtual void AddTabWin(const ::rtl::OUString& _rComposedName, const ::rtl::OUString& rWinName, sal_Bool bNewTable = sal_False);
46 
47 		virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData);
48 
49         /** determines whether the classes Init method should accept a query name, or only table names
50         */
51         virtual bool    allowQueries() const;
52 
53         // OContainerListener
54         virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
55 	    virtual void _elementRemoved( const  ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
56 	    virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
57 
58 	public:
59 		ORelationTableView( Window* pParent, ORelationDesignView* pView );
60 		virtual ~ORelationTableView();
61 
62 		virtual void RemoveTabWin( OTableWindow* pTabWin );
63 		virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest);
64 		virtual bool RemoveConnection(OTableConnection* pConn,sal_Bool _bDelete);
65 
66 		virtual void ReSync();
67 
68 		void AddNewRelation();
69 			// reisst den Dialog fuer eine voellig neue Relation hoch
70 		// wird vom AddTabDlg benutzt, um festzustellen, ob noch Tabellen hinzugefuegt werden duerfen
71 		virtual sal_Bool IsAddAllowed();
72 
73 		virtual void lookForUiActivities();
74 	};
75 }
76 #endif // DBAUI_RELATION_TABLEVIEW_HXX
77 
78 
79