LibreOffice Module scripting (master) 1
Macros | Typedefs | Functions | Variables
eventhelper.cxx File Reference
#include <sal/macros.h>
#include <sal/log.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/uno3.hxx>
#include <comphelper/proparrhlp.hxx>
#include <comphelper/propertycontainer.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <ooo/vba/XVBAToOOEventDescGen.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/theIntrospection.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/util/XCloseListener.hpp>
#include <com/sun/star/util/XCloseBroadcaster.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XDialog.hpp>
#include <com/sun/star/awt/KeyEvent.hpp>
#include <com/sun/star/awt/MouseEvent.hpp>
#include <com/sun/star/awt/XFixedText.hpp>
#include <com/sun/star/awt/XTextComponent.hpp>
#include <com/sun/star/awt/XComboBox.hpp>
#include <com/sun/star/awt/XRadioButton.hpp>
#include <com/sun/star/awt/XListBox.hpp>
#include <sfx2/objsh.hxx>
#include <basic/basmgr.hxx>
#include <filter/msfilter/msvbahelper.hxx>
#include <vbahelper/vbareturntypes.hxx>
#include <com/sun/star/script/XScriptListener.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/evtmethodhelper.hxx>
#include <vector>
#include <unordered_map>
Include dependency graph for eventhelper.cxx:

Go to the source code of this file.

Macros

#define EVENTLSTNR_PROPERTY_ID_MODEL   1
 

Typedefs

typedef Sequence< Any >(* Translator) (const Sequence< Any > &)
 
typedef std::unordered_map< OUString, std::vector< TranslateInfo > > EventInfoHash
 
typedef ::cppu::WeakImplHelper< container::XNameContainer > NameContainer_BASE
 
typedef ::cppu::WeakImplHelper< XScriptListener, util::XCloseListener, lang::XInitialization, css::lang::XServiceInfo > EventListener_BASE
 

Functions

static bool isKeyEventOk (awt::KeyEvent &evt, const Sequence< Any > &params)
 
static bool isMouseEventOk (awt::MouseEvent &evt, const Sequence< Any > &params)
 
static Sequence< Any > ooMouseEvtToVBADblClick (const Sequence< Any > &params)
 
static Sequence< Any > ooMouseEvtToVBAMouseEvt (const Sequence< Any > &params)
 
static Sequence< Any > ooKeyPressedToVBAKeyPressed (const Sequence< Any > &params)
 
static Sequence< Any > ooKeyPressedToVBAKeyUpDown (const Sequence< Any > &params)
 
static bool ApproveAll (const ScriptEvent &evt, void const *pPara)
 
static bool ApproveType (const ScriptEvent &evt, void const *pPara)
 
static bool DenyType (const ScriptEvent &evt, void const *pPara)
 
static bool DenyMouseDrag (const ScriptEvent &evt, void const *pPara)
 
static EventInfoHashgetEventTransInfo ()
 
static bool eventMethodToDescriptor (std::u16string_view rEventMethod, ScriptEventDescriptor &evtDesc, const OUString &sCodeName)
 
bool ApproveAll (SAL_UNUSED_PARAMETER const ScriptEvent &, SAL_UNUSED_PARAMETER void const *)
 
static bool FindControl (const ScriptEvent &evt, void const *pPara)
 
