Line data Source code
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/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>
27 :
28 : #include <hatchwindow.hxx>
29 :
30 : using namespace ::com::sun::star;
31 :
32 : namespace {
33 :
34 8 : class OHatchWindowFactory : public ::cppu::WeakImplHelper2<
35 : embed::XHatchWindowFactory,
36 : lang::XServiceInfo >
37 : {
38 : public:
39 4 : 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 ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
43 :
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;
48 : };
49 :
50 2 : 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)
55 : {
56 2 : if ( !xParent.is() )
57 0 : throw lang::IllegalArgumentException(); // TODO
58 :
59 2 : SolarMutexGuard aGuard;
60 2 : VCLXHatchWindow* pResult = new VCLXHatchWindow();
61 2 : pResult->initializeWindow( xParent, aBounds, aHandlerSize );
62 2 : return uno::Reference< embed::XHatchWindow >( static_cast< embed::XHatchWindow* >( pResult ) );
63 : }
64 :
65 0 : OUString SAL_CALL OHatchWindowFactory::getImplementationName()
66 : throw ( uno::RuntimeException, std::exception )
67 : {
68 0 : return OUString( "com.sun.star.comp.embed.HatchWindowFactory" );
69 : }
70 :
71 0 : sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName )
72 : throw ( uno::RuntimeException, std::exception )
73 : {
74 0 : return cppu::supportsService(this, ServiceName);
75 : }
76 :
77 0 : uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames()
78 : throw ( uno::RuntimeException, std::exception )
79 : {
80 0 : uno::Sequence< OUString > aRet(2);
81 0 : aRet[0] = "com.sun.star.embed.HatchWindowFactory";
82 0 : aRet[1] = "com.sun.star.comp.embed.HatchWindowFactory";
83 0 : return aRet;
84 : }
85 :
86 : }
87 :
88 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
89 4 : com_sun_star_comp_embed_HatchWindowFactory_get_implementation(
90 : css::uno::XComponentContext *,
91 : css::uno::Sequence<css::uno::Any> const &)
92 : {
93 4 : return cppu::acquire(new OHatchWindowFactory);
94 1227 : }
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|