LCOV - code coverage report
Current view: top level - ucb/source/ucp/tdoc - tdoc_documentcontentfactory.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 33 0.0 %
Date: 2014-04-14 Functions: 0 11 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             : /**************************************************************************
      22             :                                 TODO
      23             :  **************************************************************************
      24             : 
      25             :  *************************************************************************/
      26             : 
      27             : #include "cppuhelper/factory.hxx"
      28             : #include <cppuhelper/supportsservice.hxx>
      29             : 
      30             : #include "tdoc_documentcontentfactory.hxx"
      31             : 
      32             : using namespace com::sun::star;
      33             : using namespace tdoc_ucp;
      34             : 
      35             : 
      36             : 
      37             : 
      38             : // DocumentContentFactory Implementation.
      39             : 
      40             : 
      41             : 
      42             : 
      43           0 : DocumentContentFactory::DocumentContentFactory(
      44             :             const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
      45           0 : : m_xSMgr( xSMgr )
      46             : {
      47           0 : }
      48             : 
      49             : 
      50             : // virtual
      51           0 : DocumentContentFactory::~DocumentContentFactory()
      52             : {
      53           0 : }
      54             : 
      55             : 
      56             : 
      57             : // XServiceInfo methods.
      58             : 
      59             : 
      60             : 
      61             : // virtual
      62           0 : OUString SAL_CALL DocumentContentFactory::getImplementationName()
      63             :     throw ( uno::RuntimeException, std::exception )
      64             : {
      65           0 :     return getImplementationName_Static();
      66             : }
      67             : 
      68             : // virtual
      69             : sal_Bool SAL_CALL
      70           0 : DocumentContentFactory::supportsService( const OUString& ServiceName )
      71             :     throw ( uno::RuntimeException, std::exception )
      72             : {
      73           0 :     return cppu::supportsService(this, ServiceName);
      74             : }
      75             : 
      76             : // virtual
      77             : uno::Sequence< OUString > SAL_CALL
      78           0 : DocumentContentFactory::getSupportedServiceNames()
      79             :     throw ( uno::RuntimeException, std::exception )
      80             : {
      81           0 :     return getSupportedServiceNames_Static();
      82             : }
      83             : 
      84             : 
      85             : // static
      86           0 : OUString DocumentContentFactory::getImplementationName_Static()
      87             : {
      88             :     return OUString(
      89           0 :         "com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory" );
      90             : }
      91             : 
      92             : 
      93             : // static
      94             : uno::Sequence< OUString >
      95           0 : DocumentContentFactory::getSupportedServiceNames_Static()
      96             : {
      97           0 :     uno::Sequence< OUString > aSNS( 1 );
      98             :     aSNS.getArray()[ 0 ]
      99           0 :         = OUString(
     100           0 :             "com.sun.star.frame.TransientDocumentsDocumentContentFactory" );
     101           0 :     return aSNS;
     102             : }
     103             : 
     104             : 
     105             : 
     106             : // XTransientDocumentsDocumentContentFactory methods.
     107             : 
     108             : 
     109             : 
     110             : // virtual
     111             : uno::Reference< ucb::XContent > SAL_CALL
     112           0 : DocumentContentFactory::createDocumentContent(
     113             :         const uno::Reference< frame::XModel >& Model )
     114             :     throw ( lang::IllegalArgumentException, uno::RuntimeException, std::exception )
     115             : {
     116           0 :     uno::Reference< frame::XTransientDocumentsDocumentContentFactory > xDocFac;
     117             :     try
     118             :     {
     119             :         xDocFac
     120           0 :             = uno::Reference< frame::XTransientDocumentsDocumentContentFactory >(
     121           0 :                 m_xSMgr->createInstance(
     122             :                     OUString(
     123             :                         "com.sun.star.ucb.TransientDocumentsContentProvider" )
     124           0 :                     ),
     125           0 :                 uno::UNO_QUERY );
     126             :     }
     127           0 :     catch ( uno::Exception const & )
     128             :     {
     129             :         // handled below.
     130             :     }
     131             : 
     132           0 :     if ( xDocFac.is() )
     133           0 :         return xDocFac->createDocumentContent( Model );
     134             : 
     135             :     throw uno::RuntimeException(
     136             :         OUString(
     137             :             "Unable to obtain document content factory!" ),
     138           0 :         static_cast< cppu::OWeakObject * >( this ) );
     139             : }
     140             : 
     141             : 
     142             : 
     143             : // Service factory implementation.
     144             : 
     145             : 
     146             : 
     147             : static uno::Reference< uno::XInterface > SAL_CALL
     148           0 : DocumentContentFactory_CreateInstance(
     149             :     const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
     150             :     throw( uno::Exception )
     151             : {
     152             :     lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
     153           0 :         new DocumentContentFactory( rSMgr ) );
     154           0 :     return uno::Reference< uno::XInterface >::query( pX );
     155             : }
     156             : 
     157             : 
     158             : // static
     159             : uno::Reference< lang::XSingleServiceFactory >
     160           0 : DocumentContentFactory::createServiceFactory(
     161             :     const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
     162             : {
     163             :     return uno::Reference< lang::XSingleServiceFactory >(
     164             :             cppu::createOneInstanceFactory(
     165             :                 rxServiceMgr,
     166             :                 DocumentContentFactory::getImplementationName_Static(),
     167             :                 DocumentContentFactory_CreateInstance,
     168           0 :                 DocumentContentFactory::getSupportedServiceNames_Static() ) );
     169             : }
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10