LCOV - code coverage report
Current view: top level - scripting/source/dlgprov - DialogModelProvider.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 61 0.0 %
Date: 2014-04-14 Functions: 0 20 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             : #include "DialogModelProvider.hxx"
      21             : #include "dlgprov.hxx"
      22             : #include <com/sun/star/resource/XStringResourceManager.hpp>
      23             : #include <com/sun/star/ucb/SimpleFileAccess.hpp>
      24             : 
      25             : #include <cppuhelper/supportsservice.hxx>
      26             : 
      27             : // component helper namespace
      28             : namespace comp_DialogModelProvider {
      29             : 
      30             : using namespace ::com::sun::star;
      31             : using namespace awt;
      32             : using namespace lang;
      33             : using namespace uno;
      34             : using namespace script;
      35             : using namespace beans;
      36             : 
      37             : 
      38             : // component and service helper functions:
      39             : OUString SAL_CALL _getImplementationName();
      40             : css::uno::Sequence< OUString > SAL_CALL _getSupportedServiceNames();
      41             : css::uno::Reference< css::uno::XInterface > SAL_CALL _create( css::uno::Reference< css::uno::XComponentContext > const & context );
      42             : 
      43             : } // closing component helper namespace
      44             : 
      45             : 
      46             : 
      47             : /// anonymous implementation namespace
      48             : namespace dlgprov {
      49             : 
      50             : using namespace ::com::sun::star;
      51             : using namespace awt;
      52             : using namespace lang;
      53             : using namespace uno;
      54             : using namespace script;
      55             : using namespace beans;
      56             : 
      57             : 
      58           0 : DialogModelProvider::DialogModelProvider(Reference< XComponentContext > const & context) :
      59           0 :     m_xContext(context)
      60           0 : {}
      61             : 
      62             : // lang::XInitialization:
      63           0 : void SAL_CALL DialogModelProvider::initialize(const css::uno::Sequence< uno::Any > & aArguments) throw (css::uno::RuntimeException, css::uno::Exception, std::exception)
      64             : {
      65           0 :     if ( aArguments.getLength() == 1 )
      66             :     {
      67           0 :         OUString sURL;
      68           0 :         if ( !( aArguments[ 0 ] >>= sURL ))
      69           0 :             throw css::lang::IllegalArgumentException();
      70             :          // Try any other URL with SimpleFileAccess
      71           0 :         Reference< ucb::XSimpleFileAccess3 > xSFI = ucb::SimpleFileAccess::create(m_xContext);
      72             : 
      73             :         try
      74             :         {
      75           0 :             Reference< io::XInputStream > xInput = xSFI->openFileRead( sURL );
      76           0 :             Reference< resource::XStringResourceManager > xStringResourceManager;
      77           0 :             if ( xInput.is() )
      78             :             {
      79           0 :                 xStringResourceManager = dlgprov::lcl_getStringResourceManager(m_xContext,sURL);
      80           0 :                 Any aDialogSourceURLAny;
      81           0 :                 aDialogSourceURLAny <<= sURL;
      82             : 
      83           0 :                 Reference< frame::XModel > xModel;
      84           0 :                 m_xDialogModel.set( dlgprov::lcl_createDialogModel( m_xContext, xInput , xModel, xStringResourceManager, aDialogSourceURLAny  ), UNO_QUERY_THROW);
      85           0 :                 m_xDialogModelProp.set(m_xDialogModel, UNO_QUERY_THROW);
      86           0 :             }
      87             :         }
      88           0 :         catch( Exception& )
      89           0 :         {}
      90             :         //m_sURL = sURL;
      91             :     }
      92           0 : }
      93             : 
      94             : // container::XElementAccess:
      95           0 : uno::Type SAL_CALL DialogModelProvider::getElementType() throw (css::uno::RuntimeException, std::exception)
      96             : {
      97           0 :     return m_xDialogModel->getElementType();
      98             : }
      99             : 
     100           0 : sal_Bool SAL_CALL DialogModelProvider::hasElements() throw (css::uno::RuntimeException, std::exception)
     101             : {
     102           0 :     return m_xDialogModel->hasElements();
     103             : }
     104             : 
     105             : // container::XNameAccess:
     106           0 : uno::Any SAL_CALL DialogModelProvider::getByName(const OUString & aName) throw (css::uno::RuntimeException, css::container::NoSuchElementException, css::lang::WrappedTargetException, std::exception)
     107             : {
     108           0 :     return m_xDialogModel->getByName(aName);
     109             : }
     110             : 
     111           0 : css::uno::Sequence< OUString > SAL_CALL DialogModelProvider::getElementNames() throw (css::uno::RuntimeException, std::exception)
     112             : {
     113           0 :     return m_xDialogModel->getElementNames();
     114             : }
     115             : 
     116           0 : sal_Bool SAL_CALL DialogModelProvider::hasByName(const OUString & aName) throw (css::uno::RuntimeException, std::exception)
     117             : {
     118           0 :     return m_xDialogModel->hasByName(aName);
     119             : }
     120             : 
     121             : // container::XNameReplace:
     122           0 : void SAL_CALL DialogModelProvider::replaceByName(const OUString & aName, const uno::Any & aElement) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, std::exception)
     123             : {
     124           0 :     m_xDialogModel->replaceByName(aName,aElement);
     125           0 : }
     126             : 
     127             : // container::XNameContainer:
     128           0 : void SAL_CALL DialogModelProvider::insertByName(const OUString & aName, const uno::Any & aElement) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, std::exception)
     129             : {
     130           0 :     m_xDialogModel->insertByName(aName,aElement);
     131           0 : }
     132             : 
     133           0 : void SAL_CALL DialogModelProvider::removeByName(const OUString & aName) throw (css::uno::RuntimeException, css::container::NoSuchElementException, css::lang::WrappedTargetException, std::exception)
     134             : {
     135           0 :     m_xDialogModel->removeByName(aName);
     136           0 : }
     137           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL DialogModelProvider::getPropertySetInfo(  ) throw (uno::RuntimeException, std::exception)
     138             : {
     139           0 :     return m_xDialogModelProp->getPropertySetInfo();
     140             : }
     141           0 : void SAL_CALL DialogModelProvider::setPropertyValue( const OUString&, const uno::Any& ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     142             : {
     143           0 : }
     144           0 : uno::Any SAL_CALL DialogModelProvider::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     145             : {
     146           0 :     return m_xDialogModelProp->getPropertyValue(PropertyName);
     147             : }
     148           0 : void SAL_CALL DialogModelProvider::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     149             : {
     150           0 : }
     151           0 : void SAL_CALL DialogModelProvider::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     152             : {
     153           0 : }
     154           0 : void SAL_CALL DialogModelProvider::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     155             : {
     156           0 : }
     157           0 : void SAL_CALL DialogModelProvider::removeVetoableChangeListener( const OUString& ,const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     158             : {
     159           0 : }
     160             : 
     161             : // com.sun.star.uno.XServiceInfo:
     162           0 : OUString SAL_CALL DialogModelProvider::getImplementationName() throw (css::uno::RuntimeException, std::exception)
     163             : {
     164           0 :     return comp_DialogModelProvider::_getImplementationName();
     165             : }
     166             : 
     167           0 : sal_Bool SAL_CALL DialogModelProvider::supportsService(OUString const & serviceName) throw (css::uno::RuntimeException, std::exception)
     168             : {
     169           0 :     return cppu::supportsService(this, serviceName);
     170             : }
     171             : 
     172           0 : css::uno::Sequence< OUString > SAL_CALL DialogModelProvider::getSupportedServiceNames() throw (css::uno::RuntimeException, std::exception)
     173             : {
     174           0 :     return comp_DialogModelProvider::_getSupportedServiceNames();
     175             : }
     176             : 
     177             : } // closing anonymous implementation namespace
     178             : 
     179             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10