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/XScriptListener.hpp>
36 #include <com/sun/star/uno/XComponentContext.hpp>
38 #include <cppuhelper/implbase.hxx>
39 #include <osl/mutex.hxx>
50 ::osl::Mutex
& getMutex();
53 // class DialogProviderImpl
55 css::uno::Reference
< css::container::XNameContainer
> lcl_createControlModel(const css::uno::Reference
< css::uno::XComponentContext
>& i_xContext
);
56 css::uno::Reference
< css::resource::XStringResourceManager
> lcl_getStringResourceManager(const css::uno::Reference
< css::uno::XComponentContext
>& i_xContext
,const OUString
& i_sURL
);
57 /// @throws css::uno::Exception
58 css::uno::Reference
< css::container::XNameContainer
> lcl_createDialogModel(
59 const css::uno::Reference
< css::uno::XComponentContext
>& i_xContext
,
60 const css::uno::Reference
< css::io::XInputStream
>& xInput
,
61 const css::uno::Reference
< css::frame::XModel
>& xModel
,
62 const css::uno::Reference
< css::resource::XStringResourceManager
>& xStringResourceManager
,
63 const css::uno::Any
&aDialogSourceURL
);
65 typedef ::cppu::WeakImplHelper
<
66 css::lang::XServiceInfo
,
67 css::lang::XInitialization
,
68 css::awt::XDialogProvider2
,
69 css::awt::XContainerWindowProvider
> DialogProviderImpl_BASE
;
71 class DialogProviderImpl
: public DialogProviderImpl_BASE
76 css::uno::Reference
< css::io::XInputStream
> mxInput
;
77 css::uno::Reference
< css::container::XNameContainer
> mxDlgLib
;
78 css::uno::Reference
< css::script::XScriptListener
> mxBasicRTLListener
;
80 std::unique_ptr
< BasicRTLParams
> m_BasicInfo
;
81 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
82 css::uno::Reference
< css::frame::XModel
> m_xModel
;
84 OUString msDialogLibName
;
85 css::uno::Reference
< css::awt::XControlModel
> createDialogModel( const OUString
& sURL
);
87 css::uno::Reference
< css::awt::XUnoControlDialog
> createDialogControl(
88 const css::uno::Reference
< css::awt::XControlModel
>& rxDialogModel
,
89 const css::uno::Reference
< css::awt::XWindowPeer
>& xParent
);
91 void attachControlEvents( const css::uno::Reference
< css::awt::XControl
>& rxControlContainer
,
92 const css::uno::Reference
< css::uno::XInterface
>& rxHandler
,
93 const css::uno::Reference
< css::beans::XIntrospectionAccess
>& rxIntrospectionAccess
,
94 bool bDialogProviderMode
);
95 css::uno::Reference
< css::beans::XIntrospectionAccess
> inspectHandler(
96 const css::uno::Reference
< css::uno::XInterface
>& rxHandler
);
98 /// @throws css::uno::Exception
99 css::uno::Reference
< css::container::XNameContainer
> createDialogModel(
100 const css::uno::Reference
< css::io::XInputStream
>& xInput
,
101 const css::uno::Reference
< css::resource::XStringResourceManager
>& xStringResourceManager
,
102 const css::uno::Any
&aDialogSourceURL
);
103 /// @throws css::uno::Exception
104 css::uno::Reference
< css::awt::XControlModel
> createDialogModelForBasic();
106 // XDialogProvider / XDialogProvider2 impl method
107 /// @throws css::lang::IllegalArgumentException
108 /// @throws css::uno::RuntimeException
109 css::uno::Reference
< css::awt::XControl
> createDialogImpl(
111 const css::uno::Reference
< css::uno::XInterface
>& xHandler
,
112 const css::uno::Reference
< css::awt::XWindowPeer
>& xParent
,
113 bool bDialogProviderMode
);
116 explicit DialogProviderImpl(
117 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
118 virtual ~DialogProviderImpl() override
;
121 virtual OUString SAL_CALL
getImplementationName( ) override
;
122 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
123 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
126 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
129 virtual css::uno::Reference
< css::awt::XDialog
> SAL_CALL
createDialog(
130 const OUString
& URL
) override
;
133 virtual css::uno::Reference
< css::awt::XDialog
> SAL_CALL
createDialogWithHandler(
135 const css::uno::Reference
< css::uno::XInterface
>& xHandler
) override
;
137 virtual css::uno::Reference
< css::awt::XDialog
> SAL_CALL
createDialogWithArguments(
139 const css::uno::Sequence
< css::beans::NamedValue
>& Arguments
) override
;
141 virtual css::uno::Reference
< css::awt::XWindow
> SAL_CALL
createContainerWindow(
142 const OUString
& URL
, const OUString
& WindowType
,
143 const css::uno::Reference
< css::awt::XWindowPeer
>& xParent
,
144 const css::uno::Reference
< css::uno::XInterface
>& xHandler
) override
;
148 } // namespace dlgprov
151 // component helper namespace
152 namespace comp_DialogModelProvider
{
154 // component and service helper functions:
155 OUString
_getImplementationName();
156 css::uno::Sequence
< OUString
> _getSupportedServiceNames();
158 } // namespace comp_DialogModelProvider
161 #endif // INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGPROV_HXX
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */