1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir #ifndef DBAUI_RELATIONCONTROLLER_HXX
24cdf0e10cSrcweir #define DBAUI_RELATIONCONTROLLER_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef DBAUI_JOINCONTROLLER_HXX
27cdf0e10cSrcweir #include "JoinController.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef DBAUI_RELATIONDESIGNVIEW_HXX
30cdf0e10cSrcweir #include "RelationDesignView.hxx"
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class VCLXWindow;
34cdf0e10cSrcweir class WaitObject;
35cdf0e10cSrcweir namespace dbaui
36cdf0e10cSrcweir {
37cdf0e10cSrcweir 	class OTableConnectionData;
38cdf0e10cSrcweir 	class OTableWindowData;
39cdf0e10cSrcweir 	class OAddTableDlg;
40cdf0e10cSrcweir 	class OTableFieldDesc;
41cdf0e10cSrcweir 	class OTableWindow;
42cdf0e10cSrcweir 	class ORelationController : public OJoinController
43cdf0e10cSrcweir 	{
44cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >	m_xTables;
45cdf0e10cSrcweir         ::std::auto_ptr<WaitObject> m_pWaitObject;
46cdf0e10cSrcweir         sal_uLong		m_nThreadEvent;
47cdf0e10cSrcweir 		sal_Bool	m_bRelationsPossible;
48cdf0e10cSrcweir 	protected:
49cdf0e10cSrcweir 		// all the features which should be handled by this class
50cdf0e10cSrcweir 		virtual void			describeSupportedFeatures();
51cdf0e10cSrcweir 		// 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.
52cdf0e10cSrcweir 		virtual FeatureState	GetState(sal_uInt16 nId) const;
53cdf0e10cSrcweir 		// execute a feature
54cdf0e10cSrcweir 		virtual void			Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
55cdf0e10cSrcweir 
getRelationView()56cdf0e10cSrcweir 		ORelationDesignView*	getRelationView() { return static_cast<ORelationDesignView*>( getView() ); }
57cdf0e10cSrcweir 		void loadData();
58cdf0e10cSrcweir         TTableWindowData::value_type existsTable(const ::rtl::OUString& _rComposedTableName,sal_Bool _bCase) const;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 		// load the window positions out of the datasource
61cdf0e10cSrcweir 		void loadLayoutInformation();
62cdf0e10cSrcweir 		void loadTableData(const ::com::sun::star::uno::Any& _aTable);
63cdf0e10cSrcweir 	public:
64cdf0e10cSrcweir 		ORelationController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM);
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 		~ORelationController();
67cdf0e10cSrcweir 		// temp
68cdf0e10cSrcweir 		void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY );
69cdf0e10cSrcweir 
70cdf0e10cSrcweir         void mergeData(const TTableConnectionData& _aConnectionData);
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 		virtual sal_Bool Construct(Window* pParent);
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 		// XServiceInfo
75cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
76cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
77cdf0e10cSrcweir 		// need by registration
78cdf0e10cSrcweir 		static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
79cdf0e10cSrcweir 		static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
80cdf0e10cSrcweir 		static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
81cdf0e10cSrcweir 				SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
82cdf0e10cSrcweir 
83cdf0e10cSrcweir         // OJoinController overridables
84cdf0e10cSrcweir         virtual bool allowViews() const;
85cdf0e10cSrcweir         virtual bool allowQueries() const;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	private:
88cdf0e10cSrcweir 		// ask the user if the design should be saved when it is modified
89cdf0e10cSrcweir 		virtual short saveModified();
90cdf0e10cSrcweir 		virtual void reset();
91cdf0e10cSrcweir 		virtual void impl_initialize();
92cdf0e10cSrcweir 		virtual ::rtl::OUString getPrivateTitle( ) const;
93cdf0e10cSrcweir         DECL_LINK( OnThreadFinished, void* );
94cdf0e10cSrcweir 	};
95cdf0e10cSrcweir }
96cdf0e10cSrcweir #endif // DBAUI_RELATIONCONTROLLER_HXX
97cdf0e10cSrcweir 
98