office-gobmx/wizards/Package_sfwidgets.mk
Jean-Pierre Ledure 88c82f1028 ScriptForge - (SFWidgets) new SF_Menu service
Display a menu in the menubar of a document (form document to be done)
After use, the menu will not be saved neither in the application settings,
nor in the document. The menu setting does not affect the modified status of the
document.

The menu will be displayed, as usual, when its header in the menubar is clicked.
When one of its items is selected, there are 3 alternative options:
  - a UNO command (like ".uno:About") is triggered
  - a user script is run receiving a standard argument defined in this service
  - one of above combined with a toggle of the status of the item

The menu is described from top to bottom.
Each menu item receives a numeric and a string identifier.
Each menu item may be decorated with a tooltip and/or an icon.

The AddItem(), AddCheckBox() and AddRadioButton() methods, when
coompared with their equivalents in the SF_PopupMenu service,
receive 2 additional arguments: Command and Script.

The various document services receive 2 additional methods:
   CreateMenu(), returning a Menu service instance
   RemoveMenu()

Very short example:
   menu = doc.CreateMenu("My menu", Before := "Help")
   menu.AddItem("First Item", Command := "About")
   menu.AddItem('2nd Item", Script := "... URI notation ...")
   menu.Dispose()   '   Once set the menu object may ve erased, listeners stay tuned
Later in the lifecycle of the document, one may run:
   doc.RemoveMenu("My menu")   '  doc.RemoveMenu("File") works as well !!!

All the functionalities are available both in Basic and Python user scripts.

Change-Id: Iabd157573693e9648fcb06d36c90af9a22b17a6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126309
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-12-03 15:24:57 +01:00

32 lines
1.2 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_basicsrvsfwidgets,$(SRCDIR)/wizards/source/sfwidgets))
$(eval $(call gb_Package_add_files,wizards_basicsrvsfwidgets,$(LIBO_SHARE_FOLDER)/basic/SFWidgets,\
SF_Menu.xba \
SF_MenuListener.xba \
SF_PopupMenu.xba \
SF_Register.xba \
__License.xba \
dialog.xlb \
script.xlb \
))
# vim: set noet sw=4 ts=4: