Bump version to 5.0-14
[LibreOffice.git] / svtools / source / hatchwindow / hatchwindowfactory.cxx
blobd31c989cefa0d7be0c11699b280d577928325cde
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 .
20 #include <com/sun/star/embed/XHatchWindowFactory.hpp>
21 #include <com/sun/star/lang/XServiceInfo.hpp>
22 #include <com/sun/star/uno/XComponentContext.hpp>
23 #include <cppuhelper/implbase2.hxx>
24 #include <cppuhelper/supportsservice.hxx>
25 #include <rtl/ref.hxx>
26 #include <vcl/svapp.hxx>
28 #include <hatchwindow.hxx>
30 using namespace ::com::sun::star;
32 namespace {
34 class OHatchWindowFactory : public ::cppu::WeakImplHelper2<
35 embed::XHatchWindowFactory,
36 lang::XServiceInfo >
38 public:
39 OHatchWindowFactory() {}
41 // XHatchWindowFactory
42 virtual uno::Reference< embed::XHatchWindow > SAL_CALL createHatchWindowInstance( const uno::Reference< awt::XWindowPeer >& xParent, const awt::Rectangle& aBounds, const awt::Size& aSize ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
44 // XServiceInfo
45 virtual OUString SAL_CALL getImplementationName() throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
46 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
47 virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
50 uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchWindowInstance(
51 const uno::Reference< awt::XWindowPeer >& xParent,
52 const awt::Rectangle& aBounds,
53 const awt::Size& aHandlerSize )
54 throw (uno::RuntimeException, std::exception)
56 if ( !xParent.is() )
57 throw lang::IllegalArgumentException(); // TODO
59 SolarMutexGuard aGuard;
60 VCLXHatchWindow* pResult = new VCLXHatchWindow();
61 pResult->initializeWindow( xParent, aBounds, aHandlerSize );
62 return uno::Reference< embed::XHatchWindow >( static_cast< embed::XHatchWindow* >( pResult ) );
65 OUString SAL_CALL OHatchWindowFactory::getImplementationName()
66 throw ( uno::RuntimeException, std::exception )
68 return OUString( "com.sun.star.comp.embed.HatchWindowFactory" );
71 sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName )
72 throw ( uno::RuntimeException, std::exception )
74 return cppu::supportsService(this, ServiceName);
77 uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames()
78 throw ( uno::RuntimeException, std::exception )
80 uno::Sequence< OUString > aRet(2);
81 aRet[0] = "com.sun.star.embed.HatchWindowFactory";
82 aRet[1] = "com.sun.star.comp.embed.HatchWindowFactory";
83 return aRet;
88 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
89 com_sun_star_comp_embed_HatchWindowFactory_get_implementation(
90 css::uno::XComponentContext *,
91 css::uno::Sequence<css::uno::Any> const &)
93 return cppu::acquire(new OHatchWindowFactory);
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */