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_RELATIONCONTROLLER_HXX
24 #define DBAUI_RELATIONCONTROLLER_HXX
25 
26 #ifndef DBAUI_JOINCONTROLLER_HXX
27 #include "JoinController.hxx"
28 #endif
29 #ifndef DBAUI_RELATIONDESIGNVIEW_HXX
30 #include "RelationDesignView.hxx"
31 #endif
32 
33 class VCLXWindow;
34 class WaitObject;
35 namespace dbaui
36 {
37 	class OTableConnectionData;
38 	class OTableWindowData;
39 	class OAddTableDlg;
40 	class OTableFieldDesc;
41 	class OTableWindow;
42 	class ORelationController : public OJoinController
43 	{
44 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >	m_xTables;
45         ::std::auto_ptr<WaitObject> m_pWaitObject;
46         sal_uLong		m_nThreadEvent;
47 		sal_Bool	m_bRelationsPossible;
48 	protected:
49 		// all the features which should be handled by this class
50 		virtual void			describeSupportedFeatures();
51 		// state of a feature. 'feature' may be the handle of a ::com::sun::star::util::URL somebody requested a dispatch interface for OR a toolbar slot.
52 		virtual FeatureState	GetState(sal_uInt16 nId) const;
53 		// execute a feature
54 		virtual void			Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
55 
getRelationView()56 		ORelationDesignView*	getRelationView() { return static_cast<ORelationDesignView*>( getView() ); }
57 		void loadData();
58         TTableWindowData::value_type existsTable(const ::rtl::OUString& _rComposedTableName,sal_Bool _bCase) const;
59 
60 		// load the window positions out of the datasource
61 		void loadLayoutInformation();
62 		void loadTableData(const ::com::sun::star::uno::Any& _aTable);
63 	public:
64 		ORelationController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM);
65 
66 		~ORelationController();
67 		// temp
68 		void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY );
69 
70         void mergeData(const TTableConnectionData& _aConnectionData);
71 
72 		virtual sal_Bool Construct(Window* pParent);
73 
74 		// XServiceInfo
75 		virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
76 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
77 		// need by registration
78 		static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
79 		static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
80 		static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
81 				SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
82 
83         // OJoinController overridables
84         virtual bool allowViews() const;
85         virtual bool allowQueries() const;
86 
87 	private:
88 		// ask the user if the design should be saved when it is modified
89 		virtual short saveModified();
90 		virtual void reset();
91 		virtual void impl_initialize();
92 		virtual ::rtl::OUString getPrivateTitle( ) const;
93         DECL_LINK( OnThreadFinished, void* );
94 	};
95 }
96 #endif // DBAUI_RELATIONCONTROLLER_HXX
97 
98