fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / svtools / source / hatchwindow / hatchwindowfactory.cxx
blob51566f408fba3660b0bd1693c8f353fe9de937d5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "hatchwindowfactory.hxx"
22 #include "hatchwindow.hxx"
23 #include "cppuhelper/factory.hxx"
24 #include <vcl/svapp.hxx>
26 #include "documentcloser.hxx"
28 using namespace ::com::sun::star;
30 //-------------------------------------------------------------------------
31 uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::impl_staticGetSupportedServiceNames()
33 uno::Sequence< OUString > aRet(2);
34 aRet[0] = OUString( "com.sun.star.embed.HatchWindowFactory" );
35 aRet[1] = OUString( "com.sun.star.comp.embed.HatchWindowFactory" );
36 return aRet;
39 //-------------------------------------------------------------------------
40 OUString SAL_CALL OHatchWindowFactory::impl_staticGetImplementationName()
42 return OUString( "com.sun.star.comp.embed.HatchWindowFactory" );
45 //-------------------------------------------------------------------------
46 uno::Reference< uno::XInterface > SAL_CALL OHatchWindowFactory::impl_staticCreateSelfInstance(
47 const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
49 return uno::Reference< uno::XInterface >( *new OHatchWindowFactory( xServiceManager ) );
53 //-------------------------------------------------------------------------
54 uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchWindowInstance(
55 const uno::Reference< awt::XWindowPeer >& xParent,
56 const awt::Rectangle& aBounds,
57 const awt::Size& aHandlerSize )
58 throw (uno::RuntimeException)
60 if ( !xParent.is() )
61 throw lang::IllegalArgumentException(); // TODO
63 SolarMutexGuard aGuard;
64 VCLXHatchWindow* pResult = new VCLXHatchWindow();
65 pResult->initializeWindow( xParent, aBounds, aHandlerSize );
66 return uno::Reference< embed::XHatchWindow >( static_cast< embed::XHatchWindow* >( pResult ) );
69 //-------------------------------------------------------------------------
70 OUString SAL_CALL OHatchWindowFactory::getImplementationName()
71 throw ( uno::RuntimeException )
73 return impl_staticGetImplementationName();
76 //-------------------------------------------------------------------------
77 sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName )
78 throw ( uno::RuntimeException )
80 uno::Sequence< OUString > aSeq = impl_staticGetSupportedServiceNames();
82 for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
83 if ( ServiceName == aSeq[nInd] )
84 return sal_True;
86 return sal_False;
89 //-------------------------------------------------------------------------
90 uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames()
91 throw ( uno::RuntimeException )
93 return impl_staticGetSupportedServiceNames();
96 //-------------------------------------------------------------------------
98 extern "C"
101 SAL_DLLPUBLIC_EXPORT void * SAL_CALL hatchwindowfactory_component_getFactory (
102 const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */)
104 void * pResult = 0;
105 if (pServiceManager)
107 uno::Reference< lang::XSingleServiceFactory > xFactory;
108 if (OHatchWindowFactory::impl_staticGetImplementationName().compareToAscii (pImplementationName ) == 0)
110 xFactory = cppu::createOneInstanceFactory(
111 reinterpret_cast< lang::XMultiServiceFactory* >(pServiceManager),
112 OHatchWindowFactory::impl_staticGetImplementationName(),
113 OHatchWindowFactory::impl_staticCreateSelfInstance,
114 OHatchWindowFactory::impl_staticGetSupportedServiceNames());
116 else if (ODocumentCloser::impl_staticGetImplementationName().compareToAscii (pImplementationName ) == 0)
118 xFactory = cppu::createSingleFactory(
119 reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
120 ODocumentCloser::impl_staticGetImplementationName(),
121 ODocumentCloser::impl_staticCreateSelfInstance,
122 ODocumentCloser::impl_staticGetSupportedServiceNames() );
125 if (xFactory.is())
127 xFactory->acquire();
128 pResult = xFactory.get();
131 return pResult;
134 } // extern "C"
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */