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 
24 #ifndef TOOLKIT_DIALOG_CONTROL_HXX
25 #define TOOLKIT_DIALOG_CONTROL_HXX
26 
27 #include <toolkit/controls/controlmodelcontainerbase.hxx>
28 #include <com/sun/star/awt/XTopWindow.hpp>
29 #include <com/sun/star/awt/XDialog2.hpp>
30 #include <com/sun/star/resource/XStringResourceResolver.hpp>
31 #include "toolkit/helper/servicenames.hxx"
32 #include "toolkit/helper/macros.hxx"
33 #include <toolkit/controls/unocontrolcontainer.hxx>
34 #include <cppuhelper/basemutex.hxx>
35 #include <cppuhelper/implbase3.hxx>
36 #include <list>
37 
38 //	----------------------------------------------------
39 //	class UnoControlDialogModel
40 //	----------------------------------------------------
41 
42 class UnoControlDialogModel :	public ControlModelContainerBase
43 {
44 protected:
45 	::com::sun::star::uno::Any			ImplGetDefaultValue( sal_uInt16 nPropId ) const;
46 	::cppu::IPropertyArrayHelper&		SAL_CALL getInfoHelper();
47 public:
48 						UnoControlDialogModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
49 						UnoControlDialogModel( const UnoControlDialogModel& rModel );
50 						~UnoControlDialogModel();
51 
52     UnoControlModel*	Clone() const;
53 	// ::com::sun::star::beans::XMultiPropertySet
54 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
55 
56 	// ::com::sun::star::io::XPersistObject
57     ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
58 
59 	// XServiceInfo
60 	DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel, ControlModelContainerBase, szServiceName2_UnoControlDialogModel )
61 
62 };
63 
64 typedef ::cppu::AggImplInheritanceHelper3   <   ControlContainerBase
65                                             ,   ::com::sun::star::awt::XTopWindow
66                                             ,   ::com::sun::star::awt::XDialog2
67                                             ,   ::com::sun::star::awt::XWindowListener
68                                             >   UnoDialogControl_Base;
69 class UnoDialogControl : public UnoDialogControl_Base
70 {
71 private:
72     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >			mxMenuBar;
73 	TopWindowListenerMultiplexer	                                            maTopWindowListeners;
74     bool                                                                        mbWindowListener;
75 
76 public:
77 
78 								UnoDialogControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
79 								~UnoDialogControl();
80 	::rtl::OUString				GetComponentServiceName();
81 
82     void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
83     void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
84     void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
85 
86     // ::com::sun::star::awt::XTopWindow
87     void SAL_CALL addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
88     void SAL_CALL removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
89     void SAL_CALL toFront(  ) throw (::com::sun::star::uno::RuntimeException);
90     void SAL_CALL toBack(  ) throw (::com::sun::star::uno::RuntimeException);
91     void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw (::com::sun::star::uno::RuntimeException);
92 
93     // ::com::sun::star::awt::XWindowListener
94     virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
95     virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
96     virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
97     virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
98 
99     // ::com::sun::star::awt::XDialog2
100     virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
101     virtual void SAL_CALL setHelpId( const rtl::OUString& Id ) throw (::com::sun::star::uno::RuntimeException);
102 
103 	// ::com::sun::star::awt::XDialog
104     void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
105 	::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException);
106 	sal_Int16 SAL_CALL execute() throw(::com::sun::star::uno::RuntimeException);
107 	void SAL_CALL endExecute() throw(::com::sun::star::uno::RuntimeException);
108 
109 	// ::com::sun::star::awt::XControl
110     sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
111 
112     // XModifyListener
113     virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
114 
115     // ::com::sun::star::lang::XServiceInfo
116 	DECLIMPL_SERVICEINFO( UnoDialogControl, szServiceName2_UnoControlDialog )
117 
118 protected:
119    // virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
120 	virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
121     virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
122 protected:
123 };
124 
125 #endif // TOOLKIT_DIALOG_CONTROL_HXX
126