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

Generated by: LCOV version 1.10