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

Generated by: LCOV version 1.10