LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbaeventshelper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 29 10.3 %
Date: 2015-06-13 12:38:46 Functions: 2 9 22.2 %
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 "vbaeventshelper.hxx"
      21             : #include <com/sun/star/script/ModuleType.hpp>
      22             : #include <com/sun/star/script/vba/VBAEventId.hpp>
      23             : #include <vbahelper/helperdecl.hxx>
      24             : 
      25             : using namespace ::com::sun::star;
      26             : using namespace ::com::sun::star::script::vba::VBAEventId;
      27             : using namespace ::ooo::vba;
      28             : 
      29           0 : SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) :
      30           0 :     VbaEventsHelperBase( aArgs, xContext )
      31             : {
      32             :     using namespace ::com::sun::star::script::ModuleType;
      33           0 :     registerEventHandler( DOCUMENT_NEW,     DOCUMENT,   "Document_New" );
      34           0 :     registerEventHandler( AUTO_NEW,         NORMAL,     "AutoNew" );
      35           0 :     registerEventHandler( DOCUMENT_OPEN,    DOCUMENT,   "Document_Open" );
      36           0 :     registerEventHandler( AUTO_OPEN,        NORMAL,     "AutoOpen" );
      37           0 :     registerEventHandler( DOCUMENT_CLOSE,   DOCUMENT,   "Document_Close" );
      38           0 :     registerEventHandler( AUTO_CLOSE,       NORMAL,     "AutoClose" );
      39           0 : }
      40             : 
      41           0 : SwVbaEventsHelper::~SwVbaEventsHelper()
      42             : {
      43           0 : }
      44             : 
      45           0 : bool SwVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue,
      46             :         const EventHandlerInfo& rInfo, const uno::Sequence< uno::Any >& /*rArgs*/ ) throw (uno::RuntimeException)
      47             : {
      48           0 :     switch( rInfo.mnEventId )
      49             :     {
      50             :         case DOCUMENT_NEW:
      51           0 :             rEventQueue.push_back( AUTO_NEW );
      52           0 :         break;
      53             :         case DOCUMENT_OPEN:
      54           0 :             rEventQueue.push_back( AUTO_OPEN );
      55           0 :         break;
      56             :         case DOCUMENT_CLOSE:
      57           0 :             rEventQueue.push_back( AUTO_CLOSE );
      58           0 :         break;
      59             :     }
      60           0 :     return true;
      61             : }
      62             : 
      63           0 : uno::Sequence< uno::Any > SwVbaEventsHelper::implBuildArgumentList( const EventHandlerInfo& /*rInfo*/,
      64             :         const uno::Sequence< uno::Any >& /*rArgs*/ ) throw (lang::IllegalArgumentException)
      65             : {
      66             :     // no event handler expects any arguments
      67           0 :     return uno::Sequence< uno::Any >();
      68             : }
      69             : 
      70           0 : void SwVbaEventsHelper::implPostProcessEvent( EventQueue& /*rEventQueue*/,
      71             :         const EventHandlerInfo& /*rInfo*/, bool /*bCancel*/ ) throw (uno::RuntimeException)
      72             : {
      73             :     // nothing to do after any event
      74           0 : }
      75             : 
      76           0 : OUString SwVbaEventsHelper::implGetDocumentModuleName( const EventHandlerInfo& /*rInfo*/,
      77             :         const uno::Sequence< uno::Any >& /*rArgs*/ ) const throw (lang::IllegalArgumentException)
      78             : {
      79             :     // TODO: get actual codename from document
      80           0 :     return OUString( "ThisDocument" );
      81             : }
      82             : 
      83             : namespace vbaeventshelper
      84             : {
      85             : namespace sdecl = comphelper::service_decl;
      86           1 : sdecl::inheritingClass_<SwVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
      87           1 : extern sdecl::ServiceDecl const serviceDecl(
      88             :     serviceImpl,
      89             :     "SwVbaEventsHelper",
      90             :     "com.sun.star.document.vba.VBATextEventProcessor" );
      91           3 : }
      92             : 
      93             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11