/src/libreoffice/toolkit/source/hatchwindow/hatchwindowfactory.cxx
Line | Count | Source (jump to first uncovered line) |
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> |
24 | | #include <cppuhelper/implbase.hxx> |
25 | | #include <cppuhelper/supportsservice.hxx> |
26 | | #include <vcl/svapp.hxx> |
27 | | |
28 | | #include "hatchwindow.hxx" |
29 | | |
30 | | using namespace ::com::sun::star; |
31 | | |
32 | | namespace { |
33 | | |
34 | | class OHatchWindowFactory : public ::cppu::WeakImplHelper< |
35 | | embed::XHatchWindowFactory, |
36 | | lang::XServiceInfo > |
37 | | { |
38 | | public: |
39 | 0 | 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 | | |
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 | 0 | { |
55 | 0 | if ( !xParent.is() ) |
56 | 0 | throw lang::IllegalArgumentException(); // TODO |
57 | | |
58 | 0 | SolarMutexGuard aGuard; |
59 | 0 | rtl::Reference<VCLXHatchWindow> pResult = new VCLXHatchWindow(); |
60 | 0 | pResult->initializeWindow( xParent, aBounds, aHandlerSize ); |
61 | 0 | return pResult; |
62 | 0 | } |
63 | | |
64 | | OUString SAL_CALL OHatchWindowFactory::getImplementationName() |
65 | 0 | { |
66 | 0 | return u"com.sun.star.comp.embed.HatchWindowFactory"_ustr; |
67 | 0 | } |
68 | | |
69 | | sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName ) |
70 | 0 | { |
71 | 0 | return cppu::supportsService(this, ServiceName); |
72 | 0 | } |
73 | | |
74 | | uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames() |
75 | 0 | { |
76 | 0 | return { u"com.sun.star.embed.HatchWindowFactory"_ustr, u"com.sun.star.comp.embed.HatchWindowFactory"_ustr }; |
77 | 0 | } |
78 | | |
79 | | } |
80 | | |
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 &) |
85 | 0 | { |
86 | 0 | return cppu::acquire(new OHatchWindowFactory); |
87 | 0 | } |
88 | | |
89 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |