Files
odfstudio/wizards/Package_scriptforge.mk
Jean-Pierre Ledure e79a47409f ScriptForge - new SharedMemory service
Singleton class implementing the
  "ScriptForge.SharedMemory"
service. Implemented as a usual Basic module.

Contains the mechanisms to manage persistent memory storage
across Basic and/or Python scripts.

When a script stops running, all the variables it uses vanish,
except Basic Global variables, which stay in memory until
the end of the LibreOffice session.

However event-driven scripting can often benefit from having
variables still being available when the next script is
triggered, probably due to a user action.

The SharedMemory service implements interfaces allowing
to store both BASIC and PYTHON variables in persistent storage,
and to retrieve them later from either BASIC or PYTHON scripts
interchangeably.

The use of the Basic Global statement is more efficient
than the actual service and should be preferred when the variables
are created and retrieved in basic scripts only.

The supported variable types are:
 * Scalar or tuple combining:
  - int, within the bounds of the Basic Long type
  - float, within the bounds of the Basic Double type
  - str
  - bool
  - None
 * datetime.datetime
 * UNO object
 * ScriptForge class instance

Example:
  Sub CreateDoc()
    ui = CreateScriptService("UI")
    doc = ui.CreateDocument("Calc")
    store = CreateScriptService("SharedMemory")
    store.StoreValue(doc, "actualdocument")
  ...

  def UpdateDoc():
    store = CreateScriptService("SharedMemory")
    doc = store.ReadValue("actualdocument")
    ...

The service is available both for Basic and Python scripts.
The actual commit requires the creation of an additional
Help page.

Change-Id: Id53994be5105206c16659f769338261b3dde2d3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190174
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2025-08-25 16:24:31 +02:00

66 lines
2.0 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
$(eval $(call gb_Package_Package,wizards_basicsrvscriptforge,$(SRCDIR)/wizards/source/scriptforge))
$(eval $(call gb_Package_add_files,wizards_basicsrvscriptforge,$(LIBO_SHARE_FOLDER)/basic/ScriptForge,\
SF_Array.xba \
SF_Dictionary.xba \
SF_Exception.xba \
SF_FileSystem.xba \
SF_L10N.xba \
SF_Platform.xba \
SF_PythonHelper.xba \
SF_Region.xba \
SF_Root.xba \
SF_Services.xba \
SF_Session.xba \
SF_SharedMemory.xba \
SF_String.xba \
SF_TextStream.xba \
SF_Timer.xba \
SF_UI.xba \
SF_Utils.xba \
_CodingConventions.xba \
_ModuleModel.xba \
__License.xba \
dialog.xlb \
dlgConsole.xdl \
dlgProgress.xdl \
script.xlb \
))
$(eval $(call gb_Package_add_files,wizards_basicsrvscriptforge,$(LIBO_SHARE_FOLDER)/Scripts/python,\
python/ScriptForgeHelper.py \
))
$(eval $(call gb_Package_add_files,wizards_basicsrvscriptforge,$(LIBO_SHARE_FOLDER)/basic/ScriptForge/po,\
po/ScriptForge.pot \
po/en.po \
po/es.po \
po/fr.po \
po/pt.po \
))
$(eval $(call gb_Package_add_files,wizards_basicsrvscriptforge,$(LIBO_LIB_PYUNO_FOLDER),\
python/scriptforge.py \
python/scriptforge.pyi \
))
# vim: set noet sw=4 ts=4: