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