LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbaapplication.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 65 0.0 %
Date: 2014-04-14 Functions: 0 23 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 <stdio.h>
      20             : #include "vbaapplication.hxx"
      21             : #include "vbadocument.hxx"
      22             : #include <osl/file.hxx>
      23             : #include <vbahelper/vbahelper.hxx>
      24             : #include "vbawindow.hxx"
      25             : #include "vbasystem.hxx"
      26             : #include "vbaoptions.hxx"
      27             : #include "vbaselection.hxx"
      28             : #include "vbadocuments.hxx"
      29             : #include "vbaaddins.hxx"
      30             : #include "vbadialogs.hxx"
      31             : #include <ooo/vba/word/WdEnableCancelKey.hpp>
      32             : #include <basic/sbuno.hxx>
      33             : #include <editeng/acorrcfg.hxx>
      34             : #include "wordvbahelper.hxx"
      35             : #include <docsh.hxx>
      36             : #include "vbalistgalleries.hxx"
      37             : 
      38             : using namespace ::ooo;
      39             : using namespace ::ooo::vba;
      40             : using namespace ::com::sun::star;
      41             : 
      42             : using ::com::sun::star::uno::Reference;
      43             : using ::com::sun::star::uno::UNO_QUERY_THROW;
      44             : using ::com::sun::star::uno::UNO_QUERY;
      45             : 
      46           0 : SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( xContext )
      47             : {
      48           0 : }
      49             : 
      50           0 : SwVbaApplication::~SwVbaApplication()
      51             : {
      52           0 : }
      53             : 
      54           0 : SfxObjectShell* SwVbaApplication::GetDocShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
      55             : {
      56           0 :     return static_cast< SfxObjectShell* >( word::getDocShell( xModel ) );
      57             : }
      58             : 
      59             : OUString SAL_CALL
      60           0 : SwVbaApplication::getName() throw (uno::RuntimeException, std::exception)
      61             : {
      62           0 :     static OUString appName("Microsoft Word" );
      63           0 :     return appName;
      64             : }
      65             : 
      66             : uno::Reference< word::XDocument > SAL_CALL
      67           0 : SwVbaApplication::getActiveDocument() throw (uno::RuntimeException, std::exception)
      68             : {
      69           0 :     return new SwVbaDocument( this, mxContext, getCurrentDocument() );
      70             : }
      71             : 
      72             : uno::Reference< word::XWindow > SAL_CALL
      73           0 : SwVbaApplication::getActiveWindow() throw (uno::RuntimeException, std::exception)
      74             : {
      75             :     // #FIXME sofar can't determine Parent
      76           0 :     uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_SET_THROW );
      77           0 :     uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
      78           0 :     return new SwVbaWindow( uno::Reference< XHelperInterface >(), mxContext, xModel, xController );
      79             : }
      80             : 
      81             : uno::Reference<word::XSystem > SAL_CALL
      82           0 : SwVbaApplication::getSystem() throw (uno::RuntimeException, std::exception)
      83             : {
      84           0 :     return uno::Reference< word::XSystem >( new SwVbaSystem( mxContext ) );
      85             : }
      86             : 
      87             : uno::Reference<word::XOptions > SAL_CALL
      88           0 : SwVbaApplication::getOptions() throw (uno::RuntimeException, std::exception)
      89             : {
      90           0 :     return uno::Reference< word::XOptions >( new SwVbaOptions( mxContext ) );
      91             : }
      92             : 
      93             : uno::Any SAL_CALL
      94           0 : SwVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException, std::exception)
      95             : {
      96           0 :     return VbaApplicationBase::CommandBars( aIndex );
      97             : }
      98             : 
      99             : uno::Reference< word::XSelection > SAL_CALL
     100           0 : SwVbaApplication::getSelection() throw (uno::RuntimeException, std::exception)
     101             : {
     102           0 :     return new SwVbaSelection( this, mxContext, getCurrentDocument() );
     103             : }
     104             : 
     105             : uno::Any SAL_CALL
     106           0 : SwVbaApplication::Documents( const uno::Any& index ) throw (uno::RuntimeException, std::exception)
     107             : {
     108           0 :     uno::Reference< XCollection > xCol( new SwVbaDocuments( this, mxContext ) );
     109           0 :     if ( index.hasValue() )
     110           0 :         return xCol->Item( index, uno::Any() );
     111           0 :     return uno::makeAny( xCol );
     112             : }
     113             : 
     114             : uno::Any SAL_CALL
     115           0 : SwVbaApplication::Addins( const uno::Any& index ) throw (uno::RuntimeException, std::exception)
     116             : {
     117           0 :     static uno::Reference< XCollection > xCol( new SwVbaAddins( this, mxContext ) );
     118           0 :     if ( index.hasValue() )
     119           0 :         return xCol->Item( index, uno::Any() );
     120           0 :     return uno::makeAny( xCol );
     121             : }
     122             : 
     123             : uno::Any SAL_CALL
     124           0 : SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException, std::exception)
     125             : {
     126           0 :     uno::Reference< word::XDialogs > xCol( new SwVbaDialogs( this, mxContext, getCurrentDocument() ));
     127           0 :     if ( index.hasValue() )
     128           0 :         return xCol->Item( index );
     129           0 :     return uno::makeAny( xCol );
     130             : }
     131             : 
     132             : uno::Any SAL_CALL
     133           0 : SwVbaApplication::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException, std::exception)
     134             : {
     135           0 :     uno::Reference< text::XTextDocument > xTextDoc( getCurrentDocument(), uno::UNO_QUERY_THROW );
     136           0 :     uno::Reference< XCollection > xCol( new SwVbaListGalleries( this, mxContext, xTextDoc ) );
     137           0 :     if ( index.hasValue() )
     138           0 :         return xCol->Item( index, uno::Any() );
     139           0 :     return uno::makeAny( xCol );
     140             : }
     141             : 
     142           0 : sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException, std::exception)
     143             : {
     144           0 :     return SvxAutoCorrCfg::Get().IsAutoTextTip();
     145             : }
     146             : 
     147           0 : void SAL_CALL SwVbaApplication::setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException, std::exception)
     148             : {
     149           0 :     SvxAutoCorrCfg::Get().SetAutoTextTip( _displayAutoCompleteTips );
     150           0 : }
     151             : 
     152           0 : sal_Int32 SAL_CALL SwVbaApplication::getEnableCancelKey() throw (css::uno::RuntimeException, std::exception)
     153             : {
     154             :     // the default value is wdCancelInterrupt in Word
     155           0 :     return word::WdEnableCancelKey::wdCancelInterrupt;
     156             : }
     157             : 
     158           0 : void SAL_CALL SwVbaApplication::setEnableCancelKey( sal_Int32/* _enableCancelKey */) throw (css::uno::RuntimeException, std::exception)
     159             : {
     160             :     // seems not supported in Writer
     161           0 : }
     162             : 
     163           0 : float SAL_CALL SwVbaApplication::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException, std::exception)
     164             : {
     165           0 :     return VbaApplicationBase::CentimetersToPoints( _Centimeters );
     166             : }
     167             : 
     168             : uno::Reference< frame::XModel >
     169           0 : SwVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
     170             : {
     171           0 :     return getCurrentWordDoc( mxContext );
     172             : }
     173             : 
     174             : OUString
     175           0 : SwVbaApplication::getServiceImplName()
     176             : {
     177           0 :     return OUString("SwVbaApplication");
     178             : }
     179             : 
     180             : uno::Sequence< OUString >
     181           0 : SwVbaApplication::getServiceNames()
     182             : {
     183           0 :     static uno::Sequence< OUString > aServiceNames;
     184           0 :     if ( aServiceNames.getLength() == 0 )
     185             :     {
     186           0 :         aServiceNames.realloc( 1 );
     187           0 :         aServiceNames[ 0 ] = "ooo.vba.word.Application";
     188             :     }
     189           0 :     return aServiceNames;
     190             : }
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10