Commit Graph
100 Commits
Author SHA1 Message Date
Andrea Gelmini 60489faa6c Fix typo
Change-Id: Ic3f79113f09be10f6ff33183b09f80e269f77f93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152122
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-22 20:45:22 +02:00
Jean-Pierre Ledure 0a1022b04c ScriptForge (SFDialogs: create dialogs on-the-fly
A dialog service is returned by next statement

  dialog = CreateScriptService("newdialog", dialogname, place)

All properties and methods applicable to predefined
dialogs are available for such new dialogs.
In particular the series of CreateXXX() methods for the addition
of ne dialog controls.

The functionality is available from Basic and Python user
scripts.

An update of the SFDialogs.SF_Dialog help page is required.

A display rendering unstability (flickerings, delays, ..) has
been observed when (all conditions must be met)
- the user script is run from Python
- from inside the LibreOffice process
- the dialog is non-modal

Change-Id: Id3f311cd04497fd79712ce712bdb2724b5caa861
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152071
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2023-05-22 14:08:20 +02:00
Jean-Pierre Ledure f692b5c5e4 ScriptForge New method dialog.CreateHyperlink()
Method (Dialog service)
  CreateHyperlink(controlname, place, border, multiline,
                  align, verticalalign)

completes the set of available methods for
dynamic DialogControl creation.

Cfr. https://gerrit.libreoffice.org/c/core/+/151896

Change-Id: I162075ea39efdd2e1189fe8b16ac05316e6a13ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151954
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2023-05-20 12:56:41 +02:00
Jean-Pierre Ledure 66a3b09fc3 ScriptForge (SFDialogs) create controls dynamically
The dialog service hosts now a bunch of methods
to create new controls dynamically in an existing
dialog predefined in the Basic IDE.

In other words, a dialog is initialized with controls
in the Basic IDE. New controls can be added at run-time
before or after the Execute() statement.

All the new methods have in common their first 2 arguments:
 ControlName
 Place: an (X, Y, Width, Height) array
        or a com.sun.star.awt.Rectangle

New methods:
 CreateButton(..., toggle, push)
 CreateCheckBox(..., multiline)
 CreateComboBox(..., border, dropdown, linecount)
 CreateCurrencyField(..., border, spinbutton, minvalue,
                     maxvalue, increment, accuracy)
 CreateDateField(..., border, dropdown, mindate, maxdate)
 CreateFileControl(..., border)
 CreateFixedLine(..., orientation)
 CreateFixedText(..., border, multiline, align, verticalalign)
 CreateFormattedField(..., border, spinbutton, minvalue,
                      maxvalue)
 CreateGroupBox(...)
 CreateImageControl(..., border, scale)
 CreateListBox(..., border, dropdown, linecount, multiselect)
 CreateNumericField(..., border, spinbutton, minvalue,
                    maxvalue, increment, accuracy)
 CreatePatternField(..., border, editmask, literalmask)
 CreateProgressBar(..., border, minvalue, maxvalue)
 CreateRadioButton(..., multiline)
 CreateScrollBar(..., orientation, border, minvalue, maxvalue)
 CreateTableControl(..., border, rowheaders, columnheaders,
                    scrollbars, gridlines)
 CreateTextField(..., border, multiline, maximumlength,
                 passwordcharacter)
 CreateTimeField(..., border, mintime, maxtime)
 CreateTreeControl(..., border)

All the methods return a SF_DialogControl instance.

The arguments have bben chosen based on functionality
rather than on layout. After the creatio of the control,
most properties and methods relevant to SF_DialogControl
objects are applicable. Also the XControlModel property
might contribute to layout refinements.

Other changes:
- The SF_DialogControl class receives next updatable
  properties: Border and TabIndex
- The dialogcontrol.SetTableData() receives an
  additional argument: rowheaderwidth
- The dialogcontrol.Resize() method without arguments
  resizes the control to its "preferred size", a size
  adjusted depending on its actual content

All the new functionalities are callable from both
Basic and Python user scripts.

Described changes will require a serios review of the
Dialog and DialogControl help pages.

Change-Id: I654eeae5456527bf14b1f4b43f04d176bbd830b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151896
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-05-18 10:30:45 +02:00
Jean-Pierre Ledure a58017d99c ScriptForge (SFDialogs) support hyperlink control types
Controls designated in english as "Hyperlink controls"
in the Basic IDE are from now on accepted as instances
of the SF_DialogControl service.

All generic properties are accepted.
The supported specific properties are:
   - Caption (the text that appears in the dialog box)
   - URL (the URL to activate when clicked)

The new control type is supported in Basic and Python
user scripts.

The SFDialogs.DialogControl help page needs to be updated.

Change-Id: I4827834ad8ef336c084ee51b5285b85745ceb1b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150824
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-04-23 14:54:49 +02:00
Jean-Pierre Ledure 37a68d6ae3 ScriptForge (SFDialogs) dialogs and controls are sized in APPFONTs
Dimensioning a dialog in the Basic IDE is done
by using "Map AppFont" units.
Map AppFont units are device and resolution independent.
One Map AppFont unit is equal to one eighth of the average
character (Systemfont) height and one quarter of the average
character width.

A dialog or control model also uses AppFont units.
While their views use pixels.

This is confusing. It also complicates size prototyping
with the Basic IDE.

In ScriptForge, sizing and positioning a dialog or a control
is done from now on in AppFont units as well.

Additionally, X and Y positions accept now negative values.

Compatibility with past is ensured: dynamic change or
position and size is a new feature in 7.6.

The change is valid both for Basic and Python user scripts.
It requires a small change in the actual documentation
(pixels => AppFontunits)

Change-Id: Id80b0ccf473eb012b0a8c85d66f5a8ada9b26be5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150704
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-04-21 11:02:01 +02:00
Jean-Pierre Ledure 3d94a43d28 ScriptForge - (SF_DialogControl) new Resize() method
Addition of method
   control.Resize(X, Y, Width, Height)
to selectively (arguments are applicable only when present)
update the position and/or the size of any
dialog control.

Addition of updatable properties:
   Height
   Width
   X
   Y
for the same purpose.

All measures are expressed in PIXELS.

The measures for dialogs are also as from now expressed
in pixels.

Changes are applicable to Basic and Python user scripts.

Documentation should be updated.

Change-Id: I03a6c819efa6a2a67c88403f1ae644d94eb7f2d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149174
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-03-21 06:35:19 +00:00
Jean-Pierre Ledure 0483b0a4bb ScriptForge (SFDialogs) make On properties editable
A dialog box and its controls may be associated
with scripts triggered by events (mouse moved,
key pressed, ...).

The link is usually preset in the Basic IDE when
the dialog is designed.

So far, ScriptForge did not offer the setting of
a link event-script by code.

The actual commit removes this limitation: every
On-property related to either a dialog or a dialog
control is now editbale.
With the important precision that such a property
may be updated ONLY IF it was NOT PRESET in the
Basic IDE.

Static (IDE) and dynamic (by code) definition of
a specific On property on a specific dialog or on
a specific dialog control are mutually exclusive.

The new capacity may be used both in Basic and Python scripts.

A short update of the help texts (dialog and dialogcontrol)
is needed with mention of above restriction.

Change-Id: Ia078aaab317ced7ade7ce69694504013f8e768a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148800
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-03-14 10:46:15 +00:00
Jean-Pierre Ledure f36265ed0e ScriptForge (SFWidgets) new Toolbar and ToolbarButton services
Each component has its own set of toolbars, depending
on the component type (Calc, Writer, Basic IDE, ...).
In the context of the actual class, a toolbar
is presumed defined statically:
  - either by the application
  - or by a customization done by the user.
The definition of a toolbar can be stored
in the application configuration files
or in the current document.

Changes made by scripts to toolbars stored
in the application are persistent. They are valid
for all documents of the same type.

Note that the menubar and the statusbar
are not considered toolbars in this context.

A toolbar consists in a series of graphical
controls to trigger actions.
  The "Toolbar" service gives access to the "ToolbarButton" service to manage
  the individual buttons belonging to the toolbar.

The "Toolbar" service is triggered from next
services: Document, Calc, Writer, Base, FormDocument
and Datasheet. All those components might host toolbars.

Proposed properties in the Toolbar service:
  BuiltIn
  Docked
  HasGlobalScope
  Name
  ResourceURL
  Visible (r/w)
  XUIElement
Proposed method:
  ToolbarButtons()

Proposed properties in the ToolbarButton service:
  Caption
  Height
  Index
  OnClick (r/w)
  Parent
  TipText (r/w)
  Visible (r/w)
  X
  Y
(The Height, Width, X, Y properties allow for
easy hook of a popup menu to tye button)
Proposed method:
  Execute()

Both services are available both from Basic and Python user scripts.
An update of the dcumentation help is required.

Change-Id: I43cb523b52e3d6362994557d74c4ef9faa220507
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147925
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-02-28 15:31:12 +00:00
Jean-Pierre Ledure 96302e0bba ScriptForge (SF_Document) Echo() method freezes screen updates
While a script is executed any display update
resulting from that execution is done immediately.

For performance reasons it might be an advantage
to differ the display updates up to the end of the script.
This is where pairs of Echo() methods to set
and reset the removal of the immediate updates
may be beneficial.

Optionally the actual mouse pointer can be
modified to the image of an hourglass.

Arguments:
  EchoOn: when False, the display updates are suspended.
          Default = True.
          Multiple calls with EchoOn = False are harmless.
  Hourglass: when True, the mouse pointer is changed
          to an hourglass. Default = False.
          The mouse pointer needs to be inside the actual
          document's window.
          Note that it is very likely that at the least
          manual movement of the mouse, the operating system
          or the LibreOffice process will take back
          the control of the mouse icon and its usual behaviour.

The method may be called from any document, including Calc and
Writer, or form document.

It may be invoked from Basic and Python user scripts.

Echo() should be documented in the sfdocument.xhp help page.

Change-Id: I4d669f5e332131bd1b2efcd33b7a98b304796ad1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146258
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-01-27 16:54:19 +00:00
Jean-Pierre Ledure 3563f2064a ScriptForge Upgrade version number to 7.6
Change-Id: Ifbf5ba5b28b7afff64ed36965eadfa68a750cfd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145976
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-01-22 16:27:39 +00:00
Jean-Pierre Ledure ac21a5ee9b ScriptForge (SF_Calc) new RemoveDuplicates() method
Remove duplicate values from a range of values.

The comparison between rows is done on a subset
of the columns in the range.
The resulting range replaces the input range,
in which, either:
  all duplicate rows are cleared from their content
  all duplicate rows are suppressed
    and rows below are pushed upwards.

Anyway, the first copy of each set of duplicates
is kept and the initial sequence is preserved.

Arguments of the method:
  Range: the range, as a string,
         from which the duplicate rows should be removed
  Columns: an array of column numbers to compare;
           items are in the interval [1 .. range width]
           Default = the first column in the range
  Header: when True, the first row is a header row.
           Default = False.
  CaseSensitive: for string comparisons.
                 Default = False.
  Mode: either "CLEAR" or "COMPACT" (Default)
        For large ranges, the "COMPACT" mode
        is probably significantly slower.

The method has been implemented for Basic
and Python user scripts.

The calc.xhp help page should be updated accordingly.

Change-Id: I352b2f3da98974d9482575850550cec4e27d2e01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145954
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-01-21 16:48:19 +00:00
Jean-Pierre Ledure 88a67c50af ScriptForge - (SFDocuments) new FormDocument service
The SF_FormDocument service is focused on :
- The orchestration of Base form documents
  (aka Base Forms, but this is confusing)
  and the identification of and the access to their controls.
- Form documents are always contained in a Base document.

A form document may be opened either:
- via code or user interface from the Base file welcome page
- via code only, without having its Base container opened first
In any mode, a form document can be opened only in 1 single copy.

The FormDocument service is triggered either by
    base.OpenFormDocument(...)
    database.OpenFormDocument(...)
        ' Base file may be closed
    ui.GetDocument(...)

Specific methods:
    CloseDocument()
    Forms()
    GetDatabase()
    PrintOut()
Next methods are inherited from the Document superclass:
    Activate()
    CreateMenu(), RemoveMenu()
    ExportAsPdf()
    RunCommand()
    SaveCopyAs()
    SetPrinter()

As a consequence, next methods remain available
but should be declared as deprecated in the help:
    base.CloseFormDocument()
    base.Forms()
    base.PrintOut()
    base.SetPrinter()

Above changes have several more minor impacts :
- beside IsCalc, IsWriter, ... , a new IsFormDocument property
- the UI service identifies open form documents
- a new service means a new entry to register
  in the Services catalog
- management of form events has been reviewed
- the connection between Base, FormDocument, Form
  and Database services is reinforced
- menus were available on components, now also on sub-components

The new service is available for both Basic and Python user scripts.
It requires in the help
    - a new sf_formdocument page
    - a review of the sf_base, sf_database, sf_form, sf_ui pages

Change-Id: Ib06d1c4565ca093af2f068fa5b8082082641752e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145080
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-01-05 15:00:28 +00:00
Jean-Pierre Ledure 26511a8961 ScriptForge - (SF_Datasheet) Filter, OrderBy properties
For homogeneity with the Form service,
the
  ApplyFilter()
  OrderBy()
methods are replaced by the
  Filter
  OrderBy
updatable properties respectively.

Functionally there is no change.

This substitution is valid both for Basic and
Python user scripts.

Change-Id: I63a1d5c4554437b6a2cd634677e6eee246cb59ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142355
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2022-11-06 17:37:10 +01:00
Jean-Pierre Ledure 18638efa39 ScriptForge - (SF_Datasheet) new menu methods
Next 2 methods are added:
  CreateMenu()
  RemoveMenu()

They allow the addition of a menu entry in the menubar
of datasheets in the same way as in documents.

The implementation required to make the
  SFWidgets.SF_Menu
  SFWidgets.SF_MenuListener
  SFWidgets.SF_Register
classes and modules more generic to be applicable
in several contexts.

In addition, 2 properties are added:
  DatabaseFileName
  ParentDatabase
to better identify the database from which the datasheet
is derived.

New properties and methods are applicable both
for Basic and Python user scripts.

Change-Id: Iac6318287e89b18810a53ec5928a68e921ea96db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142285
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2022-11-05 17:10:41 +01:00
Jean-Pierre Ledure 985c77b570 ScriptForge = (SFDatabases) New Datasheet service
A datasheet is the visual representation
of tabular data produced by a database.
In the user interface of LibreOffice
it is the result of the opening of a table or a query.
In this case the concerned Base document must be open.

In the context of ScriptForge, a datasheet
may be opened automatically by script code :
- either by reproducing the behaviour of the user interface
- or at any moment.
  In this case the Base document does not need to be open.
Additionally, any SELECT SQL statement
may define the datasheet display.

The proposed API allows for either datasheets
(opened manually of by code) in particular
to know which cell is selected and its content.

Properties:
  ColumnHeaders
  CurrentColumn
  CurrentRow
  LastRow
  Source
  SourceType
  XComponent
  XControlModel
  XTabControllerModel

Methods
  Activate
  ApplyFilter
  CloseDatasheet
  GetValue
  GetText
  GoToCell
  OrderBy

The Base and Database services are enriched with the
  OpenTable
  OpenQuery
methods. The Database service gets also a new
  OpenSql
method.

The whole set of properties and methods is available
both for Basic and Python scripts.

This new service requires a new help page dedicated
to this service, as well as an update of the
pages about the Base and Database services.

Change-Id: Ib409ce74d95de78f2792ba53e7ae554eab0867ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142118
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-11-02 11:26:46 +01:00
Jean-Pierre Ledure a69bca0fda ScriptForge - (SF_Basic) new CreateUnoStruct() method
The method extends the set of functions compatible
with their corresponding Basic builtin functions.

BTW it might avoid the need for the user to
   import uno
in his/her Python scripts.
Of course (s)he remains free to prefer the latter.

Impact only on Python scripts. Basic part is unchanged.
An update of the help page about the Basic service is reuired.

Change-Id: I3b01eb76aa52f62fa54bae49ddb45755126bc3fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141429
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2022-10-16 18:25:59 +02:00
Jean-Pierre Ledure 55477bf4fd ScriptForge - (SF_Dialog) new SetPageManager method
The SetPageManager() method

Define how the dialog displays pages.
The page manager is an alternative to the direct use
of the Page property of the dialog and dialogcontrol objects.

The arguments define which controls are involved
in the orchestration of the displayed pages.
Possible options:
    - select a value in a list- or combobox
    - select an item in a group of radio buttons
    - select a button linked to a page
      placed side-by-side the buttons can simulate a tabbed interface
    - press a NEXT or BACK button like in many wizards
Those options may be combined.
The control updates will be synchronized.
The method will set the actual page number to 1.
Afterwards the Page property may be used to display any other page

The SetPageManager() method is to be run
only once and before the Execute() statement.
If invoked several times, subsequent calls will be ignored.
The method will define new listeners
on the concerned controls, addressing generic routines.
The corresponding events will be fired during the dialog execution.
Preset events (in the Basic IDE) will be preserved
and executed immediately AFTER the page change.
The listeners will be removed at dialog termination.

The implementation has next parts:
1. Store the arguments in the Dialog instance
2. Set appropriate listeners on involved controls
3. Page change synchronizes the values in the involved controls
   (be it by user code or by page manager)
4. Events triggered by listeners change page number

The method is available both in Basic and Python contexts.
This commit require the Dialog help page to be updated.

Change-Id: I00a0212414f283102c73de4ceb488aa1aeddf746
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141257
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2022-10-12 17:52:59 +02:00
Jean-Pierre Ledure 992b393be8 ScriptForge - (scriptforge.py) ignore PythonShell in bridge mode
Bridge mode = python dialogs with LO process via socket.

Behaviour before actual patch:
  the exception.PythonShell() method gives a Python error on the
     from apso_utils import console
  statement, because the APSO libraries are not in the
  pythonpath.
  (They are set in the path by the exension in macro mode)

New behaviour:
  the exception.PythonShell() method does nothing,
  the import statement is not executed, hence no error.

The rationale behind is:
  - in bridge mode, the macro run is started in practice
    from either a Python console or an IDE console
    that receive evntual print() statements outputs
  - there is no need for an APSO console that, anyway, should
    not receive any output of print() statements, except
    if redirection of the output towards the APSO console
    (run in the [LO] process) was possible, quod non.
  - the same script may be executed in both bridge and macro modes
    without change

Change-Id: Id7c8eb19cd074bf39f470d84b5eb48880e908f39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139772
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-09-11 17:31:34 +02:00
Jean-Pierre Ledure d57836db76 ScriptForge - (Calc) extend use cases of FilterFormula
A FilterFormula is a Calc formula that returns TRUE or FALSE
   The formula is expressed in terms of
   - the top-left cell of the range when FilterScope = "CELL"
   - the topmost row of the range when FilterScope = "ROW"
   - the leftmost column of the range when FilterScope = "COLUMN"
   After pasting, the relative and absolute references
   will be interpreted correctly.

The FilterScope indicates the way the formula is applied,
once by row, column or individual cell.

The requested action is done only on the rows/columns/cells
for which the FilterFormula returns True.

Next methods receive 2 new arguments:
=>   FilterFormula and FilterScope:
   ClearAll()
   ClearFormats()
   ClearValues()
   SetCellStyle()

These changes are valid for Basic and Python user scripts.
Without these new arguments above methods behave as before.

The documentation needs to be adapted:
- inclusion of FilterFormula and FilterScope concepts in the
  DEFINITIONS section of the SF_Calc help page
- new arguments to add in resp. methods

Change-Id: I657b231252106b91ed7e27a49ef3331c1fcee917
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138590
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2022-08-20 19:35:49 +02:00
Jean-Pierre Ledure cd8ab93d9b ScriptForge - tdf#149983 dialog.Execute() failure
(patch https://gerrit.libreoffice.org/c/core/+/137084 cont'd)

In SF_PythonHelper._PythonDispatcher():

Force a hardcoded call of the methods in the Dialog
service which may potentially be invoked while the
dialog is displayed, bypassing the generic CallByName()
Basic builtin function:
   Activate
   Center
   EndExecute
   Resize
   Execute => was missing in the list
              Case when a parent dialog opens a child dialog
(Controls is already hardcoded because returning an array)

Change-Id: Ia12fccbb61362768301df6670161f258b32d3a78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137289
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2022-07-21 14:53:30 +02:00
Jean-Pierre Ledure 91a1662c66 ScriptForge - tdf#149983 dialog.EndExecute() failure
In SF_PythonHelper._PythonDispatcher():

Force a hardcoded call of the methods in the Dialog
service which may potentially be invoked while the
dialog is displayed, bypassing the generic CallByName()
Basic builtin function:
   Activate
   Center
   EndExecute
   Resize
(Controls is already hardcoded because returning an array)

Change-Id: I4931f43b37ae5f7337740d1c65b255f4a14ca069
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137084
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2022-07-16 09:49:06 +02:00
Jean-Pierre Ledure 7c0f0afd58 ScriptForge - (SF_FileSystem) new Normalize() method
Normalize a pathname by collapsing redundant
separators and up-level references
so that A//B, A/B/, A/./B and A/foo/../B
all become A/B.

On Windows, it converts forward slashes
to backward slashes.

The Basic Normalize() method invokes the
_SF_FileSystem__Normalize() function located in
the ScriptForgeHelper.py module for execution
with the os.path builtin library

The os.path.normpath() function can easily be
executed directly from python user scripts.
However the FileSystem.Normalize() method is
proposed as well for Python scripts
- for compatibility Basic/Python reasons
- to manage the FileNaming notation

Change-Id: I1e089612432bd2c75b2e76ffa984289ef7f9d75c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136835
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2022-07-06 12:27:09 +02:00
Jean-Pierre Ledure 1d5ed2fdd1 ScriptForge - (scriptforge.py) modify URL to help page
Avoid using hardcoded release number. Use 'latest'.

Change-Id: I04f531ee736bcd94d058413634ddb49046bc6c5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135475
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-06-08 12:22:46 +02:00
Jean-Pierre Ledure bf51fd3de3 ScriptForge - (SF_Calc) new CreatePivotTable() method
Create a new pivot table with the properties defined by the arguments.
If a pivot table with the same name exists already in the
targeted sheet, it will be erased without warning.

Parameters:
  PivotTableName: The user-defined name of the new pivottable
  SourceRange: The range as a string containing the raw data.
    The first row of the range is presumed to contain
    the field names of the new pivot table
  TargetCell: the top left cell or the range as a string
  where to locate the pivot table.
    Only the top left cell of the range will be considered.
  DataFields: A single string or an array of
    field name + function to apply, formatted like:
      Array("FieldName[;Function]", ...)
    The allowed functions are: Sum, Count, Average, Max,
      Min, Product, CountNums, StDev, StDevP, Var, VarP and Median.
    The default function is:
      When the values are all numerical, Sum is used, otherwise Count.
  RowFields: A single string or an array of the field
    names heading the pivot table rows
  ColumnFields: A single string or an array of the field
    names heading the pivot table columns
  FilterButton: When True (default), display a "Filter"
    button above the pivot table
  RowTotals: When True (default), display a separate
    column for row totals
  ColumnTotals: When True (default), display a
    separate row for column totals

Returns:
  Return the range where the new pivot table is deployed.

The method may be used in Basic and Python user scripts.

Change-Id: I99df23e1b1b97b17a747ae15a079d7e2f5655b41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133131
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-04-18 18:53:53 +02:00
Ilmari Lauhakangas e568c9dca8 Update remaining DevGuide wiki links.
My Kate editor decided to do some whitespace cleanup, but maybe
it's fine as the main changes are not targeting functional bits anyway.

Change-Id: I5292e77e43055f94a6256a7f72d49fd59287d194
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132928
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-04-13 08:16:52 +02:00
Jean-Pierre Ledure 43507de576 ScriptForge - (SF_Calc) new CompactUp() and CompactLeft() methods
The CompactUp(CompactLeft) method:

Delete the rows(columns) of a specified range matching a filter
expressed as a formula applied on each row(column).
The deleted cells can span whole rows(columns)
or be limited to the width(height) of the range.
The execution of the method has no effect on the
current selection.

Args:
  Range: the range in which cells have to be erased, as a string
  WholeRow(WholeColumn): when True (default = False),
    erase whole rows(columns)
  FilterFormula: the formula to be applied on each row(column).
    The row(column) is erased when the formula results in True.
    The formula shall probably involve one or more cells of
    the first row(column) of the range..
    By default, a row is erased when all the cells
    of the row(column) are empty,
    i.e. suppose the range is "A1:J200" (width = 10),
    the default value [for CompactUp] becomes "=(COUNTBLANK(A1:J1)=10)"

Returns:
  A string representing the location of the initial range
  after compaction, or the zero-length string if the whole range
  has been deleted.

Examples for CompactUp():
  newrange = oDoc.CompactUp("SheetX.G1:L10")
      ' All empty rows of the range are suppressed
  newrange = oDoc.CompactUp("SheetX.G1:L10", WholeRow := True, _
      FilterFormula := "=(G1=""X"")")
      ' The rows having a "X" in column G are completely suppressed

Both methods are available for use from Basic and Python scripts.

Change-Id: Ib1269b22bcd189ca86a1bd3bda2c67e895598cb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132783
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-04-10 18:06:05 +02:00
Jean-Pierre Ledure 7c8e9db0e4 ScriptForge - (SF_Dialog) new Resize() and Center() methods
The "dialog" service receives 2 new methods for easy
move/resize of the concerned dialog.

Resize(left, top, widt, height)
  Move the topleft corner of a dialog to new coordinates and/or modify its dimensions
  All distances are expressed in 1/100th mm
  Without arguments, the method resets the initial width and height

Center(window)
  Center the actual dialog instance in the middle of a parent window
  Without arguments, the method centers the dialog
    in the middle of the active window
  The Parent argument can be either
    - a ScriptForge dialog object
    - a ScriptForge document (Calc, Base, ...) object

Both methods are available from Basic and Python user scripts

Change-Id: Ic3680739c9d518da3d76d3588943ae5ce6bad8ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132418
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-04-01 14:09:40 +02:00
Jean-Pierre Ledure 272a90c45a ScriptForge - (SF_Region) new service in the core library
Singleton class implementing the "ScriptForge.Region" service
Implemented as a usual Basic module

A collection of functions about languages, countries and timezones
- Locales
- Currencies
- Numbers and dates formatting
- Calendars
- Timezones conversions
- Numbers transformed to text in local language

Definitions:
  Locale or Region
    A combination of a language (2 or 3 lower case characters)
    and a country (2 upper case characters)
    Most properties and methods require a locale as argument.
    Some of them accept either the complete locale or only
    the language or country parts.
  Timezone
    Specified as "Region/City" name like "Europe/Berlin",
    or a custom time zone ID such as "UTC" or "GMT-8:00".
    The time offset between the timezone and the
    Greenwich Meridian Time (GMT) is expressed in minutes.
    The Daylight Saving Time (DST) is an additional offset.
    Both offsets can be positive or negative.

Properties:
  Currency
  Language
  Country
  DatePatterns
  DateSeparator
  ThousandSeparator
  DecimalPoint
  TimeSeparator
  ListSeparator
  DayNames
  DayAbbrevNames
  DayNarrowNames
  MonthNames
  MonthAbbrevNames
  MonthNarrowNames

Methods
  UTCDateTime
  UTCNow
  LocalDateTime
  TimeZoneOffset
  DSTOffset
  Number2Text

Change-Id: Iabf31ea0e6c235e960fcca5b1e7a9d928cf8cd0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132068
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-03-24 16:20:30 +01:00
Jean-Pierre Ledure ae24ce8c63 ScriptForge - (UI) size and position of the active window
The UI service receives next 4 new properties:
  Height
  Width
  X
  Y

They all return a Long value representing the size or position
of the active window. The active window does not need to be a
document, it may f.i. be the Basic IDE.

Those properties are read-only.
To modify the size or the position of the window,
use the the Resize() method.

They are implemented for use from Basic and Python scripts.

Change-Id: I0021663e39612f411cefa5c7ec9ec594a4cb6f39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131444
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-03-13 16:11:07 +01:00
Jean-Pierre Ledure 2598c35dba ScriptForge - (SF_Document) new Import/ExportFilters properties
The ImportFilters and ExportFilters properties
of the Document, Calc and Writer services
return a zero-based array (Basic) or a list (Python)
of all filters available for the current document
instance.

These properties are NOT applicable to Base documents.

ImportFilter contains the filters flagged for import
or for Import/Export. Idem for ExportFilters.
Both lists overlap each other partially.

The filter selection is done thanks to the
- filter type, to be compared with the Identifier of
  the document's component
- filter flags, last 2 bits determine the import or export
  orientation

The filter names are potential arguments of the OpenDocument()
and SaveAs() methods (and alike).

Both properties are callable from Basic and Python user scripts.

Change-Id: I8ce5312a58a013bc7e1e68101ff9f50f3233155d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131106
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-03-07 16:13:46 +01:00
Jean-Pierre Ledure 363dd5850f ScriptForge - (SF_Calc) new ExportRangeToFile() method
The Calc service offers the possibility to export
a range, given as a string, to a file in several
different image formats.

Supported formats: pdf, jpeg, png.

Arguments:
- Range: a sheet name or a range of cells
- Filename: the file to export to in FileSystem notation
- ImageType: the expected output format
- Overwrite: True when the output file may be overwritten

New error message: RANGEEXPORTERROR
Error is introduced in po files.

The method is available both in Basic and Python user scripts.

Change-Id: Ibd297ec2da1b48fca3dee7d8e03bd2ee4815957a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130835
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-03-02 14:13:39 +01:00
Jean-Pierre Ledure 740329373b ScriptForge - (SF_Platform) add the FilterNames property
The FilterNames property returns, as an unsorted zero-based
array of strings, the list of available/installed import
and export filters for components.

The property can serve as support for the FilterName
argument used for opening and saving documents.

The FilterNames property is available both from Basic
and Python user scripts.

Change-Id: I607500b56836ceeb6716b10d39d22638b0741f3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130624
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-02-27 15:27:15 +01:00
Jean-Pierre Ledure 60f786bde4 ScriptForge - (L10N): add new arguments to the service creation
Actual arguments:
  - FolderName: the folder containing the PO-files
  - Locale: in the form la-CO (language-COUNTRY)
  - Encoding: The character set that should be used

New arguments introduced by this commit:
  - Locale2: fallback Locale to select if Locale po file does not exist
  - Encoding2: Encoding of the 2nd Locale file

Both new arguments are optional => no regression on existing scripts

The arguments are available in Basic and Python equally.
They may be passed as keyworg arguments in Python only.

The default locale is now set to the "OfficeLocale",
which is the locale in the user interface.
NB: the distinction between SystemLocale and OfficeLocale
is new in version 7.4.

Change-Id: Ie3bc5d30193df35a8c6c1ec706e13eaea0050981
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130074
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-02-17 16:18:49 +01:00
Jean-Pierre Ledure 74a638011d ScriptForge - (scriptforge.py) get lists of properties and methods
To allow object introspection and some help
files automatic generation (see Telegram discussions),
the possibility to make the list of properties
and methods used in Basic  available in Python
has been requested.

These changes are for internal use only.

Main changes:
- the SFServices parent class receives new basicproperties()
  and basicmethods() methods
- Basic PythonDispatcher() is adapted to provide the lists to
  the Python caller
- Methods lists are reviewed in SFDocuments to NOT include
  the methods implemented in the parent SF_Document class, to
  avoid redundant entries in the list

Change-Id: I80758e225b039426b46f52dd67efe54c50f9f31e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129969
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-02-15 17:50:45 +01:00
Jean-Pierre Ledure b52016e5d0 ScriptForge - (SF_Platform,SF_FileSystem) Manage extensions
New properties and methods
--------------------------

SF_Platform.Extensions : (property)
   provide a list of the installed extensions
   as an array of strings

SF_FileSystem.ExtensionFolder(Extension as string) : (method)
   provides the location in FileNaming notation of the
   folder where the given extension is installed

The SF_FileSystem.ExtensionsFolder (notice the additional "s")
is kept as a property providing the folder containing the
extensions installed by the user.

All methods and properties are available with an identical
syntax and semantics both from Basic and Python scripts.

The difference between a propert or a method is
irrelevant for Basic but is essential in Python:
a property must not have brackets, a method must have them.
Hence the distinction between
   ExtensionFolder being a method requiring an argument
   ExtensionsFolder being a property without argument

Change-Id: Idd18a5624f4abd84095d146e467e8fdcf497bd0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129572
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-02-07 09:16:03 +01:00
Jean-Pierre Ledure a151300354 ScriptForge - (SF_UI) Import RunCommand() from SF_Session
Functionally SF_UI groups methods impacting the
user interface, while the Session service groups general-purpose
actions.

The RunCommand() method (newly introduced in 7.4) simulates
menu commands applied on the active window.

RunCommand() fits better in the UI service.

It is removed from SF_Session.

Change-Id: Ia72150efea2f50de13d15a4c1f5fea79777d1760
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129453
Tested-by: Jenkins
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-02-04 14:20:10 +01:00
Jean-Pierre Ledure 5069692319 ScriptForge - (SF_Platform) refine locales
So far, only SF_Platform.Locale was supported, returning
the locale of the operating system.

Now, 3 different locales may be considered:

- SystemLocale: identical to Locale (still supported)
- OfficeLocale: the locale associated with the LibreOffice
  installation
- FormatLocale: the locale associated with how numbers and
  dates are formatted.

Of course, in many cases all locales are identical. Anyway
a distinction can be made.

All these properties are read-only.

Those properties are supported in Basic and Python evenly.

Change-Id: I0792d49a052b1441a30ac231d61eda997dc4216a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129297
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-02-01 19:26:49 +01:00
Andrea Gelmini cba7646dbc Fix typo
Change-Id: I472190c743dd26e88e3400f323ab52fa05c187d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129215
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2022-01-31 14:24:31 +01:00
Jean-Pierre Ledure 9688e4970e ScriptForge - (SF_Session, SF_Document) add arguments to RunCommand()
Next wiki page
 https://wiki.documentfoundation.org/Development/DispatchCommands
facilitates the use of commands with the
DispatchHelper service, including with arguments

This commit
- adds the RunCommand() method in the Session service
- extends the scope of existing RunCommand() methods
  for the Document, Base, Calc and Writer services
  with the addition of command arguments
Syntax by examples:
 (Basic)
  session.RunCommand("BasicIDEAppear", _
    "Document", "LibreOffice Macros & Dialogs", _
    "LibName", "ScriptForge", _
    "Name", "SF_Session", _
    "Line", 100)
 (Python) (1)
  session.RunCommand("BasicIDEAppear",
    "Document", "LibreOffice Macros & Dialogs",
    "LibName", "ScriptForge",
    "Name", "SF_Session",
    "Line", 100)
 (Python) (2)
  session.RunCommand("BasicIDEAppear",
    Document = "LibreOffice Macros & Dialogs",
    LibName = "ScriptForge",
    Name = "SF_Session",
    Line = 100)

Change-Id: I60cd5eb1ed0a057420215ce7aebe92b2aafabd53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129175
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-01-30 18:26:36 +01:00
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
Jean-Pierre Ledure 6b4f02396b ScriptForge - (SF_Calc) new OpenRangeSelector() method
The method activates the Calc document, opens a non-modal dialog
with a text box, let the user make a selection in the current
or another sheet and returns the selected area as a string.
This method does not change the current selection.

Arguments:
 Title: the title to display on the top of the dialog
 Selection: a default preselection as a String.
   When absent, the first element of the current selection is preselected.
 SingleCell: When True, only a single cell may be selected. Default = False
 CloseAfterSelect: When True (default-, the dialog is closed immediately
   after the selection. When False, the user may change his/her mind
   and must close the dialog manually.
Returns:
 The selected range as a string, or the empty string
 when the user cancelled the request (close window button)

Example:
 Dim sSelect As String, vValues As Variant
 sSelect = oDoc.OpenRangeSelector("Select a range ...")
 If sSelect = "" Then Exit Function
 vValues = oDoc.GetValue(sSelect)

The implementation requires a new module: SF_DocumentListener.xba

The method is available for Basic and Python user scripts.

Change-Id: I2d67a9c900ea8ac661cd6b6fb43bb4a34e6abd8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125201
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-11-15 13:47:26 +01:00
Jean-Pierre Ledure bef0b6dfef ScriptForge - (SF_Calc) new Printf() method
Returns the input string after substitution of its tokens by
their values in the given range

This method is usually used in combination with SetFormula()

The accepted tokens are:
   - %S   The sheet name containing the range,
          including single quotes when necessary
   - %R1  The row number of the top-left part of the range
   - %C1  The column letter of the top-left part of the range
   - %R2  The row number of the bottom-right part of the range
   - %C2  The column letter of the bottom-right part of the range

The default token character (%) may be modified.

The method is available both for Basic and Python user scripts

Change-Id: If9c3a042abf22ba760d1410b105b04716d092418
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125044
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-11-11 14:53:40 +01:00
Jean-Pierre Ledure 754247fe3f ScriptForge - (SF_Calc) First/Last * Row/Column/Cell accept sheets and ranges
The methods
   FirstCell
   FirstColumn
   FirstRow
   LastCell
   LastColumn
   LastRow
   SheetName
accept uniformly either a sheet name or a range name.
They return a single cell as an absolute address (First/LastCell),
a String (SheetName) or a Long.

The range name is to be understood as the extended notation for ranges.

FirstCell/Column/Row accept sheet names. However they will then always return
either the "A1" cell or the value 1.

The LastCell/Column/Row return the real last xxx for ranges, and
the last USED xxx when the argument is a sheet.

The A1Style() method surrounds from now on sheet names
with single quotes only when necessary.

The GetRangeAddress() method has been dropped as redundant with the actual
methods. (Was new in 7.3 => no effect on upward compatibiity)

Change-Id: Iff1ce437ee27dfb8481361f648b3f7a33ae2c4b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124904
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-11-09 13:09:24 +01:00
Jean-Pierre Ledure 59372ead7e ScriptForge - (SF_Calc) new GetRangeAddress() method
The GetRangeAddress() method accepts 2 arguments:
  GetRangeAddress(Range, AddressItem)

- a range as a string, to be understood as the extended definition
  described in the help pages

- the item to be extracted from the given range, either:
    firstrow
    firstcol
    lastrow
    lastcol
    sheet

The returned value is either:
- a Long
- a String when sheet is requested
- an array of all these values when no item is given

The method is available for both Basic and Python user scripts

Change-Id: I6156b176e29cf47207a079d10552443467dd2f6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124551
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-11-01 16:39:23 +01:00
Jean-Pierre Ledure 020967fde8 ScriptForge - (SF_Calc) new ShiftDown, ShiftLeft, ShiftRight, ShiftUp methods
ShiftRight()/ShiftDown() insert empty cells at the left/on the top of
a given range and move all cells at the right/bottom of the range
accordingly.
They are similar to the Insert Cells ... menu commands

ShiftLeft()/ShiftUp() delete cells at the left/top of a given
range and move all cells at the right/below the range
accordingly.
They are similar to the Delete Cells ... menu commands

The insertion/deletion may be done for a whole column/row.

The number of columns/rows to insert/delete may be chosen.

All methods are available in Basic and Python user scripts.

Change-Id: I14555a3966c26054925dd71b0696f3dfc773fc21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124530
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-10-31 18:16:42 +01:00
Jean-Pierre Ledure a97227aeb4 ScriptForge - (SF_Calc) new XSheetCellCursor property
The XSheetCellCursor property requires one mandatory argument,
a range as a string.

It returns a UNO object of type com.sun.star.sheet.XSheetCellCursor.
Such an object is designed to navigate thru the spreadsheet.

After the user script has used one or more navigation verbs
(gotoNext(), ...) the resulting range can be got back in the
script by using the cursor.AbsoluteName UNO property.
The new range can be given as input to further ScriptForge
methods.

XSheetCellCursor is available both from Basic and Python user scripts.

Change-Id: I62fb18a6f496d81b01036aef2ca6733f07632d9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124280
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-10-28 10:47:52 +02:00
Jean-Pierre Ledure f73196867b ScriptForge - (SF_Calc) new Region() property
The Region() property expects one mandatory argument,
a range given as a string.

It returns a new range as a string, including the sheet name,
corresponding with the smallest area
- containing the input range
- completely surrounded with empty cells

It is complementary to Offset() and A1Style() to make easy the
definition of new ranges relative to known ranges

The property is available both in Basic and Python user scripts.

Change-Id: Ifc9ce07b76e72fe580baf2c8103387cab56a6ef0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124230
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-10-27 12:49:44 +02:00
Jean-Pierre Ledure 6a1feb2644 ScriptForge - (SF_Calc) new A1Style() method
Returns a range expressed in A1-style as defined by its coordinates
If only one pair of coordinates is given, the range will embrace only a single cell

Arguments:
   Row1 : the row number of the first coordinate
   Column1 : the column number of the first coordinates
   Row2 : optional, the row number of the second coordinate
   Column2 : optional, the column number of the second coordinates
   SheetName: Default = the current sheet. If present, the sheet must exist

Is complementary to the Offset() method to compute ranges easily

Available both from Basic and Python user scripts

Change-Id: Ib9323441bbd579beb867329c8b0930653462d00e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124093
Tested-by: Jenkins
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-10-25 11:06:54 +02:00
Jean-Pierre Ledure 78db0dcfb6 ScriptForge - new SFWidgets library, new PopupMenu service
The SFWidgets library is intended to host the Toolbar,
ToolbarControl (both future) and PopupMenu services.

A popup menu is usually triggered by a mouse action
(typically a right-click) on a dialog, a form, or one of their controls.
In these cases the menu will be displayed below the clicked area.

When triggered by other events, including in the normal flow
of a user script, the script should provide the coordinates
of the topleft edge of the menu versus the actual component.

The menu is described from top to bottom with next methods:
   AddItem()
   AddCheckBox()
   AddRadioButton()
Example:
   .AddCheckBox("View>Toolbars>Dialog")
   .AddCheckBox("View>Toolbars>Find", Status := True)
   .AddCheckBox("View>Status Bar", Status := True)
   .AddItem("View>Full Screen", Name := "FULLSCREEN")
The SubmenuCharacter (Default = ">") is modifiable.

Each menu item receives a numeric and a string identifier.
The execute() method returns the item selected by the user.

The service is available both from Basic and Python user scripts.

The commit includes the review of build files to include
the new library and the new modules.

Change-Id: I2940be25313cc8fff7b337766edd348b04a20584
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123654
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-10-15 16:39:48 +02:00