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 
28 #ifndef _BIB_FRAMECTR_HXX
29 #define _BIB_FRAMECTR_HXX
30 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
31 #include <com/sun/star/frame/XDispatchProvider.hpp>
32 #include <com/sun/star/frame/XController.hpp>
33 #include <com/sun/star/frame/XDispatch.hpp>
34 #include <com/sun/star/form/XLoadable.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
37 #include <cppuhelper/implbase5.hxx>
38 #include <svl/svarray.hxx>
39 
40 #include "bibmod.hxx"
41 class BibDataManager;
42 class BibFrameCtrl_Impl;
43 namespace com{namespace sun{namespace star{
44     namespace form { namespace runtime {
45         class XFormController;
46     } }
47 }}}
48 class BibStatusDispatch
49 {
50 public:
51 	::com::sun::star::util::URL 				aURL;
52 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >	xListener;
53 						BibStatusDispatch( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >	xRef )
54 							: aURL( rURL )
55 							, xListener( xRef )
56 						{}
57 };
58 
59 typedef BibStatusDispatch* BibStatusDispatchPtr;
60 SV_DECL_PTRARR_DEL( BibStatusDispatchArr, BibStatusDispatchPtr, 4, 4 )
61 
62 class BibFrameController_Impl : public cppu::WeakImplHelper5 <
63     ::com::sun::star::lang::XServiceInfo,
64 	::com::sun::star::frame::XController,
65 	::com::sun::star::frame::XDispatch,
66     ::com::sun::star::frame::XDispatchProvider,
67     ::com::sun::star::frame::XDispatchInformationProvider
68 >
69 {
70 friend class BibFrameCtrl_Impl;
71 	BibFrameCtrl_Impl*			pImp;
72 	BibStatusDispatchArr		aStatusListeners;
73 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >					xWindow;
74 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 				xFrame;
75 	sal_Bool						bDisposing;
76 	sal_Bool						bHierarchical;
77 	::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >				m_xDatMan;
78 	BibDataManager* 			pDatMan;
79 	HdlBibModul 				pBibMod;
80 
81 	DECL_STATIC_LINK( BibFrameController_Impl, DisposeHdl, void* );
82 
83     sal_Bool                    SaveModified(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& xController);
84 public:
85 								BibFrameController_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > & xComponent,
86 														BibDataManager* pDatMan);
87 								~BibFrameController_Impl();
88 
89 
90 	void						activate();
91 	void						deactivate();
92 
93 	void						ChangeDataSource(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs);
94 	void						RemoveFilter();
95 
96 								// ::com::sun::star::lang::XServiceInfo
97     virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
98     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName ) throw (::com::sun::star::uno::RuntimeException);
99     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
100 
101 								// ::com::sun::star::frame::XController
102 	virtual void				SAL_CALL attachFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame ) throw (::com::sun::star::uno::RuntimeException);
103 	virtual sal_Bool			SAL_CALL attachModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel ) throw (::com::sun::star::uno::RuntimeException);
104 	virtual sal_Bool			SAL_CALL suspend( sal_Bool bSuspend ) throw (::com::sun::star::uno::RuntimeException);
105 	virtual ::com::sun::star::uno::Any	SAL_CALL	getViewData() throw (::com::sun::star::uno::RuntimeException);
106 	virtual void SAL_CALL							restoreViewData( const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::uno::RuntimeException);
107 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException);
108 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel() throw (::com::sun::star::uno::RuntimeException);
109 
110 								// ::com::sun::star::lang::XComponent
111 	virtual void				SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
112 	virtual void				SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener ) throw (::com::sun::star::uno::RuntimeException);
113 	virtual void				SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener ) throw (::com::sun::star::uno::RuntimeException);
114 
115 								// ::com::sun::star::frame::XDispatchProvider
116 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >			SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw (::com::sun::star::uno::RuntimeException);
117 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >  > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts) throw (::com::sun::star::uno::RuntimeException);
118 
119 								//class ::com::sun::star::frame::XDispatch
120 	virtual void				SAL_CALL dispatch(const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs) throw (::com::sun::star::uno::RuntimeException);
121 	virtual void				SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw (::com::sun::star::uno::RuntimeException);
122 	virtual void				SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw (::com::sun::star::uno::RuntimeException);
123 
124                                 // ::com::sun::star::frame::XDispatchInformationProvider
125     virtual ::com::sun::star::uno::Sequence< ::sal_Int16 > SAL_CALL getSupportedCommandGroups(  ) throw (::com::sun::star::uno::RuntimeException);
126     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( ::sal_Int16 CommandGroup ) throw (::com::sun::star::uno::RuntimeException);
127  };
128 
129 #endif
130 
131