1*9e0fc027SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9e0fc027SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9e0fc027SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9e0fc027SAndrew Rist  * distributed with this work for additional information
6*9e0fc027SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9e0fc027SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9e0fc027SAndrew Rist  * "License"); you may not use this file except in compliance
9*9e0fc027SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9e0fc027SAndrew Rist  *
11*9e0fc027SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9e0fc027SAndrew Rist  *
13*9e0fc027SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9e0fc027SAndrew Rist  * software distributed under the License is distributed on an
15*9e0fc027SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9e0fc027SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9e0fc027SAndrew Rist  * specific language governing permissions and limitations
18*9e0fc027SAndrew Rist  * under the License.
19*9e0fc027SAndrew Rist  *
20*9e0fc027SAndrew Rist  *************************************************************/
21*9e0fc027SAndrew Rist 
22*9e0fc027SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_filter.hxx"
26cdf0e10cSrcweir #include <osl/mutex.hxx>
27cdf0e10cSrcweir #include <vos/mutex.hxx>
28cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <osl/thread.h>
31cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
32cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
33cdf0e10cSrcweir #include <cppuhelper/component.hxx>
34cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
35cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp>
36cdf0e10cSrcweir #include <com/sun/star/frame/XTerminateListener.hpp>
37cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx>
38cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
39cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
40cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
41cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
42cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
43cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
44cdf0e10cSrcweir #include <tools/resmgr.hxx>
45cdf0e10cSrcweir #include <vcl/svapp.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <svl/solar.hrc>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include "xmlfiltersettingsdialog.hxx"
50cdf0e10cSrcweir 
51cdf0e10cSrcweir //using namespace ::comphelper;
52cdf0e10cSrcweir using namespace ::rtl;
53cdf0e10cSrcweir using namespace ::cppu;
54cdf0e10cSrcweir using namespace ::osl;
55cdf0e10cSrcweir using namespace ::com::sun::star::uno;
56cdf0e10cSrcweir using namespace ::com::sun::star::lang;
57cdf0e10cSrcweir using namespace ::com::sun::star::beans;
58cdf0e10cSrcweir using namespace ::com::sun::star::registry;
59cdf0e10cSrcweir using namespace ::com::sun::star::frame;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class XMLFilterDialogComponentBase
63cdf0e10cSrcweir {
64cdf0e10cSrcweir protected:
65cdf0e10cSrcweir 	::osl::Mutex maMutex;
66cdf0e10cSrcweir };
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir class XMLFilterDialogComponent :	public XMLFilterDialogComponentBase,
70cdf0e10cSrcweir 									public OComponentHelper,
71cdf0e10cSrcweir 									public ::com::sun::star::ui::dialogs::XExecutableDialog,
72cdf0e10cSrcweir 									public XServiceInfo,
73cdf0e10cSrcweir 									public XInitialization,
74cdf0e10cSrcweir 									public XTerminateListener
75cdf0e10cSrcweir {
76cdf0e10cSrcweir public:
77cdf0e10cSrcweir 	XMLFilterDialogComponent( const Reference< XMultiServiceFactory >& rxMSF );
78cdf0e10cSrcweir 	virtual ~XMLFilterDialogComponent();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir protected:
81cdf0e10cSrcweir 	// XInterface
82cdf0e10cSrcweir     virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
83cdf0e10cSrcweir 	virtual Any SAL_CALL queryAggregation( Type const & rType ) throw (RuntimeException);
84cdf0e10cSrcweir     virtual void SAL_CALL acquire() throw ();
85cdf0e10cSrcweir     virtual void SAL_CALL release() throw ();
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	// XTypeProvider
88cdf0e10cSrcweir 	virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException);
89cdf0e10cSrcweir 	virtual Sequence< Type > SAL_CALL getTypes() throw (RuntimeException);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	// XServiceInfo
92cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(RuntimeException);
94cdf0e10cSrcweir     virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (RuntimeException);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	// XExecutableDialog
97cdf0e10cSrcweir 	virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw(RuntimeException);
98cdf0e10cSrcweir 	virtual sal_Int16 SAL_CALL execute(  ) throw(RuntimeException);
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	// XInitialization
101cdf0e10cSrcweir 	virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	// XTerminateListener
104cdf0e10cSrcweir 	virtual void SAL_CALL queryTermination( const EventObject& Event ) throw (TerminationVetoException, RuntimeException);
105cdf0e10cSrcweir 	virtual void SAL_CALL notifyTermination( const EventObject& Event ) throw (RuntimeException);
106cdf0e10cSrcweir     virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	/** Called in dispose method after the listeners were notified.
109cdf0e10cSrcweir     */
110cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir private:
113cdf0e10cSrcweir 	com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxParent;	/// parent window
114cdf0e10cSrcweir 	com::sun::star::uno::Reference< XMultiServiceFactory > mxMSF;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	static ResMgr* mpResMgr;
117cdf0e10cSrcweir 	XMLFilterSettingsDialog* mpDialog;
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir //-------------------------------------------------------------------------
121cdf0e10cSrcweir 
122cdf0e10cSrcweir ResMgr* XMLFilterDialogComponent::mpResMgr = NULL;
123cdf0e10cSrcweir 
XMLFilterDialogComponent(const com::sun::star::uno::Reference<XMultiServiceFactory> & rxMSF)124cdf0e10cSrcweir XMLFilterDialogComponent::XMLFilterDialogComponent( const com::sun::star::uno::Reference< XMultiServiceFactory >& rxMSF ) :
125cdf0e10cSrcweir 	OComponentHelper( maMutex ),
126cdf0e10cSrcweir 	mxMSF( rxMSF ),
127cdf0e10cSrcweir 	mpDialog( NULL )
128cdf0e10cSrcweir {
129cdf0e10cSrcweir 	Reference< XDesktop > xDesktop( mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
130cdf0e10cSrcweir 	if( xDesktop.is() )
131cdf0e10cSrcweir 	{
132cdf0e10cSrcweir 		Reference< XTerminateListener > xListener( this );
133cdf0e10cSrcweir 		xDesktop->addTerminateListener( xListener );
134cdf0e10cSrcweir 	}
135cdf0e10cSrcweir }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir //-------------------------------------------------------------------------
138cdf0e10cSrcweir 
~XMLFilterDialogComponent()139cdf0e10cSrcweir XMLFilterDialogComponent::~XMLFilterDialogComponent()
140cdf0e10cSrcweir {
141cdf0e10cSrcweir }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir //-------------------------------------------------------------------------
144cdf0e10cSrcweir 
145cdf0e10cSrcweir // XInterface
queryInterface(const Type & aType)146cdf0e10cSrcweir Any SAL_CALL XMLFilterDialogComponent::queryInterface( const Type& aType ) throw (RuntimeException)
147cdf0e10cSrcweir {
148cdf0e10cSrcweir 	return OComponentHelper::queryInterface( aType );
149cdf0e10cSrcweir }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir //-------------------------------------------------------------------------
152cdf0e10cSrcweir 
queryAggregation(Type const & rType)153cdf0e10cSrcweir Any SAL_CALL XMLFilterDialogComponent::queryAggregation( Type const & rType ) throw (RuntimeException)
154cdf0e10cSrcweir {
155cdf0e10cSrcweir     if (rType == ::getCppuType( (Reference< ::com::sun::star::ui::dialogs::XExecutableDialog > const *)0 ))
156cdf0e10cSrcweir     {
157cdf0e10cSrcweir         void * p = static_cast< ::com::sun::star::ui::dialogs::XExecutableDialog * >( this );
158cdf0e10cSrcweir         return Any( &p, rType );
159cdf0e10cSrcweir     }
160cdf0e10cSrcweir     else if (rType == ::getCppuType( (Reference< XServiceInfo > const *)0 ))
161cdf0e10cSrcweir     {
162cdf0e10cSrcweir         void * p = static_cast< XServiceInfo * >( this );
163cdf0e10cSrcweir         return Any( &p, rType );
164cdf0e10cSrcweir     }
165cdf0e10cSrcweir     else if (rType == ::getCppuType( (Reference< XInitialization > const *)0 ))
166cdf0e10cSrcweir     {
167cdf0e10cSrcweir         void * p = static_cast< XInitialization * >( this );
168cdf0e10cSrcweir         return Any( &p, rType );
169cdf0e10cSrcweir     }
170cdf0e10cSrcweir 	else if (rType == ::getCppuType( (Reference< XTerminateListener > const *)0 ))
171cdf0e10cSrcweir 	{
172cdf0e10cSrcweir         void * p = static_cast< XTerminateListener * >( this );
173cdf0e10cSrcweir         return Any( &p, rType );
174cdf0e10cSrcweir 	}
175cdf0e10cSrcweir     return OComponentHelper::queryAggregation( rType );
176cdf0e10cSrcweir }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir //-------------------------------------------------------------------------
179cdf0e10cSrcweir 
acquire()180cdf0e10cSrcweir void SAL_CALL XMLFilterDialogComponent::acquire() throw ()
181cdf0e10cSrcweir {
182cdf0e10cSrcweir     OComponentHelper::acquire();
183cdf0e10cSrcweir }
184cdf0e10cSrcweir 
185cdf0e10cSrcweir //-------------------------------------------------------------------------
186cdf0e10cSrcweir 
release()187cdf0e10cSrcweir void SAL_CALL XMLFilterDialogComponent::release() throw ()
188cdf0e10cSrcweir {
189cdf0e10cSrcweir     OComponentHelper::release();
190cdf0e10cSrcweir }
191cdf0e10cSrcweir 
192cdf0e10cSrcweir //-------------------------------------------------------------------------
193cdf0e10cSrcweir 
XMLFilterDialogComponent_getImplementationName()194cdf0e10cSrcweir OUString XMLFilterDialogComponent_getImplementationName() throw ( RuntimeException )
195cdf0e10cSrcweir {
196cdf0e10cSrcweir 	return OUString( RTL_CONSTASCII_USTRINGPARAM( "XMLFilterDialogComponent" ) );
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir //-------------------------------------------------------------------------
200cdf0e10cSrcweir 
XMLFilterDialogComponent_getSupportedServiceNames()201cdf0e10cSrcweir Sequence< OUString > SAL_CALL XMLFilterDialogComponent_getSupportedServiceNames()  throw ( RuntimeException )
202cdf0e10cSrcweir {
203cdf0e10cSrcweir 	OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.XSLTFilterDialog" ) );
204cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSupported( &aServiceName, 1 );
205cdf0e10cSrcweir 	return aSupported;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir //-------------------------------------------------------------------------
209cdf0e10cSrcweir 
XMLFilterDialogComponent_supportsService(const OUString & ServiceName)210cdf0e10cSrcweir sal_Bool SAL_CALL XMLFilterDialogComponent_supportsService( const OUString& ServiceName ) throw ( RuntimeException )
211cdf0e10cSrcweir {
212cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSupported(XMLFilterDialogComponent_getSupportedServiceNames());
213cdf0e10cSrcweir 	const ::rtl::OUString* pArray = aSupported.getConstArray();
214cdf0e10cSrcweir 	for (sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pArray)
215cdf0e10cSrcweir 		if (pArray->equals(ServiceName))
216cdf0e10cSrcweir 			return sal_True;
217cdf0e10cSrcweir 	return sal_False;
218cdf0e10cSrcweir }
219cdf0e10cSrcweir 
220cdf0e10cSrcweir //-------------------------------------------------------------------------
221cdf0e10cSrcweir 
XMLFilterDialogComponent_createInstance(const Reference<XMultiServiceFactory> & rSMgr)222cdf0e10cSrcweir Reference< XInterface > SAL_CALL XMLFilterDialogComponent_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception )
223cdf0e10cSrcweir {
224cdf0e10cSrcweir 	return (OWeakObject*)new XMLFilterDialogComponent( rSMgr );
225cdf0e10cSrcweir }
226cdf0e10cSrcweir 
227cdf0e10cSrcweir //-------------------------------------------------------------------------
getImplementationName()228cdf0e10cSrcweir ::rtl::OUString SAL_CALL XMLFilterDialogComponent::getImplementationName() throw(com::sun::star::uno::RuntimeException)
229cdf0e10cSrcweir {
230cdf0e10cSrcweir 	return XMLFilterDialogComponent_getImplementationName();
231cdf0e10cSrcweir }
232cdf0e10cSrcweir 
233cdf0e10cSrcweir //-------------------------------------------------------------------------
234cdf0e10cSrcweir 
getImplementationId(void)235cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL XMLFilterDialogComponent::getImplementationId( void ) throw( RuntimeException )
236cdf0e10cSrcweir {
237cdf0e10cSrcweir 	static OImplementationId* pId = 0;
238cdf0e10cSrcweir 	if( !pId )
239cdf0e10cSrcweir 	{
240cdf0e10cSrcweir 		MutexGuard aGuard( Mutex::getGlobalMutex() );
241cdf0e10cSrcweir 		if( !pId)
242cdf0e10cSrcweir 		{
243cdf0e10cSrcweir 			static OImplementationId aId;
244cdf0e10cSrcweir 			pId = &aId;
245cdf0e10cSrcweir 		}
246cdf0e10cSrcweir 	}
247cdf0e10cSrcweir 	return pId->getImplementationId();
248cdf0e10cSrcweir }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir //-------------------------------------------------------------------------
251cdf0e10cSrcweir 
getTypes()252cdf0e10cSrcweir Sequence< Type > XMLFilterDialogComponent::getTypes() throw (RuntimeException)
253cdf0e10cSrcweir {
254cdf0e10cSrcweir 	static OTypeCollection * s_pTypes = 0;
255cdf0e10cSrcweir 	if (! s_pTypes)
256cdf0e10cSrcweir 	{
257cdf0e10cSrcweir 		MutexGuard aGuard( Mutex::getGlobalMutex() );
258cdf0e10cSrcweir 		if (! s_pTypes)
259cdf0e10cSrcweir 		{
260cdf0e10cSrcweir 			static OTypeCollection s_aTypes(
261cdf0e10cSrcweir 				::getCppuType( (const Reference< XComponent > *)0 ),
262cdf0e10cSrcweir 				::getCppuType( (const Reference< XTypeProvider > *)0 ),
263cdf0e10cSrcweir 				::getCppuType( (const Reference< XAggregation > *)0 ),
264cdf0e10cSrcweir 				::getCppuType( (const Reference< XWeak > *)0 ),
265cdf0e10cSrcweir 				::getCppuType( (const Reference< XServiceInfo > *)0 ),
266cdf0e10cSrcweir 				::getCppuType( (const Reference< XInitialization > *)0 ),
267cdf0e10cSrcweir 				::getCppuType( (const Reference< XTerminateListener > *)0 ),
268cdf0e10cSrcweir 				::getCppuType( (const Reference< ::com::sun::star::ui::dialogs::XExecutableDialog > *)0 ));
269cdf0e10cSrcweir 			s_pTypes = &s_aTypes;
270cdf0e10cSrcweir 		}
271cdf0e10cSrcweir 	}
272cdf0e10cSrcweir 	return s_pTypes->getTypes();
273cdf0e10cSrcweir }
274cdf0e10cSrcweir 
275cdf0e10cSrcweir //-------------------------------------------------------------------------
276cdf0e10cSrcweir 
getSupportedServiceNames()277cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL XMLFilterDialogComponent::getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException)
278cdf0e10cSrcweir {
279cdf0e10cSrcweir 	return XMLFilterDialogComponent_getSupportedServiceNames();
280cdf0e10cSrcweir }
281cdf0e10cSrcweir 
282cdf0e10cSrcweir //-------------------------------------------------------------------------
supportsService(const::rtl::OUString & ServiceName)283cdf0e10cSrcweir sal_Bool SAL_CALL XMLFilterDialogComponent::supportsService(const ::rtl::OUString& ServiceName) throw(RuntimeException)
284cdf0e10cSrcweir {
285cdf0e10cSrcweir 	return XMLFilterDialogComponent_supportsService( ServiceName );
286cdf0e10cSrcweir }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir //-------------------------------------------------------------------------
289cdf0e10cSrcweir 
290cdf0e10cSrcweir /** Called in dispose method after the listeners were notified.
291cdf0e10cSrcweir */
disposing()292cdf0e10cSrcweir void SAL_CALL XMLFilterDialogComponent::disposing()
293cdf0e10cSrcweir {
294cdf0e10cSrcweir 	vos::OGuard aGuard( Application::GetSolarMutex() );
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	if( mpDialog )
297cdf0e10cSrcweir 	{
298cdf0e10cSrcweir 		delete mpDialog;
299cdf0e10cSrcweir 		mpDialog = NULL;
300cdf0e10cSrcweir 	}
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	if( mpResMgr )
303cdf0e10cSrcweir 	{
304cdf0e10cSrcweir 		delete mpResMgr;
305cdf0e10cSrcweir 		mpResMgr = NULL;
306cdf0e10cSrcweir 	}
307cdf0e10cSrcweir }
308cdf0e10cSrcweir 
309cdf0e10cSrcweir //-------------------------------------------------------------------------
310cdf0e10cSrcweir 
311cdf0e10cSrcweir // XTerminateListener
queryTermination(const EventObject &)312cdf0e10cSrcweir void SAL_CALL XMLFilterDialogComponent::queryTermination( const EventObject& /* Event */ ) throw (TerminationVetoException, RuntimeException)
313cdf0e10cSrcweir {
314cdf0e10cSrcweir 	vos::OGuard aGuard( Application::GetSolarMutex() );
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 	// we will never give a veto here
317cdf0e10cSrcweir 	if( mpDialog && !mpDialog->isClosable() )
318cdf0e10cSrcweir 	{
319cdf0e10cSrcweir 		mpDialog->ToTop();
320cdf0e10cSrcweir 		throw TerminationVetoException();
321cdf0e10cSrcweir 	}
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir //-------------------------------------------------------------------------
325cdf0e10cSrcweir 
notifyTermination(const EventObject &)326cdf0e10cSrcweir void SAL_CALL XMLFilterDialogComponent::notifyTermination( const EventObject& /* Event */ ) throw (RuntimeException)
327cdf0e10cSrcweir {
328cdf0e10cSrcweir 	// we are going down, so dispose us!
329cdf0e10cSrcweir 	dispose();
330cdf0e10cSrcweir }
331cdf0e10cSrcweir 
disposing(const EventObject &)332cdf0e10cSrcweir void SAL_CALL XMLFilterDialogComponent::disposing( const EventObject& /* Source */ ) throw (RuntimeException)
333cdf0e10cSrcweir {
334cdf0e10cSrcweir }
335cdf0e10cSrcweir 
336cdf0e10cSrcweir //-------------------------------------------------------------------------
setTitle(const::rtl::OUString &)337cdf0e10cSrcweir void SAL_CALL XMLFilterDialogComponent::setTitle( const ::rtl::OUString& /* _rTitle */ ) throw(RuntimeException)
338cdf0e10cSrcweir {
339cdf0e10cSrcweir }
340cdf0e10cSrcweir 
341cdf0e10cSrcweir //-------------------------------------------------------------------------
execute()342cdf0e10cSrcweir sal_Int16 SAL_CALL XMLFilterDialogComponent::execute(  ) throw(RuntimeException)
343cdf0e10cSrcweir {
344cdf0e10cSrcweir 	vos::OGuard aGuard( Application::GetSolarMutex() );
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 	if( NULL == mpResMgr )
347cdf0e10cSrcweir 	{
348cdf0e10cSrcweir 		ByteString aResMgrName( "xsltdlg" );
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 		mpResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
351cdf0e10cSrcweir 	}
352cdf0e10cSrcweir 
353cdf0e10cSrcweir 	if( NULL == mpDialog )
354cdf0e10cSrcweir 	{
355cdf0e10cSrcweir 		Window* pParent = NULL;
356cdf0e10cSrcweir 		if( mxParent.is() )
357cdf0e10cSrcweir 		{
358cdf0e10cSrcweir 			VCLXWindow* pImplementation = VCLXWindow::GetImplementation(mxParent);
359cdf0e10cSrcweir 			if (pImplementation)
360cdf0e10cSrcweir 				pParent = pImplementation->GetWindow();
361cdf0e10cSrcweir 		}
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 		Reference< XComponent > xComp( this );
364cdf0e10cSrcweir 		mpDialog = new XMLFilterSettingsDialog( pParent, *mpResMgr, mxMSF );
365cdf0e10cSrcweir 		mpDialog->ShowWindow();
366cdf0e10cSrcweir 	}
367cdf0e10cSrcweir 	else if( !mpDialog->IsVisible() )
368cdf0e10cSrcweir 	{
369cdf0e10cSrcweir 		mpDialog->ShowWindow();
370cdf0e10cSrcweir 	}
371cdf0e10cSrcweir 	mpDialog->ToTop();
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 	return 0;
374cdf0e10cSrcweir }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir //-------------------------------------------------------------------------
initialize(const Sequence<Any> & aArguments)377cdf0e10cSrcweir void SAL_CALL XMLFilterDialogComponent::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException)
378cdf0e10cSrcweir {
379cdf0e10cSrcweir 	const Any* pArguments = aArguments.getConstArray();
380cdf0e10cSrcweir 	for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
381cdf0e10cSrcweir 	{
382cdf0e10cSrcweir 		PropertyValue aProperty;
383cdf0e10cSrcweir 		if(*pArguments >>= aProperty)
384cdf0e10cSrcweir 		{
385cdf0e10cSrcweir 			if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) == 0 )
386cdf0e10cSrcweir 			{
387cdf0e10cSrcweir 				aProperty.Value >>= mxParent;
388cdf0e10cSrcweir 			}
389cdf0e10cSrcweir 		}
390cdf0e10cSrcweir 	}
391cdf0e10cSrcweir }
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 
394cdf0e10cSrcweir extern "C"
395cdf0e10cSrcweir {
396cdf0e10cSrcweir //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)397cdf0e10cSrcweir void SAL_CALL component_getImplementationEnvironment(
398cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
399cdf0e10cSrcweir {
400cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
401cdf0e10cSrcweir }
402cdf0e10cSrcweir 
403cdf0e10cSrcweir //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)404cdf0e10cSrcweir void * SAL_CALL component_getFactory(
405cdf0e10cSrcweir 	const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
406cdf0e10cSrcweir {
407cdf0e10cSrcweir 	void * pRet = 0;
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 	if( pServiceManager )
410cdf0e10cSrcweir 	{
411cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory;
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 		OUString implName = OUString::createFromAscii( pImplName );
414cdf0e10cSrcweir 		if ( implName.equals(XMLFilterDialogComponent_getImplementationName()) )
415cdf0e10cSrcweir 		{
416cdf0e10cSrcweir 			xFactory = createOneInstanceFactory(
417cdf0e10cSrcweir 				reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
418cdf0e10cSrcweir 				OUString::createFromAscii( pImplName ),
419cdf0e10cSrcweir 				XMLFilterDialogComponent_createInstance, XMLFilterDialogComponent_getSupportedServiceNames() );
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 		}
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 		if (xFactory.is())
424cdf0e10cSrcweir 		{
425cdf0e10cSrcweir 			xFactory->acquire();
426cdf0e10cSrcweir 			pRet = xFactory.get();
427cdf0e10cSrcweir 		}
428cdf0e10cSrcweir 	}
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 	return pRet;
431cdf0e10cSrcweir }
432cdf0e10cSrcweir }
433