1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include "vbaeventshelper.hxx"
23 #include <com/sun/star/script/ModuleType.hpp>
24 #include <com/sun/star/script/vba/VBAEventId.hpp>
25 #include <cppuhelper/supportsservice.hxx>
27 using namespace ::com::sun::star
;
28 using namespace ::com::sun::star::script::vba::VBAEventId
;
30 SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence
< css::uno::Any
> const& aArgs
, uno::Reference
< uno::XComponentContext
> const& /*xContext*/ ) :
31 VbaEventsHelperBase( aArgs
)
33 using namespace ::com::sun::star::script::ModuleType
;
34 registerEventHandler( DOCUMENT_NEW
, DOCUMENT
, "Document_New" );
35 registerEventHandler( AUTO_NEW
, NORMAL
, "AutoNew" );
36 registerEventHandler( DOCUMENT_OPEN
, DOCUMENT
, "Document_Open" );
37 registerEventHandler( AUTO_OPEN
, NORMAL
, "AutoOpen" );
38 registerEventHandler( DOCUMENT_CLOSE
, DOCUMENT
, "Document_Close" );
39 registerEventHandler( AUTO_CLOSE
, NORMAL
, "AutoClose" );
42 SwVbaEventsHelper::~SwVbaEventsHelper()
46 bool SwVbaEventsHelper::implPrepareEvent(EventQueue
& /*rEventQueue*/,
47 const EventHandlerInfo
& /*rInfo*/, const uno::Sequence
<uno::Any
>& /*rArgs*/)
52 uno::Sequence
< uno::Any
> SwVbaEventsHelper::implBuildArgumentList( const EventHandlerInfo
& /*rInfo*/,
53 const uno::Sequence
< uno::Any
>& /*rArgs*/ )
55 // no event handler expects any arguments
56 return uno::Sequence
< uno::Any
>();
59 void SwVbaEventsHelper::implPostProcessEvent( EventQueue
& /*rEventQueue*/,
60 const EventHandlerInfo
& /*rInfo*/, bool /*bCancel*/ )
62 // nothing to do after any event
65 OUString
SwVbaEventsHelper::implGetDocumentModuleName( const EventHandlerInfo
& /*rInfo*/,
66 const uno::Sequence
< uno::Any
>& /*rArgs*/ ) const
68 // TODO: get actual codename from document
69 return "ThisDocument";
73 OUString
SwVbaEventsHelper::getImplementationName()
75 return "SwVbaEventsHelper";
77 sal_Bool
SwVbaEventsHelper::supportsService( const OUString
& ServiceName
)
79 return cppu::supportsService(this, ServiceName
);
81 css::uno::Sequence
< OUString
> SwVbaEventsHelper::getSupportedServiceNames()
83 return { "com.sun.star.script.vba.VBATextEventProcessor" };
87 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
88 Writer_SwVbaEventsHelper_get_implementation(
89 css::uno::XComponentContext
* context
, css::uno::Sequence
<css::uno::Any
> const& args
)
91 return cppu::acquire(new SwVbaEventsHelper(args
, context
));
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */