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