1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGPROV_HXX
21 #define INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGPROV_HXX
23 #include <com/sun/star/awt/XControl.hpp>
24 #include <com/sun/star/awt/XDialog.hpp>
25 #include <com/sun/star/awt/XDialogProvider2.hpp>
26 #include <com/sun/star/awt/XContainerWindowProvider.hpp>
27 #include <com/sun/star/awt/XUnoControlDialog.hpp>
28 #include <com/sun/star/beans/XIntrospectionAccess.hpp>
29 #include <com/sun/star/container/XNameContainer.hpp>
30 #include <com/sun/star/frame/XModel.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XInitialization.hpp>
33 #include <com/sun/star/io/XInputStream.hpp>
34 #include <com/sun/star/resource/XStringResourceManager.hpp>
35 #include <com/sun/star/script/XScriptEventsAttacher.hpp>
36 #include <com/sun/star/uno/XComponentContext.hpp>
38 #include <cppuhelper/implbase4.hxx>
39 #include <osl/mutex.hxx>
51 ::osl::Mutex
& getMutex();
55 // class DialogProviderImpl
57 ::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
);
58 ::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 OUString
& i_sURL
);
59 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> lcl_createDialogModel(
60 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& i_xContext
,
61 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInput
,
62 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
>& xModel
,
63 const ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourceManager
>& xStringResourceManager
,
64 const ::com::sun::star::uno::Any
&aDialogSourceURL
) throw ( ::com::sun::star::uno::Exception
);
66 typedef ::cppu::WeakImplHelper4
<
67 ::com::sun::star::lang::XServiceInfo
,
68 ::com::sun::star::lang::XInitialization
,
69 ::com::sun::star::awt::XDialogProvider2
,
70 ::com::sun::star::awt::XContainerWindowProvider
> DialogProviderImpl_BASE
;
72 class DialogProviderImpl
: public DialogProviderImpl_BASE
77 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> mxInput
;
78 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> mxDlgLib
;
79 ::com::sun::star::uno::Reference
< ::com::sun::star::script::XScriptListener
> mxBasicRTLListener
;
81 std::unique_ptr
< BasicRTLParams
> m_BasicInfo
;
82 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
83 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> m_xModel
;
85 OUString msDialogLibName
;
86 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> createDialogModel( const OUString
& sURL
);
88 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XUnoControlDialog
> createDialogControl(
89 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& rxDialogModel
,
90 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParent
);
92 void attachControlEvents( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& rxControlContainer
,
93 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rxHandler
,
94 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XIntrospectionAccess
>& rxIntrospectionAccess
,
95 bool bDialogProviderMode
);
96 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XIntrospectionAccess
> inspectHandler(
97 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rxHandler
);
99 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> createDialogModel(
100 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInput
,
101 const ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourceManager
>& xStringResourceManager
,
102 const ::com::sun::star::uno::Any
&aDialogSourceURL
) throw ( ::com::sun::star::uno::Exception
);
103 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> createDialogModelForBasic() throw ( ::com::sun::star::uno::Exception
);
105 // XDialogProvider / XDialogProvider2 impl method
106 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
> SAL_CALL
createDialogImpl(
108 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xHandler
,
109 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParent
,
110 bool bDialogProviderMode
)
111 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
115 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
116 virtual ~DialogProviderImpl();
119 virtual OUString SAL_CALL
getImplementationName( )
120 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
121 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
122 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( )
124 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
128 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
131 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDialog
> SAL_CALL
createDialog(
132 const OUString
& URL
)
133 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDialog
> SAL_CALL
createDialogWithHandler(
138 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xHandler
)
139 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDialog
> SAL_CALL
createDialogWithArguments(
143 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& Arguments
)
144 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
146 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> SAL_CALL
createContainerWindow(
147 const OUString
& URL
, const OUString
& WindowType
,
148 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParent
,
149 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xHandler
)
150 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
154 } // namespace dlgprov
158 // component helper namespace
159 namespace comp_DialogModelProvider
{
161 // component and service helper functions:
162 OUString SAL_CALL
_getImplementationName();
163 css::uno::Sequence
< OUString
> SAL_CALL
_getSupportedServiceNames();
165 } // namespace comp_DialogModelProvider
170 #endif // INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGPROV_HXX
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */