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

Generated by: LCOV version 1.10