From cfd0aa4ba18b58179724d50d7d1ac4f500ca1db4 Mon Sep 17 00:00:00 2001 From: Alain Romedenne Date: Mon, 31 May 2021 09:00:38 +0200 Subject: Remove literals that prevent proper L10N - extra index - index relocation Change-Id: Ia52c0db88406dd5b24514280c663cfb5de157091 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/116169 Tested-by: Jenkins Reviewed-by: Rafael Lima --- .../text/sbasic/python/python_document_events.xhp | 37 ++++++++++++++-------- source/text/sbasic/shared/01040000.xhp | 1 + 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/source/text/sbasic/python/python_document_events.xhp b/source/text/sbasic/python/python_document_events.xhp index 187d299f1e..21c6457c7e 100644 --- a/source/text/sbasic/python/python_document_events.xhp +++ b/source/text/sbasic/python/python_document_events.xhp @@ -20,27 +20,27 @@ Python;Monitoring Document Events Access2Base;Console Access2Base;Trace - Tools;Strings - API;GlobalScope.BasicLibraries API;document.DocumentEvent: Monitoring Document Event API;document.XDocumentEventBroadcaster: Monitoring Document Event API;document.XDocumentEventListener: Monitoring Document Event - API;frame.Desktop: Monitoring Document Event - API;frame.GlobalEventBroadcaster: Monitoring Document Event API;lang.EventObject: Monitoring Document Event - API;script.provider.MasterScriptProviderFactory: Monitoring Document Event - API;script.provider.XScript: Monitoring Document Event

Monitoring Document Events

Next to assigning macros to events, one can monitor events raised by %PRODUCTNAME documents. Application Programming Interface (API) broadcasters are responsible for calling event scripts. Unlike listeners that require to define all supported methods, even if unused, document monitors require only two methods next to hooked event scripts.

Listening to Document Events

- Monitoring is illustrated herewith for Basic and Python languages using object-oriented programming. Assigning OnLoad script, to the Open Document event, suffices to initiate and terminate document event monitoring. Tools - Customize menu Events tab is used to assign either scripts. - Intercepting events helps setting scripts pre- and post-conditions such as loading and unloading libraries or track script processing in the background. Access2Base Trace module usage is illustrating that second context. -

With Python

+ Monitoring is illustrated herewith for Basic and Python languages using object-oriented programming. Assigning OnLoad script, to the Open Document event, suffices to initiate and terminate document event monitoring. Tools - Customize menu Events tab is used to assign either scripts. + Intercepting events helps setting scripts pre- and post-conditions such as loading and unloading libraries or track script processing in the background. Access2Base.Trace module usage is illustrating that second context. + +

With Python

+ + API;frame.Desktop: Monitoring Document Event + API;script.provider.MasterScriptProviderFactory: Monitoring Document Event + API;script.provider.XScript: Monitoring Document Event + Events monitoring starts from object instantiation and ultimately stops when Python releases the object. Raised events are reported using Access2Base console. - OnLoad and OnUnload events can be used to respectively set and unset Python programs path. They are described as Open document and Document closed. + OnLoad and OnUnload events can be used to respectively set and unset Python programs path. They are described as Open document and Document closed. # -*- coding: utf-8 -*- from __future__ import unicode_literals @@ -149,9 +149,14 @@ return xScript Mind the misspelled documentEventOccured method that inherits a typo from %PRODUCTNAME Application Programming Interface (API). - Start application and Close application events can respectively be used to set and to unset Python path for user scripts or %PRODUCTNAME scripts. In a similar fashion, document based Python libraries or modules can be loaded and released using Open document and Document closed events. Refer to Importing Python Modules for more information. -

With %PRODUCTNAME Basic

- The Onload script is assigned to Open document event using Tools - Customize menu Events tab. Events monitoring starts from the moment a ConsoleLogger object is instantiated and ultimately stops when Basic engine releases it. OnLoad event loads necessary Basic libraries, while caught events are reported using Access2Base.Trace module. + Start application and Close application events can respectively be used to set and to unset Python path for user scripts or %PRODUCTNAME scripts. In a similar fashion, document based Python libraries or modules can be loaded and released using Open document and Document closed events. Refer to Importing Python Modules for more information. + +

With %PRODUCTNAME Basic

+ + API;GlobalScope.BasicLibraries + Tools;Strings + + The Onload script is assigned to Open document event using Tools - Customize menu Events tab. Events monitoring starts from the moment a ConsoleLogger object is instantiated and ultimately stops when Basic engine releases it. OnLoad event loads necessary Basic libraries, while caught events are reported using Access2Base.Trace module. REM controller.Events module Option Explicit @@ -228,7 +233,11 @@ ' Your code for handled events goes here Mind the misspelled _documentEventOccured method that inherits a typo from %PRODUCTNAME Application Programming Interface (API). -

Discovering Documents Events

+ +

Discovering Documents Events

+ + API;frame.GlobalEventBroadcaster: Monitoring Document Event + The broadcaster API object provides the list of events it is responsible for:

With Python

diff --git a/source/text/sbasic/shared/01040000.xhp b/source/text/sbasic/shared/01040000.xhp index 182aa39ade..942be5ce68 100644 --- a/source/text/sbasic/shared/01040000.xhp +++ b/source/text/sbasic/shared/01040000.xhp @@ -33,6 +33,7 @@ assigning macros to events documents; events events; assigning macros + events; in documents API; XDocumentEventListener

Document Event-Driven Macros

-- cgit