LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbaglobals.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 60 0.0 %
Date: 2014-04-14 Functions: 0 21 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             : #include <vbahelper/helperdecl.hxx>
      20             : #include "vbaglobals.hxx"
      21             : #include <sal/macros.h>
      22             : #include <comphelper/unwrapargs.hxx>
      23             : 
      24             : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
      25             : #include <com/sun/star/beans/XPropertySet.hpp>
      26             : #include <com/sun/star/container/XNameContainer.hpp>
      27             : #include <cppuhelper/bootstrap.hxx>
      28             : #include "vbaapplication.hxx"
      29             : using namespace ::com::sun::star;
      30             : using namespace ::com::sun::star::uno;
      31             : using namespace ::ooo::vba;
      32             : 
      33             : // SwVbaGlobals
      34             : 
      35           0 : SwVbaGlobals::SwVbaGlobals(  uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& rxContext ) : SwVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext, "WordDocumentContext" )
      36             : {
      37             :     OSL_TRACE("SwVbaGlobals::SwVbaGlobals()");
      38           0 :         uno::Sequence< beans::PropertyValue > aInitArgs( 2 );
      39           0 :         aInitArgs[ 0 ].Name = "Application";
      40           0 :         aInitArgs[ 0 ].Value = uno::makeAny( getApplication() );
      41           0 :         aInitArgs[ 1 ].Name = "WordDocumentContext";
      42           0 :         aInitArgs[ 1 ].Value = uno::makeAny( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ) );
      43             : 
      44           0 :         init( aInitArgs );
      45           0 : }
      46             : 
      47           0 : SwVbaGlobals::~SwVbaGlobals()
      48             : {
      49             :     OSL_TRACE("SwVbaGlobals::~SwVbaGlobals");
      50           0 : }
      51             : 
      52             : // XGlobals
      53             : 
      54             : uno::Reference<word::XApplication >
      55           0 : SwVbaGlobals::getApplication() throw (uno::RuntimeException)
      56             : {
      57             :     OSL_TRACE("In SwVbaGlobals::getApplication");
      58           0 :     if ( !mxApplication.is() )
      59           0 :          mxApplication.set( new SwVbaApplication( mxContext) );
      60             : 
      61           0 :        return mxApplication;
      62             : }
      63             : 
      64             : uno::Reference<word::XSystem > SAL_CALL
      65           0 : SwVbaGlobals::getSystem() throw (uno::RuntimeException, std::exception)
      66             : {
      67           0 :     return getApplication()->getSystem();
      68             : }
      69             : 
      70             : uno::Reference< word::XDocument > SAL_CALL
      71           0 : SwVbaGlobals::getActiveDocument() throw (uno::RuntimeException, std::exception)
      72             : {
      73           0 :     return getApplication()->getActiveDocument();
      74             : }
      75             : 
      76             : uno::Reference< word::XWindow > SAL_CALL
      77           0 : SwVbaGlobals::getActiveWindow() throw (uno::RuntimeException, std::exception)
      78             : {
      79           0 :     return getApplication()->getActiveWindow();
      80             : }
      81             : 
      82             : OUString SAL_CALL
      83           0 : SwVbaGlobals::getName() throw (uno::RuntimeException, std::exception)
      84             : {
      85           0 :     return getApplication()->getName();
      86             : }
      87             : 
      88             : uno::Reference<word::XOptions > SAL_CALL
      89           0 : SwVbaGlobals::getOptions() throw (uno::RuntimeException, std::exception)
      90             : {
      91           0 :     return getApplication()->getOptions();
      92             : }
      93             : 
      94             : uno::Any SAL_CALL
      95           0 : SwVbaGlobals::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException, std::exception)
      96             : {
      97           0 :     return getApplication()->CommandBars( aIndex );
      98             : }
      99             : 
     100             : uno::Any SAL_CALL
     101           0 : SwVbaGlobals::Documents( const uno::Any& index ) throw (uno::RuntimeException, std::exception)
     102             : {
     103           0 :     return getApplication()->Documents( index );
     104             : }
     105             : 
     106             : uno::Any SAL_CALL
     107           0 : SwVbaGlobals::Addins( const uno::Any& index ) throw (uno::RuntimeException, std::exception)
     108             : {
     109           0 :     return getApplication()->Addins( index );
     110             : }
     111             : 
     112             : uno::Any SAL_CALL
     113           0 : SwVbaGlobals::Dialogs( const uno::Any& index ) throw (uno::RuntimeException, std::exception)
     114             : {
     115           0 :     return getApplication()->Dialogs( index );
     116             : }
     117             : 
     118             : uno::Any SAL_CALL
     119           0 : SwVbaGlobals::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException, std::exception)
     120             : {
     121           0 :     return getApplication()->ListGalleries( index );
     122             : }
     123             : 
     124             : uno::Reference<word::XSelection > SAL_CALL
     125           0 : SwVbaGlobals::getSelection() throw (uno::RuntimeException, std::exception)
     126             : {
     127           0 :     return getApplication()->getSelection();
     128             : }
     129             : 
     130           0 : float SAL_CALL SwVbaGlobals::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException, std::exception)
     131             : {
     132           0 :     return getApplication()->CentimetersToPoints( _Centimeters );
     133             : }
     134             : 
     135             : OUString
     136           0 : SwVbaGlobals::getServiceImplName()
     137             : {
     138           0 :     return OUString("SwVbaGlobals");
     139             : }
     140             : 
     141             : uno::Sequence< OUString >
     142           0 : SwVbaGlobals::getServiceNames()
     143             : {
     144           0 :         static uno::Sequence< OUString > aServiceNames;
     145           0 :         if ( aServiceNames.getLength() == 0 )
     146             :         {
     147           0 :                 aServiceNames.realloc( 1 );
     148           0 :                 aServiceNames[ 0 ] = "ooo.vba.word.Globals";
     149             :         }
     150           0 :         return aServiceNames;
     151             : }
     152             : 
     153             : uno::Sequence< OUString >
     154           0 : SwVbaGlobals::getAvailableServiceNames(  ) throw (uno::RuntimeException, std::exception)
     155             : {
     156             :     static bool bInit = false;
     157           0 :     static uno::Sequence< OUString > serviceNames( SwVbaGlobals_BASE::getAvailableServiceNames() );
     158           0 :     if ( !bInit )
     159             :     {
     160             :          OUString names[] = {
     161             :             OUString( "ooo.vba.word.Document" ),
     162             : //            #FIXME #TODO make Application a proper service
     163             : //            OUString( "ooo.vba.word.Application" ),
     164           0 :         };
     165           0 :         sal_Int32 nWordServices = SAL_N_ELEMENTS( names );
     166           0 :         sal_Int32 startIndex = serviceNames.getLength();
     167           0 :         serviceNames.realloc( serviceNames.getLength() + nWordServices );
     168           0 :         for ( sal_Int32 index = 0; index < nWordServices; ++index )
     169           0 :              serviceNames[ startIndex + index ] = names[ index ];
     170           0 :         bInit = true;
     171             :     }
     172           0 :     return serviceNames;
     173             : }
     174             : 
     175             : namespace globals
     176             : {
     177             : namespace sdecl = comphelper::service_decl;
     178           0 : sdecl::vba_service_class_<SwVbaGlobals, sdecl::with_args<true> > serviceImpl;
     179           0 : extern sdecl::ServiceDecl const serviceDecl(
     180             :     serviceImpl,
     181             :     "SwVbaGlobals",
     182             :     "ooo.vba.word.Globals" );
     183           0 : }
     184             : 
     185             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10