LibreOffice Module toolkit (master) 1
hatchwindowfactory.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
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>
26#include <vcl/svapp.hxx>
27
28#include "hatchwindow.hxx"
29
30using namespace ::com::sun::star;
31
32namespace {
33
34class OHatchWindowFactory : public ::cppu::WeakImplHelper<
35 embed::XHatchWindowFactory,
36 lang::XServiceInfo >
37{
38public:
39 OHatchWindowFactory() {}
40
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;
43
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;
48};
49
50uno::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{
55 if ( !xParent.is() )
56 throw lang::IllegalArgumentException(); // TODO
57
58 SolarMutexGuard aGuard;
60 pResult->initializeWindow( xParent, aBounds, aHandlerSize );
61 return pResult;
62}
63
64OUString SAL_CALL OHatchWindowFactory::getImplementationName()
65{
66 return "com.sun.star.comp.embed.HatchWindowFactory";
67}
68
69sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName )
70{
71 return cppu::supportsService(this, ServiceName);
72}
73
74uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames()
75{
76 return { "com.sun.star.embed.HatchWindowFactory", "com.sun.star.comp.embed.HatchWindowFactory" };
77}
78
79}
80
81extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
83 css::uno::XComponentContext *,
84 css::uno::Sequence<css::uno::Any> const &)
85{
86 return cppu::acquire(new OHatchWindowFactory);
87}
88
89/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_embed_HatchWindowFactory_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool