Bump version to 24.04.3.4
[LibreOffice.git] / toolkit / source / hatchwindow / hatchwindowfactory.cxx
blob3e50db64ee82785b181fd4068c7f23c567b9a7e2
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/IllegalArgumentException.hpp>
22 #include <com/sun/star/lang/XServiceInfo.hpp>
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <cppuhelper/implbase.hxx>
25 #include <cppuhelper/supportsservice.hxx>
26 #include <vcl/svapp.hxx>
28 #include "hatchwindow.hxx"
30 using namespace ::com::sun::star;
32 namespace {
34 class OHatchWindowFactory : public ::cppu::WeakImplHelper<
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 ) override;
44 // XServiceInfo
45 virtual OUString SAL_CALL getImplementationName() override;
46 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
47 virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 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 )
55 if ( !xParent.is() )
56 throw lang::IllegalArgumentException(); // TODO
58 SolarMutexGuard aGuard;
59 rtl::Reference<VCLXHatchWindow> pResult = new VCLXHatchWindow();
60 pResult->initializeWindow( xParent, aBounds, aHandlerSize );
61 return pResult;
64 OUString SAL_CALL OHatchWindowFactory::getImplementationName()
66 return "com.sun.star.comp.embed.HatchWindowFactory";
69 sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName )
71 return cppu::supportsService(this, ServiceName);
74 uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames()
76 return { "com.sun.star.embed.HatchWindowFactory", "com.sun.star.comp.embed.HatchWindowFactory" };
81 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
82 com_sun_star_comp_embed_HatchWindowFactory_get_implementation(
83 css::uno::XComponentContext *,
84 css::uno::Sequence<css::uno::Any> const &)
86 return cppu::acquire(new OHatchWindowFactory);
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */