1*6998d047SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6998d047SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6998d047SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6998d047SAndrew Rist * distributed with this work for additional information 6*6998d047SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6998d047SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6998d047SAndrew Rist * "License"); you may not use this file except in compliance 9*6998d047SAndrew Rist * with the License. You may obtain a copy of the License at 10*6998d047SAndrew Rist * 11*6998d047SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*6998d047SAndrew Rist * 13*6998d047SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6998d047SAndrew Rist * software distributed under the License is distributed on an 15*6998d047SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6998d047SAndrew Rist * KIND, either express or implied. See the License for the 17*6998d047SAndrew Rist * specific language governing permissions and limitations 18*6998d047SAndrew Rist * under the License. 19*6998d047SAndrew Rist * 20*6998d047SAndrew Rist *************************************************************/ 21*6998d047SAndrew Rist 22*6998d047SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SCRIPTING_DLGPROV_HXX 25cdf0e10cSrcweir #define SCRIPTING_DLGPROV_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/awt/XControl.hpp> 28cdf0e10cSrcweir #include <com/sun/star/awt/XDialog.hpp> 29cdf0e10cSrcweir #include <com/sun/star/awt/XDialogProvider2.hpp> 30cdf0e10cSrcweir #include <com/sun/star/awt/XContainerWindowProvider.hpp> 31cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp> 32cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 34cdf0e10cSrcweir #include <com/sun/star/script/XScriptEventsAttacher.hpp> 35cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 36cdf0e10cSrcweir #include <com/sun/star/beans/XIntrospectionAccess.hpp> 37cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 38cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 39cdf0e10cSrcweir #include <com/sun/star/resource/XStringResourceManager.hpp> 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 42cdf0e10cSrcweir #include <osl/mutex.hxx> 43cdf0e10cSrcweir #include <memory> 44cdf0e10cSrcweir 45cdf0e10cSrcweir //......................................................................... 46cdf0e10cSrcweir namespace dlgprov 47cdf0e10cSrcweir { 48cdf0e10cSrcweir //......................................................................... 49cdf0e10cSrcweir 50cdf0e10cSrcweir // ============================================================================= 51cdf0e10cSrcweir // mutex 52cdf0e10cSrcweir // ============================================================================= 53cdf0e10cSrcweir 54cdf0e10cSrcweir ::osl::Mutex& getMutex(); 55cdf0e10cSrcweir 56cdf0e10cSrcweir 57cdf0e10cSrcweir // ============================================================================= 58cdf0e10cSrcweir // class DialogProviderImpl 59cdf0e10cSrcweir // ============================================================================= 60cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > lcl_createControlModel(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext); 61cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > lcl_getStringResourceManager(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext,const ::rtl::OUString& i_sURL); 62cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > lcl_createDialogModel( 63cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext, 64cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput, 65cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager, 66cdf0e10cSrcweir const ::com::sun::star::uno::Any &aDialogSourceURL) throw ( ::com::sun::star::uno::Exception ); 67cdf0e10cSrcweir 68cdf0e10cSrcweir typedef ::cppu::WeakImplHelper4< 69cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo, 70cdf0e10cSrcweir ::com::sun::star::lang::XInitialization, 71cdf0e10cSrcweir ::com::sun::star::awt::XDialogProvider2, 72cdf0e10cSrcweir ::com::sun::star::awt::XContainerWindowProvider > DialogProviderImpl_BASE; 73cdf0e10cSrcweir 74cdf0e10cSrcweir class DialogProviderImpl : public DialogProviderImpl_BASE 75cdf0e10cSrcweir { 76cdf0e10cSrcweir private: 77cdf0e10cSrcweir struct BasicRTLParams 78cdf0e10cSrcweir { 79cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > mxInput; 80cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxDlgLib; 81cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > mxBasicRTLListener; 82cdf0e10cSrcweir }; 83cdf0e10cSrcweir std::auto_ptr< BasicRTLParams > m_BasicInfo; 84cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 85cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; 86cdf0e10cSrcweir 87cdf0e10cSrcweir 88cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl( 91cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel, 92cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir void attachControlEvents( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxControlContainer, 95cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler, 96cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess, 97cdf0e10cSrcweir bool bDialogProviderMode ); 98cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler( 99cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler ); 100cdf0e10cSrcweir // helper methods 101cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createControlModel() throw ( ::com::sun::star::uno::Exception ); 102cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createDialogModel( 103cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput, 104cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager, 105cdf0e10cSrcweir const ::com::sun::star::uno::Any &aDialogSourceURL) throw ( ::com::sun::star::uno::Exception ); 106cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModelForBasic() throw ( ::com::sun::star::uno::Exception ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir // XDialogProvider / XDialogProvider2 impl method 109cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XControl > SAL_CALL createDialogImpl( 110cdf0e10cSrcweir const ::rtl::OUString& URL, 111cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler, 112cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent, 113cdf0e10cSrcweir bool bDialogProviderMode ) 114cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir 116cdf0e10cSrcweir public: 117cdf0e10cSrcweir DialogProviderImpl( 118cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); 119cdf0e10cSrcweir virtual ~DialogProviderImpl(); 120cdf0e10cSrcweir 121cdf0e10cSrcweir // XServiceInfo 122cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) 123cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 124cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 125cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 126cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) 127cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 128cdf0e10cSrcweir 129cdf0e10cSrcweir // XInitialization 130cdf0e10cSrcweir virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) 131cdf0e10cSrcweir throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 132cdf0e10cSrcweir 133cdf0e10cSrcweir // XDialogProvider 134cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialog( 135cdf0e10cSrcweir const ::rtl::OUString& URL ) 136cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 137cdf0e10cSrcweir 138cdf0e10cSrcweir // XDialogProvider2 139cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialogWithHandler( 140cdf0e10cSrcweir const ::rtl::OUString& URL, 141cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler ) 142cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 143cdf0e10cSrcweir 144cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialogWithArguments( 145cdf0e10cSrcweir const ::rtl::OUString& URL, 146cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) 147cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 148cdf0e10cSrcweir 149cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createContainerWindow( 150cdf0e10cSrcweir const ::rtl::OUString& URL, const ::rtl::OUString& WindowType, 151cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent, 152cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler ) 153cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 154cdf0e10cSrcweir }; 155cdf0e10cSrcweir 156cdf0e10cSrcweir //......................................................................... 157cdf0e10cSrcweir } // namespace dlgprov 158cdf0e10cSrcweir //......................................................................... 159cdf0e10cSrcweir 160cdf0e10cSrcweir #endif // SCRIPTING_DLGPROV_HXX 161