Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / ui / vba / vbaeventshelper.hxx
blob7e85b8fdc3a2da9748b7c342dbdc0cafbaa249ef
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #ifndef INCLUDED_SC_SOURCE_UI_VBA_VBAEVENTSHELPER_HXX
21 #define INCLUDED_SC_SOURCE_UI_VBA_VBAEVENTSHELPER_HXX
23 #include <rtl/ref.hxx>
24 #include <vbahelper/vbaeventshelperbase.hxx>
26 class ScDocShell;
27 class ScDocument;
28 class ScVbaEventListener;
30 class ScVbaEventsHelper : public VbaEventsHelperBase
32 public:
33 ScVbaEventsHelper( const css::uno::Sequence< css::uno::Any >& rArgs );
34 virtual ~ScVbaEventsHelper() override;
36 virtual void SAL_CALL notifyEvent( const css::document::EventObject& rEvent ) override;
38 OUString SAL_CALL getImplementationName() override;
40 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
42 protected:
43 virtual bool implPrepareEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) override;
44 virtual css::uno::Sequence< css::uno::Any > implBuildArgumentList( const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) override;
45 virtual void implPostProcessEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, bool bCancel ) override;
46 virtual OUString implGetDocumentModuleName( const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) const override;
48 private:
49 /** Checks if selection has been changed compared to selection of last call.
50 @return true, if the selection has been changed.
51 @throws css::lang::IllegalArgumentException
52 @throws css::uno::RuntimeException
54 bool isSelectionChanged( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex );
56 /** Creates a VBA Worksheet object (the argument must contain a sheet index).
57 @throws css::lang::IllegalArgumentException
58 @throws css::uno::RuntimeException
60 css::uno::Any createWorksheet( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) const;
61 /** Creates a VBA Range object (the argument must contain a UNO range or UNO range list).
62 @throws css::lang::IllegalArgumentException
63 @throws css::uno::RuntimeException
65 css::uno::Any createRange( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) const;
66 /** Creates a VBA Hyperlink object (the argument must contain a UNO cell).
67 @throws css::lang::IllegalArgumentException
68 @throws css::uno::RuntimeException
70 css::uno::Any createHyperlink( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) const;
71 /** Creates a VBA Window object (the argument must contain a model controller).
72 @throws css::lang::IllegalArgumentException
73 @throws css::uno::RuntimeException
75 css::uno::Any createWindow( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) const;
77 private:
78 ::rtl::Reference< ScVbaEventListener > mxListener;
79 css::uno::Any maOldSelection;
80 ScDocShell* mpDocShell;
81 ScDocument* mpDoc;
82 bool mbOpened;
85 #endif
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */