update dev300-m58
[ooovba.git] / scripting / source / dlgprov / dlgprov.hxx
blob4d0eb50140d96259ca280b0af8a6173b1d056a9e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlgprov.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SCRIPTING_DLGPROV_HXX
32 #define SCRIPTING_DLGPROV_HXX
34 #include <com/sun/star/awt/XControl.hpp>
35 #include <com/sun/star/awt/XDialog.hpp>
36 #include <com/sun/star/awt/XDialogProvider2.hpp>
37 #include <com/sun/star/awt/XContainerWindowProvider.hpp>
38 #include <com/sun/star/frame/XModel.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/script/XScriptEventsAttacher.hpp>
42 #include <com/sun/star/uno/XComponentContext.hpp>
43 #include <com/sun/star/beans/XIntrospectionAccess.hpp>
44 #include <com/sun/star/container/XNameContainer.hpp>
45 #include <com/sun/star/io/XInputStream.hpp>
46 #include <com/sun/star/resource/XStringResourceManager.hpp>
48 #include <cppuhelper/implbase4.hxx>
49 #include <osl/mutex.hxx>
50 #include <memory>
52 //.........................................................................
53 namespace dlgprov
55 //.........................................................................
57 // =============================================================================
58 // mutex
59 // =============================================================================
61 ::osl::Mutex& getMutex();
64 // =============================================================================
65 // class DialogProviderImpl
66 // =============================================================================
68 typedef ::cppu::WeakImplHelper4<
69 ::com::sun::star::lang::XServiceInfo,
70 ::com::sun::star::lang::XInitialization,
71 ::com::sun::star::awt::XDialogProvider2,
72 ::com::sun::star::awt::XContainerWindowProvider > DialogProviderImpl_BASE;
74 class DialogProviderImpl : public DialogProviderImpl_BASE
76 private:
77 struct BasicRTLParams
79 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > mxInput;
80 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxDlgLib;
81 ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > mxBasicRTLListener;
83 std::auto_ptr< BasicRTLParams > m_BasicInfo;
84 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
85 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
87 rtl::OUString msDialogLibName;
88 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL );
90 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl(
91 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel,
92 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent );
94 void attachControlEvents( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxControlContainer,
95 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler,
96 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess,
97 bool bDialogProviderMode, const rtl::OUString& );
98 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler(
99 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler );
100 // helper methods
101 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createControlModel() throw ( ::com::sun::star::uno::Exception );
102 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createDialogModel(
103 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput,
104 const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager,
105 const ::com::sun::star::uno::Any &aDialogSourceURL) throw ( ::com::sun::star::uno::Exception );
106 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModelForBasic() throw ( ::com::sun::star::uno::Exception );
108 // XDialogProvider / XDialogProvider2 impl method
109 virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XControl > SAL_CALL createDialogImpl(
110 const ::rtl::OUString& URL,
111 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler,
112 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent,
113 bool bDialogProviderMode )
114 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
116 public:
117 DialogProviderImpl(
118 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
119 virtual ~DialogProviderImpl();
121 // XServiceInfo
122 virtual ::rtl::OUString SAL_CALL getImplementationName( )
123 throw (::com::sun::star::uno::RuntimeException);
124 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
125 throw (::com::sun::star::uno::RuntimeException);
126 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
127 throw (::com::sun::star::uno::RuntimeException);
129 // XInitialization
130 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
131 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
133 // XDialogProvider
134 virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialog(
135 const ::rtl::OUString& URL )
136 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
138 // XDialogProvider2
139 virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialogWithHandler(
140 const ::rtl::OUString& URL,
141 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler )
142 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
144 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createContainerWindow(
145 const ::rtl::OUString& URL, const ::rtl::OUString& WindowType,
146 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent,
147 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler )
148 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
151 //.........................................................................
152 } // namespace dlgprov
153 //.........................................................................
155 #endif // SCRIPTING_DLGPROV_HXX