bool DenyMouseDrag (const ScriptEvent &evt, SAL_UNUSED_PARAMETER void const *)
 
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ooo_vba_EventListener_get_implementation (css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
 
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ooo_vba_VBAToOOEventDesc_get_implementation (css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
 

Variables

constexpr std::u16string_view DELIM = u"::"
 
constexpr sal_Int32 DELIMLEN = DELIM.size()
 
Type const typeXFixedText = cppu::UnoType<awt::XFixedText>::get()
 
Type const typeXTextComponent = cppu::UnoType<awt::XTextComponent>::get()
 
Type const typeXComboBox = cppu::UnoType<awt::XComboBox>::get()
 
Type const typeXRadioButton = cppu::UnoType<awt::XRadioButton>::get()
 
Type const typeXListBox = cppu::UnoType<awt::XListBox>::get()
 
TypeList const fixedTextList = {&typeXFixedText, 1}
 
TypeList const textCompList = {&typeXTextComponent, 1}
 
TypeList const radioButtonList = {&typeXRadioButton, 1}
 
TypeList const comboBoxList = {&typeXComboBox, 1}
 
TypeList const listBoxList = {&typeXListBox, 1}
 
static TranslatePropMap aTranslatePropMap_Impl []
 
constexpr OUStringLiteral EVENTLSTNR_PROPERTY_MODEL = u"Model"
 

Macro Definition Documentation

◆ EVENTLSTNR_PROPERTY_ID_MODEL

#define EVENTLSTNR_PROPERTY_ID_MODEL   1

Definition at line 522 of file eventhelper.cxx.

Typedef Documentation

◆ EventInfoHash

typedef std::unordered_map< OUString, std::vector< TranslateInfo > > EventInfoHash

Definition at line 161 of file eventhelper.cxx.

◆ EventListener_BASE

typedef ::cppu::WeakImplHelper< XScriptListener, util::XCloseListener, lang::XInitialization, css::lang::XServiceInfo > EventListener_BASE

Definition at line 520 of file eventhelper.cxx.

◆ NameContainer_BASE

typedef ::cppu::WeakImplHelper< container::XNameContainer > NameContainer_BASE

Definition at line 421 of file eventhelper.cxx.

◆ Translator

typedef Sequence< Any >(* Translator) (const Sequence< Any > &)

Definition at line 144 of file eventhelper.cxx.

Function Documentation

◆ ApproveAll() [1/2]

static bool ApproveAll ( const ScriptEvent &  evt,
void const *  pPara 
)
static

◆ ApproveAll() [2/2]

bool ApproveAll ( SAL_UNUSED_PARAMETER const ScriptEvent &  ,
SAL_UNUSED_PARAMETER void const *   
)

Definition at line 725 of file eventhelper.cxx.

◆ ApproveType()

bool ApproveType ( const ScriptEvent &  evt,
void const *  pPara 
)
static

Definition at line 754 of file eventhelper.cxx.

References FindControl().

◆ DenyMouseDrag() [1/2]

bool DenyMouseDrag ( const ScriptEvent &  evt,
SAL_UNUSED_PARAMETER void const *   
)

Definition at line 768 of file eventhelper.cxx.

References aEvent.

◆ DenyMouseDrag() [2/2]

static bool DenyMouseDrag ( const ScriptEvent &  evt,
void const *  pPara 
)
static

References pTypeList.

◆ DenyType()

bool DenyType ( const ScriptEvent &  evt,
void const *  pPara 
)
static

Definition at line 760 of file eventhelper.cxx.

References FindControl().

◆ eventMethodToDescriptor()

static bool eventMethodToDescriptor ( std::u16string_view  rEventMethod,
ScriptEventDescriptor &  evtDesc,
const OUString &  sCodeName 
)
static

Definition at line 298 of file eventhelper.cxx.

References DELIM, DELIMLEN, and getEventTransInfo().

◆ FindControl()

static bool FindControl ( const ScriptEvent &  evt,
void const *  pPara 
)
static

Definition at line 731 of file eventhelper.cxx.

References aEvent, and i.

Referenced by ApproveType(), and DenyType().

◆ getEventTransInfo()

static EventInfoHash & getEventTransInfo ( )
static

Definition at line 249 of file eventhelper.cxx.

References aTranslatePropMap_Impl, i, nCount, and SAL_N_ELEMENTS.

Referenced by eventMethodToDescriptor().

◆ isKeyEventOk()

static bool isKeyEventOk ( awt::KeyEvent &  evt,
const Sequence< Any > &  params 
)
static

Definition at line 82 of file eventhelper.cxx.

Referenced by ooKeyPressedToVBAKeyPressed(), and ooKeyPressedToVBAKeyUpDown().

◆ isMouseEventOk()

static bool isMouseEventOk ( awt::MouseEvent &  evt,
const Sequence< Any > &  params 
)
static

Definition at line 87 of file eventhelper.cxx.

Referenced by ooMouseEvtToVBADblClick(), and ooMouseEvtToVBAMouseEvt().

◆ ooKeyPressedToVBAKeyPressed()

static Sequence< Any > ooKeyPressedToVBAKeyPressed ( const Sequence< Any > &  params)
static

Definition at line 117 of file eventhelper.cxx.

References Any, and isKeyEventOk().

◆ ooKeyPressedToVBAKeyUpDown()

static Sequence< Any > ooKeyPressedToVBAKeyUpDown ( const Sequence< Any > &  params)
static

Definition at line 129 of file eventhelper.cxx.

References Any, isKeyEventOk(), and shift.

◆ ooMouseEvtToVBADblClick()

static Sequence< Any > ooMouseEvtToVBADblClick ( const Sequence< Any > &  params)
static

Definition at line 92 of file eventhelper.cxx.

References isMouseEventOk().

◆ ooMouseEvtToVBAMouseEvt()

static Sequence< Any > ooMouseEvtToVBAMouseEvt ( const Sequence< Any > &  params)
static

Definition at line 103 of file eventhelper.cxx.

References Any, and isMouseEventOk().

◆ ooo_vba_EventListener_get_implementation()

SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ooo_vba_EventListener_get_implementation ( css::uno::XComponentContext *  ,
css::uno::Sequence< css::uno::Any > const &   
)

Definition at line 967 of file eventhelper.cxx.

◆ ooo_vba_VBAToOOEventDesc_get_implementation()

SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ooo_vba_VBAToOOEventDesc_get_implementation ( css::uno::XComponentContext *  ,
css::uno::Sequence< css::uno::Any > const &   
)

Definition at line 975 of file eventhelper.cxx.

Variable Documentation

◆ aTranslatePropMap_Impl

TranslatePropMap aTranslatePropMap_Impl[]
static

Definition at line 202 of file eventhelper.cxx.

Referenced by getEventTransInfo().

◆ comboBoxList

TypeList const comboBoxList = {&typeXComboBox, 1}

Definition at line 198 of file eventhelper.cxx.

◆ DELIM

constexpr std::u16string_view DELIM = u"::"
constexpr

Definition at line 79 of file eventhelper.cxx.

Referenced by eventMethodToDescriptor().

◆ DELIMLEN

constexpr sal_Int32 DELIMLEN = DELIM.size()
constexpr

Definition at line 80 of file eventhelper.cxx.

Referenced by eventMethodToDescriptor().

◆ EVENTLSTNR_PROPERTY_MODEL

constexpr OUStringLiteral EVENTLSTNR_PROPERTY_MODEL = u"Model"
constexpr

Definition at line 523 of file eventhelper.cxx.

◆ fixedTextList

TypeList const fixedTextList = {&typeXFixedText, 1}

Definition at line 195 of file eventhelper.cxx.

◆ listBoxList

TypeList const listBoxList = {&typeXListBox, 1}

Definition at line 199 of file eventhelper.cxx.

◆ radioButtonList

TypeList const radioButtonList = {&typeXRadioButton, 1}

Definition at line 197 of file eventhelper.cxx.

◆ textCompList

TypeList const textCompList = {&typeXTextComponent, 1}

Definition at line 196 of file eventhelper.cxx.

◆ typeXComboBox

Type const typeXComboBox = cppu::UnoType<awt::XComboBox>::get()

Definition at line 190 of file eventhelper.cxx.

◆ typeXFixedText

Type const typeXFixedText = cppu::UnoType<awt::XFixedText>::get()

Definition at line 188 of file eventhelper.cxx.

◆ typeXListBox

Type const typeXListBox = cppu::UnoType<awt::XListBox>::get()

Definition at line 192 of file eventhelper.cxx.

◆ typeXRadioButton

Type const typeXRadioButton = cppu::UnoType<awt::XRadioButton>::get()

Definition at line 191 of file eventhelper.cxx.

◆ typeXTextComponent

Type const typeXTextComponent = cppu::UnoType<awt::XTextComponent>::get()

Definition at line 189 of file eventhelper.cxx.