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 .
21 #include "DialogModelProvider.hxx"
22 #include "dlgprov.hxx"
23 #include "dlgevtatt.hxx"
24 #include <com/sun/star/awt/UnoControlDialog.hpp>
25 #include <com/sun/star/awt/Toolkit.hpp>
26 #include <com/sun/star/awt/XControlContainer.hpp>
27 #include <com/sun/star/awt/XWindowPeer.hpp>
28 #include <com/sun/star/beans/theIntrospection.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/document/XEmbeddedScripts.hpp>
31 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
32 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
33 #include <com/sun/star/io/XInputStreamProvider.hpp>
34 #include <com/sun/star/resource/XStringResourceSupplier.hpp>
35 #include <com/sun/star/resource/XStringResourceManager.hpp>
36 #include <com/sun/star/script/XLibraryContainer.hpp>
37 #include <com/sun/star/ucb/SimpleFileAccess.hpp>
38 #include <com/sun/star/uri/XUriReference.hpp>
39 #include <com/sun/star/uri/UriReferenceFactory.hpp>
40 #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
41 #include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
42 #include <com/sun/star/util/theMacroExpander.hpp>
44 #include <cppuhelper/implementationentry.hxx>
45 #include <cppuhelper/exc_hlp.hxx>
46 #include <cppuhelper/supportsservice.hxx>
47 #include <sfx2/app.hxx>
48 #include <sfx2/objsh.hxx>
49 #include <xmlscript/xmldlg_imexp.hxx>
50 #include <tools/urlobj.hxx>
51 #include <comphelper/namedvaluecollection.hxx>
52 #include <util/MiscUtils.hxx>
53 #include <vcl/settings.hxx>
54 #include <vcl/svapp.hxx>
55 #include <i18nlangtag/languagetag.hxx>
57 using namespace ::com::sun::star
;
61 using namespace script
;
62 using namespace beans
;
63 using namespace document
;
64 using namespace ::sf_misc
;
66 // component helper namespace
67 namespace comp_DialogModelProvider
70 OUString
_getImplementationName()
72 return "com.sun.star.comp.scripting.DialogModelProvider";
75 uno::Sequence
< OUString
> _getSupportedServiceNames()
77 uno::Sequence
< OUString
> s
{ "com.sun.star.awt.UnoControlDialogModelProvider" };
81 static uno::Reference
< uno::XInterface
> _create(const uno::Reference
< uno::XComponentContext
> & context
)
83 return static_cast< ::cppu::OWeakObject
* >(new dlgprov::DialogModelProvider(context
));
85 } // closing component helper namespace
90 Reference
< resource::XStringResourceManager
> lcl_getStringResourceManager(const Reference
< XComponentContext
>& i_xContext
,const OUString
& i_sURL
)
92 INetURLObject
aInetObj( i_sURL
);
93 OUString aDlgName
= aInetObj
.GetBase();
94 aInetObj
.removeSegment();
95 OUString aDlgLocation
= aInetObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
96 css::lang::Locale aLocale
= Application::GetSettings().GetUILanguageTag().getLocale();
98 Sequence
<Any
> aArgs( 6 );
99 aArgs
[0] <<= aDlgLocation
;
100 aArgs
[1] <<= true; // bReadOnly
101 aArgs
[2] <<= aLocale
;
102 aArgs
[3] <<= aDlgName
;
103 aArgs
[4] <<= OUString();
105 Reference
< task::XInteractionHandler
> xDummyHandler
;
106 aArgs
[5] <<= xDummyHandler
;
107 Reference
< XMultiComponentFactory
> xSMgr_( i_xContext
->getServiceManager(), UNO_SET_THROW
);
109 Reference
< resource::XStringResourceManager
> xStringResourceManager( xSMgr_
->createInstanceWithContext
110 ( "com.sun.star.resource.StringResourceWithLocation",
111 i_xContext
), UNO_QUERY
);
112 if( xStringResourceManager
.is() )
114 Reference
< XInitialization
> xInit( xStringResourceManager
, UNO_QUERY
);
116 xInit
->initialize( aArgs
);
118 return xStringResourceManager
;
120 Reference
< container::XNameContainer
> lcl_createControlModel(const Reference
< XComponentContext
>& i_xContext
)
122 Reference
< XMultiComponentFactory
> xSMgr_( i_xContext
->getServiceManager(), UNO_SET_THROW
);
123 Reference
< container::XNameContainer
> xControlModel( xSMgr_
->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", i_xContext
), UNO_QUERY_THROW
);
124 return xControlModel
;
126 Reference
< container::XNameContainer
> lcl_createDialogModel( const Reference
< XComponentContext
>& i_xContext
,
127 const Reference
< io::XInputStream
>& xInput
,
128 const Reference
< frame::XModel
>& xModel
,
129 const Reference
< resource::XStringResourceManager
>& xStringResourceManager
,
130 const Any
&aDialogSourceURL
)
132 Reference
< container::XNameContainer
> xDialogModel( lcl_createControlModel(i_xContext
) );
134 Reference
< beans::XPropertySet
> xDlgPropSet( xDialogModel
, UNO_QUERY
);
135 xDlgPropSet
->setPropertyValue( "DialogSourceURL", aDialogSourceURL
);
137 // #TODO we really need to detect the source of the Dialog, is it
138 // the dialog. E.g. if the dialog was created from basic ( then we just
139 // can't tell where its from )
140 // If we are happy to always substitute the form model for the awt
141 // one then maybe the presence of a document model is enough to trigger
142 // swapping out the models ( or perhaps we only want to do this
143 // for vba mode ) there are a number of feasible and valid possibilities
144 ::xmlscript::importDialogModel( xInput
, xDialogModel
, i_xContext
, xModel
);
146 // Set resource property
147 if( xStringResourceManager
.is() )
149 Reference
< beans::XPropertySet
> xDlgPSet( xDialogModel
, UNO_QUERY
);
150 Any aStringResourceManagerAny
;
151 aStringResourceManagerAny
<<= xStringResourceManager
;
152 xDlgPSet
->setPropertyValue( "ResourceResolver", aStringResourceManagerAny
);
158 // component operations
161 static OUString
getImplementationName_DialogProviderImpl()
163 return "com.sun.star.comp.scripting.DialogProvider";
167 static Sequence
< OUString
> getSupportedServiceNames_DialogProviderImpl()
169 return { "com.sun.star.awt.DialogProvider",
170 "com.sun.star.awt.DialogProvider2",
171 "com.sun.star.awt.ContainerWindowProvider" };
178 ::osl::Mutex
& getMutex()
180 static ::osl::Mutex s_aMutex
;
186 // DialogProviderImpl
189 DialogProviderImpl::DialogProviderImpl( const Reference
< XComponentContext
>& rxContext
)
190 :m_xContext( rxContext
)
195 DialogProviderImpl::~DialogProviderImpl()
200 static Reference
< resource::XStringResourceManager
> getStringResourceFromDialogLibrary
201 ( const Reference
< container::XNameContainer
>& xDialogLib
)
203 Reference
< resource::XStringResourceManager
> xStringResourceManager
;
204 if( xDialogLib
.is() )
206 Reference
< resource::XStringResourceSupplier
> xStringResourceSupplier( xDialogLib
, UNO_QUERY
);
207 if( xStringResourceSupplier
.is() )
209 Reference
< resource::XStringResourceResolver
>
210 xStringResourceResolver
= xStringResourceSupplier
->getStringResource();
212 xStringResourceManager
=
213 Reference
< resource::XStringResourceManager
>( xStringResourceResolver
, UNO_QUERY
);
216 return xStringResourceManager
;
219 Reference
< container::XNameContainer
> DialogProviderImpl::createDialogModel(
220 const Reference
< io::XInputStream
>& xInput
,
221 const Reference
< resource::XStringResourceManager
>& xStringResourceManager
,
222 const Any
&aDialogSourceURL
)
224 return lcl_createDialogModel(m_xContext
,xInput
,m_xModel
,xStringResourceManager
,aDialogSourceURL
);
227 Reference
< XControlModel
> DialogProviderImpl::createDialogModelForBasic()
230 // shouldn't get here
231 throw RuntimeException("No information to create dialog" );
232 Reference
< resource::XStringResourceManager
> xStringResourceManager
= getStringResourceFromDialogLibrary( m_BasicInfo
->mxDlgLib
);
234 Any
aDialogSourceURL((OUString()));
235 Reference
< XControlModel
> xCtrlModel( createDialogModel( m_BasicInfo
->mxInput
, xStringResourceManager
, aDialogSourceURL
), UNO_QUERY_THROW
);
239 Reference
< XControlModel
> DialogProviderImpl::createDialogModel( const OUString
& sURL
)
242 OUString
aURL( sURL
);
245 // TODO: use URL parsing class
246 // TODO: decoding of location
248 Reference
< uri::XUriReferenceFactory
> xFac ( uri::UriReferenceFactory::create( m_xContext
) );
250 // i75778: Support non-script URLs
251 Reference
< io::XInputStream
> xInput
;
252 Reference
< container::XNameContainer
> xDialogLib
;
254 // Accept file URL to single dialog
255 bool bSingleDialog
= false;
257 Reference
< util::XMacroExpander
> xMacroExpander
=
258 util::theMacroExpander::get(m_xContext
);
260 Reference
< uri::XUriReference
> uriRef
;
263 uriRef
= xFac
->parse( aURL
);
266 OUString errorMsg
= "DialogProviderImpl::getDialogModel: failed to parse URI: " + aURL
;
267 throw IllegalArgumentException( errorMsg
, Reference
< XInterface
>(), 1 );
269 Reference
< uri::XVndSunStarExpandUrl
> sxUri( uriRef
, UNO_QUERY
);
273 aURL
= sxUri
->expand( xMacroExpander
);
276 Reference
< uri::XVndSunStarScriptUrl
> sfUri( uriRef
, UNO_QUERY
);
279 bSingleDialog
= true;
281 // Try any other URL with SimpleFileAccess
282 Reference
< ucb::XSimpleFileAccess3
> xSFI
= ucb::SimpleFileAccess::create(m_xContext
);
286 xInput
= xSFI
->openFileRead( aURL
);
293 OUString sDescription
= sfUri
->getName();
295 sal_Int32 nIndex
= 0;
297 OUString sLibName
= sDescription
.getToken( 0, '.', nIndex
);
300 sDlgName
= sDescription
.getToken( 0, '.', nIndex
);
302 OUString sLocation
= sfUri
->getParameter( "location" );
305 // get dialog library container
306 // TODO: dialogs in packages
307 Reference
< XLibraryContainer
> xLibContainer
;
309 if ( sLocation
== "application" )
311 xLibContainer
= SfxGetpApp()->GetDialogContainer();
313 else if ( sLocation
== "document" )
315 Reference
< XEmbeddedScripts
> xDocumentScripts( m_xModel
, UNO_QUERY
);
316 if ( xDocumentScripts
.is() )
318 xLibContainer
= xDocumentScripts
->getDialogLibraries();
319 OSL_ENSURE( xLibContainer
.is(),
320 "DialogProviderImpl::createDialogModel: invalid dialog container!" );
325 const Sequence
< OUString
> aOpenDocsTdocURLs( MiscUtils::allOpenTDocUrls( m_xContext
) );
326 for ( auto const & tdocURL
: aOpenDocsTdocURLs
)
328 Reference
< frame::XModel
> xModel( MiscUtils::tDocUrlToModel( tdocURL
) );
329 OSL_ENSURE( xModel
.is(), "DialogProviderImpl::createDialogModel: invalid document model!" );
333 OUString sDocURL
= xModel
->getURL();
334 if ( sDocURL
.isEmpty() )
336 ::comphelper::NamedValueCollection
aModelArgs( xModel
->getArgs() );
337 sDocURL
= aModelArgs
.getOrDefault( "Title", sDocURL
);
340 if ( sLocation
!= sDocURL
)
343 Reference
< XEmbeddedScripts
> xDocumentScripts( m_xModel
, UNO_QUERY
);
344 if ( !xDocumentScripts
.is() )
347 xLibContainer
= xDocumentScripts
->getDialogLibraries();
348 OSL_ENSURE( xLibContainer
.is(),
349 "DialogProviderImpl::createDialogModel: invalid dialog container!" );
353 // get input stream provider
354 Reference
< io::XInputStreamProvider
> xISP
;
355 if ( !xLibContainer
.is() )
357 throw IllegalArgumentException(
358 "DialogProviderImpl::getDialog: library container not found!",
359 Reference
< XInterface
>(), 1 );
362 // load dialog library
363 if ( !xLibContainer
->isLibraryLoaded( sLibName
) )
364 xLibContainer
->loadLibrary( sLibName
);
366 // get dialog library
367 if ( xLibContainer
->hasByName( sLibName
) )
369 Any aElement
= xLibContainer
->getByName( sLibName
);
370 aElement
>>= xDialogLib
;
373 if ( !xDialogLib
.is() )
375 throw IllegalArgumentException(
376 "DialogProviderImpl::getDialogModel: library not found!",
377 Reference
< XInterface
>(), 1 );
380 // get input stream provider
381 if ( xDialogLib
->hasByName( sDlgName
) )
383 Any aElement
= xDialogLib
->getByName( sDlgName
);
389 throw IllegalArgumentException(
390 "DialogProviderImpl::getDialogModel: dialog not found!",
391 Reference
< XInterface
>(), 1 );
397 xInput
= xISP
->createInputStream();
398 msDialogLibName
= sLibName
;
401 // import dialog model
402 Reference
< XControlModel
> xCtrlModel
;
403 if ( xInput
.is() && m_xContext
.is() )
405 Reference
< resource::XStringResourceManager
> xStringResourceManager
;
408 xStringResourceManager
= lcl_getStringResourceManager(m_xContext
,aURL
);
410 else if( xDialogLib
.is() )
412 xStringResourceManager
= getStringResourceFromDialogLibrary( xDialogLib
);
415 Any aDialogSourceURLAny
;
416 aDialogSourceURLAny
<<= aURL
;
418 Reference
< container::XNameContainer
> xDialogModel( createDialogModel( xInput
, xStringResourceManager
, aDialogSourceURLAny
), UNO_SET_THROW
);
420 xCtrlModel
.set( xDialogModel
, UNO_QUERY
);
426 Reference
< XUnoControlDialog
> DialogProviderImpl::createDialogControl
427 ( const Reference
< XControlModel
>& rxDialogModel
, const Reference
< XWindowPeer
>& xParent
)
429 OSL_ENSURE( rxDialogModel
.is(), "DialogProviderImpl::getDialogControl: no dialog model" );
431 Reference
< XUnoControlDialog
> xDialogControl
;
433 if ( m_xContext
.is() )
435 xDialogControl
= UnoControlDialog::create( m_xContext
);
438 if ( rxDialogModel
.is() )
439 xDialogControl
->setModel( rxDialogModel
);
442 xDialogControl
->setVisible( false );
444 // get the parent of the dialog control
445 Reference
< XWindowPeer
> xPeer
;
450 else if ( m_xModel
.is() )
452 Reference
< frame::XController
> xController
= m_xModel
->getCurrentController();
453 if ( xController
.is() )
455 Reference
< frame::XFrame
> xFrame
= xController
->getFrame();
457 xPeer
.set( xFrame
->getContainerWindow(), UNO_QUERY
);
462 Reference
< XToolkit
> xToolkit( Toolkit::create( m_xContext
), UNO_QUERY_THROW
);
463 xDialogControl
->createPeer( xToolkit
, xPeer
);
466 return xDialogControl
;
470 void DialogProviderImpl::attachControlEvents(
471 const Reference
< XControl
>& rxControl
,
472 const Reference
< XInterface
>& rxHandler
,
473 const Reference
< XIntrospectionAccess
>& rxIntrospectionAccess
,
474 bool bDialogProviderMode
)
476 if ( rxControl
.is() )
478 Reference
< XControlContainer
> xControlContainer( rxControl
, UNO_QUERY
);
480 if ( xControlContainer
.is() )
482 Sequence
< Reference
< XControl
> > aControls
= xControlContainer
->getControls();
483 const Reference
< XControl
>* pControls
= aControls
.getConstArray();
484 sal_Int32 nControlCount
= aControls
.getLength();
486 Sequence
< Reference
< XInterface
> > aObjects( nControlCount
+ 1 );
487 Reference
< XInterface
>* pObjects
= aObjects
.getArray();
488 for ( sal_Int32 i
= 0; i
< nControlCount
; ++i
)
490 pObjects
[i
].set( pControls
[i
], UNO_QUERY
);
493 // also add the dialog control itself to the sequence
494 pObjects
[nControlCount
].set( rxControl
, UNO_QUERY
);
496 Reference
<XScriptEventsAttacher
> xScriptEventsAttacher
497 = new DialogEventsAttacherImpl(
498 m_xContext
, m_xModel
, rxControl
, rxHandler
, rxIntrospectionAccess
,
500 (m_BasicInfo
? m_BasicInfo
->mxBasicRTLListener
: nullptr), msDialogLibName
);
503 xScriptEventsAttacher
->attachEvents( aObjects
, Reference
< XScriptListener
>(), aHelper
);
508 Reference
< XIntrospectionAccess
> DialogProviderImpl::inspectHandler( const Reference
< XInterface
>& rxHandler
)
510 Reference
< XIntrospectionAccess
> xIntrospectionAccess
;
511 static Reference
< XIntrospection
> xIntrospection
;
513 if( !rxHandler
.is() )
514 return xIntrospectionAccess
;
516 if( !xIntrospection
.is() )
518 // Get introspection service
519 xIntrospection
= theIntrospection::get( m_xContext
);
526 aHandlerAny
<<= rxHandler
;
527 xIntrospectionAccess
= xIntrospection
->inspect( aHandlerAny
);
529 catch( RuntimeException
& )
531 xIntrospectionAccess
.clear();
533 return xIntrospectionAccess
;
540 OUString
DialogProviderImpl::getImplementationName( )
542 return getImplementationName_DialogProviderImpl();
545 sal_Bool
DialogProviderImpl::supportsService( const OUString
& rServiceName
)
547 return cppu::supportsService(this, rServiceName
);
550 Sequence
< OUString
> DialogProviderImpl::getSupportedServiceNames( )
552 return getSupportedServiceNames_DialogProviderImpl();
559 void DialogProviderImpl::initialize( const Sequence
< Any
>& aArguments
)
561 ::osl::MutexGuard
aGuard( getMutex() );
563 if ( aArguments
.getLength() == 1 )
565 aArguments
[0] >>= m_xModel
;
567 if ( !m_xModel
.is() )
569 throw RuntimeException( "DialogProviderImpl::initialize: invalid argument format!" );
572 else if ( aArguments
.getLength() == 4 )
574 // call from RTL_Impl_CreateUnoDialog
575 aArguments
[0] >>= m_xModel
;
576 m_BasicInfo
.reset( new BasicRTLParams
);
577 m_BasicInfo
->mxInput
.set( aArguments
[ 1 ], UNO_QUERY_THROW
);
578 // allow null mxDlgLib, a document dialog instantiated from
579 // from application basic is unable to provide ( or find ) it's
581 aArguments
[ 2 ] >>= m_BasicInfo
->mxDlgLib
;
582 // leave the possibility to optionally allow the old dialog creation
583 // to use the new XScriptListener ( which converts the old style macro
585 m_BasicInfo
->mxBasicRTLListener
.set( aArguments
[ 3 ], UNO_QUERY
);
587 else if ( aArguments
.getLength() > 4 )
589 throw RuntimeException( "DialogProviderImpl::initialize: invalid number of arguments!" );
597 static const char aDecorationPropName
[] = "Decoration";
599 Reference
< XControl
> DialogProviderImpl::createDialogImpl(
600 const OUString
& URL
, const Reference
< XInterface
>& xHandler
,
601 const Reference
< XWindowPeer
>& xParent
, bool bDialogProviderMode
)
603 // if the dialog is located in a document, the document must already be open!
605 ::osl::MutexGuard
aGuard( getMutex() );
608 // m_xHandler = xHandler;
610 //Reference< XDialog > xDialog;
611 Reference
< XControl
> xCtrl
;
612 Reference
< XControlModel
> xCtrlMod
;
615 // add support for basic RTL_FUNCTION
617 xCtrlMod
= createDialogModelForBasic();
620 OSL_ENSURE( !URL
.isEmpty(), "DialogProviderImpl::getDialog: no URL!" );
621 xCtrlMod
= createDialogModel( URL
);
624 catch ( const RuntimeException
& ) { throw; }
625 catch ( const Exception
& )
627 const Any
aError( ::cppu::getCaughtException() );
628 throw WrappedTargetRuntimeException( OUString(), *this, aError
);
632 // i83963 Force decoration
633 if( bDialogProviderMode
)
635 uno::Reference
< beans::XPropertySet
> xDlgModPropSet( xCtrlMod
, uno::UNO_QUERY
);
636 if( xDlgModPropSet
.is() )
640 bool bDecoration
= true;
641 Any aDecorationAny
= xDlgModPropSet
->getPropertyValue( aDecorationPropName
);
642 aDecorationAny
>>= bDecoration
;
645 xDlgModPropSet
->setPropertyValue( aDecorationPropName
, makeAny( true ) );
646 xDlgModPropSet
->setPropertyValue( "Title", makeAny( OUString() ) );
649 catch( UnknownPropertyException
& )
654 xCtrl
.set( createDialogControl( xCtrlMod
, xParent
) );
657 Reference
< XIntrospectionAccess
> xIntrospectionAccess
= inspectHandler( xHandler
);
658 attachControlEvents( xCtrl
, xHandler
, xIntrospectionAccess
, bDialogProviderMode
);
665 Reference
< XDialog
> DialogProviderImpl::createDialog( const OUString
& URL
)
667 Reference
< XInterface
> xDummyHandler
;
668 Reference
< XWindowPeer
> xDummyPeer
;
669 Reference
< XControl
> xControl
= DialogProviderImpl::createDialogImpl( URL
, xDummyHandler
, xDummyPeer
, true );
670 Reference
< XDialog
> xDialog( xControl
, UNO_QUERY
);
674 Reference
< XDialog
> DialogProviderImpl::createDialogWithHandler(
675 const OUString
& URL
, const Reference
< XInterface
>& xHandler
)
679 throw IllegalArgumentException(
680 "DialogProviderImpl::createDialogWithHandler: Invalid xHandler!",
681 Reference
< XInterface
>(), 1 );
683 Reference
< XWindowPeer
> xDummyPeer
;
684 Reference
< XControl
> xControl
= DialogProviderImpl::createDialogImpl( URL
, xHandler
, xDummyPeer
, true );
685 Reference
< XDialog
> xDialog( xControl
, UNO_QUERY
);
689 Reference
< XDialog
> DialogProviderImpl::createDialogWithArguments(
690 const OUString
& URL
, const Sequence
< NamedValue
>& Arguments
)
692 ::comphelper::NamedValueCollection
aArguments( Arguments
);
694 Reference
< XWindowPeer
> xParentPeer
;
695 if ( aArguments
.has( "ParentWindow" ) )
697 const Any
& aParentWindow( aArguments
.get( "ParentWindow" ) );
698 if ( !( aParentWindow
>>= xParentPeer
) )
700 const Reference
< XControl
> xParentControl( aParentWindow
, UNO_QUERY
);
701 if ( xParentControl
.is() )
702 xParentPeer
= xParentControl
->getPeer();
706 const Reference
< XInterface
> xHandler( aArguments
.get( "EventHandler" ), UNO_QUERY
);
708 Reference
< XControl
> xControl
= DialogProviderImpl::createDialogImpl( URL
, xHandler
, xParentPeer
, true );
709 Reference
< XDialog
> xDialog( xControl
, UNO_QUERY
);
713 Reference
< XWindow
> DialogProviderImpl::createContainerWindow(
714 const OUString
& URL
, const OUString
&,
715 const Reference
< XWindowPeer
>& xParent
, const Reference
< XInterface
>& xHandler
)
719 throw IllegalArgumentException(
720 "DialogProviderImpl::createContainerWindow: Invalid xParent!",
721 Reference
< XInterface
>(), 1 );
723 Reference
< XControl
> xControl
= DialogProviderImpl::createDialogImpl( URL
, xHandler
, xParent
, false );
724 Reference
< XWindow
> xWindow( xControl
, UNO_QUERY
);
729 // component operations
732 static Reference
< XInterface
> create_DialogProviderImpl(
733 Reference
< XComponentContext
> const & xContext
)
735 return static_cast< lang::XTypeProvider
* >( new DialogProviderImpl( xContext
) );
739 static struct ::cppu::ImplementationEntry
const s_component_entries
[] =
741 {create_DialogProviderImpl
, getImplementationName_DialogProviderImpl
,getSupportedServiceNames_DialogProviderImpl
, ::cppu::createSingleComponentFactory
,nullptr, 0},
742 { &comp_DialogModelProvider::_create
,&comp_DialogModelProvider::_getImplementationName
,&comp_DialogModelProvider::_getSupportedServiceNames
,&::cppu::createSingleComponentFactory
, nullptr, 0 },
743 { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
747 } // namespace dlgprov
755 SAL_DLLPUBLIC_EXPORT
void * dlgprov_component_getFactory(
756 const sal_Char
* pImplName
, void * pServiceManager
,
757 void * pRegistryKey
)
759 return ::cppu::component_getFactoryHelper(
760 pImplName
, pServiceManager
, pRegistryKey
, ::dlgprov::s_component_entries
);
764 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */