LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/hatchwindow - hatchwindowfactory.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 39 0.0 %
Date: 2012-12-27 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          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             : 
      21             : #include "hatchwindowfactory.hxx"
      22             : #include "hatchwindow.hxx"
      23             : #include "cppuhelper/factory.hxx"
      24             : #include <vcl/svapp.hxx>
      25             : 
      26             : #include "documentcloser.hxx"
      27             : 
      28             : using namespace ::com::sun::star;
      29             : 
      30             : //-------------------------------------------------------------------------
      31           0 : uno::Sequence< ::rtl::OUString > SAL_CALL OHatchWindowFactory::impl_staticGetSupportedServiceNames()
      32             : {
      33           0 :     uno::Sequence< ::rtl::OUString > aRet(2);
      34           0 :     aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.HatchWindowFactory" ));
      35           0 :     aRet[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.embed.HatchWindowFactory" ));
      36           0 :     return aRet;
      37             : }
      38             : 
      39             : //-------------------------------------------------------------------------
      40           0 : ::rtl::OUString SAL_CALL OHatchWindowFactory::impl_staticGetImplementationName()
      41             : {
      42           0 :     return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.embed.HatchWindowFactory" ));
      43             : }
      44             : 
      45             : //-------------------------------------------------------------------------
      46           0 : uno::Reference< uno::XInterface > SAL_CALL OHatchWindowFactory::impl_staticCreateSelfInstance(
      47             :             const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
      48             : {
      49           0 :     return uno::Reference< uno::XInterface >( *new OHatchWindowFactory( xServiceManager ) );
      50             : }
      51             : 
      52             : 
      53             : //-------------------------------------------------------------------------
      54           0 : uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchWindowInstance(
      55             :                 const uno::Reference< awt::XWindowPeer >& xParent,
      56             :                 const awt::Rectangle& aBounds,
      57             :                 const awt::Size& aHandlerSize )
      58             :     throw (uno::RuntimeException)
      59             : {
      60           0 :     if ( !xParent.is() )
      61           0 :         throw lang::IllegalArgumentException(); // TODO
      62             : 
      63           0 :     SolarMutexGuard aGuard;
      64           0 :     VCLXHatchWindow* pResult = new VCLXHatchWindow();
      65           0 :     pResult->initializeWindow( xParent, aBounds, aHandlerSize );
      66           0 :     return uno::Reference< embed::XHatchWindow >( static_cast< embed::XHatchWindow* >( pResult ) );
      67             : }
      68             : 
      69             : //-------------------------------------------------------------------------
      70           0 : ::rtl::OUString SAL_CALL OHatchWindowFactory::getImplementationName()
      71             :     throw ( uno::RuntimeException )
      72             : {
      73           0 :     return impl_staticGetImplementationName();
      74             : }
      75             : 
      76             : //-------------------------------------------------------------------------
      77           0 : sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const ::rtl::OUString& ServiceName )
      78             :     throw ( uno::RuntimeException )
      79             : {
      80           0 :     uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
      81             : 
      82           0 :     for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
      83           0 :         if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
      84           0 :             return sal_True;
      85             : 
      86           0 :     return sal_False;
      87             : }
      88             : 
      89             : //-------------------------------------------------------------------------
      90           0 : uno::Sequence< ::rtl::OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames()
      91             :     throw ( uno::RuntimeException )
      92             : {
      93           0 :     return impl_staticGetSupportedServiceNames();
      94             : }
      95             : 
      96             : //-------------------------------------------------------------------------
      97             : 
      98             : extern "C"
      99             : {
     100             : 
     101           0 : SAL_DLLPUBLIC_EXPORT void * SAL_CALL hatchwindowfactory_component_getFactory (
     102             :     const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */)
     103             : {
     104           0 :     void * pResult = 0;
     105           0 :     if (pServiceManager)
     106             :     {
     107           0 :         uno::Reference< lang::XSingleServiceFactory > xFactory;
     108           0 :         if (OHatchWindowFactory::impl_staticGetImplementationName().compareToAscii (pImplementationName ) == 0)
     109             :         {
     110             :             xFactory = cppu::createOneInstanceFactory(
     111             :                 reinterpret_cast< lang::XMultiServiceFactory* >(pServiceManager),
     112             :                 OHatchWindowFactory::impl_staticGetImplementationName(),
     113             :                 OHatchWindowFactory::impl_staticCreateSelfInstance,
     114           0 :                 OHatchWindowFactory::impl_staticGetSupportedServiceNames());
     115             :         }
     116           0 :         else if (ODocumentCloser::impl_staticGetImplementationName().compareToAscii (pImplementationName ) == 0)
     117             :         {
     118             :             xFactory = cppu::createSingleFactory(
     119             :                 reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
     120             :                 ODocumentCloser::impl_staticGetImplementationName(),
     121             :                 ODocumentCloser::impl_staticCreateSelfInstance,
     122           0 :                 ODocumentCloser::impl_staticGetSupportedServiceNames() );
     123             :         }
     124             : 
     125           0 :         if (xFactory.is())
     126             :         {
     127           0 :             xFactory->acquire();
     128           0 :             pResult = xFactory.get();
     129           0 :         }
     130             :     }
     131           0 :     return pResult;
     132             : }
     133             : 
     134             : } // extern "C"
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10