core.git: Branch 'libreoffice-24-2-5' - wizards/source
wizards/source/sfdocuments/SF_Document.xba |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 647e35f54a9c41d6840bf191fcc97de56c6578a8 Author: Jean-Pierre Ledure AuthorDate: Mon Jul 8 16:04:04 2024 +0200 Commit: Christian Lohmaier CommitDate: Wed Jul 10 11:51:39 2024 +0200 ScriptForge (Document) tdf#161946 Fix CreateMenu() / Before A too strict validity check of the Before argument prevents the use of numeric values. String values work fine. Fix the arguments of the call to SF_Utils.Validate() in SFDocuments.Document.xba Change-Id: Id1d21cef1c3f056078b0208a8e15c503e1ecb201 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170165 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit b2b29283c21640d02b12c031963dbd50a646552c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170225 (cherry picked from commit 42e3bb7cde89db579d5a42a18b7a7a93c6aad059) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170226 (cherry picked from commit 161a6e1b2f946ee8f756874d240da738668ccbba) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170238 Reviewed-by: Christian Lohmaier Reviewed-by: Xisco Fauli Tested-by: Christian Lohmaier diff --git a/wizards/source/sfdocuments/SF_Document.xba b/wizards/source/sfdocuments/SF_Document.xba index 6382b7c62827..43e143f30a59 100644 --- a/wizards/source/sfdocuments/SF_Document.xba +++ b/wizards/source/sfdocuments/SF_Document.xba @@ -572,7 +572,7 @@ Check: If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not _IsStillAlive() Then GoTo Finally If Not ScriptForge.SF_Utils._Validate(MenuHeader, MenuHeader, V_STRING) Then GoTo Finally - If Not ScriptForge.SF_Utils._Validate(Before, Before, V_STRING) Then GoTo Finally + If Not ScriptForge.SF_Utils._Validate(Before, Before, Array(V_STRING, ScriptForge.V_NUMERIC)) Then GoTo Finally If Not ScriptForge.SF_Utils._Validate(SubmenuChar, SubmenuChar, V_STRING) Then GoTo Finally End If @@ -2138,4 +2138,4 @@ Private Function _Repr() As String End Function SFDocuments.SF_Document._Repr REM END OF SFDOCUMENTS.SF_DOCUMENT - + \ No newline at end of file
core.git: wizards/source
wizards/source/scriptforge/SF_Session.xba | 26 +++--- 1 file changed, 23 insertions(+), 3 deletions(-) New commits: commit e110974bc1c2a0b253d27cf3ad2643aa5208e2cd Author: Jean-Pierre Ledure AuthorDate: Sat Mar 23 17:41:49 2024 +0100 Commit: Jean-Pierre Ledure CommitDate: Sun Mar 24 17:35:49 2024 +0100 ScriptForge (session).RunApplication() redesign The RunApplication() method uses - either the Shell() Basic built-in function (only in asynchronous mode) - or the com.sun.star.system.SystemShellExecute() service in this order. The second is tried in case of failure of the first one. Benefits: - the method can start batch files or scripts - broader than Shell(): giving a user file as argument opens its application first based on the file suffix - more robust error handling Read discussion in tdf#160222. This change could require a light revisit of the sf_session help page. Change-Id: I1fb4717db4b971bd62885ad0e38b7c08a8e6f434 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165218 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index 307fb7a8f4bf..cc6e576e1c5f 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -563,9 +563,12 @@ Public Function RunApplication(Optional ByVal Command As Variant _ The method does not validate the given parameters, but only passes them to the specified command Returns: True if success + Exceptions: + UNKNOWNFILEERRORCommand could not be identified as a valid file Examples: session.RunApplication(Notepad.exe) session.RunApplication(C:\myFolder\myDocument.odt) + session.RunApplication(kate) (Linux) session.RunApplication(kate, /home/me/install.txt)(Linux) Dim bReturn As Boolean Returned value @@ -585,9 +588,23 @@ Check: End If Try: - Set oShell = SF_Utils._GetUNOService(SystemShellExecute) - sCommand = SF_FileSystem._ConvertToUrl(Command) - oShell.execute(sCommand, Parameters, com.sun.star.system.SystemShellExecuteFlags.DEFAULTS) + Cfr. discussion tdf#160222 + 1) Try Shell(), always in not synchronized mode + 2) If failure - check command existence as a valid file + - try com.sun.star.system.SystemShellExecute + sCommand = SF_FileSystem._ConvertFromUrl(Command) + On Local Error GoTo Step2 + Shell(sCommand, , Parameters, False) + Step2: + If Err 0 Then + On Error GoTo 0 Reset error status + If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch + If Not SF_FileSystem.FileExists(Command) Then GoTo CatchNotExists + Set oShell = SF_Utils._GetUNOService(SystemShellExecute) + sCommand = SF_FileSystem._ConvertToUrl(Command) + oShell.execute(sCommand, Parameters, com.sun.star.system.SystemShellExecuteFlags.DEFAULTS) + End If + bReturn = True Finally: @@ -596,6 +613,9 @@ Finally: Exit Function Catch: GoTo Finally +CatchNotExists: + SF_Exception.RaiseFatal(UNKNOWNFILEERROR, Command, Command) + GoTo Finally End Function ScriptForge.SF_Session.RunApplication REM -
core.git: Branch 'libreoffice-7-6' - wizards/source
wizards/source/scriptforge/SF_Session.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 2b168309d077e0685fe0d90d2f84981845153f7c Author: Jean-Pierre Ledure AuthorDate: Thu Mar 21 15:54:55 2024 +0100 Commit: Jean-Pierre Ledure CommitDate: Fri Mar 22 15:06:05 2024 +0100 ScriptForge (session).RunApplication() crash fix tdf#160222 Use com.sun.star.system.SystemShellExecuteFlags.DEFAULTS i.o. com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY as argument of com.sun.star.system.SystemShellExecute.execute() Change-Id: I3919777cf9442387aec6ed694a2883519e4a7910 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165105 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit ec2d0fceedec8aa775940d496eb86c40f958a10c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165127 (cherry picked from commit c826976b634596e476515a678ce415d9d16830c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165128 Tested-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index 2bde313194b1..6cd2dd714d2e 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -587,7 +587,7 @@ Check: Try: Set oShell = SF_Utils._GetUNOService(SystemShellExecute) sCommand = SF_FileSystem._ConvertToUrl(Command) - oShell.execute(sCommand, Parameters, com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY) + oShell.execute(sCommand, Parameters, com.sun.star.system.SystemShellExecuteFlags.DEFAULTS) bReturn = True Finally:
core.git: Branch 'libreoffice-24-2' - wizards/source
wizards/source/scriptforge/SF_Session.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c826976b634596e476515a678ce415d9d16830c6 Author: Jean-Pierre Ledure AuthorDate: Thu Mar 21 15:54:55 2024 +0100 Commit: Xisco Fauli CommitDate: Fri Mar 22 13:18:53 2024 +0100 ScriptForge (session).RunApplication() crash fix tdf#160222 Use com.sun.star.system.SystemShellExecuteFlags.DEFAULTS i.o. com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY as argument of com.sun.star.system.SystemShellExecute.execute() Change-Id: I3919777cf9442387aec6ed694a2883519e4a7910 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165105 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit ec2d0fceedec8aa775940d496eb86c40f958a10c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165127 diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index aeca1133e346..307fb7a8f4bf 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -587,7 +587,7 @@ Check: Try: Set oShell = SF_Utils._GetUNOService(SystemShellExecute) sCommand = SF_FileSystem._ConvertToUrl(Command) - oShell.execute(sCommand, Parameters, com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY) + oShell.execute(sCommand, Parameters, com.sun.star.system.SystemShellExecuteFlags.DEFAULTS) bReturn = True Finally:
core.git: wizards/source
wizards/source/scriptforge/SF_Session.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 065fa9d77e5bd550600e8985d7e7aac8e10745c4 Author: Jean-Pierre Ledure AuthorDate: Thu Mar 21 15:54:55 2024 +0100 Commit: Jean-Pierre Ledure CommitDate: Fri Mar 22 09:54:47 2024 +0100 ScriptForge (session).RunApplication() crash fix tdf#160222 Use com.sun.star.system.SystemShellExecuteFlags.DEFAULTS i.o. com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY as argument of com.sun.star.system.SystemShellExecute.execute() Change-Id: I3919777cf9442387aec6ed694a2883519e4a7910 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165105 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index aeca1133e346..307fb7a8f4bf 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -587,7 +587,7 @@ Check: Try: Set oShell = SF_Utils._GetUNOService(SystemShellExecute) sCommand = SF_FileSystem._ConvertToUrl(Command) - oShell.execute(sCommand, Parameters, com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY) + oShell.execute(sCommand, Parameters, com.sun.star.system.SystemShellExecuteFlags.DEFAULTS) bReturn = True Finally:
core.git: wizards/Package_scriptforge.mk wizards/source
wizards/Package_scriptforge.mk|1 wizards/source/scriptforge/python/scriptforge.py | 104 wizards/source/scriptforge/python/scriptforge.pyi | 7232 ++ 3 files changed, 7317 insertions(+), 20 deletions(-) New commits: commit c5e0c65bd26664349fb7c80a792e2fe949fee0fe Author: Jean-Pierre Ledure AuthorDate: Fri Mar 15 15:55:45 2024 +0100 Commit: Jean-Pierre Ledure CommitDate: Fri Mar 15 17:27:00 2024 +0100 ScriptForge - Python typing hints Python typing hints may be stored either - inside the original .py source file - in a separate .pyi source file (aka. STUB). Choice is made to create a new scriptforge.pyi file - to allow hiding the private functions - to specialize each module: technical doc vs. user doc - to allow potential later translation - to minimize the impact at run-time: stubs are active only during code edition. The new scriptforge.pyi module - provides the static type checking of all the public interfaces (methods/properties) of the ScriptForge API. - when the user uses an IDE like PyCharm or VSCode, (s)he might benefit from the typing hints provided by the signatures and docstrings stored in the module. Visually, while editing a user script: - hovering an object instance, a method or a property displays its detailed description - a "." after an object instance displays a drop-down box listing all available interfaces - brackets after a method-name start code-completion by displaying its arguments. Limitations: SF supports ProperCase, lowercase and camelCase naming for methods and properties. Only ProperCase is described in scriptforge.pyi. Extending to the other 2 notations would be easy but would also overload needlessly the drop-down lists. The effective code (scriptforge.py) is completed with a series of importable variable types, corresponding roughly with the available service instance names in uppercase. Example from scriptforge import CALC, RANGE def userfct(c: CALC, r: RANGE) -> RANGE: r1: RANGE = "A1:K10" Objective: enrich the signatures in user scripts and benefit from the same hints when the variable types cannot be derived from the context. The help documentation should be complemented with the actual additional feature. Change-Id: I6c39939a3cdbed94828e9449cd691fe15c24c923 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164867 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/Package_scriptforge.mk b/wizards/Package_scriptforge.mk index 4cd78e1f4982..96b5a907a321 100644 --- a/wizards/Package_scriptforge.mk +++ b/wizards/Package_scriptforge.mk @@ -57,5 +57,6 @@ $(eval $(call gb_Package_add_files,wizards_basicsrvscriptforge,$(LIBO_SHARE_FOLD $(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: diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index de590875c961..e339ada06d63 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2020-2024 Jean-Pierre LEDURE, Rafael LIMA, Alain ROMEDENNE +# Copyright 2020-2024 Jean-Pierre LEDURE, Rafael LIMA, @AmourSpirit, Alain ROMEDENNE # = # === The ScriptForge library and its associated libraries are part of the LibreOffice project. === @@ -38,6 +38,11 @@ - implements a protocol between those interfaces and, when appropriate, the corresponding ScriptForge Basic libraries implementing the requested services. +The scriptforge.pyi module +- provides the static type checking of all the visible interfaces of the ScriptForge API. +- when the user uses an IDE like PyCharm or VSCode, (s)he might benefit from the typing + hints provided by them thanks to the twin scriptforhe.pyi module. + Usage: When Python and LibreOffice run in the same process (usual case): @@ -45,10 +50,13 @@ When Python and LibreOffice are started in separate processes, LibreOffice being started from console ... (example for Linux with port = 2023) -./soffice --accept='socket,host=localhost,port=2023;urp;' +./soffice --accept='socket,host=localhost,port=2024;urp;' then use next statements: from scriptforge import CreateScriptService, ScriptForge -ScriptForge(hostname = 'localhost', port = 2023) +
core.git: Branch 'libreoffice-7-6' - 2 commits - sw/inc sw/qa sw/source wizards/source
sw/inc/anchoreddrawobject.hxx |4 sw/inc/anchoredobject.hxx |5 sw/qa/core/text/text.cxx |2 sw/qa/extras/layout/layout3.cxx|4 sw/qa/extras/uiwriter/uiwriter5.cxx|4 sw/source/core/doc/doclay.cxx |6 - sw/source/core/draw/dcontact.cxx |8 - sw/source/core/draw/dview.cxx |4 sw/source/core/fields/postithelper.cxx |4 sw/source/core/frmedt/fefly1.cxx | 22 +-- sw/source/core/frmedt/feshview.cxx | 12 +- sw/source/core/frmedt/fews.cxx |4 sw/source/core/inc/flyfrm.hxx |4 sw/source/core/layout/anchoreddrawobject.cxx | 58 +- sw/source/core/layout/anchoredobject.cxx | 46 +++ sw/source/core/layout/atrfrm.cxx |2 sw/source/core/layout/calcmove.cxx |8 - sw/source/core/layout/flowfrm.cxx | 16 +- sw/source/core/layout/fly.cxx | 34 ++--- sw/source/core/layout/flycnt.cxx | 10 - sw/source/core/layout/flyincnt.cxx |2 sw/source/core/layout/flylay.cxx | 10 - sw/source/core/layout/frmtool.cxx |6 - sw/source/core/layout/layact.cxx |2 sw/source/core/layout/objectformattertxtfrm.cxx| 17 +- sw/source/core/layout/pagechg.cxx | 26 ++-- sw/source/core/layout/sortedobjs.cxx | 22 +-- sw/source/core/layout/tabfrm.cxx | 32 ++--- sw/source/core/layout/trvlfrm.cxx |7 - sw/source/core/layout/wsfrm.cxx|6 - sw/source/core/objectpositioning/anchoredobjectposition.cxx|2 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx |4 sw/source/core/text/EnhancedPDFExportHelper.cxx|2 sw/source/core/text/frmform.cxx|2 sw/source/core/text/itratr.cxx |2 sw/source/core/text/itrform2.cxx |2 sw/source/core/text/porfly.cxx |2 sw/source/core/text/porlay.cxx |2 sw/source/core/text/txtfly.cxx | 39 +++--- sw/source/core/text/txtfrm.cxx |2 sw/source/core/txtnode/ndtxt.cxx |6 - sw/source/core/unocore/unoobj2.cxx | 12 +- wizards/source/scriptforge/SF_Array.xba|2 43 files changed, 233 insertions(+), 233 deletions(-) New commits: commit 67a2cba41b6caeabac031f1ae35b6c465037b0fd Author: Jean-Pierre Ledure AuthorDate: Fri Jan 12 22:30:06 2024 +0100 Commit: Xisco Fauli CommitDate: Tue Jan 16 09:40:22 2024 +0100 ScriptForge (SF_Array) fix tdf#158976 Shuffle() The algorithm used to shuffle a 1D array prevented any item of the array to remain in the same entry after the shuffle. This has been fixed. The potential targeted entries to receive an item include the actual entry. This change might impact existing scripts that have Randomize()d their sorts to always get the same shuffle results. This should impact test scripts only. SF_Array.Shuffle() is available in Basic only. No impact on help pages. Change-Id: If56d901f4af68f8889a7352c306bae6e3443ae97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161987 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit ca9168b8ad842c86b2168e12bb98087b9f8139bd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162009 Reviewed-by: Xisco Fauli (cherry picked from commit d4898d7bbe8496504e36f7d91f55f62043f6a302) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162105 diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba index 49bdab14770a..c12446133e72 100644 --- a/wizards/source/scriptforge/SF_Array.xba +++ b/wizards/source/scriptforge/SF_Array.xba @@ -1767,7 +1767,7 @@ Try: Next i Now ... shuffle ! Do While lCurrentIndex lMin
core.git: Branch 'distro/collabora/co-24.04' - 22 commits - bin/update external/onlineupdate include/sfx2 Makefile.gbuild sc/inc sc/qa sc/source sdext/source sd/source sfx2/source svl/source sw/inc sw
/source/uibase/docvw/edtwin.cxx | 28 - sw/source/uibase/shells/drwbassh.cxx | 16 vcl/source/app/salvtables.cxx | 13 vcl/unx/gtk3/gtkinst.cxx | 22 + vcl/unx/gtk3/gtksalmenu.cxx|7 vcl/win/window/salframe.cxx| 126 +++ wizards/source/scriptforge/SF_Array.xba|2 writerfilter/source/dmapper/GraphicImport.cxx |7 73 files changed, 980 insertions(+), 488 deletions(-) New commits: commit 4e27fce7843c59bdfce55a9123bfc5402fd107ae Author: Jean-Pierre Ledure AuthorDate: Fri Jan 12 22:30:06 2024 +0100 Commit: Andras Timar CommitDate: Mon Jan 15 16:27:16 2024 +0100 ScriptForge (SF_Array) fix tdf#158976 Shuffle() The algorithm used to shuffle a 1D array prevented any item of the array to remain in the same entry after the shuffle. This has been fixed. The potential targeted entries to receive an item include the actual entry. This change might impact existing scripts that have Randomize()d their sorts to always get the same shuffle results. This should impact test scripts only. SF_Array.Shuffle() is available in Basic only. No impact on help pages. Change-Id: If56d901f4af68f8889a7352c306bae6e3443ae97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161987 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit ca9168b8ad842c86b2168e12bb98087b9f8139bd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162009 Reviewed-by: Xisco Fauli diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba index 54110cde9352..1b5ae92df523 100644 --- a/wizards/source/scriptforge/SF_Array.xba +++ b/wizards/source/scriptforge/SF_Array.xba @@ -1767,7 +1767,7 @@ Try: Next i Now ... shuffle ! Do While lCurrentIndex lMin - lRandomIndex = Int(Rnd * (lCurrentIndex - lMin)) + lMin + lRandomIndex = Int(Rnd * (lCurrentIndex - lMin + 1)) + lMin vSwapValue = vShuffle(lCurrentIndex) vShuffle(lCurrentIndex) = vShuffle(lRandomIndex) vShuffle(lRandomIndex) = vSwapValue commit 3aa40eb74b7488d9a51b9f3f680fabc0c1ec059f Author: Mike Kaganski AuthorDate: Sun Jan 14 12:16:48 2024 +0600 Commit: Andras Timar CommitDate: Mon Jan 15 16:27:16 2024 +0100 tdf#159174: there may be no tabs in the clipboard document Change-Id: I053d91bf44e39e14ade9face14084a107d0df898 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162041 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 0b93cc83993b3cd78aa05556342839a21c96dc5a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162092 Reviewed-by: Xisco Fauli diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index a61520875238..84e21da02214 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -466,6 +466,9 @@ static void lcl_HidePrint( const ScTableInfo& rTabInfo, SCCOL nX1, SCCOL nX2 ) void ScPrintFunc::DrawToDev(ScDocument& rDoc, OutputDevice* pDev, double /* nPrintFactor */, const tools::Rectangle& rBound, ScViewData* pViewData, bool bMetaFile) { +if (rDoc.GetMaxTableNumber() < 0) +return; + //! evaluate nPrintFactor !!! SCTAB nTab = 0; commit 763d8d48cd774bcf0b49954dff726245f77b9677 Author: Mike Kaganski AuthorDate: Sun Jan 14 17:53:03 2024 +0600 Commit: Andras Timar CommitDate: Mon Jan 15 16:27:16 2024 +0100 Let SwAnchoredObject::GetFrameFormat return pointer, and drop HasFrameFormat In commit 19062c98da5b2e9edc7a99068fa06a83c7578826, it was important to check if objects have frame format before using GetFrameFormat. Thic change makes it simpler amd more obvious. Also, it allows to avoid two calls to GetUserCall, by obtaining the pointer once and checking it. Change-Id: I980fcba9e369e107f3d062e8cab0a34e02384290 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162044 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162079 diff --git a/sw/inc/anchoreddrawobject.hxx b/sw/inc/anchoreddrawobject.hxx index 609582d4d326..bfc40fe07a3c 100644 --- a/sw/inc/anchoreddrawobject.hxx +++ b/sw/inc/anchoreddrawobject.hxx @@ -115,8 +115,8 @@ class SwAnchoredDrawObject final : public SwAnchoredObject } // accessors to the format -virtual SwFrameFormat& GetFrameFormat() override; -virtual const SwFrameFormat& GetFrameFormat() const override; +virtual SwFrameFormat* Ge
core.git: Branch 'libreoffice-24-2' - wizards/source
wizards/source/scriptforge/SF_Array.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4651a5eb1b913d61d015c8fe2d713110bd2c5c50 Author: Jean-Pierre Ledure AuthorDate: Fri Jan 12 22:30:06 2024 +0100 Commit: Xisco Fauli CommitDate: Mon Jan 15 14:29:48 2024 +0100 ScriptForge (SF_Array) fix tdf#158976 Shuffle() The algorithm used to shuffle a 1D array prevented any item of the array to remain in the same entry after the shuffle. This has been fixed. The potential targeted entries to receive an item include the actual entry. This change might impact existing scripts that have Randomize()d their sorts to always get the same shuffle results. This should impact test scripts only. SF_Array.Shuffle() is available in Basic only. No impact on help pages. Change-Id: If56d901f4af68f8889a7352c306bae6e3443ae97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161987 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit ca9168b8ad842c86b2168e12bb98087b9f8139bd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162009 Reviewed-by: Xisco Fauli diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba index 54110cde9352..1b5ae92df523 100644 --- a/wizards/source/scriptforge/SF_Array.xba +++ b/wizards/source/scriptforge/SF_Array.xba @@ -1767,7 +1767,7 @@ Try: Next i Now ... shuffle ! Do While lCurrentIndex lMin - lRandomIndex = Int(Rnd * (lCurrentIndex - lMin)) + lMin + lRandomIndex = Int(Rnd * (lCurrentIndex - lMin + 1)) + lMin vSwapValue = vShuffle(lCurrentIndex) vShuffle(lCurrentIndex) = vShuffle(lRandomIndex) vShuffle(lRandomIndex) = vSwapValue
core.git: wizards/source
wizards/source/scriptforge/SF_Array.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ca9168b8ad842c86b2168e12bb98087b9f8139bd Author: Jean-Pierre Ledure AuthorDate: Fri Jan 12 22:30:06 2024 +0100 Commit: Jean-Pierre Ledure CommitDate: Sat Jan 13 11:20:08 2024 +0100 ScriptForge (SF_Array) fix tdf#158976 Shuffle() The algorithm used to shuffle a 1D array prevented any item of the array to remain in the same entry after the shuffle. This has been fixed. The potential targeted entries to receive an item include the actual entry. This change might impact existing scripts that have Randomize()d their sorts to always get the same shuffle results. This should impact test scripts only. SF_Array.Shuffle() is available in Basic only. No impact on help pages. Change-Id: If56d901f4af68f8889a7352c306bae6e3443ae97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161987 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba index 54110cde9352..1b5ae92df523 100644 --- a/wizards/source/scriptforge/SF_Array.xba +++ b/wizards/source/scriptforge/SF_Array.xba @@ -1767,7 +1767,7 @@ Try: Next i Now ... shuffle ! Do While lCurrentIndex lMin - lRandomIndex = Int(Rnd * (lCurrentIndex - lMin)) + lMin + lRandomIndex = Int(Rnd * (lCurrentIndex - lMin + 1)) + lMin vSwapValue = vShuffle(lCurrentIndex) vShuffle(lCurrentIndex) = vShuffle(lRandomIndex) vShuffle(lRandomIndex) = vSwapValue
core.git: wizards/source
wizards/source/scriptforge/SF_Utils.xba |2 +- wizards/source/scriptforge/__License.xba |2 +- wizards/source/scriptforge/po/ScriptForge.pot|4 ++-- wizards/source/scriptforge/po/en.po |4 ++-- wizards/source/scriptforge/python/scriptforge.py |4 ++-- wizards/source/sfdatabases/__License.xba |2 +- wizards/source/sfdialogs/__License.xba |2 +- wizards/source/sfdocuments/__License.xba |2 +- wizards/source/sfunittests/__License.xba |2 +- wizards/source/sfwidgets/__License.xba |2 +- 10 files changed, 13 insertions(+), 13 deletions(-) New commits: commit 5fc9908b956fbc87b8b0933a1c8c6bb956e38bbc Author: Jean-Pierre Ledure AuthorDate: Mon Dec 25 13:10:46 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Mon Dec 25 14:10:36 2023 +0100 ScriptForge - Upgrade to version 24.8 Copyright years are also reviewed to include 2024. Change-Id: I1f30443922a6dc3b35c6f05616a5c4e56de1e396 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161277 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Utils.xba b/wizards/source/scriptforge/SF_Utils.xba index 5ebdd58ce9ab..eac0cb282b27 100644 --- a/wizards/source/scriptforge/SF_Utils.xba +++ b/wizards/source/scriptforge/SF_Utils.xba @@ -21,7 +21,7 @@ REM = GLOBAL Global _SF_As VariantSF_Root (Basic) object) ScriptForge version -Const SF_Version = 24.2 +Const SF_Version = 24.8 Standard symbolic names for VarTypes V_EMPTY = 0 diff --git a/wizards/source/scriptforge/__License.xba b/wizards/source/scriptforge/__License.xba index a817525250ef..f08c294d4431 100644 --- a/wizards/source/scriptforge/__License.xba +++ b/wizards/source/scriptforge/__License.xba @@ -1,7 +1,7 @@ http://openoffice.org/2000/script; script:name="__License" script:language="StarBasic" script:moduleType="normal"> - Copyright 2019-2022 Jean-Pierre LEDURE, Rafael LIMA, Alain ROMEDENNE + Copyright 2019-2024 Jean-Pierre LEDURE, Rafael LIMA, Alain ROMEDENNE REM === REM ===The ScriptForge library and its associated libraries are part of the LibreOffice project. === diff --git a/wizards/source/scriptforge/po/ScriptForge.pot b/wizards/source/scriptforge/po/ScriptForge.pot index 5bf1aa6a008e..430e61d4e884 100644 --- a/wizards/source/scriptforge/po/ScriptForge.pot +++ b/wizards/source/scriptforge/po/ScriptForge.pot @@ -7,14 +7,14 @@ # *** are part of the LibreOffice project. *** # * # -# ScriptForge Release 24.2 +# ScriptForge Release 24.8 # --- # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION " "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice_status=UNCONFIRMED=UI " -"POT-Creation-Date: 2023-12-04 16:36:35 " +"POT-Creation-Date: 2023-12-25 12:02:38 " "PO-Revision-Date: -MM-DD HH:MM:SS " "Last-Translator: FULL NAME " "Language-Team: LANGUAGE " diff --git a/wizards/source/scriptforge/po/en.po b/wizards/source/scriptforge/po/en.po index 5bf1aa6a008e..430e61d4e884 100644 --- a/wizards/source/scriptforge/po/en.po +++ b/wizards/source/scriptforge/po/en.po @@ -7,14 +7,14 @@ # *** are part of the LibreOffice project. *** # * # -# ScriptForge Release 24.2 +# ScriptForge Release 24.8 # --- # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION " "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice_status=UNCONFIRMED=UI " -"POT-Creation-Date: 2023-12-04 16:36:35 " +"POT-Creation-Date: 2023-12-25 12:02:38 " "PO-Revision-Date: -MM-DD HH:MM:SS " "Last-Translator: FULL NAME " "Language-Team: LANGUAGE " diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 998d57d066a8..de590875c961 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2020-2022 Jean-Pierre LEDURE, Rafael LIMA, Alain ROMEDENNE +# Copyright 2020-2024 Jean-Pierre LEDURE, Rafael LIMA, Alain ROMEDENNE #
core.git: Branch 'libreoffice-7-6' - wizards/source
wizards/source/sfdocuments/SF_Calc.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4073f13330600d3efc25fc25450f9f635c6e74b2 Author: Jean-Pierre Ledure AuthorDate: Sat Jul 8 17:35:44 2023 +0200 Commit: Julien Nabet CommitDate: Sat Dec 9 10:25:18 2023 +0100 ScriptForge - (SF_Calc) fix typo in CopyToRange() method Change-Id: I07db487d94c2d0a8f2ec5955f6e94b00911d25c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154214 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit b16861f667673560cf57d28bdd16bb592e6e3c22) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160472 Reviewed-by: Rafael Lima diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index fe71b69e6a82..0138730c11f3 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -1085,7 +1085,7 @@ Const cstSubArgs = SourceRange, DestinationRange If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch sCopy = -Check:string +Check: If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not _IsStillAlive(True) Then GoTo Finally If Not ScriptForge.SF_Utils._Validate(SourceRange, SourceRange, Array(V_STRING, ScriptForge.V_OBJECT), , , CALCREFERENCE) Then GoTo Finally
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Root.xba|4 ++-- wizards/source/scriptforge/po/ScriptForge.pot |8 +++- wizards/source/scriptforge/po/en.po |8 +++- 3 files changed, 8 insertions(+), 12 deletions(-) New commits: commit e8ac98c6569f8c462e754a3142aeb9f433588ec8 Author: Jean-Pierre Ledure AuthorDate: Wed Dec 6 12:02:49 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Wed Dec 6 17:55:57 2023 +0100 ScriptForge (SF_Root) Fix typos Suppression of linefeeds in excess inside english error messages. Change-Id: I38189e7dcf9d24055e477a5cb6cfeb42644ded39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160385 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/SF_Root.xba b/wizards/source/scriptforge/SF_Root.xba index dc1bfa32a49c..69e0ee25ec42 100644 --- a/wizards/source/scriptforge/SF_Root.xba +++ b/wizards/source/scriptforge/SF_Root.xba @@ -1022,7 +1022,7 @@ Try: SF_Dialog.CreateControl .AddText( Context := DUPLICATECONTROL _ , MsgId := A control with the same name exists already in the dialog %3.\n\n _ - « %1 » = %2\n _ + « %1 » = %2 _ , Comment :=SF_Dialog CreateControl\n _ %1: An identifier\n _ %2: A string\n _ @@ -1059,7 +1059,7 @@ Try: SF_Dataset.Update/Insert/Delete/GetValue .AddText( Context := NOCURRENTRECORD _ , MsgId := A database record could not be retrieved, inserted or updated by the database system.\n _ - The current record could not be determined.\n _ + The current record could not be determined. _ , Comment := SF_Dataset cant read field values or store field updates _ ) SF_Dataset._SetColumnValue diff --git a/wizards/source/scriptforge/po/ScriptForge.pot b/wizards/source/scriptforge/po/ScriptForge.pot index 814f75ec041f..5bf1aa6a008e 100644 --- a/wizards/source/scriptforge/po/ScriptForge.pot +++ b/wizards/source/scriptforge/po/ScriptForge.pot @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice_status=UNCONFIRMED=UI\n; -"POT-Creation-Date: 2023-11-11 15:24:14\n" +"POT-Creation-Date: 2023-12-04 16:36:35\n" "PO-Revision-Date: -MM-DD HH:MM:SS\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -965,8 +965,7 @@ msgctxt "DUPLICATECONTROL" msgid "" "A control with the same name exists already in the dialog '%3'.\n" "\n" -"« %1 » = %2\n" -"" +"« %1 » = %2" msgstr "" #. SF_Database when running update SQL statement @@ -1012,8 +1011,7 @@ msgctxt "NOCURRENTRECORD" msgid "" "A database record could not be retrieved, inserted or updated by the " "database system.\n" -"The current record could not be determined.\n" -"" +"The current record could not be determined." msgstr "" #. SF_Database can't store field updates diff --git a/wizards/source/scriptforge/po/en.po b/wizards/source/scriptforge/po/en.po index 814f75ec041f..5bf1aa6a008e 100644 --- a/wizards/source/scriptforge/po/en.po +++ b/wizards/source/scriptforge/po/en.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice_status=UNCONFIRMED=UI\n; -"POT-Creation-Date: 2023-11-11 15:24:14\n" +"POT-Creation-Date: 2023-12-04 16:36:35\n" "PO-Revision-Date: -MM-DD HH:MM:SS\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -965,8 +965,7 @@ msgctxt "DUPLICATECONTROL" msgid "" "A control with the same name exists already in the dialog '%3'.\n" "\n" -"« %1 » = %2\n" -"" +"« %1 » = %2" msgstr "" #. SF_Database when running update SQL statement @@ -1012,8 +1011,7 @@ msgctxt "NOCURRENTRECORD" msgid "" "A database record could not be retrieved, inserted or updated by the " "database system.\n" -"The current record could not be determined.\n" -"" +"The current record could not be determined." msgstr "" #. SF_Database can't store field updates
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdatabases/SF_Database.xba |2 +- wizards/source/sfdatabases/SF_Dataset.xba |7 --- 2 files changed, 5 insertions(+), 4 deletions(-) New commits: commit 07036eea5089feae511145412d7105cb76c1955a Author: Jean-Pierre Ledure AuthorDate: Thu Nov 30 17:11:13 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Fri Dec 1 13:43:45 2023 +0100 ScriptForge (SF_Dataset) fix GetRows() in chunks Two bugs are fixed with this commit: 1. when rows in a dataset are read in chunks, one record is skipped errorneously between every two successive chunks. 2. In updatable datasets, the updatable fields need to be identified. This is done at dataset creation. Before: the IsDefinitelyWritable criterion was used, valid for Firebird, not for HSQL After: the IsWritable criterion is used, valid for both. The correction in Basic is valid as well for Python. Documentation is unchanged. Change-Id: I990c02aaa8a93123a7e669b1294605fa19780167 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160163 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdatabases/SF_Database.xba b/wizards/source/sfdatabases/SF_Database.xba index fa5d0778b873..ff0eafc5b783 100644 --- a/wizards/source/sfdatabases/SF_Database.xba +++ b/wizards/source/sfdatabases/SF_Database.xba @@ -28,7 +28,7 @@ Option Explicit Transaction handling Changes to data remain reversible until the moment the running script instructs the database to commit them. The implicit (default) behaviour is that commit takes place after the execution of every single SQL statement. - The choice can be made (SetTranactionMode()) to take commitments manually. + The choice can be made (SetTransactionMode()) to take commitments manually. The Commit() and Rollback() statements delimit transactions. Service invocation and usage: diff --git a/wizards/source/sfdatabases/SF_Dataset.xba b/wizards/source/sfdatabases/SF_Dataset.xba index e9eb050d93f0..02b3d35affd9 100644 --- a/wizards/source/sfdatabases/SF_Dataset.xba +++ b/wizards/source/sfdatabases/SF_Dataset.xba @@ -585,6 +585,7 @@ Check: If Not ScriptForge.SF_Utils._Validate(Header, Header, ScriptForge.V_BOOLEAN) Then GoTo Finally If Not ScriptForge.SF_Utils._Validate(MaxRows, MaxRows, ScriptForge.V_NUMERIC) Then GoTo Finally End If + If MaxRows 0 Then MaxRows = 1 Try: With _RowSet @@ -608,7 +609,7 @@ Try: End If Load data - Do While bRead And (MaxRows = 0 Or lRows MaxRows - 1) + Do While bRead lRows = lRows + 1 If lRows = 0 Then ReDim vResult(0 To lRows, 0 To lCols) @@ -618,7 +619,7 @@ Try: For i = 0 To lCols vResult(lRows, i) = _ParentDatabase._GetColumnValue(_RowSet, i + 1) Next i - bRead = .next() + If MaxRows = 0 Or lRows MaxRows - 1 Then bRead = .next() Else bRead = False Loop Else @@ -1343,7 +1344,7 @@ Try: Field names sFields = sFields , .Name Updatable field names - If Not _ReadOnly And .isDefinitelyWritable And Not .IsAutoIncrement Then sUpdatableFields = sUpdatableFields , .Name + If Not _ReadOnly And .IsWritable And Not .IsAutoIncrement Then sUpdatableFields = sUpdatableFields , .Name Default values _DefaultValues(i) = _ConvertDefaultValue(oColumn) AutoValue
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |9 wizards/source/sfdatabases/SF_Database.xba | 332 +-- wizards/source/sfdatabases/SF_Dataset.xba| 11 wizards/source/sfdatabases/SF_Register.xba |2 4 files changed, 337 insertions(+), 17 deletions(-) New commits: commit 9b5b313a2f2980f9a10295aabdd696f58af03302 Author: Jean-Pierre Ledure AuthorDate: Thu Nov 23 17:59:33 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Fri Nov 24 09:54:59 2023 +0100 ScriptForge (SF_Database) manage transactions Transactions are managed by next UNO properties: XConnection.AutoCommit XConnection.TransactionIsolation (They seem very easy to use but, in practice, are not easy at all) Usually all transactions are in auto-commit mode, that means, a commit takes place after each single SQL command. Switching auto-commit off means however that the connection needs to be of type "ISOLATED" and not of the default type "SHARED". => The usual shared connection must be closed. As a consequence, all rowsets/resultsets linked to the shared connection need to be closed as well. => Additionally the buffers must be emptied (flushed) to make committed data visible in the Base user interface. All above aspects and constraints are managed in the database.SetTransactionMode(transactionmode) database.Commit() database.Rollback() methods transparently for the user scripts. The [transactionmode] argument has as value one of the TransactionIsolation constants. Without argument, database.SetTransactionMode() restores the automatic mode. The manual transaction mode is available for both Basic and Python scripts. Its implementation will require an update of the documentation about the Database service. Change-Id: I214bd91a1744d6d24609bc5efc987152c6e946c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159867 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 77e0119809da..998d57d066a8 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1794,6 +1794,9 @@ class SFDatabases: def CloseDatabase(self): return self.ExecMethod(self.vbMethod, 'CloseDatabase') +def Commit(self): +return self.ExecMethod(self.vbMethod, 'Commit') + def CreateDataset(self, sqlcommand, directsql = False, filter = '', orderby = ''): return self.ExecMethod(self.vbMethod, 'CreateDataset', sqlcommand, directsql, filter, orderby) @@ -1831,9 +1834,15 @@ class SFDatabases: def OpenTable(self, tablename): return self.ExecMethod(self.vbMethod, 'OpenTable', tablename) +def Rollback(self): +return self.ExecMethod(self.vbMethod, 'Rollback') + def RunSql(self, sqlcommand, directsql = False): return self.ExecMethod(self.vbMethod, 'RunSql', sqlcommand, directsql) +def SetTransactionMode(self, transactionmode = 0): +return self.ExecMethod(self.vbMethod, 'SetTransactionMode', transactionmode) + # # # SF_Dataset CLASS # # diff --git a/wizards/source/sfdatabases/SF_Database.xba b/wizards/source/sfdatabases/SF_Database.xba index cf970ea980fc..141a5bade393 100644 --- a/wizards/source/sfdatabases/SF_Database.xba +++ b/wizards/source/sfdatabases/SF_Database.xba @@ -25,6 +25,12 @@ Option Explicit The provided interfaces include simple tables, queries and fields lists, and access to database metadata. + Tranaction handling + Changes to data remain reversible until the moment the running script instructs the database to commit them. + The implicit (default) behaviour is that commit takes place after the execution of every single SQL statement. + The choice can be made (SetTranactionMode()) to take commitments manually. + The Commit() and Rollback() statements delimit transactions. + Service invocation and usage: 1) To access any database at anytime Dim myDatabase As Object @@ -67,6 +73,9 @@ Private _URLAs StringText on status bar Private _Location As String File name Private _ReadOnly As Boolean Private_MetaData As Object com.sun.star.sdbc.XDatab
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) New commits: commit 5dac0fe157a5c35824cab2c27e391ff7a0d1d421 Author: Jean-Pierre Ledure AuthorDate: Sun Nov 12 16:33:02 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Sun Nov 12 17:44:55 2023 +0100 ScriptForge (SFDatabases) fix dates processing in GetRows The database.GetRows() dataset.GetRows() methods return an array of data collected in a database table or query. When a column has the type DATE, the transmission of their values through the Basic-Python bridge require them to be converted upfront to UNO DateTime structures. The later conversion from UNO DateTime to the python datetime.datetime structure has been added with this patch. No impact on Basic scripts. The documentation does not need to be changed. Change-Id: I7a6533aff70d2d1402bfc3f057b65a4940148cc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159348 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index bcaff12f5cc5..77e0119809da 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -348,8 +348,8 @@ class ScriptForge(object, metaclass = _Singleton): # A Basic object to be mapped onto a new Python class instance # A UNO object # A set of property values to be returned as a dict() -# An array, tuple or tuple of tuples -# A scalar or Nothing +# An array, tuple or tuple of tuples - manage dates inside +# A scalar, Nothing, a date returnvalue = returntuple[cstValue] if returntuple[cstVarType] == ScriptForge.V_OBJECT and len(returntuple) > cstClass: # Skip Nothing if returntuple[cstClass] == ScriptForge.objUNO: @@ -372,6 +372,16 @@ class ScriptForge(object, metaclass = _Singleton): # Intercept empty array if isinstance(returnvalue, uno.ByteSequence): return () +if flags & SFServices.flgDateRet == SFServices.flgDateRet: # Bits comparison +# Intercept all UNO dates in the 1D or 2D array +if isinstance(returnvalue[0], tuple): # tuple of tuples +arr = [] +for i in range(len(returnvalue)): +row = tuple(map(SFScriptForge.SF_Basic.CDateFromUnoDateTime, returnvalue[i])) +arr.append(row) +returnvalue = tuple(arr) +else: # 1D tuple +returnvalue = tuple(map(SFScriptForge.SF_Basic.CDateFromUnoDateTime, returnvalue)) elif returntuple[cstVarType] == ScriptForge.V_DATE: dat = SFScriptForge.SF_Basic.CDateFromUnoDateTime(returnvalue) return dat @@ -1806,7 +1816,8 @@ class SFDatabases: return self.ExecMethod(self.vbMethod, 'DSum', expression, tablename, criteria) def GetRows(self, sqlcommand, directsql = False, header = False, maxrows = 0): -return self.ExecMethod(self.vbMethod + self.flgArrayRet, 'GetRows', sqlcommand, directsql, header, maxrows) +return self.ExecMethod(self.vbMethod + self.flgArrayRet + self.flgDateRet, 'GetRows', sqlcommand, + directsql, header, maxrows) def OpenFormDocument(self, formdocument): return self.ExecMethod(self.vbMethod, 'OpenFormDocument', formdocument) @@ -1870,7 +1881,7 @@ class SFDatabases: return self.ExecMethod(self.vbMethod, 'ExportValueToFile', fieldname, filename, overwrite) def GetRows(self, header = False, maxrows = 0): -return self.ExecMethod(self.vbMethod + self.flgArrayRet, 'GetRows', header, maxrows) +return self.ExecMethod(self.vbMethod + self.flgArrayRet + self.flgDateRet, 'GetRows', header, maxrows) def GetValue(self, fieldname): return self.ExecMethod(self.vbMethod, 'GetValue', fieldname)
[Libreoffice-commits] core.git: wizards/Package_sfdatabases.mk wizards/source
wizards/Package_sfdatabases.mk |1 wizards/source/scriptforge/SF_Exception.xba | 19 wizards/source/scriptforge/SF_PythonHelper.xba |4 wizards/source/scriptforge/SF_Root.xba | 49 wizards/source/scriptforge/po/ScriptForge.pot| 65 wizards/source/scriptforge/po/en.po | 65 wizards/source/scriptforge/python/scriptforge.py | 88 + wizards/source/sfdatabases/SF_Database.xba | 146 +- wizards/source/sfdatabases/SF_Dataset.xba| 1664 +++ wizards/source/sfdatabases/SF_Datasheet.xba |8 wizards/source/sfdatabases/script.xlb|1 11 files changed, 2066 insertions(+), 44 deletions(-) New commits: commit 7b2a6f04443c5d80ce681e5f1c89bf140fdb5c3a Author: Jean-Pierre Ledure AuthorDate: Sat Nov 11 17:02:38 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Sat Nov 11 18:20:15 2023 +0100 ScriptForge (SFDatabases) new Dataset service A dataset represents a set of tabular data stored/produced by a database. To use datasets, the database instance must exist but the Base document may not be open. A Dataset instance is create either with - the (new) database.CreateDataset() method - from an existing dataset with the (new) dataset.CreateDataset() method. The proposed API supports next main purposes: - browse for- and backward thru the dataset to get its content - update any record with new values - create new records or delete some. In summary, the AKA "CRUD" operations (create, read, update, delete). The originality of the proposed API is the use of a dense syntax to make insertions and updates easy and readable: Example: (BASIC) Dim newID As Long newID = dataset.Insert("LastName", "Doe", "FirstName", "John") ' ... is equivalent to: Dim dict As Object, newID As Long Set dict = CreateScriptService("ScriptForge.Dictionary") dict.Add("LastName", "Doe") dict.Add("FirstName", "John") newID = dataset.Insert(dict) (PYTHON) - next statements are equivalent newid = dataset.Insert('LastName', 'Doe', 'FirstName', 'John') newid = dataset.Insert({'LastName': 'Doe', 'FirstName': 'John'}) newid = dataset.Insert(dict(LastName = 'Doe', FirstName = 'John')) newid = dataset.Insert(LastName = 'Doe', FirstName = 'John') You will notice that the returned value is the AutoValue primery key (when it exists) which makes it reuse as a foreign key immediate. The API is fully available both in Basic and Python user scripts. The new service will require its inclusion in the user documentation. Change-Id: I4f834c4234e5b96ec8fddfffbad791ecf31899df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159325 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/Package_sfdatabases.mk b/wizards/Package_sfdatabases.mk index bc5636fa1b2f..2919c84dce3c 100644 --- a/wizards/Package_sfdatabases.mk +++ b/wizards/Package_sfdatabases.mk @@ -21,6 +21,7 @@ $(eval $(call gb_Package_Package,wizards_basicsrvsfdatabases,$(SRCDIR)/wizards/s $(eval $(call gb_Package_add_files,wizards_basicsrvsfdatabases,$(LIBO_SHARE_FOLDER)/basic/SFDatabases,\ SF_Database.xba \ + SF_Dataset.xba \ SF_Datasheet.xba \ SF_Register.xba \ __License.xba \ diff --git a/wizards/source/scriptforge/SF_Exception.xba b/wizards/source/scriptforge/SF_Exception.xba index 38e5b2ef24e0..4b0fdb8d5eb1 100644 --- a/wizards/source/scriptforge/SF_Exception.xba +++ b/wizards/source/scriptforge/SF_Exception.xba @@ -132,6 +132,10 @@ Const DUPLICATECONTROLERROR= DUPLICATECONTROLERROR SF_Database Const DBREADONLYERROR = DBREADONLYERROR Const SQLSYNTAXERROR = SQLSYNTAXERROR +Const SQLSYNTAX2ERROR = SQLSYNTAX2ERROR +Const NOCURRENTRECORDERROR = NOCURRENTRECORDERROR +Const RECORDUPDATEERROR= RECORDUPDATEERROR +Const FIELDEXPORTERROR = FIELDEXPORTERROR Python Const PYTHONSHELLERROR = PYTHONSHELLERROR @@ -1035,12 +1039,25 @@ Try: sMessage = sLocation _ \n \n \n .GetText(VALIDATEERROR, pvArgs(0)) _ \n \n .GetText(DUPLICATECONTROL, pvArgs(0), pvArgs(1), pvArgs(2)) - Case DBREADONLYERROR SF_Database.RunSql() + Case DBREADONLYERROR SF_Database.RunSql(), SF_Dataset.Delete(), Insert(), Update() sMessage = sLocation _ \n \n .GetText(DBRE
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_PythonHelper.xba |8 wizards/source/scriptforge/python/ScriptForgeHelper.py |2 wizards/source/scriptforge/python/scriptforge.py | 49 + wizards/source/sfdocuments/SF_Calc.xba | 39 + wizards/source/sfdocuments/SF_Document.xba | 457 + wizards/source/sfdocuments/SF_FormDocument.xba | 25 wizards/source/sfdocuments/SF_Writer.xba | 39 + 7 files changed, 611 insertions(+), 8 deletions(-) New commits: commit a29841ccbdf1e71b9a7c943c5c430d1a1b96234b Author: Jean-Pierre Ledure AuthorDate: Wed Oct 4 16:59:53 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Wed Oct 4 18:50:16 2023 +0200 ScriptForge (SFDocuments) Styles management Introduction of new properties and methods: - StyleFamilies List of available style families All document types except Base - XStyle(family, stylename) UNO representation of given style All document types except Base - Styles(family, [namepattern, used, userdefined, parentstyle, category) A list of styles matching the given criteria All document types except Base - DeleteStyles(family, styleslist) Suppress the user-defined styles in the list All document types except Base and FormDocument - ImportStylesFromFile(filename, families, overwrite) Load styles from a closed file Calc and Writer only Example: to delete unused styles: a = doc.Styles("ParagraphStyles", used := False) doc.DeleteStyles("ParagraphStyles", a) All functionalities are available from Basic and Python scripts. Documentation has to be completed. Change-Id: I2533c14912257b58feb42bb11ff9d151c7b9531a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157563 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba index b611dbfd0d7e..8ad0dfa7c06c 100644 --- a/wizards/source/scriptforge/SF_PythonHelper.xba +++ b/wizards/source/scriptforge/SF_PythonHelper.xba @@ -783,6 +783,7 @@ Try: Case SFDocuments.Document Select Case Script Case Forms : vReturn = vBasicObject.Forms(vArgs(0)) + Case Styles : vReturn = vBasicObject.Styles(vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5)) Case Toolbars : vReturn = vBasicObject.Toolbars(vArgs(0)) End Select Case SFDocuments.Base @@ -800,6 +801,7 @@ Try: Case SetArray : vReturn = vBasicObject.SetArray(vArgs(0), vArgs(1)) Case SetFormula : vReturn = vBasicObject.SetFormula(vArgs(0), vArgs(1)) Case SetValue : vReturn = vBasicObject.SetValue(vArgs(0), vArgs(1)) + Case Styles : vReturn = vBasicObject.Styles(vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5)) Case Toolbars : vReturn = vBasicObject.Toolbars(vArgs(0)) End Select Case SFDocuments.Form @@ -814,6 +816,12 @@ Try: Case Forms : vReturn = vBasicObject.Forms(vArgs(0)) Case Toolbars : vReturn = vBasicObject.Toolbars(vArgs(0)) End Select + Case SFDocuments.Writer + Select Case Script + Case Forms : vReturn = vBasicObject.Forms(vArgs(0)) + Case Styles : vReturn = vBasicObject.Styles(vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5)) + Case Toolbars
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Session.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d97b5849f3cfcecbdd929dca7bd7ac2c4fa31f8b Author: Jean-Pierre Ledure AuthorDate: Mon Oct 2 14:14:42 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Mon Oct 2 18:18:40 2023 +0200 ScriptForge (SF_Session) validate Recipient arg of SendMail When the Recipient argument is absent when calling session.SendMail(...) or is not a string, an error message is raised, as should, but its content is wrong. The error message is now corrected. Change-Id: I248b6ce55c85a4b956f834c8e1ea7d0df40ab233 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157488 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index 2bde313194b1..aeca1133e346 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -649,7 +649,7 @@ Check: If IsMissing(EditMessage) Or IsEmpty(EditMessage) Then EditMessage = True If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then - If Not SF_Utils._Validate(Cc, Recipient, V_STRING) Then GoTo Finally + If Not SF_Utils._Validate(Recipient, Recipient, V_STRING) Then GoTo Finally If Not SF_Utils._Validate(Cc, Cc, V_STRING) Then GoTo Finally If Not SF_Utils._Validate(Bcc, Bcc, V_STRING) Then GoTo Finally If Not SF_Utils._Validate(Subject, Subject, V_STRING) Then GoTo Finally
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - wizards/source
wizards/source/sfdocuments/SF_Base.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit b352ce86679d8ee751f57dc34ca808a62712e3b1 Author: Jean-Pierre Ledure AuthorDate: Thu Sep 28 15:03:32 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Thu Sep 28 17:20:41 2023 +0200 ScriptForge (SF_Base) tdf#156599 Error message when loading a form Error occurs in SF_Base.IsLoaded(...) "Object variable not set" When user scripts run the method repeatedly from nearly simultaneous events, it might happen that the _FormDocuments private variable is not initialized. Simultaneous calls may be interpreted as internal calls. Internal calls do not execute the "Check" part of the published API. Hence the failing initialization. Solution: force the initialization of that specific variable at each run. Change-Id: I489cbaed7b8e57d6876b7af4b26f5be0beb3db69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157374 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit 3ce1237c0149d05e993eaac41634ce5dfe2ccca6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157319 diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba index 5c8c909b8cf2..b7662b7341cd 100644 --- a/wizards/source/sfdocuments/SF_Base.xba +++ b/wizards/source/sfdocuments/SF_Base.xba @@ -415,10 +415,10 @@ Const cstSubArgs = FormDocument bLoaded = False Check: + If IsNull(_FormDocuments) Then Set _FormDocuments = _Component.getFormDocuments() If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not _IsStillAlive() Then GoTo Finally Build list of available FormDocuments recursively with _CollectFormDocuments - If IsNull(_FormDocuments) Then Set _FormDocuments = _Component.getFormDocuments() vFormNames = Split(_CollectFormDocuments(_FormDocuments), cstToken) If Not ScriptForge.SF_Utils._Validate(FormDocument, FormDocument, V_STRING, vFormNames) Then GoTo Finally End If
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Base.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit bbe4d3498c2f994342b4d213f0ae874e7b0b7775 Author: Jean-Pierre Ledure AuthorDate: Thu Sep 28 15:03:32 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Thu Sep 28 16:16:38 2023 +0200 ScriptForge (SF_Base) tdf#156599 Error message when loading a form Error occurs in SF_Base.IsLoaded(...) "Object variable not set" When user scripts run the method repeatedly from nearly simultaneous events, it might happen that the _FormDocuments private variable is not initialized. Simultaneous calls may be interpreted as internal calls. Internal calls do not execute the "Check" part of the published API. Hence the failing initialization. Solution: force the initialization of that specific variable at each run. Change-Id: I489cbaed7b8e57d6876b7af4b26f5be0beb3db69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157374 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba index f96ddfd22e46..b6497b9b4f12 100644 --- a/wizards/source/sfdocuments/SF_Base.xba +++ b/wizards/source/sfdocuments/SF_Base.xba @@ -415,10 +415,10 @@ Const cstSubArgs = FormDocument bLoaded = False Check: + If IsNull(_FormDocuments) Then Set _FormDocuments = _Component.getFormDocuments() If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not _IsStillAlive() Then GoTo Finally Build list of available FormDocuments recursively with _CollectFormDocuments - If IsNull(_FormDocuments) Then Set _FormDocuments = _Component.getFormDocuments() vFormNames = Split(_CollectFormDocuments(_FormDocuments), cstToken) If Not ScriptForge.SF_Utils._Validate(FormDocument, FormDocument, V_STRING, vFormNames) Then GoTo Finally End If
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Utils.xba |2 +- wizards/source/scriptforge/po/ScriptForge.pot|4 ++-- wizards/source/scriptforge/po/en.po |4 ++-- wizards/source/scriptforge/python/scriptforge.py |2 +- 4 files changed, 6 insertions(+), 6 deletions(-) New commits: commit f9c4973ac604ae091de08484ee2f5599db90a3a3 Author: Jean-Pierre Ledure AuthorDate: Sun Sep 3 13:16:05 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sun Sep 3 14:49:17 2023 +0200 ScriptForge - Upgrade version number (7.6 => 24.2) Change-Id: I0e7ceeafcf4c5a802249125e6be44a71adb1456b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156480 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Utils.xba b/wizards/source/scriptforge/SF_Utils.xba index 608a2e8422ca..5ebdd58ce9ab 100644 --- a/wizards/source/scriptforge/SF_Utils.xba +++ b/wizards/source/scriptforge/SF_Utils.xba @@ -21,7 +21,7 @@ REM = GLOBAL Global _SF_As VariantSF_Root (Basic) object) ScriptForge version -Const SF_Version = 7.6 +Const SF_Version = 24.2 Standard symbolic names for VarTypes V_EMPTY = 0 diff --git a/wizards/source/scriptforge/po/ScriptForge.pot b/wizards/source/scriptforge/po/ScriptForge.pot index 1f18806679ac..644399bbbd15 100644 --- a/wizards/source/scriptforge/po/ScriptForge.pot +++ b/wizards/source/scriptforge/po/ScriptForge.pot @@ -7,14 +7,14 @@ # *** are part of the LibreOffice project. *** # * # -# ScriptForge Release 7.6 +# ScriptForge Release 24.2 # --- # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice_status=UNCONFIRMED=UI\n; -"POT-Creation-Date: 2023-07-14 16:26:26\n" +"POT-Creation-Date: 2023-09-03 13:05:04\n" "PO-Revision-Date: -MM-DD HH:MM:SS\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/wizards/source/scriptforge/po/en.po b/wizards/source/scriptforge/po/en.po index 1f18806679ac..644399bbbd15 100644 --- a/wizards/source/scriptforge/po/en.po +++ b/wizards/source/scriptforge/po/en.po @@ -7,14 +7,14 @@ # *** are part of the LibreOffice project. *** # * # -# ScriptForge Release 7.6 +# ScriptForge Release 24.2 # --- # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice_status=UNCONFIRMED=UI\n; -"POT-Creation-Date: 2023-07-14 16:26:26\n" +"POT-Creation-Date: 2023-09-03 13:05:04\n" "PO-Revision-Date: -MM-DD HH:MM:SS\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 01da93cf6c28..060c57208de7 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -108,7 +108,7 @@ class ScriptForge(object, metaclass = _Singleton): # Class constants # # library = 'ScriptForge' -Version = '7.6' # Actual version number +Version = '24.2' # Actual version number # # Basic dispatcher for Python scripts (@scope#library.module.function) basicdispatcher = '@application#ScriptForge.SF_PythonHelper._PythonDispatcher'
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |8 +++ wizards/source/sfdocuments/SF_Base.xba |2 - wizards/source/sfdocuments/SF_Calc.xba |6 + wizards/source/sfdocuments/SF_Document.xba | 24 +++ wizards/source/sfdocuments/SF_FormDocument.xba |6 + wizards/source/sfdocuments/SF_Writer.xba |6 + 6 files changed, 47 insertions(+), 5 deletions(-) New commits: commit b3278aa41d036a7fd9f3a8ce9aa683397e87e6a8 Author: Jean-Pierre Ledure AuthorDate: Sat Sep 2 17:57:24 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sun Sep 3 11:00:26 2023 +0200 ScriptForge (SF_Document) new XDocumentSettings property The XDocumentSettings property returns a com.sun.star.XXX.DocumentSettings UNO object. XXX = sheet, text, drawing or presentation It gives access to a bunch of UNO internal properties, specific to the document(s type. The property is available in Basic and Python user scripts. An update of the SF_Document service help page is required. Change-Id: I9d6db473c91ac5b1814def9cd100e874aa5490cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156475 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index b235a791f87d..01da93cf6c28 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -2165,7 +2165,7 @@ class SFDocuments: DocumentType = False, ExportFilters = False, FileSystem = False, ImportFilters = False, IsBase = False, IsCalc = False, IsDraw = False, IsFormDocument = False, IsImpress = False, IsMath = False, IsWriter = False, Keywords = True, Readonly = False, - Subject = True, Title = True, XComponent = False) + Subject = True, Title = True, XComponent = False, XDocumentSettings = False) # Force for each property to get its value from Basic - due to intense interactivity with user forceGetProperty = True @@ -2292,7 +2292,7 @@ class SFDocuments: FileSystem = False, ImportFilters = False, IsBase = False, IsCalc = False, IsDraw = False, IsFormDocument = False, IsImpress = False, IsMath = False, IsWriter = False, Keywords = True, Readonly = False, Sheets = False, Subject = True, - Title = True, XComponent = False) + Title = True, XComponent = False, XDocumentSettings = False) # Force for each property to get its value from Basic - due to intense interactivity with user forceGetProperty = True @@ -2648,7 +2648,7 @@ class SFDocuments: servicesynonyms = ('formdocument', 'sfdocuments.formdocument') serviceproperties = dict(DocumentType = False, FileSystem = False, IsBase = False, IsCalc = False, IsDraw = False, IsFormDocument = False, IsImpress = False, IsMath = False, - IsWriter = False, Readonly = False, XComponent = False) + IsWriter = False, Readonly = False, XComponent = False, XDocumentSettings = False) @classmethod def ReviewServiceArgs(cls, windowname = ''): @@ -2687,7 +2687,7 @@ class SFDocuments: DocumentType = False, ExportFilters = False, FileSystem = False, ImportFilters = False, IsBase = False, IsCalc = False, IsDraw = False, IsFormDocument = False, IsImpress = False, IsMath = False, IsWriter = False, Keywords = True, Readonly = False, - Subject = True, Title = True, XComponent = False) + Subject = True, Title = True, XComponent = False, XDocumentSettings = False) # Force for each property to get its value from Basic - due to intense interactivity with user forceGetProperty = True diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba index 67e4663b0748..f96ddfd22e46 100644 --- a/wizards/source/sfdocuments/SF_Base.xba +++ b/wizards/source/sfdocuments/SF_Base.xba @@ -1125,4 +1125,4 @@ Private Function _Repr() As String End Function SFDocuments.SF_Base._Repr REM END OF SFDOCUMENTS.SF_BASE - + \ No newline at end of file diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index a78762056fb0..941f23834230 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - wizards/source
wizards/source/sfdatabases/SF_Database.xba |3 +++ wizards/source/sfdocuments/SF_Base.xba |3 +++ 2 files changed, 6 insertions(+) New commits: commit 57d492a77143e9cc25e6ab6f292d184ff2f0c108 Author: Jean-Pierre Ledure AuthorDate: Mon Aug 21 15:01:53 2023 +0200 Commit: Xisco Fauli CommitDate: Tue Aug 22 12:52:19 2023 +0200 ScriptForge - fix tdf#156836 Abort on MoveFirst() The incident occurs when a move (last(), first(), next()) within the form's resultset is done from a Basic script immediately after the opening of the document containing the form. The insertion of a Wait 1 statement prevents the occurrence of the incident by interrupting very shortly the Basic process. Change-Id: I5e798db6e3f9ffaeeef38fb9badd008cbb190d1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155897 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit f1412705bed9faad3d9a4e36e7dcea9eb3cb98d0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155912 diff --git a/wizards/source/sfdatabases/SF_Database.xba b/wizards/source/sfdatabases/SF_Database.xba index f93cf55d74c0..109d4c57d909 100644 --- a/wizards/source/sfdatabases/SF_Database.xba +++ b/wizards/source/sfdatabases/SF_Database.xba @@ -455,6 +455,9 @@ Try: Set oOpen = ScriptForge.SF_Services.CreateScriptService(SFDocuments.FormDocument, oNewForm) + Prevent desynchonization when using .last(), .next() etc immediately after component loading. Bug #156836 + Wait 1 + Finally: Set OpenFormDocument = oOpen ScriptForge.SF_Utils._ExitFunction(cstThisSub) diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba index cc5ab488365e..5c8c909b8cf2 100644 --- a/wizards/source/sfdocuments/SF_Base.xba +++ b/wizards/source/sfdocuments/SF_Base.xba @@ -505,6 +505,9 @@ Try: Set oOpen = ScriptForge.SF_Services.CreateScriptService(SFDocuments.FormDocument, oNewForm) + Prevent desynchonization when using .last(), .next() etc immediately after component loading. Bug #156836 + Wait 1 + Finally: Set OpenFormDocument = oOpen ScriptForge.SF_Utils._ExitFunction(cstThisSub)
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdatabases/SF_Database.xba |3 +++ wizards/source/sfdocuments/SF_Base.xba |3 +++ 2 files changed, 6 insertions(+) New commits: commit 84bc3ffcf5c570f044843125552589456b07f5a1 Author: Jean-Pierre Ledure AuthorDate: Mon Aug 21 15:01:53 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Mon Aug 21 17:33:29 2023 +0200 ScriptForge - fix tdf#156836 Abort on MoveFirst() The incident occurs when a move (last(), first(), next()) within the form's resultset is done from a Basic script immediately after the opening of the document containing the form. The insertion of a Wait 1 statement prevents the occurrence of the incident by interrupting very shortly the Basic process. Change-Id: I5e798db6e3f9ffaeeef38fb9badd008cbb190d1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155897 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdatabases/SF_Database.xba b/wizards/source/sfdatabases/SF_Database.xba index f93cf55d74c0..109d4c57d909 100644 --- a/wizards/source/sfdatabases/SF_Database.xba +++ b/wizards/source/sfdatabases/SF_Database.xba @@ -455,6 +455,9 @@ Try: Set oOpen = ScriptForge.SF_Services.CreateScriptService(SFDocuments.FormDocument, oNewForm) + Prevent desynchonization when using .last(), .next() etc immediately after component loading. Bug #156836 + Wait 1 + Finally: Set OpenFormDocument = oOpen ScriptForge.SF_Utils._ExitFunction(cstThisSub) diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba index efc8bfeb148c..af1ebc1e4930 100644 --- a/wizards/source/sfdocuments/SF_Base.xba +++ b/wizards/source/sfdocuments/SF_Base.xba @@ -505,6 +505,9 @@ Try: Set oOpen = ScriptForge.SF_Services.CreateScriptService(SFDocuments.FormDocument, oNewForm) + Prevent desynchonization when using .last(), .next() etc immediately after component loading. Bug #156836 + Wait 1 + Finally: Set OpenFormDocument = oOpen ScriptForge.SF_Utils._ExitFunction(cstThisSub)
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Array.xba |8 wizards/source/scriptforge/SF_PythonHelper.xba | 118 - wizards/source/scriptforge/python/scriptforge.py | 279 +-- 3 files changed, 224 insertions(+), 181 deletions(-) New commits: commit 0bbe5b4f2a7797bfd05fdbde316857fceaf84d77 Author: Jean-Pierre Ledure AuthorDate: Sat Aug 19 17:30:25 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sun Aug 20 10:48:48 2023 +0200 ScriptForge - Refactor Python <=> Basic protocol Incremental changes had made the code in SF_PythonHelper.xba scriptforge.py (which manage the protocol between the Python user scripts and the ScriptForge services implemented in Basic) less readable and efficient. Next features have been reviewed: - dict instances may be passed as arguments and returned. Conversions are done on-th-fly. - dates may be passed as arguments and returned. Conversions are done on-th-fly. The lists of hardcoded methods have been removed. - 2D arrays in standard modules may be passed as arguments and returned. Conversions are done on-th-fly. The lists of hardcoded methods have been removed. - The hardcoded list of methods requiring a post- processing has been reduced. - Methods in standard modules, when not returning an array, are also executed with CallByName(). - The unused 'localProperties' attribute in Python services has been removed. - Flags about arrays in standard modules have been adapted in filesystem.Files() filesystem.SubFolders() session.UnoMethods() session.UnoProperties() string.SplitNotQuoted() string.Wrap() ui.Documents() - The platform.UserData property became a usual property. Dictionaries are admitted as arguments and return values. As a consquence next functions are supported in Python as well: session.GetPDFExportOpetions() session.SetPDFExportOptions() document, calc, writer.CustomProperties document, calc, writer.DocumentProperties These changes require an update of the help pages. Non-regression tests were run with success. All changes are transparent for existing scripts. Change-Id: Iae7a1f5090c590209cd3cb2314c919c44736eba9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155860 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba index 49bdab14770a..54110cde9352 100644 --- a/wizards/source/scriptforge/SF_Array.xba +++ b/wizards/source/scriptforge/SF_Array.xba @@ -849,7 +849,6 @@ REM Public Function ImportFromCSVFile(Optional ByRef FileName As Variant _ , Optional ByVal Delimiter As Variant _ , Optional ByVal DateFormat As Variant _ - , Optional ByVal _IsoDate As Variant _ ) As Variant Import the data contained in a comma-separated values (CSV) file The comma may be replaced by any character @@ -866,7 +865,6 @@ Public Function ImportFromCSVFile(Optional ByRef FileName As Variant _ The dash (-) may be replaced by a dot (.), a slash (/) or a space Other date formats will be ignored If (default), dates will be considered as strings - _IsoDate: when True, the execution is initiated from Python, do not convert dates to Date variables. Internal use only Returns: A 2D-array with each row corresponding with a single record read in the file and each column corresponding with a field of the record @@ -892,7 +890,9 @@ Dim vItem As Variant Individual item in the output array Dim iPosition As Integer Date position in individual item Dim iYear As Integer, iMonth As Integer, iDay As Integer Date components +Dim bIsoDate As Boolean When True, do not convert dates to Date variables Dim i As Long + Const cstItemsLimit = 25 Maximum number of admitted items Const cstThisSub = Array.ImportFromCSVFile Const cstSubArgs = FileName, [Delimiter=,], [DateFormat=] @@ -903,7 +903,6 @@ Const cstSubArgs = FileName, [Delimiter=,], [DateF Check: If IsMissing(Delimiter) Or IsEmpty(Delimiter) Then Delimiter = , If IsMissing(DateFormat) Or IsEmpty(DateFormat) Then DateFormat = - If IsMissing(_IsoDate) Or IsEmpty(_IsoDate) Then _I
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdatabases/SF_Register.xba | 20 ++-- wizards/source/sfdocuments/SF_Form.xba |3 +++ wizards/source/sfdocuments/SF_FormDocument.xba |5 - 3 files changed, 21 insertions(+), 7 deletions(-) New commits: commit d2c1a4fa508572cc2908787deeebc5baa9d6e0c3 Author: Jean-Pierre Ledure AuthorDate: Wed Aug 9 12:33:39 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Wed Aug 9 14:45:23 2023 +0200 SCriptForge (SFDatabases) manage database credentials When not embedded, databases usually require user and password to grant access to scripts. When the access was refused, so far the execution was stopped brutally with an error message provided by LO internal code. This was made visible during some tests with a MySql database server. The code to be reviewed is located in the creation of the "database" service. This service has the sungularity that it can be called from several other service instances. As from this commit unsuccessful tentatives to login to a database from code are rejected with a clean SF error message. The different scenarios to create a database service have been (re)tested. Change-Id: I695d108242872d27671688af76916784908aeebe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155507 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdatabases/SF_Register.xba b/wizards/source/sfdatabases/SF_Register.xba index 04c76ff59e94..cee09f94f3f3 100644 --- a/wizards/source/sfdatabases/SF_Register.xba +++ b/wizards/source/sfdatabases/SF_Register.xba @@ -25,6 +25,7 @@ Option Explicit REM == EXCEPTIONS Private Const BASEDOCUMENTOPENERROR= BASEDOCUMENTOPENERROR +Private Const DBCONNECTERROR = DBCONNECTERROR REM == PUBLIC METHODS @@ -65,7 +66,8 @@ Public Function _NewDatabase(Optional ByVal pvArgs As Variant) As Object Returns: The instance or Nothing Exceptions: - BASEDOCUMENTOPENERROR The database file could not be opened or connected + BASEDOCUMENTOPENERROR The database file could not be opened + DBCONNECTERROR The database could not be connected, credentials are probably wrong Dim oDatabase As Object Return value Dim vFileName As Variant alias of pvArgs(0) @@ -116,7 +118,9 @@ Try: Set .[Me] = oDatabase ._Location = ConvertToUrl(vFileName) Set ._DataSource = oDBContext.getByName(._Location) + If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo CatchConnect Set ._Connection = ._DataSource.getConnection(vUser, vPassword) + If IsNull(._Connection) Then GoTo CatchConnect ._ReadOnly = vReadOnly Set ._MetaData = ._Connection.MetaData ._URL = ._MetaData.URL @@ -130,20 +134,23 @@ Catch: CatchError: ScriptForge.SF_Exception.RaiseFatal(BASEDOCUMENTOPENERROR, FileName, vFileName, RegistrationName, vRegistration) GoTo Finally +CatchConnect: + ScriptForge.SF_Exception.RaiseFatal(DBCONNECTERROR, User, vUser, Password, vPassword, vFileName) + GoTo Finally End Function SFDatabases.SF_Register._NewDatabase REM - Public Function _NewDatabaseFromSource(Optional ByVal pvArgs As Variant) As Object - ByRef poDataSource As Object _ - , ByVal psUser As String _ - , ByVal psPassword As String _ + ByRef oDataSource As Object _ + , ByVal sUser As String _ + , ByVal sPassword As String _ ) As Object Create a new instance of the SF_Database class from the given datasource established in the SFDocuments.Base service THIS SERVICE MUST NOT BE CALLED FROM A USER SCRIPT Args: - DataSource: com.sun.star.sdbc.XDataSource - User, Password : connection parameters + oDataSource:com.sun.star.sdbc.XDataSource + sUser, sPassword : connection parameters Returns: Th
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6-0' - wizards/source
wizards/source/scriptforge/SF_Session.xba |2 ++ 1 file changed, 2 insertions(+) New commits: commit b9d9dba945d88f0eafbac874c9fc1b432113d23f Author: Jean-Pierre Ledure AuthorDate: Sun Jul 30 15:03:15 2023 +0200 Commit: Christian Lohmaier CommitDate: Mon Aug 7 15:15:35 2023 +0200 ScriptForge (SF_Session) fix SendMail() w/o attachment Fix error message when no attachment is passed to the method. Execution will continue now without trouble. Change-Id: I447af45db97f086963027c131c6b5fb9dab93c7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155066 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit 1e94999d6198258d1451584e96810bd8fb294653) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155040 (cherry picked from commit 6c50435a56cade7b4a9c48aaa85ef3c8eca6f15a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155143 Reviewed-by: Xisco Fauli Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index b4292f36ea83..2bde313194b1 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -679,6 +679,8 @@ Check: If Not SF_FileSystem.FileExists(sFile) Then GoTo CatchNotExists vFileNames(i) = ConvertToUrl(sFile) Next i + Else + vFileNames = Array() End If Try:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - wizards/source
wizards/source/scriptforge/SF_Session.xba |2 ++ 1 file changed, 2 insertions(+) New commits: commit 3f72da38ed0d5d69bf68577b61cdfa60777094cd Author: Jean-Pierre Ledure AuthorDate: Sun Jul 30 15:03:15 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Mon Jul 31 11:53:16 2023 +0200 ScriptForge (SF_Session) fix SendMail() w/o attachment Fix error message when no attachment is passed to the method. Execution will continue now without trouble. Change-Id: I447af45db97f086963027c131c6b5fb9dab93c7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155066 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit 1e94999d6198258d1451584e96810bd8fb294653) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155040 (cherry picked from commit ec03e4833659eab7918c026ab9e60e83dbc8c5be) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155042 diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index b4292f36ea83..2bde313194b1 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -679,6 +679,8 @@ Check: If Not SF_FileSystem.FileExists(sFile) Then GoTo CatchNotExists vFileNames(i) = ConvertToUrl(sFile) Next i + Else + vFileNames = Array() End If Try:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - wizards/source
wizards/source/scriptforge/SF_Session.xba |2 ++ 1 file changed, 2 insertions(+) New commits: commit 6c50435a56cade7b4a9c48aaa85ef3c8eca6f15a Author: Jean-Pierre Ledure AuthorDate: Sun Jul 30 15:03:15 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Mon Jul 31 09:34:57 2023 +0200 ScriptForge (SF_Session) fix SendMail() w/o attachment Fix error message when no attachment is passed to the method. Execution will continue now without trouble. Change-Id: I447af45db97f086963027c131c6b5fb9dab93c7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155066 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit 1e94999d6198258d1451584e96810bd8fb294653) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155040 diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index b4292f36ea83..2bde313194b1 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -679,6 +679,8 @@ Check: If Not SF_FileSystem.FileExists(sFile) Then GoTo CatchNotExists vFileNames(i) = ConvertToUrl(sFile) Next i + Else + vFileNames = Array() End If Try:
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Session.xba |2 ++ 1 file changed, 2 insertions(+) New commits: commit bd640d338b6c8a1a4915c4b88b52ac1cc48f7dd0 Author: Jean-Pierre Ledure AuthorDate: Sun Jul 30 15:03:15 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sun Jul 30 18:28:48 2023 +0200 ScriptForge (SF_Session) fix SendMail() w/o attachment Fix error message when no attachment passed to the method. Execution continues now without trouble. Change-Id: I447af45db97f086963027c131c6b5fb9dab93c7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155066 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index b4292f36ea83..2bde313194b1 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -679,6 +679,8 @@ Check: If Not SF_FileSystem.FileExists(sFile) Then GoTo CatchNotExists vFileNames(i) = ConvertToUrl(sFile) Next i + Else + vFileNames = Array() End If Try:
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Platform.xba | 32 +++ wizards/source/scriptforge/SF_PythonHelper.xba |2 + wizards/source/scriptforge/python/scriptforge.py | 12 +++- 3 files changed, 45 insertions(+), 1 deletion(-) New commits: commit 0f43960ec87229f15f9138d83072bb1f510fa9b2 Author: Jean-Pierre Ledure AuthorDate: Fri Jul 28 16:47:10 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sat Jul 29 12:39:34 2023 +0200 ScriptForge (SF_Platform) new UserData property The UserData property lists the content of the "User Data" oage of the Options dialog. The content is returned: - in Basic: in a SF_Dictionary instance - in Python: in a dict[] instance. The list of the available keys is: city, company, country, email, encryptionkey, encrypttoself, fax, firstname, homephone, initials, lastname, officephone, position, postalcode, signingkey, state, street, title Many are different from the UNO/priginal values to make them more user understandable. This commit will require an update of the SF_Platform help page. Both Basic and Python user scripts are supported. Change-Id: If645579ee9109a1b8180da5a5f3a71979bb5ca59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155024 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Platform.xba b/wizards/source/scriptforge/SF_Platform.xba index 8403866fffe8..8e8aa5330a9d 100644 --- a/wizards/source/scriptforge/SF_Platform.xba +++ b/wizards/source/scriptforge/SF_Platform.xba @@ -217,6 +217,14 @@ Property Get SystemLocale() As String SystemLocale = _PropertyGet(SystemLocale) End Property ScriptForge.SF_Platform.SystemLocale (get) +REM - +Property Get UserData() As Variant + Returns a dictionary of all Options + User Data values + Example: + MsgBox platform.UserData + UserData = _PropertyGet(UserData) +End Property ScriptForge.SF_Platform.UserData (get) + REM = METHODS REM - @@ -285,6 +293,7 @@ Public Function Properties() As Variant , Processor _ , PythonVersion _ , SystemLocale _ + , UserData _ ) End Function ScriptForge.SF_Platform.Properties @@ -374,6 +383,10 @@ Dim sFont As String A single font name Dim vExtensionsList As Variant Array of extension descriptors Dim sExtensions As StringComma separated list of extensions Dim sExtension As String A single extension name +Dim vUserDataInternal As Variant The internal names of the supported user data items +Dim vUserDataExternal As Variant The external names of the supported user data items +Dim vUserData As Variant A SF_Dictionary instance linking user data external names and values +Dim vUserDataOptions As Variant configmgr.RootAccess Dim i As Long Const cstPyHelper = $ _SF_Platform @@ -438,6 +451,25 @@ Const cstSubArgs = Case SystemLocale, Locale Set oLocale = SF_Utils._GetUNOService(SystemLocale) _PropertyGet = oLocale.Language - oLocale.Country + Case UserData + vUserDataExternal = Array( _ + city, company, country, email, encryptionkey, encrypttoself, fax _ + , firstname, homephone, initials, lastname, officephone, position _ + , postalcode, signingkey, state, street, title _ + ) + vUserDataInternal = Array( _ + l, o, c, mail, encryptionkey, encrypttoself, facsimiletelephonenumber _ + , givenname, homephone, initials, sn, telephonenumber, position _ + , postalcode, signingkey, st, street, title _ + ) + Get the UserData page from the Options database + vUserDataOptions = SF_Utils._GetRegistryKeyContent(org.openoffice.UserProfile/Data) + Create and feed the ouput dictionary + vUserData = CreateScriptService(ScriptForge.Dictionary) + For i = 0 To UBound(vUserDataExternal) + vUserData.Add(vUserDataExternal(i), vUserDataOptions.getByName(vUserDataInternal(i))) + Next i + _P
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_FileSystem.xba |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit d5e1e4103b2ee77140d4866c4b4f482cb0ee184f Author: Jean-Pierre Ledure AuthorDate: Sun Jul 23 10:53:24 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sun Jul 23 16:10:06 2023 +0200 ScriptForge (SF_FileSystem) Fix typos Typos in comment lines Change-Id: I5e92417af0c9fb1f6f4d240a5a7731c9efa5230d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154802 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index d7b8ba926442..e37d4d3dcec6 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -967,7 +967,7 @@ Public Function GetFileLen(Optional ByVal FileName As Variant) As Currency File size if FileName exists 0 when FileName belongs to a documents internal file systems. Exceptions: - UNKNOWNFILEERRORThe file does not exist of is a folder + UNKNOWNFILEERRORThe file does not exist or is a folder Example: Print SF_FileSystem.GetFileLen(C:\pagefile.sys) @@ -1018,7 +1018,7 @@ Public Function GetFileModified(Optional ByVal FileName As Variant) As Variant Returns: The modification date and time as a Basic Date Exceptions: - UNKNOWNFILEERRORThe file does not exist of is a folder + UNKNOWNFILEERRORThe file does not exist or is a folder FILESYSTEMERROR The method is not applicable on documents file systems Example: Dim a As Date @@ -1248,7 +1248,7 @@ Public Function HashFile(Optional ByVal FileName As Variant _ The requested checksum as a string. Hexadecimal digits are lower-cased A zero-length string when an error occurred Exceptions: - UNKNOWNFILEERRORThe file does not exist of is a folder + UNKNOWNFILEERRORThe file does not exist or is a folder FILESYSTEMERROR The method is not applicable on documents file systems Example: Print SF_FileSystem.HashFile(C:\pagefile.sys, MD5) @@ -2370,4 +2370,4 @@ Dim sFolder As String Folder End Function ScriptForge.SF_FileSystem._SFInstallFolder REM END OF SCRIPTFORGE.SF_FileSystem - + \ No newline at end of file
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_FileSystem.xba | 202 --- wizards/source/scriptforge/SF_TextStream.xba |2 wizards/source/scriptforge/python/scriptforge.py |8 3 files changed, 151 insertions(+), 61 deletions(-) New commits: commit c216a5fc499dd3cd4324c30aa69df415ecf22113 Author: Jean-Pierre Ledure AuthorDate: Sat Jul 22 16:10:14 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sat Jul 22 18:03:36 2023 +0200 ScriptForge (SF_FileSystem) IncludeSubfolders argument In the FileSystem service, the - SubFolders() - Files() methods receive an optional argument IncludeSubfolders (Boolean). That argument determines whether or not only the given FolderName is explored or also its subfolders up to the bottom of the folders structure. The argument must be used with caution as the number of returned folders or files may increase rapidly. anThis could consume excessive process time. This patch will require an update of the help page about the filesystem service. The new argument is available both for Basic and Python user scripts. Change-Id: Id2a96cd63cb51f8681f20a203a711b47a636fc3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154763 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index bb611d69b59a..2364ec4206b1 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -84,6 +84,11 @@ Const cstForAppending= 8 Document file system Const DOCFILESYSTEM= vnd.sun.star.tdoc:/ + Folders and files scanning +Const cstSEPARATOR = //; Separates folders or files in the accumulators +Const cstFILES = 1 Caler = Files() +Const cstFOLDERS = 2 Caller = SubFolders() + REM = CONSTRUCTOR/DESTRUCTOR REM - @@ -762,11 +767,15 @@ End Function ScriptForge.SF_FileSystem.FileExists REM - Public Function Files(Optional ByVal FolderName As Variant _ , Optional ByVal Filter As Variant _ + , Optional ByVal IncludeSubfolders As Variant _ ) As Variant Return an array of the FileNames stored in the given folder. The folder must exist + Subfolders may be optionally explored too. + If the number of files exceeds a reasonable amount ( 1000 ?), the process time may become long. Args: FolderName: the folder to explore Filter: contains wildcards (? and *) to limit the list to the relevant files (default = ) + IncludeSubfolders: when True (default = False), subfolders are explored too. Returns: An array of strings, each entry is the FileName of an existing file Exceptions: @@ -775,58 +784,36 @@ Public Function Files(Optional ByVal FolderName As Variant _ Example: Dim a As Variant FSO.FileNaming = SYS - a = FSO.Files(C:\Windows\) + a = FSO.Files(C:\Windows\, IncludeSubfolders := True) Dim vFiles As VariantReturn value Dim oSfa As Object com.sun.star.ucb.SimpleFileAccess -Dim sFolderName As StringURL lias for FolderName -Dim sFile As String Single file -Dim bDocFileSystem As BooleanWhen True, a document file system is being explored +Dim sFilesColl As String cstSEPARATOR delimited string of list of files (FileNaming notation) Dim i As Long Const cstThisSub = FileSystem.Files -Const cstSubArgs = FolderName, [Filter=] +Const cstSubArgs = FolderName, [Filter=], [IncludeSubfolders=False] If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch vFiles = Array() Check: If IsMissing(Filter) Or IsEmpty(Filter) Then Filter = + If IsMissing(IncludeSubfolders) Or IsEmpty(IncludeSubfolders) Then IncludeSubfolders = False If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not SF_Utils._ValidateFile(FolderName, FolderName) Then GoTo Finally If Not SF_Utils._Validate(Filter, Filter, V_STRING) Then GoTo Finally + If Not SF_Utils._Validate(IncludeSubfolders, IncludeSubfolders, V_BOOLEAN) Then GoTo Finally End If - sFolderName = SF_FileSystem
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - wizards/source
wizards/source/sfdocuments/SF_FormDocument.xba |1 - 1 file changed, 1 deletion(-) New commits: commit 28755b163993a29654a17b6d189273d2ded39873 Author: Jean-Pierre Ledure AuthorDate: Tue Jul 18 16:31:10 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Fri Jul 21 10:41:17 2023 +0200 ScriptForge (SF_FormDocument) fix tdf#156356 Variable not defined Change-Id: I4bbd4b05ca42ccde4b83eb55a1f1ae80ebca9680 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154592 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure (cherry picked from commit d1cf6a9b765ae981ef0469835fb05750b66d6204) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154618 diff --git a/wizards/source/sfdocuments/SF_FormDocument.xba b/wizards/source/sfdocuments/SF_FormDocument.xba index a619ac113aa4..29c2bfff8b1c 100644 --- a/wizards/source/sfdocuments/SF_FormDocument.xba +++ b/wizards/source/sfdocuments/SF_FormDocument.xba @@ -103,7 +103,6 @@ Private Sub Class_Initialize() Set _BaseComponent = Nothing Set _FormDocument = Nothing Set _DataSource = Nothing - Set _Database = Nothing _PersistentName = _HierarchicalName = End Sub SFDocuments.SF_FormDocument Constructor
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_FormDocument.xba |1 - 1 file changed, 1 deletion(-) New commits: commit 3480cfdb1e153ff489dcbd3790c3f120fdde13a0 Author: Jean-Pierre Ledure AuthorDate: Tue Jul 18 16:31:10 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Wed Jul 19 15:08:38 2023 +0200 ScriptForge (FormDocument) fix tdf#156356 Variable not defined Change-Id: I4bbd4b05ca42ccde4b83eb55a1f1ae80ebca9680 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154592 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/sfdocuments/SF_FormDocument.xba b/wizards/source/sfdocuments/SF_FormDocument.xba index ca2f8e70..4270c08e2907 100644 --- a/wizards/source/sfdocuments/SF_FormDocument.xba +++ b/wizards/source/sfdocuments/SF_FormDocument.xba @@ -103,7 +103,6 @@ Private Sub Class_Initialize() Set _BaseComponent = Nothing Set _FormDocument = Nothing Set _DataSource = Nothing - Set _Database = Nothing _PersistentName = _HierarchicalName = End Sub SFDocuments.SF_FormDocument Constructor
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Exception.xba |5 wizards/source/scriptforge/SF_FileSystem.xba | 177 ++- wizards/source/scriptforge/SF_Region.xba |2 wizards/source/scriptforge/SF_Root.xba | 15 + wizards/source/scriptforge/SF_TextStream.xba | 27 +++ wizards/source/scriptforge/SF_Utils.xba |7 wizards/source/scriptforge/po/ScriptForge.pot| 15 + wizards/source/scriptforge/po/en.po | 15 + wizards/source/scriptforge/python/scriptforge.py | 42 ++--- wizards/source/sfdocuments/SF_Base.xba |6 wizards/source/sfdocuments/SF_Calc.xba |6 wizards/source/sfdocuments/SF_Document.xba | 23 ++ wizards/source/sfdocuments/SF_FormDocument.xba |6 wizards/source/sfdocuments/SF_Writer.xba |6 14 files changed, 290 insertions(+), 62 deletions(-) New commits: commit 44334328f75dd0023122a4cb446ccba0d507720c Author: Jean-Pierre Ledure AuthorDate: Fri Jul 14 17:11:14 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sat Jul 15 09:54:01 2023 +0200 ScriptForge (SF_FileSystem) support document(s internal file structure 1. The SF_Document services (document, base, calc, formdocument, writer) receive a new FileSystem property that returns the "root" of the component's file structure under the format: "vnd.sun.star.tdoc:/XXX" XXX being the document's identifier. The implementation does not use the RuntimeUID (UNO property of the OfficeDocument service) which is optional and, f.i. not present for Base documents. Instead the css.frame.TransientDocumentsDocumentContentFactory service is used. 2. The SF_FileSystem and SF_TextStream modules have been reviewed to support the new context. Next restrictions have been met: - The FileNaming property is always cnsidered as 'URL' - CompareFiles() is not applicable - GetFileLen() always returns zero - HashFile() is not applicable - Normalize() always returns the input string unchanged - PickFile() is not applicable - PickFolder() is not applicable Additionally, - CreatetextFile() - OpenTextFile() in write or append modes copy or initialize the file in a temporary storage and write it back in the document when it is being closed. The process is transparent for the user. 3. The GetTempName() method accepts an option Extension argument, for better convenience. The new functionalities are available in Basic and Python. Changes require an update of the help documentation. Change-Id: Ibf8dd9983656923cf6ab43d9f48398dc4d1e6307 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154443 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Exception.xba b/wizards/source/scriptforge/SF_Exception.xba index 6add0b158990..38e5b2ef24e0 100644 --- a/wizards/source/scriptforge/SF_Exception.xba +++ b/wizards/source/scriptforge/SF_Exception.xba @@ -72,6 +72,7 @@ Const OVERWRITEERROR = OVERWRITEERROR Const READONLYERROR= READONLYERROR Const NOFILEMATCHERROR = NOFILEMATCHFOUND Const FOLDERCREATIONERROR = FOLDERCREATIONERROR +Const FILESYSTEMERROR = FILESYSTEMERROR SF_Services Const UNKNOWNSERVICEERROR = UNKNOWNSERVICEERROR @@ -884,6 +885,10 @@ Try: sMessage = sLocation _ \n \n \n .GetText(VALIDATEERROR, pvArgs(0)) _ \n \n .GetText(FOLDERCREATION, pvArgs(0), pvArgs(1)) + Case FILESYSTEMERROR SF_FileSystem.---(ArgName, MethodName, ArgValue) + pvArgs(0) = _RightCase(pvArgs(0)) + sMessage = sLocation _ +\n \n .GetText(FILESYSTEM, pvArgs(0), pvArgs(1), pvArgs(2)) Case UNKNOWNSERVICEERROR SF_Services.CreateScriptService(ArgName, Value, Library, Service) pvArgs(0) = _RightCase(pvArgs(0)) sMessage = sLocation _ diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index b09f980429f4..aeeafc4dc73d 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -27,7 +27,7 @@ Option Explicit File and folder names may be expressed either in the (preferable because portable) URL form or in the more usual operating system notation (e.g. C:\... for Windows)
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Calc.xba |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit b16861f667673560cf57d28bdd16bb592e6e3c22 Author: Jean-Pierre Ledure AuthorDate: Sat Jul 8 17:35:44 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sat Jul 8 22:46:25 2023 +0200 ScriptForge - (SF_Calc) fix typo in CopyToRange() method Change-Id: I07db487d94c2d0a8f2ec5955f6e94b00911d25c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154214 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index fe71b69e6a82..0138730c11f3 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -1085,7 +1085,7 @@ Const cstSubArgs = SourceRange, DestinationRange If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch sCopy = -Check:string +Check: If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not _IsStillAlive(True) Then GoTo Finally If Not ScriptForge.SF_Utils._Validate(SourceRange, SourceRange, Array(V_STRING, ScriptForge.V_OBJECT), , , CALCREFERENCE) Then GoTo Finally
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |3 wizards/source/sfdialogs/SF_Dialog.xba | 93 +++ 2 files changed, 81 insertions(+), 15 deletions(-) New commits: commit a83643dea9f5922d4706c9e1d8b9f53f71eb01d9 Author: Jean-Pierre Ledure AuthorDate: Fri May 26 17:13:04 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Fri May 26 19:06:07 2023 +0200 ScriptForge (SF_Dialog) new CloneControl() method Duplicate an existing control of any type in the actual dialog. The duplicated control is left unchanged. The new control can be relocated. Args: SourceName: the name of the control to duplicate ControlName: the name of the new control. It must not exist yet. Left, Top: the coordinates of the new control expressed in "Map AppFont" units. Returns: an instance of the SF_DialogControl class or Nothing The method is available from Basic and Python user scripts This change will require an update of the SF_Dialog help page. Change-Id: I5c2a5404a14ad60b2d4df2ac7eabbf0ddd843170 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152333 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 76845c71e75d..96474e4eb4de 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1866,6 +1866,9 @@ class SFDialogs: parentobj = parent.objectreference if isinstance(parent, parentclasses) else parent return self.ExecMethod(self.vbMethod + self.flgObject + self.flgHardCode, 'Center', parentobj) +def CloneControl(self, sourcename, controlname, left = 1, top = 1): +return self.ExecMethod(self.vbMethod, 'CloneControl', sourcename, controlname, left, top) + def Controls(self, controlname = ''): return self.ExecMethod(self.vbMethod + self.flgArrayRet + self.flgHardCode, 'Controls', controlname) diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba index cf32bf92629b..21e307b5 100644 --- a/wizards/source/sfdialogs/SF_Dialog.xba +++ b/wizards/source/sfdialogs/SF_Dialog.xba @@ -571,6 +571,58 @@ Catch: GoTo Finally End Function SF_Documents.SF_Dialog.Center +REM - +Public Function CloneControl(Optional ByVal SourceName As Variant _ + , Optional ByVal ControlName As Variant _ + , Optional ByVal Left As Variant _ + , Optional ByVal Top As Variant _ + ) As Object + Duplicate an existing control of any type in the actual dialog. + The duplicated control is left unchanged. The new control can be relocated. + Specific args: + SourceName: the name of the control to duplicate + ControlName: the name of the new control. It must not exist yet + Left, Top: the coordinates of the new control expressed in Map AppFont units + Returns: + an instance of the SF_DialogControl class or Nothing + Example: + Set myButton2 = dialog.CloneControl(Button1, Button2, 30, 30) + +Dim oControl As Object Return value +Dim oSourceModel As Object com.sun.star.awt.XControlModel of the source +Dim oControlModel As Object com.sun.star.awt.XControlModel of the new control +Const cstThisSub = SFDialogs.Dialog.CloneControl +Const cstSubArgs = SourceName, ControlName, [Left=1], [Top=1] + +Check: + Set oControl = Nothing + + If IsMissing(Left) Or IsEmpty(Left) Then Left = 1 + If IsMissing(Top) Or IsEmpty(Top) Then Top = 1 + + If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place := Null) Then GoTo Finally + + If Not ScriptForge.SF_Utils._Validate(SourceName, SourceName, V_String, _DialogModel.getElementNames()) Then GoTo Finally + If Not ScriptForge.SF_Utils._Validate(Left, Left, ScriptForge.V_NUMERIC) Then GoTo Finally + If Not ScriptForge.SF_Utils._Validate(Top, Top, ScriptForge.V_NUMERIC) Then GoTo Finally + +Try: + All control types are presumes cloneable + Set oSourceModel = _DialogModel.getByName(SourceName) + Set oControlModel = oSourceModel.createClone() + oControlModel.Name = ControlName + + Create the control + Set oControl = _CreateNewControl(oControlModel, ControlName, Array(Left, Top)) + +Finally: + Set CloneControl = oControl + ScriptForge.SF_Utils._ExitFunction(cstThisSub) + Exit Function +Catch: + Go
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |3 wizards/source/sfdialogs/SF_Dialog.xba | 87 ++- wizards/source/sfdialogs/SF_DialogControl.xba|3 wizards/source/sfdialogs/SF_Register.xba |2 4 files changed, 91 insertions(+), 4 deletions(-) New commits: commit e7c4a883624745ef858d0e281e87c0483a66b791 Author: Jean-Pierre Ledure AuthorDate: Tue May 23 16:19:50 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Wed May 24 11:20:48 2023 +0200 ScripForge (SF_Dialog) new OrderTabs() method Set the tabulation index f a series of controls. The sequence of controls are given as an array of control names from the first to the last. Next controls will not be accessible (anymore ?) via the TAB key if >=1 of next conditions is met: - if they are not in the given list - if their type is FixedLine, GroupBox or ProgressBar - if the control is disabled Args: TabsList: an array of valid control names in the order of tabulation. Start: the tab index to be assigned to the 1st control in the list. Default = 1. Increment: the difference between 2 successive tab indexes. Default = 1. Returns: True when successful. The method is available from Basic and Python user scripts This change will require an update of the SF_Dialog help page. Change-Id: Ie854227691c4e182b49a521b1285deaa4de3d1ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152166 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 66d69238a16c..76845c71e75d 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1977,6 +1977,9 @@ class SFDialogs: l10nobj = l10n.objectreference if isinstance(l10n, SFScriptForge.SF_L10N) else l10n return self.ExecMethod(self.vbMethod + self.flgObject, 'GetTextsFromL10N', l10nobj) +def OrderTabs(self, tabslist, start = 1, increment = 1): +return self.ExecMethod(self.vbMethod, 'OrderTabs', tabslist, start, increment) + def Resize(self, left = -9, top = -9, width = -1, height = -1): return self.ExecMethod(self.vbMethod + self.flgHardCode, 'Resize', left, top, width, height) diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba index 9eb72d1a2d94..cf32bf92629b 100644 --- a/wizards/source/sfdialogs/SF_Dialog.xba +++ b/wizards/source/sfdialogs/SF_Dialog.xba @@ -2095,6 +2095,7 @@ Public Function Methods() As Variant , EndExecute _ , Execute _ , GetTextsFromL10N _ + , OrderTabs _ , Resize _ , SetPageManager _ , Terminate _ @@ -2102,6 +2103,90 @@ Public Function Methods() As Variant End Function SFDialogs.SF_Dialog.Methods +REM - +Public Function OrderTabs(ByRef Optional TabsList As Variant _ + , ByVal Optional Start As Variant _ + , ByVal Optional Increment As Variant _ + ) As Boolean + Set the tabulation index f a series of controls. + The sequence of controls are given as an array of control names from the first to the last. + Next controls will not be accessible (anymore ?) via the TAB key if =1 of next conditions is met: + - if they are not in the given list + - if their type is FixedLine, GroupBox or ProgressBar + - if the control is disabled + Args: + TabsList: an array of valid control names in the order of tabulation + Start: the tab index to be assigned to the 1st control in the list. Default = 1 + Increment: the difference between 2 successive tab indexes. Default = 1 + Returns: + True when successful + Example: + dialog.OredrTabs(Array(myListBox, myTextField, myNumericField), Start := 10) + +Dim bOrder As BooleanReturn value +Dim vControlNames As Variant List of control names in the dialog +Dim oControl As Object A SF_DialogControl instance +Dim bValid As BooleanWhen True, the considered control deserves a tab stop +Dim iTabIndex As Integer The tab index to be set +Dim vWrongTypes As Variant List of rejected control types +Dim i As Long + +Const cstThis
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Services.xba |3 wizards/source/scriptforge/python/scriptforge.py | 26 + wizards/source/sfdialogs/SF_Dialog.xba | 46 +++- wizards/source/sfdialogs/SF_Register.xba | 118 +-- 4 files changed, 177 insertions(+), 16 deletions(-) New commits: commit 0a1022b04c90d36e16dee121923ca4111386585b Author: Jean-Pierre Ledure AuthorDate: Sun May 21 17:06:05 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Mon May 22 14:08:20 2023 +0200 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 Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/SF_Services.xba b/wizards/source/scriptforge/SF_Services.xba index f5e0545546e6..f00ad9e94b21 100644 --- a/wizards/source/scriptforge/SF_Services.xba +++ b/wizards/source/scriptforge/SF_Services.xba @@ -128,7 +128,8 @@ Try: Select Case LCase(sService) Case document, calc, writer, base, formdocument, documentevent, formevent sLibrary = SFDocuments - Case dialog, dialogevent : sLibrary = SFDialogs + Case dialog, dialogevent, newdialog + sLibrary = SFDialogs Case database, datasheet : sLibrary = SFDatabases Case unittest : sLibrary = SFUnitTests Case menu, popupmenu, toolbar, toolbarbutton diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 1b094c4711be..8b3a67fe2f60 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1987,6 +1987,32 @@ class SFDialogs: def Terminate(self): return self.ExecMethod(self.vbMethod, 'Terminate') +# # +# SF_NewDialog CLASS +# # +class SF_NewDialog(SFServices): +""" +Pseudo service never returned from the Basic world. A SF_Dialog instance is returned instead. +Main purpose: manage the arguments of CreateScritService() for the creation of a dialog from scratch +""" +# Mandatory class properties for service registration +serviceimplementation = 'basic' +servicename = 'SFDialogs.NewDialog' +servicesynonyms = ('newdialog', 'sfdialogs.newdialog') +serviceproperties = dict() + +@classmethod +def ReviewServiceArgs(cls, dialogname = '', place = (0, 0, 0, 0)): +""" +Transform positional and keyword arguments into positional only +Add the XComponentContext as last argument +""" +outsideprocess = len(ScriptForge.hostname) > 0 and ScriptForge.port > 0 +if outsideprocess: +return dialogname, place, ScriptForge.componentcontext +else: +return dialogname, place + # # # SF_DialogControl CLASS # # diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba index 20f1e81dc650..4979fa82a681 100644 --- a/wizards/source/sfdialogs/SF_Dialog.xba +++ b/wizards/source/sfdialogs/SF_Dialog.xba @@ -14,18 +14,22 @@ Option Explicit SF_Dialog = - Management of dialogs defined with the Basic IDE + Management of dialogs. They may bedefined with th
[Libreoffice-commits] core.git: 2 commits - offapi/com wizards/source
offapi/com/sun/star/ui/dialogs/DialogClosedEvent.idl |1 offapi/com/sun/star/ui/dialogs/FilePickerEvent.idl |1 wizards/source/scriptforge/python/scriptforge.py |5 + wizards/source/sfdialogs/SF_Dialog.xba | 71 ++- wizards/source/sfdialogs/SF_DialogControl.xba|2 5 files changed, 74 insertions(+), 6 deletions(-) New commits: commit f692b5c5e4e9c57fb69d0054c654486a737d19bd Author: Jean-Pierre Ledure AuthorDate: Thu May 18 13:01:52 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sat May 20 12:56:41 2023 +0200 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 Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index adfb4d69ef97..1b094c4711be 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1912,6 +1912,11 @@ class SFDialogs: def CreateGroupBox(self, controlname, place): return self.ExecMethod(self.vbMethod, 'CreateGroupBox', controlname, place) +def CreateHyperlink(self, controlname, place, border = 'NONE', multiline = False, align = 'LEFT', +verticalalign = 'TOP'): +return self.ExecMethod(self.vbMethod, 'CreateHyperlink', controlname, place, border, multiline, align, + verticalalign) + def CreateImageControl(self, controlname, place, border = '3D', scale = 'FITTOSIZE'): return self.ExecMethod(self.vbMethod, 'CreateImageControl', controlname, place, border, scale) diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba index b50e22aebeb3..20f1e81dc650 100644 --- a/wizards/source/sfdialogs/SF_Dialog.xba +++ b/wizards/source/sfdialogs/SF_Dialog.xba @@ -1141,6 +1141,70 @@ Catch: GoTo Finally End Function SFDialogs.SF_Dialog.CreateGroupBox +REM - +Public Function CreateHyperlink(Optional ByVal ControlName As Variant _ + , Optional ByRef Place As Variant _ + , Optional ByVal Border As Variant _ + , Optional ByVal MultiLine As Variant _ + , Optional ByVal Align As Variant _ + , Optional ByVal VerticalAlign As Variant _ + ) As Object + Create a new control of type Hyperlink in the actual dialog. + Specific args: + Border: NONE (default) or FLAT or 3D + MultiLine: When True (default = False), the caption may be displayed on more than one line + Align: horizontal alignment, LEFT (default) or CENTER or RIGHT + VerticalAlign: vertical alignment, TOP (default) or MIDDLE or BOTTOM + Returns: + an instance of the SF_DialogControl class or Nothing + Example: + Set myHyperlink = dialog.CreateHyperlink(Hyperlink1, Array(20, 20, 60, 15), MultiLine := True) + +Dim oControl As Object Return value +Dim iBorder As Integer Alias of border +Dim iAlign As IntegerAlias of Align +Dim iVerticalAlign As IntegerAlias of VerticalAlign +Dim vPropNames As VariantArray of names of specific arguments +Dim vPropValues As Variant Array of values of specific arguments +Const cstThisSub = SFDialogs.Dialog.CreateHyperlink +Const cstSubArgs = ControlName, Place, [MultiLine=False], [Border=NONE|FLAT|3D] _ +, [Align=LEFT|CENTER|RIGHT], [VerticalAlign=TOP|MIDDLE|BOTTOM] + +Check: + Set oControl = Nothing + If Not _CheckNewControl(cstThisSub, cstSubArgs, ControlName, Place) Then GoTo Finally + + If IsMissing(Border) Or IsEmpty(Border) Then Border = NONE + If IsMissing(MultiLine) Or IsEmpty(MultiLine) Then MultiLine = False + If IsMissing(Align) Or IsEmpty(Align) Then Align = LEFT + If IsMissing(VerticalAlign) Or IsEmpty(VerticalAlign) Then VerticalAlign = TOP + + If Not ScriptForge.SF_Utils._Validate(Border, Border, V_STRING, Array(3D, FLAT, NONE
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Exception.xba |6 wizards/source/scriptforge/SF_Root.xba |9 wizards/source/scriptforge/po/ScriptForge.pot| 15 wizards/source/scriptforge/po/en.po | 15 wizards/source/scriptforge/python/scriptforge.py | 104 + wizards/source/sfdialogs/SF_Dialog.xba | 1286 ++- wizards/source/sfdialogs/SF_DialogControl.xba| 178 ++- wizards/source/sfdialogs/SF_DialogUtils.xba | 69 + 8 files changed, 1614 insertions(+), 68 deletions(-) New commits: commit 66a3b09fc3b2927f1333f4fd54426fc5918d89cb Author: Jean-Pierre Ledure AuthorDate: Wed May 17 17:52:53 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Thu May 18 10:30:45 2023 +0200 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 Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Exception.xba b/wizards/source/scriptforge/SF_Exception.xba index f752e054f2b5..6add0b158990 100644 --- a/wizards/source/scriptforge/SF_Exception.xba +++ b/wizards/source/scriptforge/SF_Exception.xba @@ -126,6 +126,7 @@ Const DIALOGDEADERROR = DIALOGDEADERROR Const CONTROLTYPEERROR = CONTROLTYPEERROR Const TEXTFIELDERROR = TEXTFIELDERROR Const PAGEMANAGERERROR = PAGEMANAGERERROR +Const DUPLICATECONTROLERROR= DUPLICATECONTROLERROR SF_Database Const DBREADONLYERROR = DBREADONLYERROR @@ -1024,6 +1025,11 @@ Try: Case PAGEMANAGERERROR SF_Dialog.SetPageManager(PilotsList, TabsList, WizardsList) sMessage = sLocation _ \n \n .GetText(PAGEMANAGER, pvArgs(0), pvArgs(1), pvArgs(2), pvArgs(3), pvArgs(4), pvArgs(5)) + Case DUPLICATECONTROLERROR SF_Dialog.CreateControl(ControlName, DialogName) + pvArgs(0) = _RightCase(pvArgs(0)) + sMessage =
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - wizards/source
wizards/source/sfdatabases/SF_Database.xba |9 + 1 file changed, 5 insertions(+), 4 deletions(-) New commits: commit 2840a8e139f9e6766fe291512f6a42b3d72371f6 Author: Jean-Pierre Ledure AuthorDate: Tue May 16 17:00:20 2023 +0200 Commit: Xisco Fauli CommitDate: Wed May 17 12:47:47 2023 +0200 ScriptForge - database.GetRows() tdf#155204 error when no data The complete expected bheviour is: when there is no data returned by the query, - either GetRows() returns an empty array, (Header := False) - or GetRows() returns an array with a single row containing the column names only (Header := True) In the example given in the bug report, GetRows() gives an unexpected error. Actually the "end-of-file" status is tested with the isAfterLast() indicator. It seems preferable to rely on the Boolean value returned by the first() and next() methods applied on the resultset. Change-Id: Ibe97dbbcb03d45ebb9184fab2733abe4e04963a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151844 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins (cherry picked from commit d07cc6706ef3b382fa16a104c97b69bc2d2365e5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151781 Tested-by: Xisco Fauli diff --git a/wizards/source/sfdatabases/SF_Database.xba b/wizards/source/sfdatabases/SF_Database.xba index f0dec87c294e..4297fbc7b09a 100644 --- a/wizards/source/sfdatabases/SF_Database.xba +++ b/wizards/source/sfdatabases/SF_Database.xba @@ -310,7 +310,8 @@ Dim sSql As StringSQL statement Dim bDirect Alias of DirectSQL Dim lCols As LongNumber of columns Dim lRows As LongNumber of rows -Dim oColumns As Object +Dim oColumns As Object Collection of com.sun.star.sdb.ODataColumn +Dim bRead As Boolean When True, next record has been read successfully Dim i As Long Const cstThisSub = SFDatabases.Database.GetRows Const cstSubArgs = SQLCommand, [DirectSQL=False], [Header=False], [MaxRows=0] @@ -365,8 +366,8 @@ Try: End If Load data - .first() - Do While Not .isAfterLast() And (MaxRows = 0 Or lRows MaxRows - 1) + bRead = .first() + Do While bRead And (MaxRows = 0 Or lRows MaxRows - 1) lRows = lRows + 1 If lRows = 0 Then ReDim vResult(0 To lRows, 0 To lCols) @@ -376,7 +377,7 @@ Try: For i = 0 To lCols vResult(lRows, i) = _GetColumnValue(oResult, i + 1) Next i - .next() + bRead = .next() Loop End With
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdatabases/SF_Database.xba |9 + 1 file changed, 5 insertions(+), 4 deletions(-) New commits: commit d07cc6706ef3b382fa16a104c97b69bc2d2365e5 Author: Jean-Pierre Ledure AuthorDate: Tue May 16 17:00:20 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Wed May 17 08:53:58 2023 +0200 ScriptForge - database.GetRows() tdf#155204 error when no data The complete expected bheviour is: when there is no data returned by the query, - either GetRows() returns an empty array, (Header := False) - or GetRows() returns an array with a single row containing the column names only (Header := True) In the example given in the bug report, GetRows() gives an unexpected error. Actually the "end-of-file" status is tested with the isAfterLast() indicator. It seems better to rely on the Boolean value returned by the first() and next() methods applied on the resultset. Change-Id: Ibe97dbbcb03d45ebb9184fab2733abe4e04963a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151844 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdatabases/SF_Database.xba b/wizards/source/sfdatabases/SF_Database.xba index de891935be69..f93cf55d74c0 100644 --- a/wizards/source/sfdatabases/SF_Database.xba +++ b/wizards/source/sfdatabases/SF_Database.xba @@ -312,7 +312,8 @@ Dim sSql As StringSQL statement Dim bDirect Alias of DirectSQL Dim lCols As LongNumber of columns Dim lRows As LongNumber of rows -Dim oColumns As Object +Dim oColumns As Object Collection of com.sun.star.sdb.ODataColumn +Dim bRead As Boolean When True, next record has been read successfully Dim i As Long Const cstThisSub = SFDatabases.Database.GetRows Const cstSubArgs = SQLCommand, [DirectSQL=False], [Header=False], [MaxRows=0] @@ -367,8 +368,8 @@ Try: End If Load data - .first() - Do While Not .isAfterLast() And (MaxRows = 0 Or lRows MaxRows - 1) + bRead = .first() + Do While bRead And (MaxRows = 0 Or lRows MaxRows - 1) lRows = lRows + 1 If lRows = 0 Then ReDim vResult(0 To lRows, 0 To lCols) @@ -378,7 +379,7 @@ Try: For i = 0 To lCols vResult(lRows, i) = _GetColumnValue(oResult, i + 1) Next i - .next() + bRead = .next() Loop End With
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |6 +- wizards/source/sfdialogs/SF_DialogControl.xba| 47 ++- wizards/source/sfdialogs/SF_DialogUtils.xba |2 3 files changed, 41 insertions(+), 14 deletions(-) New commits: commit a58017d99c3cea52fe7b37f2379c5306bfa59807 Author: Jean-Pierre Ledure AuthorDate: Sun Apr 23 12:57:11 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Sun Apr 23 14:54:49 2023 +0200 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 09d796aa161c..ff5a3ef8b6ee 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1913,9 +1913,9 @@ class SFDialogs: OnMouseReleased = True, OnNodeExpanded = True, OnNodeSelected = True, OnTextChanged = True, Page = True, Parent = False, Picture = True, RootNode = False, RowSource = True, Text = False, TipText = True, - TripleState = True, Value = True, Visible = True, Width = True, X = True, Y = True, - XControlModel = False, XControlView = False, XGridColumnModel = False, - XGridDataModel = False, XTreeDataModel = False) + TripleState = True, URL = True, Value = True, Visible = True, Width = True, + X = True, Y = True, XControlModel = False, XControlView = False, + XGridColumnModel = False, XGridDataModel = False, XTreeDataModel = False) # Root related properties do not start with X and, nevertheless, return a UNO object @property diff --git a/wizards/source/sfdialogs/SF_DialogControl.xba b/wizards/source/sfdialogs/SF_DialogControl.xba index e7c415f0ba52..ddcd7f4aab99 100644 --- a/wizards/source/sfdialogs/SF_DialogControl.xba +++ b/wizards/source/sfdialogs/SF_DialogControl.xba @@ -142,6 +142,7 @@ Private Const CTLFIXEDLINE = FixedLine Private Const CTLFIXEDTEXT = FixedText Private Const CTLFORMATTEDFIELD= FormattedField Private Const CTLGROUPBOX = GroupBox +Private Const CTLHYPERLINK = Hyperlink Private Const CTLIMAGECONTROL = ImageControl Private Const CTLLISTBOX = ListBox Private Const CTLNUMERICFIELD = NumericField @@ -648,6 +649,18 @@ Property Let TripleState(Optional ByVal pvTripleState As Variant) _PropertySet(TripleState, pvTripleState) End Property SFDialogs.SF_DialogControl.TripleState (let) +REM - +Property Get URL() As Variant + The URL property refers to the URL to open when the control is clicked + URL = _PropertyGet(URL, ) +End Property SFDialogs.SF_DialogControl.URL (get) + +REM - +Property Let URL(Optional ByVal pvURL As Variant) + Set the updatable property URL + _PropertySet(URL, pvURL) +End Property SFDialogs.SF_DialogControl.URL (let) + REM - Property Get Value() As Variant The Value property specifies the data contained in the control @@ -1132,6 +1145,7 @@ Public Function Properties() As Variant , Text _ , TipText _ , TripleState _ + , URL _ , Value _ , Visible _ , Width _ @@ -1673,7 +1687,6 @@ Public Sub _Initialize() Dim vServiceName As Variant Split service name Dim sType As String Last component of service name -Dim oPosSize As Object com.sun.star.awt.Rectangle Try: _ImplementationName = _ControlModel.getImplementationName() @@ -1685,6 +169
[Libreoffice-commits] core.git: wizards/Package_sfdialogs.mk wizards/source
wizards/Package_sfdialogs.mk |1 wizards/source/scriptforge/python/scriptforge.py |4 wizards/source/sfdialogs/SF_Dialog.xba | 105 +++- wizards/source/sfdialogs/SF_DialogControl.xba| 119 +++-- wizards/source/sfdialogs/SF_DialogUtils.xba | 275 +++ wizards/source/sfdialogs/script.xlb |1 6 files changed, 361 insertions(+), 144 deletions(-) New commits: commit 37a68d6ae3b32aa3d3c864f67a8c55b6eeb6964d Author: Jean-Pierre Ledure AuthorDate: Thu Apr 20 17:14:50 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Fri Apr 21 11:02:01 2023 +0200 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/Package_sfdialogs.mk b/wizards/Package_sfdialogs.mk index 8a072225a356..f746cdd88514 100644 --- a/wizards/Package_sfdialogs.mk +++ b/wizards/Package_sfdialogs.mk @@ -23,6 +23,7 @@ $(eval $(call gb_Package_add_files,wizards_basicsrvsfdialogs,$(LIBO_SHARE_FOLDER SF_Dialog.xba \ SF_DialogControl.xba \ SF_DialogListener.xba \ + SF_DialogUtils.xba \ SF_Register.xba \ __License.xba \ dialog.xlb \ diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index f61da2e3885b..09d796aa161c 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1879,7 +1879,7 @@ class SFDialogs: l10nobj = l10n.objectreference if isinstance(l10n, SFScriptForge.SF_L10N) else l10n return self.ExecMethod(self.vbMethod + self.flgObject, 'GetTextsFromL10N', l10nobj) -def Resize(self, left = -1, top = -1, width = -1, height = -1): +def Resize(self, left = -9, top = -9, width = -1, height = -1): return self.ExecMethod(self.vbMethod + self.flgHardCode, 'Resize', left, top, width, height) def SetPageManager(self, pilotcontrols = '', tabcontrols = '', wizardcontrols = '', lastpage = 0): @@ -1938,7 +1938,7 @@ class SFDialogs: def FindNode(self, displayvalue, datavalue = ScriptForge.cstSymEmpty, casesensitive = False): return self.ExecMethod(self.vbMethod + self.flgUno, 'FindNode', displayvalue, datavalue, casesensitive) -def Resize(self, left = -1, top = -1, width = -1, height = -1): +def Resize(self, left = -9, top = -9, width = -1, height = -1): return self.ExecMethod(self.vbMethod, 'Resize', left, top, width, height) def SetFocus(self): diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba index 01c6d83cf982..c252838b6c4f 100644 --- a/wizards/source/sfdialogs/SF_Dialog.xba +++ b/wizards/source/sfdialogs/SF_Dialog.xba @@ -74,7 +74,7 @@ Private _DialogModel As Object com.sun.star.awt.XControlModel - stardiv Private _Displayed As Boolean True after Execute() Private _Modal As Boolean Set by Execute() - Dialog position and dimensions in pixels + Dialog initial position and dimensions in APPFONT units Private _Left As Long Private _Top As Long Private _Width As Long @@ -151,14 +151,17 @@ Private Sub Class_Initialize() Set _DialogModel = Nothing _Displayed = False _Modal = True - _Left = -1 - _Top = -1 + + _Left = SF_DialogUtils.MINPOSITION + _Top = SF_DialogUtils.MINPOSITION _Width = -1 _Height = -1 + _PageManagement = Array() Set _ItemListener = Nothing Set _ActionListener = Nothing _LastPage = 0 + Set _FocusListe
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - wizards/source
wizards/source/scriptforge/SF_FileSystem.xba |3 +++ wizards/source/scriptforge/SF_Utils.xba |6 ++ 2 files changed, 5 insertions(+), 4 deletions(-) New commits: commit ffbe4d480802a351a13ec70777e68e37c3c019eb Author: Jean-Pierre Ledure AuthorDate: Wed Apr 12 16:27:59 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Thu Apr 13 09:44:06 2023 +0200 ScriptForge (SF_FileSystem) tdf#154462 2nd call of PickFile() fails Error happens in gen and gtk3 modes. Does not happen in kf5 mode. Linux only. Windows OK. Patch on master: https://git.libreoffice.org/core/commit/9c60996fc2a536803d016d6f60f879f8a1e49a54 Change-Id: I2f28b389d33a62af969e9d48e398fa220f99d347 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150297 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index 21464c708fe5..d81465dbff13 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -1588,6 +1588,9 @@ Try: Get selected file iAccept = .Execute() If iAccept = com.sun.star.ui.dialogs.ExecutableDialogResults.OK Then sFile = .getSelectedFiles()(0) + + Do not reuse a FilePicker, side effects observed (a.o. TDF#154462) + .dispose() End With Finally: diff --git a/wizards/source/scriptforge/SF_Utils.xba b/wizards/source/scriptforge/SF_Utils.xba index 91b703c46431..23145cb991df 100644 --- a/wizards/source/scriptforge/SF_Utils.xba +++ b/wizards/source/scriptforge/SF_Utils.xba @@ -21,7 +21,7 @@ REM = GLOBAL Global _SF_As VariantSF_Root (Basic) object) ScriptForge version -Const SF_Version = 7.4 +Const SF_Version = 7.5 Standard symbolic names for VarTypes V_EMPTY = 0 @@ -370,9 +370,7 @@ Dim oDefaultContext As Object End If Set _GetUNOService = .FileAccess Case FilePicker - If IsEmpty(.FilePicker) Or IsNull(.FilePicker) Then - Set .FilePicker = CreateUnoService(com.sun.star.ui.dialogs.FilePicker) - End If + Set .FilePicker = CreateUnoService(com.sun.star.ui.dialogs.FilePicker) Do not reuse an existing FilePicker: TDF#154462 Set _GetUNOService = .FilePicker Case FilterFactory If IsEmpty(.FilterFactory) Or IsNull(.FilterFactory) Then
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_FileSystem.xba |4 wizards/source/scriptforge/SF_Utils.xba |4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) New commits: commit 9c60996fc2a536803d016d6f60f879f8a1e49a54 Author: Jean-Pierre Ledure AuthorDate: Tue Apr 11 17:21:48 2023 +0200 Commit: Jean-Pierre Ledure CommitDate: Tue Apr 11 18:59:39 2023 +0200 ScriptForge - (SF_FileSystem) tdf#154462 2nd call of PickFile() fails Error happens in gen and gtk3 modes. Does not happen in kf5 mode. Linux only. Windows OK. Change-Id: Ia5dd21f6879c1a732d291d15d6fb9f4bf20c76e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150238 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index 21464c708fe5..b09f980429f4 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -1588,6 +1588,10 @@ Try: Get selected file iAccept = .Execute() If iAccept = com.sun.star.ui.dialogs.ExecutableDialogResults.OK Then sFile = .getSelectedFiles()(0) + + Do not reuse a FilePicker, side effects observed (a.o. TDF#154462) + .dispose() + End With Finally: diff --git a/wizards/source/scriptforge/SF_Utils.xba b/wizards/source/scriptforge/SF_Utils.xba index c19f815587ce..11753704c461 100644 --- a/wizards/source/scriptforge/SF_Utils.xba +++ b/wizards/source/scriptforge/SF_Utils.xba @@ -370,9 +370,7 @@ Dim oDefaultContext As Object End If Set _GetUNOService = .FileAccess Case FilePicker - If IsEmpty(.FilePicker) Or IsNull(.FilePicker) Then - Set .FilePicker = CreateUnoService(com.sun.star.ui.dialogs.FilePicker) - End If + Set .FilePicker = CreateUnoService(com.sun.star.ui.dialogs.FilePicker) Do not reuse an existing FilePicker: TDF#154462 Set _GetUNOService = .FilePicker Case FilterFactory If IsEmpty(.FilterFactory) Or IsNull(.FilterFactory) Then
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |7 wizards/source/sfdialogs/SF_Dialog.xba | 22 +-- wizards/source/sfdialogs/SF_DialogControl.xba| 165 +++ wizards/source/sfdialogs/SF_DialogListener.xba |4 4 files changed, 183 insertions(+), 15 deletions(-) New commits: commit 3d94a43d28813b42c11a66fa88724aae53d5780e Author: Jean-Pierre Ledure AuthorDate: Mon Mar 20 16:48:55 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Tue Mar 21 06:35:19 2023 + 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 531b0da1e6be..f61da2e3885b 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1904,7 +1904,7 @@ class SFDialogs: servicename = 'SFDialogs.DialogControl' servicesynonyms = () serviceproperties = dict(Cancel = True, Caption = True, ControlType = False, CurrentNode = True, - Default = True, Enabled = True, Format = True, ListCount = False, + Default = True, Enabled = True, Format = True, Height = True, ListCount = False, ListIndex = True, Locked = True, MultiSelect = True, Name = False, OnActionPerformed = True, OnAdjustmentValueChanged = True, OnFocusGained = True, OnFocusLost = True, OnItemStateChanged = True, OnKeyPressed = True, @@ -1913,7 +1913,7 @@ class SFDialogs: OnMouseReleased = True, OnNodeExpanded = True, OnNodeSelected = True, OnTextChanged = True, Page = True, Parent = False, Picture = True, RootNode = False, RowSource = True, Text = False, TipText = True, - TripleState = True, Value = True, Visible = True, + TripleState = True, Value = True, Visible = True, Width = True, X = True, Y = True, XControlModel = False, XControlView = False, XGridColumnModel = False, XGridDataModel = False, XTreeDataModel = False) @@ -1938,6 +1938,9 @@ class SFDialogs: def FindNode(self, displayvalue, datavalue = ScriptForge.cstSymEmpty, casesensitive = False): return self.ExecMethod(self.vbMethod + self.flgUno, 'FindNode', displayvalue, datavalue, casesensitive) +def Resize(self, left = -1, top = -1, width = -1, height = -1): +return self.ExecMethod(self.vbMethod, 'Resize', left, top, width, height) + def SetFocus(self): return self.ExecMethod(self.vbMethod, 'SetFocus') diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba index 430b29d20b57..01c6d83cf982 100644 --- a/wizards/source/sfdialogs/SF_Dialog.xba +++ b/wizards/source/sfdialogs/SF_Dialog.xba @@ -74,7 +74,7 @@ Private _DialogModel As Object com.sun.star.awt.XControlModel - stardiv Private _Displayed As Boolean True after Execute() Private _Modal As Boolean Set by Execute() - Dialog position and dimensions + Dialog position and dimensions in pixels Private _Left As Long Private _Top As Long Private _Width As Long @@ -885,7 +885,7 @@ Public Function Resize(Optional ByVal Left As Variant _ , Optional ByVal Height As Variant _ ) As Boolean Move the top-left corner of a dialog to new coordinates and/or modify its dimensions - All distances are expressed in 1/100 mm. + All distances are expressed in pixels. Without arguments, the method resets the initial dimensions Args: Left : the horizontal distance from the top-left corner @@ -932,10 +932,10 @@ Try
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_UI.xba |2 wizards/source/scriptforge/python/scriptforge.py | 20 - wizards/source/sfdialogs/SF_Dialog.xba | 160 +++- wizards/source/sfdialogs/SF_DialogControl.xba| 198 ++ wizards/source/sfdialogs/SF_DialogListener.xba | 446 ++- wizards/source/sfwidgets/SF_Toolbar.xba |4 6 files changed, 798 insertions(+), 32 deletions(-) New commits: commit 0483b0a4bbd41f026a53ff35ab3162b57bee1a91 Author: Jean-Pierre Ledure AuthorDate: Mon Mar 13 18:22:26 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Tue Mar 14 10:46:15 2023 + 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_UI.xba b/wizards/source/scriptforge/SF_UI.xba index 392eeb29a64d..3bde6c22e4ac 100644 --- a/wizards/source/scriptforge/SF_UI.xba +++ b/wizards/source/scriptforge/SF_UI.xba @@ -1506,4 +1506,4 @@ Private Function _Repr() As String End Function ScriptForge.SF_UI._Repr REM END OF SCRIPTFORGE.SF_UI - + \ No newline at end of file diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 7208ff81cda6..531b0da1e6be 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1840,10 +1840,10 @@ class SFDialogs: servicename = 'SFDialogs.Dialog' servicesynonyms = ('dialog', 'sfdialogs.dialog') serviceproperties = dict(Caption = True, Height = True, Modal = False, Name = False, - OnFocusGained = False, OnFocusLost = False, OnKeyPressed = False, - OnKeyReleased = False, OnMouseDragged = False, OnMouseEntered = False, - OnMouseExited = False, OnMouseMoved = False, OnMousePressed = False, - OnMouseReleased = False, + OnFocusGained = True, OnFocusLost = True, OnKeyPressed = True, + OnKeyReleased = True, OnMouseDragged = True, OnMouseEntered = True, + OnMouseExited = True, OnMouseMoved = True, OnMousePressed = True, + OnMouseReleased = True, Page = True, Visible = True, Width = True, XDialogModel = False, XDialogView = False) # Class constants used together with the Execute() method OKBUTTON, CANCELBUTTON = 1, 0 @@ -1906,12 +1906,12 @@ class SFDialogs: serviceproperties = dict(Cancel = True, Caption = True, ControlType = False, CurrentNode = True, Default = True, Enabled = True, Format = True, ListCount = False, ListIndex = True, Locked = True, MultiSelect = True, Name = False, - OnActionPerformed = False, OnAdjustmentValueChanged = False, OnFocusGained = False, - OnFocusLost = False, OnItemStateChanged = False, OnKeyPressed = False, - OnKeyReleased = False, OnMouseDragged = False, OnMouseEntered = False, - OnMouseExited = False, OnMouseMoved = False, OnMousePressed = False, - OnMouseReleased = False, OnNodeExpanded = True, OnNodeSelected = True, - OnTextChanged = False, Page = True, Parent = False, Picture = True, + OnActionPerformed = True, OnAdjustmentValueChanged = True, OnFocusGained = True, + OnFocusLost = True, OnItemStateChanged = True, OnKeyPressed = True
[Libreoffice-commits] core.git: wizards/Package_sfwidgets.mk wizards/source
wizards/Package_sfwidgets.mk |2 wizards/source/scriptforge/SF_PythonHelper.xba | 16 wizards/source/scriptforge/SF_Root.xba |3 wizards/source/scriptforge/SF_Services.xba |3 wizards/source/scriptforge/SF_UI.xba | 142 + wizards/source/scriptforge/SF_Utils.xba |7 wizards/source/scriptforge/python/scriptforge.py | 46 + wizards/source/sfdatabases/SF_Datasheet.xba | 48 + wizards/source/sfdocuments/SF_Base.xba |5 wizards/source/sfdocuments/SF_Calc.xba |5 wizards/source/sfdocuments/SF_Document.xba | 49 + wizards/source/sfdocuments/SF_FormDocument.xba |5 wizards/source/sfdocuments/SF_Writer.xba |5 wizards/source/sfwidgets/SF_Register.xba | 71 ++ wizards/source/sfwidgets/SF_Toolbar.xba | 541 ++ wizards/source/sfwidgets/SF_ToolbarButton.xba| 565 +++ wizards/source/sfwidgets/script.xlb |2 17 files changed, 1507 insertions(+), 8 deletions(-) New commits: commit f36265ed0e0229dc9dacd18cc16867b22d655dbe Author: Jean-Pierre Ledure AuthorDate: Mon Feb 27 18:04:46 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Tue Feb 28 15:31:12 2023 + 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/Package_sfwidgets.mk b/wizards/Package_sfwidgets.mk index 3e2041a5f810..75fc0bd1f18f 100644 --- a/wizards/Package_sfwidgets.mk +++ b/wizards/Package_sfwidgets.mk @@ -24,6 +24,8 @@ $(eval $(call gb_Package_add_files,wizards_basicsrvsfwidgets,$(LIBO_SHARE_FOLDER SF_MenuListener.xba \ SF_PopupMenu.xba \ SF_Register.xba \ + SF_Toolbar.xba \ + SF_ToolbarButton.xba \ __License.xba \ dialog.xlb \ script.xlb \ diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba index ffec0af7586c..f7345d4c6c40 100644 --- a/wizards/source/scriptforge/SF_PythonHelper.xba +++ b/wizards/source/scriptforge/SF_PythonHelper.xba @@ -791,11 +791,15 @@ Try: Case SFDialogs.DialogControl If Script = SetTableData Then vReturn = vBasicObject.SetTableData(vArgs(0), vArgs(1), vArgs(2)) Case SFDocuments.Document - If Script = Forms Then vReturn = vBasicObject.Forms(vArgs(0)) + Select Case Script + Case Forms : vReturn = vBasicObject.Forms(vArgs(0)) + Case Toolbars : vReturn = vBasicObject.Toolbars(vArgs(0)) +
[Libreoffice-commits] core.git: bin/list-dispatch-commands.py
bin/list-dispatch-commands.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit 077ff26b682b7d31ea85e8adf66fc80432c876e8 Author: Jean-Pierre Ledure AuthorDate: Sat Feb 4 12:21:02 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Tue Feb 7 10:28:43 2023 + Fix links in DispatchCommands wiki page The modified python script generates the https://wiki.documentfoundation.org/Development/DispatchCommands wiki page. The https://gerrit.libreoffice.org/c/core/+/142723 commit has broken the links to OpenGrok in the last column ("Source files") of the tables and also the list of files at the bottom of the page. The actual page in the wiki, after upgrade to LO 7.5 has been generated with the modified version of the script. Change-Id: I2ec674f4257229e543a7797fddd2f7a142a743f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146553 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/bin/list-dispatch-commands.py b/bin/list-dispatch-commands.py index f4832f12b777..db8bff6e7d95 100755 --- a/bin/list-dispatch-commands.py +++ b/bin/list-dispatch-commands.py @@ -22,7 +22,7 @@ import os srcdir = os.path.dirname(os.path.realpath(__file__)) + '/..' # go up from /bin builddir = os.getcwd() -REPO = 'https://opengrok.libreoffice.org/xref/core/' +REPO = 'https://opengrok.libreoffice.org/xref/core' BLACKLIST = ('_SwitchViewShell0', '_SwitchViewShell1', '_SwitchViewShell2', '_SwitchViewShell3', '_SwitchViewShell4') @@ -344,9 +344,9 @@ def print_output(all_commands): xcufile, xculinenumber, hxxfile, hxxlinenumber, sdifile, sdilinenumber = 2, 3, 8, 10, 14, 16 src = '' if cmd[xcufile] >= 0: -src += '[' + REPO + XCU_FILES[cmd[xcufile]] + '#' + str(cmd[xculinenumber]) + ' XCU]' +src += '[' + REPO + XCU_FILES[cmd[xcufile]].replace(srcdir, '') + '#' + str(cmd[xculinenumber]) + ' XCU]' if cmd[sdifile] >= 0: -src += ' [' + REPO + SDI_FILES[cmd[sdifile]] + '#' + str(cmd[sdilinenumber]) + ' SDI]' +src += ' [' + REPO + SDI_FILES[cmd[sdifile]].replace(srcdir, '') + '#' + str(cmd[sdilinenumber]) + ' SDI]' if cmd[hxxfile] >= 0: file = str(cmd[hxxfile] + 1 + len(XCU_FILES) + len(SDI_FILES)) src += ' [[#hxx' + file + '|HXX]]' @@ -398,15 +398,15 @@ def print_output(all_commands): fn = 0 for i in range(len(XCU_FILES)): fn += 1 -print(f'({fn}) {REPO}{XCU_FILES[i]}\n') +print(f'({fn}) {REPO}{XCU_FILES[i]}\n'.replace(srcdir, '')) print('\n') for i in range(len(SDI_FILES)): fn += 1 -print(f'({fn}) {REPO}{SDI_FILES[i]}\n') +print(f'({fn}) {REPO}{SDI_FILES[i]}\n'.replace(srcdir, '')) print('\n') for i in range(len(HXX_FILES)): fn += 1 -print(f'({fn}) {HXX_FILES[i][2:]}\n') +print(f'({fn}) {HXX_FILES[i]}\n'.replace(builddir, '')) print('')
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |3 wizards/source/sfdocuments/SF_Calc.xba |7 ++ wizards/source/sfdocuments/SF_Document.xba | 73 +++ wizards/source/sfdocuments/SF_FormDocument.xba |7 ++ wizards/source/sfdocuments/SF_Writer.xba |7 ++ 5 files changed, 97 insertions(+) New commits: commit 96302e0bbadfe3ed33af4a14a33a44bab3f5f0d4 Author: Jean-Pierre Ledure AuthorDate: Fri Jan 27 16:39:42 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Fri Jan 27 16:54:19 2023 + 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 7abd8ff67716..a67dca437fd1 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1993,6 +1993,9 @@ class SFDocuments: def CreateMenu(self, menuheader, before = '', submenuchar = '>'): return self.ExecMethod(self.vbMethod, 'CreateMenu', menuheader, before, submenuchar) +def Echo(self, echoon = True, hourglass = False): +return self.ExecMethod(self.vbMethod, 'Echo', echoon, hourglass) + def ExportAsPDF(self, filename, overwrite = False, pages = '', password = '', watermark = ''): return self.ExecMethod(self.vbMethod, 'ExportAsPDF', filename, overwrite, pages, password, watermark) diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index bba5ebdf5b2e..dfd66fb5a2bf 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -3718,6 +3718,13 @@ Public Function CreateMenu(Optional ByVal MenuHeader As Variant _ Set CreateMenu = [_Super].CreateMenu(MenuHeader, Before, SubmenuChar) End Function SFDocuments.SF_Calc.CreateMenu +REM - +Public Sub Echo(Optional ByVal EchoOn As Variant _ + , Optional ByVal Hourglass As Variant _ + ) + [_Super].Echo(EchoOn, Hourglass) +End Sub SFDocuments.SF_Calc.Echo + REM - Public Function ExportAsPDF(Optional ByVal FileName As Variant _ , Optional ByVal Overwrite As Variant _ diff --git a/wizards/source/sfdocuments/SF_Document.xba b/wizards/source/sfdocuments/SF_Document.xba index 03fb215369ea..879d90c0cfef 100644 --- a/wizards/source/sfdocuments/SF_Document.xba +++ b/wizards/source/sfdocuments/SF_Document.xba @@ -538,6 +538,78 @@ Catch: GoTo Finally End Function SFDocuments.SF_Document.CreateMenu +REM - +Public Sub Echo(Optional ByVal EchoOn As Variant _ + , Optional ByVal Hourglass As Variant _ + ) + 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 remo
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Calc.xba | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) New commits: commit 9079d15ec54928e1e7d5596e148d0f9aefe81bd6 Author: Jean-Pierre Ledure AuthorDate: Wed Jan 25 15:26:10 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Thu Jan 26 11:22:37 2023 + ScriptForge (SF_Calc) more accurate comments Impact only on comments, code left unchanged Change-Id: I5549f2549d2b9ff351ad6174b9dba458525db210 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146139 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 8169ae2e188c..bba5ebdf5b2e 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -29,6 +29,7 @@ Option Explicit The SF_Calc module is focused on : - management (copy, insert, move, ...) of sheets within a Calc document - exchange of data between Basic data structures and Calc ranges of values + - copying and importing massive amounts of data The current module is closely related to the UI service of the ScriptForge library @@ -63,9 +64,9 @@ Option Explicit or an object produced by .Range() The sheet name is optional (default = active sheet). Surrounding quotes and $ signs are optional ~.~, ~ The current selection in the active sheet - $SheetX.D2 or $D$2 A single cell - $SheetX.D2:F6, D2:D10 Multiple cells - $SheetX.A:A or 3:5 All cells in the same column or row up to the last active cell + $SheetX.D2 or $D$2 A single cell + $SheetX.D2:F6, D2:D10 Multiple cells + $SheetX.A:A or 3:5 All cells in the same column or row up to the last active cell SheetX.* All cells up to the last active cell myRange A range name at spreadsheet level ~.yourRange, SheetX.someRange A range name at sheet level @@ -74,10 +75,10 @@ Option Explicit Several methods may receive a FilterFormula as argument. A FilterFormula may be associated with a FilterScope: row, column or cell. - These arguments determines on which rows/columns/cells of a range the method should be applied + These arguments determine on which rows/columns/cells of a range the method should be applied Examples: - oDoc.ClearAll(A1:J10, FilterFormula := =(A1=0), FilterScope := CELL) Clear all negative values - oDoc.ClearAll(A2:J10, FilterFormula := =(A2A1), FilterScope := COLUMN)Clear when identical to above cell + oDoc.ClearAll(A1:J10, FilterFormula := =(A1=0), FilterScope := CELL) Clear all negative values + oDoc.ClearAll(SheetX.A1:J10, =SUM(SheetX.A1:A10)100, COLUMN) Clear all columns whose sum is greater than 500 FilterFormula: a Calc formula that returns TRUE or FALSE the formula is expressed in terms of @@ -4372,8 +4373,8 @@ Private Function _ParseAddress(ByVal psAddress As String) As Object Parse and validate a sheet or range reference Syntax to parse: [Sheet].[Range] - Sheet = [][$]sheet[] or document named range or ~ - Range = A1:D10, A1, A:D, 10:10 ($ ignored), or sheet named range or ~ + Sheet = [$][]sheet[] or document named range or ~ + Range = A1:D10, A1, A:D, 10:10 ($ ignored), or sheet named range or ~ or * Returns: An object of type _Address Exceptions:
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdialogs/SF_Dialog.xba | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) New commits: commit bc8c1d45ac91a1b3855eec8358260a8720d4c081 Author: Jean-Pierre Ledure AuthorDate: Mon Jan 23 15:35:47 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Tue Jan 24 14:25:01 2023 + ScriptForge (SF_Dialog) define constants as properties OKBUTTON and CANCELBUTTON are defined in the help as properties, both for Basic and Python user scripts. To make dialog.OKBUTTON valid in Basic, OKBUTTON should be defined either as (1) Public Const OKBUTTON = 1 or (2) Property Get OKBUTTON() Actually, it if a Private constant. <= wrong Choice is made to make it a full property (2). Python equivalent is OK, no change required. No impact on help documentation. Change-Id: Id4cf7dfbaff68fc8cc48a5c4779374ce1e7cc88b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146008 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba index 507e5ac72c00..081584f56e81 100644 --- a/wizards/source/sfdialogs/SF_Dialog.xba +++ b/wizards/source/sfdialogs/SF_Dialog.xba @@ -99,8 +99,8 @@ Private _ControlCache As Variant Array of control objects sorted like E REM MODULE CONSTANTS Dialog usual buttons -Private Const OKBUTTON = 1 -Private Const CANCELBUTTON = 0 +Private Const cstOKBUTTON = 1 +Private Const cstCANCELBUTTON = 0 Page management Private Const PILOTCONTROL = 1 @@ -152,6 +152,11 @@ End Function SFDialogs.SF_Dialog Explicit Destructor REM == PROPERTIES +REM - +Property Get CANCELBUTTON() As Variant + CANCELBUTTON = cstCANCELBUTTON +End Property SFDialogs.SF_Dialog.CANCELBUTTON (get) + REM - Property Get Caption() As Variant The Caption property refers to the title of the dialog @@ -188,6 +193,11 @@ Property Get Name() As String Name = _PropertyGet(Name) End Property SFDialogs.SF_Dialog.Name +REM - +Property Get OKBUTTON() As Variant + OKBUTTON = cstOKBUTTON +End Property SFDialogs.SF_Dialog.OKBUTTON (get) + REM - Property Get OnFocusGained() As Variant Get the script associated with the OnFocusGained event
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Calc.xba |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 4525c47fa150bfc13b93763a3bce910623158810 Author: Jean-Pierre Ledure AuthorDate: Sun Jan 22 17:33:36 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Sun Jan 22 17:31:14 2023 + ScriptForge (SF_Calc) fix typo Change-Id: I086d4f9f6490ecce773aef598049af07b5f852d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145978 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index ac6976acf2de..8169ae2e188c 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -2665,7 +2665,7 @@ Try: sRowsRange = SetArray(Offset(sMirrorRange, , Width(sMirrorRange), 1, 1), vRows()) **Step 3: sort the mirrored data, including the row numbers column - sMirrorRange = $SF_WORK.$A$1:$K$100 + sFullMirrorRange = $SF_WORK.$A$1:$K$100 sFullMirrorRange = Offset(sMirrorRange, , , , Width(sMirrorRange) + 1) SortRange(sFullMirrorRange, SortKeys := Columns, CaseSensitive := CaseSensitive) @@ -4826,4 +4826,4 @@ CatchSheet: End Function SFDocuments.SF_Calc._ValidateSheetName REM END OF SFDOCUMENTS.SF_CALC - + \ No newline at end of file
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Utils.xba |2 +- wizards/source/scriptforge/po/ScriptForge.pot|4 ++-- wizards/source/scriptforge/po/en.po |4 ++-- wizards/source/scriptforge/po/pt.po |2 +- wizards/source/scriptforge/python/scriptforge.py |2 +- 5 files changed, 7 insertions(+), 7 deletions(-) New commits: commit 3563f2064ab4b4772dd805a4acff9e541a723431 Author: Jean-Pierre Ledure AuthorDate: Sun Jan 22 16:23:00 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Sun Jan 22 16:27:39 2023 + ScriptForge Upgrade version number to 7.6 Change-Id: Ifbf5ba5b28b7afff64ed36965eadfa68a750cfd9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145976 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Utils.xba b/wizards/source/scriptforge/SF_Utils.xba index 91b703c46431..d01d66aa946f 100644 --- a/wizards/source/scriptforge/SF_Utils.xba +++ b/wizards/source/scriptforge/SF_Utils.xba @@ -21,7 +21,7 @@ REM = GLOBAL Global _SF_As VariantSF_Root (Basic) object) ScriptForge version -Const SF_Version = 7.4 +Const SF_Version = 7.6 Standard symbolic names for VarTypes V_EMPTY = 0 diff --git a/wizards/source/scriptforge/po/ScriptForge.pot b/wizards/source/scriptforge/po/ScriptForge.pot index 894b9da3bbe0..e1eca9ae462f 100644 --- a/wizards/source/scriptforge/po/ScriptForge.pot +++ b/wizards/source/scriptforge/po/ScriptForge.pot @@ -7,14 +7,14 @@ # *** are part of the LibreOffice project. *** # * # -# ScriptForge Release 7.4 +# ScriptForge Release 7.6 # --- # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice_status=UNCONFIRMED=UI\n; -"POT-Creation-Date: 2022-10-12 15:07:35\n" +"POT-Creation-Date: 2023-01-22 15:34:36\n" "PO-Revision-Date: -MM-DD HH:MM:SS\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/wizards/source/scriptforge/po/en.po b/wizards/source/scriptforge/po/en.po index 894b9da3bbe0..e1eca9ae462f 100644 --- a/wizards/source/scriptforge/po/en.po +++ b/wizards/source/scriptforge/po/en.po @@ -7,14 +7,14 @@ # *** are part of the LibreOffice project. *** # * # -# ScriptForge Release 7.4 +# ScriptForge Release 7.6 # --- # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice_status=UNCONFIRMED=UI\n; -"POT-Creation-Date: 2022-10-12 15:07:35\n" +"POT-Creation-Date: 2023-01-22 15:34:36\n" "PO-Revision-Date: -MM-DD HH:MM:SS\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/wizards/source/scriptforge/po/pt.po b/wizards/source/scriptforge/po/pt.po index 3069dc87e0b3..316956c431c4 100644 --- a/wizards/source/scriptforge/po/pt.po +++ b/wizards/source/scriptforge/po/pt.po @@ -7,7 +7,7 @@ # *** are part of the LibreOffice project. *** # * # -# ScriptForge Release 7.4 +# ScriptForge Release 7.6 # --- # msgid "" diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index f368198be7e2..7abd8ff67716 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -103,7 +103,7 @@ class ScriptForge(object, metaclass = _Singleton): # Class constants # # library = 'ScriptForge' -Version = '7.4' # Actual version number +Version = '7.6' # Actual version number # # Basic dispatcher for Python scripts basicdispatcher = '@application#ScriptForge.SF_PythonHelper._PythonDispatcher'
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |3 wizards/source/sfdocuments/SF_Calc.xba | 126 +++ 2 files changed, 129 insertions(+) New commits: commit ac21a5ee9b51ab771736a2695426196f2f663c34 Author: Jean-Pierre Ledure AuthorDate: Sat Jan 21 16:43:39 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Sat Jan 21 16:48:19 2023 + 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index a15261caed58..f368198be7e2 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -2263,6 +2263,9 @@ class SFDocuments: def PrintOut(self, sheetname = '~', pages = '', copies = 1): return self.ExecMethod(self.vbMethod, 'PrintOut', sheetname, pages, copies) +def RemoveDuplicates(self, range, columns = 1, header = False, casesensitive = False, mode = 'COMPACT'): +return self.ExecMethod(self.vbMethod, 'RemoveDuplicates', range, columns, header, casesensitive, mode) + def RemoveSheet(self, sheetname): return self.ExecMethod(self.vbMethod, 'RemoveSheet', sheetname) diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index f2c9fc34e2f2..a6dce33f9d6a 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -2111,6 +2111,7 @@ Public Function Methods() As Variant , OpenRangeSelector _ , Printf _ , PrintOut _ + , RemoveDuplicates _ , RemoveSheet _ , RenameSheet _ , SetArray _ @@ -2582,6 +2583,131 @@ Public Function Properties() As Variant End Function SFDocuments.SF_Calc.Properties +REM - +Public Function RemoveDuplicates(Optional ByVal Range As Variant _ + , Optional ByVal Columns As Variant _ + , Optional ByVal Header As Variant _ + , Optional ByVal CaseSensitive As Variant _ + , Optional ByVal Mode As Variant _ + ) As String + 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. + Args: + 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,
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Calc.xba | 97 + 1 file changed, 62 insertions(+), 35 deletions(-) New commits: commit 40bc1b275324f9a730960fe5d4d8982cdfbc7b03 Author: Jean-Pierre Ledure AuthorDate: Tue Jan 17 18:13:48 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Wed Jan 18 14:18:40 2023 + ScriptForge - (SF_Calc) sort ranges on more than 3 keys The Calc.SortRange() method sorts the given range on any number of columns/rows. The sorting order may vary by column/row. The sorting algorithm allows for maximum 3 keys. When the number of sort keys is > 3 then the range is sorted several times, by groups of 3 keys, starting from the last key. In this context the algorithm used by Calc to sort ranges is presumed STABLE, i.e. it maintains the relative order of records with equal keys. Change-Id: If7f4920f7ab8f8ffb71edf648ed9accc8eb62dce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145681 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 391321f361d8..f2c9fc34e2f2 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -1084,7 +1084,7 @@ Const cstSubArgs = SourceRange, DestinationRange If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch sCopy = -Check: +Check:string If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not _IsStillAlive(True) Then GoTo Finally If Not ScriptForge.SF_Utils._Validate(SourceRange, SourceRange, Array(V_STRING, ScriptForge.V_OBJECT), , , CALCREFERENCE) Then GoTo Finally @@ -3305,7 +3305,11 @@ Public Function SortRange(Optional ByVal Range As Variant _ , Optional ByVal CaseSensitive As Variant _ , Optional ByVal SortColumns As Variant _ ) As Variant - Sort the given range on maximum 3 columns/rows. The sorting order may vary by column/row + Sort the given range on any number of columns/rows. The sorting order may vary by column/row + If the number of sort keys is 3 then the range is sorted several times, by groups of 3 keys, + starting from the last key. In this context the algorithm used by Calc to sort ranges + is presumed STABLE, i.e. it maintains the relative order of records with equal keys. + Args: Range: the range to sort as a string SortKeys: a scalar (if 1 column/row) or an array of column/row numbers starting from 1 @@ -3329,13 +,19 @@ Public Function SortRange(Optional ByVal Range As Variant _ Dim sSort As String Return value Dim oRangeAddress As _AddressParsed range Dim oRange As Object com.sun.star.table.XCellRange +Dim oSortRange As Object The area to sort as an _Address object Dim oDestRange As Object Destination as a range Dim oDestAddress As Object com.sun.star.table.CellRangeAddress Dim oDestCell As Object com.sun.star.table.CellAddress Dim vSortDescriptor As Variant Array of com.sun.star.beans.PropertyValue Dim vSortFields As Variant Array of com.sun.star.table.TableSortField Dim sOrder As String Item in SortOrder -Dim i As Long +Dim lSort As LongCounter for sub-sorts +Dim lKeys As LongUBound of SortKeys +Dim lKey As Long Actual index in SortKeys +Dim i As Long, j As Long +Const cstMaxKeys = 3 Maximum number of keys allowed in a single sorting step + Const cstThisSub = SFDocuments.Calc.SortRange Const cstSubArgs = Range, SortKeys, [TargetRange=], [SortOrder=ASC], [DestinationCell=], [ContainsHeader=False], [CaseSensitive=False], [SortColumns=False] @@ -3368,47 +3378,64 @@ Check: If Not ScriptForge.SF_Utils._Validate(SortColumns, SortColumns, ScriptForge.V_BOOLEAN) Then GoTo Finally End If Set oRangeAddress = _ParseAddress(Range) - If Len(DestinationCell) 0 Then Set oDestRange = _ParseAddress(DestinationCell) + If Len(DestinationCell) 0 Then Set oDestRange = _ParseAddress(DestinationCell) Else Set oDestRange = Nothing Try: - Initialize the sort descriptor + Initialize a generic sort descriptor Set oRange = oRangeAddress.XCellRange - vSortDescriptor = oRange.createSortDescrip
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Calc.xba | 35 - 1 file changed, 18 insertions(+), 17 deletions(-) New commits: commit c7ac513a8217179c5fae774363e8b0b1f41cea5c Author: Jean-Pierre Ledure AuthorDate: Mon Jan 16 16:25:22 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Tue Jan 17 16:17:45 2023 + ScriptForge - (SF_Calc) fix CompactUp/CompactLeft methods When - WholeRow/WholeColumn = False - no row or column matches the FilterFormula the cells below or at the right were erroneously shifted down or right. Future behaviour: - when nothing to compact, the initial range is left unchanged the return value = the initial range - when all rows/columns are impacted, the initial range is cleared the return value = zero-length string - otherwise the initial range is compacted the return value is the compacted range In either case, the surrounding cells are unchanged. Change-Id: I27288878dcadeb4ded297b7bb1e6897947ed5e56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145622 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 806f30bd7cad..391321f361d8 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -673,16 +673,17 @@ Try: Next i Compute the final range position - If lCountDeleted .Width Then sCompact = Offset(Range, 0, 0, 0, .Width - lCountDeleted) - - Push to the right the cells that migrated leftwards irrelevantly - If Not WholeColumn Then - If Len(sCompact) 0 Then + If lCountDeleted 0 Then + sCompact = Offset(Range, 0, 0, 0, .Width - lCountDeleted) + Push to the right the cells that migrated leftwards irrelevantly + If Not WholeColumn Then sShiftRange = Offset(sCompact, 0, .Width - lCountDeleted, , lCountDeleted) - Else - sShiftRange = .RangeName + ShiftRight(sShiftRange, WholeColumn := False) End If - ShiftRight(sShiftRange, WholeColumn := False) + Conventionally, if all columns are deleted, the returned range is the zero-length string + If .Width = lCountDeleted Then sCompact = + Else Initial range is left unchanged + sCompact = .RangeName End If End With @@ -724,7 +725,6 @@ Public Function CompactUp(Optional ByVal Range As Variant _ The rows having a X in column G are completely suppressed Dim sCompact As String Return value -Dim oCompact As Object Return value as an _Address type Dim lCountDeleted As LongCount the deleted rows Dim vCompactRanges As VariantArray of ranges to be compacted based on the formula Dim oSourceAddress As Object Alias of Range as _Address @@ -768,16 +768,17 @@ Try: Next i Compute the final range position - If lCountDeleted .Height Then sCompact = Offset(Range, 0, 0, .Height - lCountDeleted, 0) - - Push downwards the cells that migrated upwards irrelevantly - If Not WholeRow Then - If Len(sCompact) 0 Then + If lCountDeleted 0 Then + sCompact = Offset(Range, 0, 0, .Height - lCountDeleted, 0) + Push downwards the cells that migrated upwards irrelevantly + If Not WholeRow Then sShiftRange = Offset(sCompact, .Height - lCountDeleted, 0, lCountDeleted) - Else - sShiftRange = .RangeName + ShiftDown(sShiftRange, WholeRow := False) End If - ShiftDown(sShiftRange, WholeRow := False) + Conventionally, if all rows are deleted, the returned range is the zero-length string + If .Height = lCountDeleted Then sCompact = + Else Initial range is left unchanged + sCompact = .RangeName End If End With
[Libreoffice-commits] core.git: wizards/Package_sfdocuments.mk wizards/source
wizards/Package_sfdocuments.mk |1 wizards/source/scriptforge/SF_PythonHelper.xba |2 wizards/source/scriptforge/SF_Services.xba |2 wizards/source/scriptforge/SF_UI.xba |2 wizards/source/scriptforge/python/scriptforge.py | 67 +- wizards/source/sfdatabases/SF_Database.xba | 91 +++ wizards/source/sfdocuments/SF_Base.xba | 36 - wizards/source/sfdocuments/SF_Calc.xba |6 wizards/source/sfdocuments/SF_Document.xba | 16 wizards/source/sfdocuments/SF_Form.xba | 73 +- wizards/source/sfdocuments/SF_FormControl.xba|5 wizards/source/sfdocuments/SF_FormDocument.xba | 642 +++ wizards/source/sfdocuments/SF_Register.xba |8 wizards/source/sfdocuments/SF_Writer.xba | 10 wizards/source/sfdocuments/script.xlb|1 wizards/source/sfwidgets/SF_MenuListener.xba |7 16 files changed, 907 insertions(+), 62 deletions(-) New commits: commit 88a67c50af61fa9ee5fa677589ce5db2039d6f2e Author: Jean-Pierre Ledure AuthorDate: Thu Jan 5 13:47:01 2023 +0100 Commit: Jean-Pierre Ledure CommitDate: Thu Jan 5 15:00:28 2023 + 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/Package_sfdocuments.mk b/wizards/Package_sfdocuments.mk index a2a03178736a..4dcebfc84140 100644 --- a/wizards/Package_sfdocuments.mk +++ b/wizards/Package_sfdocuments.mk @@ -27,6 +27,7 @@ $(eval $(call gb_Package_add_files,wizards_basicsrvsfdocuments,$(LIBO_SHARE_FOLD SF_DocumentListener.xba \ SF_Form.xba \ SF_FormControl.xba \ + SF_FormDocument.xba \ SF_Register.xba \ SF_Writer.xba \ __License.xba \ diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba index 99d9f86c610c..ffec0af7586c 100644 --- a/wizards/source/scriptforge/SF_PythonHelper.xba +++ b/wizards/source/scriptforge/SF_PythonHelper.xba @@ -814,6 +814,8 @@ Try: End Select Case SFDocuments.FormControl If Script = Controls Then vReturn = vBasicObject.Controls(vArgs(0)) + Case SFDocuments.FormDocument + If Script = Forms Then vReturn = vBasicObject.Forms(vArgs(0)) End Select End If diff --git a/wizards/source/scriptforge/SF_Services.xba b/wizards/source/scriptforge/SF_Services.xba index b72298ea3046..8de43d389581 100644 --- a/wizards/source/scriptforge/SF_Services.xba +++ b
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdatabases/SF_Datasheet.xba | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) New commits: commit 56ab74cdf90880dbf756c6ee32135a02a98a6ec7 Author: Jean-Pierre Ledure AuthorDate: Thu Dec 15 17:39:33 2022 +0100 Commit: Jean-Pierre Ledure CommitDate: Fri Dec 16 11:03:41 2022 + ScriptForge - (SF_Datasheet) default values in GetText() and GetValue() Before this commit, the 'column' argument was manadatory. Now the argument becomes optional and designates the current column, i.e. the column containing the cursor. Additionally, when a datasheet is closed by code, any filter is better removed to avoid eventual user misunderstandings when the datasheet is reopened manually during the same session. Change-Id: I904cfa56a9407539a89b7d2451dcf6b45292f660 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144242 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdatabases/SF_Datasheet.xba b/wizards/source/sfdatabases/SF_Datasheet.xba index 681f9549b814..12b7f9e4f9c0 100644 --- a/wizards/source/sfdatabases/SF_Datasheet.xba +++ b/wizards/source/sfdatabases/SF_Datasheet.xba @@ -258,7 +258,11 @@ Check: If Not _IsStillAlive() Then GoTo Finally Try: - _TabControllerModel.close() + With _TabControllerModel + .ApplyFilter = False + .Filter = + .close() + End With _Frame.close(True) _Frame.dispose() Dispose() @@ -398,6 +402,8 @@ Try: If Column = 1 Then lMaxCol = .Count - 1 If Column lMaxCol + 1 Then lCol = lMaxCol Else lCol = Column - 1 + Else + lCol = .getCurrentColumnPosition() End If End If @@ -452,11 +458,15 @@ Try: If VarType(Column) = V_STRING Then lCol = ScriptForge.SF_Array.IndexOf(_ColumnHeaders, Column, CaseSensitive := False) + 1 Else - lCol = 0 - If Column = 1 Then - lMaxCol = _ControlView.Count - If Column lMaxCol Then lCol = lMaxCol Else lCol = Column - End If + With _ControlView + lCol = 0 + If Column = 1 Then + lMaxCol = .Count + If Column lMaxCol Then lCol = lMaxCol Else lCol = Column + Else + lCol = .getCurrentColumnPosition() + 1 + End If + End With End If The _TabControllerModel acts exactly as a result set, from which the generic _GetColumnValue can extract the searched value
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdatabases/SF_Datasheet.xba |8 wizards/source/sfdocuments/SF_Base.xba |2 +- 2 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 8a67d717099179bf77bf75d9e7437280e335439e Author: Jean-Pierre Ledure AuthorDate: Thu Dec 15 16:00:09 2022 +0100 Commit: Jean-Pierre Ledure CommitDate: Thu Dec 15 16:26:25 2022 + ScriptForge - (SF_Datasheet) minor changes in comments No effect on code execution. Hence no cherry-picks to previous release(s). Change-Id: I724c05ee2807e2783655cbb8889a721a5a5e1b75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144224 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdatabases/SF_Datasheet.xba b/wizards/source/sfdatabases/SF_Datasheet.xba index a7835e21ffbc..681f9549b814 100644 --- a/wizards/source/sfdatabases/SF_Datasheet.xba +++ b/wizards/source/sfdatabases/SF_Datasheet.xba @@ -21,7 +21,7 @@ Option Explicit 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 may or may not be opened. - Additionally, any SELECT SQL statement may trigger the datasheet display. + 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. @@ -30,8 +30,8 @@ Option Explicit 1) From an open Base document Set ui = CreateScriptService(UI) Set oBase = ui.getDocument(/home/user/Documents/myDb.odb) - Set oSheet1 = oBase.OpenTable(Customers) or OpenQuery(...) - Set oSheet2 = oBase.Datasheets(Products) when the datasheet has been opened manually + Set oSheet = oBase.OpenTable(Customers) or OpenQuery(...) + May be executed also when the given table is already open 2) Independently from a Base document Set oDatabase = CreateScriptService(Database, /home/user/Documents/myDb.odb) Set oSheet = oDatabase.OpenTable(Customers) @@ -709,8 +709,8 @@ Try: Set _ControlModel = _ControlView.getModel() End With - Retrieve the parent database instance With _TabControllerModel + Retrieve the parent database instance Select Case _ParentType Case BASE Set _ParentDatabase = [_Parent].GetDatabase(.User, .Password) diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba index eb39c86e851f..8970b7c05b96 100644 --- a/wizards/source/sfdocuments/SF_Base.xba +++ b/wizards/source/sfdocuments/SF_Base.xba @@ -520,7 +520,7 @@ Public Function OpenQuery(Optional ByVal QueryName As Variant _ QueryName: a valid Query name as a case-sensitive string DesignMode: when True the query is opened in design mode (Default = False) Returns: - A Datasheet class instance if the query could be opened and DesignMode = False, otherwise False + A Datasheet class instance if the query could be opened and DesignMode = False, otherwise Nothing Exceptions: Query name is invalid Example:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - wizards/source
wizards/source/scriptforge/SF_Dictionary.xba |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit ce3b32f5d522042bd87535762e5e7002d1498cc8 Author: Jean-Pierre Ledure AuthorDate: Tue Dec 13 17:50:43 2022 +0100 Commit: Jean-Pierre Ledure CommitDate: Wed Dec 14 08:16:02 2022 + SF_Dictionary: tdf#152351 Fix ReplaceItem does not accept array as value Next basic code Dim myDict as Variant myDict = CreateScriptService("Dictionary") myDict.Add("key", Array()) myDict.ReplaceItem("key", Array(1, 2, 3)) produces an error message incriminating the user code. While it should run normally ... Fixed by enlarging the validation rules. Patch on master: https://gerrit.libreoffice.org/c/core/+/144041 Change-Id: I2f2b32f30744b9d23f09aa3a9463165a75f7b778 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144076 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Dictionary.xba b/wizards/source/scriptforge/SF_Dictionary.xba index 367fc47553d8..22ada5148e2a 100644 --- a/wizards/source/scriptforge/SF_Dictionary.xba +++ b/wizards/source/scriptforge/SF_Dictionary.xba @@ -751,7 +751,11 @@ Const cstSubArgs = Key, Value Check: If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not SF_Utils._Validate(Key, Key, V_STRING) Then GoTo Catch - If Not SF_Utils._Validate(Value, Value) Then GoTo Catch + If IsArray(Value) Then + If Not SF_Utils._ValidateArray(Value, Value) Then GoTo Catch + Else + If Not SF_Utils._Validate(Value, Value) Then GoTo Catch + End If End If If Not Exists(Key) Then GoTo CatchUnknown
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - wizards/source
wizards/source/scriptforge/SF_Dictionary.xba |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 50fde068eb702354e4b603231577c807b5e07d1a Author: Jean-Pierre Ledure AuthorDate: Tue Dec 13 16:14:27 2022 +0100 Commit: Jean-Pierre Ledure CommitDate: Tue Dec 13 16:41:48 2022 + SF_Dictionary: tdf#152351 Fix ReplaceItem does not accept array as value Next basic code Dim myDict as Variant myDict = CreateScriptService("Dictionary") myDict.Add("key", Array()) myDict.ReplaceItem("key", Array(1, 2, 3)) produces an error message incriminating the user code. While it should run normally ... Fixed by enlarging the validation rules. Patch on master: https://gerrit.libreoffice.org/c/core/+/144041 Change-Id: I9055ec61a0ec1fbe9d92bdbaf24d8d34ebf62770 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144053 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/SF_Dictionary.xba b/wizards/source/scriptforge/SF_Dictionary.xba index 367fc47553d8..22ada5148e2a 100644 --- a/wizards/source/scriptforge/SF_Dictionary.xba +++ b/wizards/source/scriptforge/SF_Dictionary.xba @@ -751,7 +751,11 @@ Const cstSubArgs = Key, Value Check: If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not SF_Utils._Validate(Key, Key, V_STRING) Then GoTo Catch - If Not SF_Utils._Validate(Value, Value) Then GoTo Catch + If IsArray(Value) Then + If Not SF_Utils._ValidateArray(Value, Value) Then GoTo Catch + Else + If Not SF_Utils._Validate(Value, Value) Then GoTo Catch + End If End If If Not Exists(Key) Then GoTo CatchUnknown
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Dictionary.xba |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 57e2245abf50cbd207d5c9c57ed67c055f8afcd6 Author: Jean-Pierre Ledure AuthorDate: Tue Dec 13 11:23:49 2022 +0100 Commit: Jean-Pierre Ledure CommitDate: Tue Dec 13 14:40:13 2022 + SF_Dictionary: tdf#152351 Fix ReplaceItem does not accept array as value Next basic code Dim myDict as Variant myDict = CreateScriptService("Dictionary") myDict.Add("key", Array()) myDict.ReplaceItem("key", Array(1, 2, 3)) produces an error message incriminating the user code. While it should run normally ... Fixed by enlarging the validation rules. Change-Id: I667abc81cb712308764c342d0e74b95821e46a5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144041 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Dictionary.xba b/wizards/source/scriptforge/SF_Dictionary.xba index 367fc47553d8..22ada5148e2a 100644 --- a/wizards/source/scriptforge/SF_Dictionary.xba +++ b/wizards/source/scriptforge/SF_Dictionary.xba @@ -751,7 +751,11 @@ Const cstSubArgs = Key, Value Check: If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not SF_Utils._Validate(Key, Key, V_STRING) Then GoTo Catch - If Not SF_Utils._Validate(Value, Value) Then GoTo Catch + If IsArray(Value) Then + If Not SF_Utils._ValidateArray(Value, Value) Then GoTo Catch + Else + If Not SF_Utils._Validate(Value, Value) Then GoTo Catch + End If End If If Not Exists(Key) Then GoTo CatchUnknown
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py | 12 - wizards/source/sfdatabases/SF_Datasheet.xba | 221 --- 2 files changed, 120 insertions(+), 113 deletions(-) New commits: commit 26511a8961bc229c5685a913cc846398a97a5489 Author: Jean-Pierre Ledure AuthorDate: Sun Nov 6 16:46:10 2022 +0100 Commit: Jean-Pierre Ledure CommitDate: Sun Nov 6 17:37:10 2022 +0100 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 24a4aac8d70f..b3b79132d4b2 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1778,16 +1778,13 @@ class SFDatabases: servicename = 'SFDatabases.Datasheet' servicesynonyms = ('datasheet', 'sfdatabases.datasheet') serviceproperties = dict(ColumnHeaders = False, CurrentColumn = False, CurrentRow = False, - DatabaseFileName = False, LastRow = False, ParentDatabase = False, Source = False, - SourceType = False, XComponent = False, XControlModel = False, - XTabControllerModel = False) + DatabaseFileName = False, Filter = True, LastRow = False, OrderBy = True, + ParentDatabase = False, Source = False, SourceType = False, XComponent = False, + XControlModel = False, XTabControllerModel = False) def Activate(self): return self.ExecMethod(self.vbMethod, 'Activate') -def ApplyFilter(self, filter = ''): -return self.ExecMethod(self.vbMethod, 'ApplyFilter', filter) - def CloseDatasheet(self): return self.ExecMethod(self.vbMethod, 'CloseDatasheet') @@ -1803,9 +1800,6 @@ class SFDatabases: def GoToCell(self, row = 0, column = 0): return self.ExecMethod(self.vbMethod, 'GoToCell', row, column) -def OrderBy(self, order = ''): -return self.ExecMethod(self.vbMethod, 'OrderBy', order) - def RemoveMenu(self, menuheader): return self.ExecMethod(self.vbMethod, 'RemoveMenu', menuheader) diff --git a/wizards/source/sfdatabases/SF_Datasheet.xba b/wizards/source/sfdatabases/SF_Datasheet.xba index f085ac510a60..a7835e21ffbc 100644 --- a/wizards/source/sfdatabases/SF_Datasheet.xba +++ b/wizards/source/sfdatabases/SF_Datasheet.xba @@ -128,6 +128,20 @@ Property Get DatabaseFileName() As String DatabaseFileName = _PropertyGet(DatabaseFileName) End Property SFDatabases.SF_Datasheet.DatabaseFileName +REM - +Property Get Filter() As Variant + The Filter is a SQL WHERE clause without the WHERE keyword + Filter = _PropertyGet(Filter) +End Property SFDatabases.SF_Datasheet.Filter (get) + +REM - +Property Let Filter(Optional ByVal pvFilter As Variant) + Set the updatable property Filter + Table and field names may be surrounded by square brackets + When the argument is the zero-length string, the actual filter is removed + _PropertySet(Filter, pvFilter) +End Property SFDatabases.SF_Datasheet.Filter (let) + REM - Property Get LastRow() As Long Returns the total number of rows @@ -136,6 +150,20 @@ Property Get LastRow() As Long LastRow = _PropertyGet(LastRow) End Property SFDatabases.SF_Datasheet.LastRow +REM - +Property Get OrderBy() As Variant + The Order is a SQL ORDER BY clause without the ORDER BY keywords + OrderBy = _PropertyGet(OrderBy) +End Property SFDocuments.SF_Form.OrderBy (get) + +REM - +Property Let OrderBy(Optional ByVal pvOrderBy As Variant) + Set the updatable property OrderBy + Table and field names may be surrounded by square brackets + When the argument is the zero-length string, the actual sort is removed + _PropertySet(OrderBy, pvOrderBy) +End Property SFDocuments.SF_Form.OrderBy (let) + REM
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_UI.xba |2 wizards/source/scriptforge/python/scriptforge.py | 11 + wizards/source/sfdatabases/SF_Database.xba |4 wizards/source/sfdatabases/SF_Datasheet.xba | 167 --- wizards/source/sfdatabases/SF_Register.xba | 59 +--- wizards/source/sfdocuments/SF_Base.xba |6 wizards/source/sfdocuments/SF_Document.xba |2 wizards/source/sfdocuments/SF_Form.xba |6 wizards/source/sfwidgets/SF_Menu.xba | 10 + wizards/source/sfwidgets/SF_MenuListener.xba |5 wizards/source/sfwidgets/SF_Register.xba | 16 +- 11 files changed, 234 insertions(+), 54 deletions(-) New commits: commit 18638efa3973bf919a2502866773c02b7c24f7d7 Author: Jean-Pierre Ledure AuthorDate: Fri Nov 4 16:54:41 2022 +0100 Commit: Jean-Pierre Ledure CommitDate: Sat Nov 5 17:10:41 2022 +0100 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_UI.xba b/wizards/source/scriptforge/SF_UI.xba index 8d2b78e3714b..186d88244d75 100644 --- a/wizards/source/scriptforge/SF_UI.xba +++ b/wizards/source/scriptforge/SF_UI.xba @@ -1364,4 +1364,4 @@ Private Function _Repr() As String End Function ScriptForge.SF_UI._Repr REM END OF SCRIPTFORGE.SF_UI - + \ No newline at end of file diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 940c355f1e44..24a4aac8d70f 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1777,8 +1777,9 @@ class SFDatabases: serviceimplementation = 'basic' servicename = 'SFDatabases.Datasheet' servicesynonyms = ('datasheet', 'sfdatabases.datasheet') -serviceproperties = dict(ColumnHeaders = False, CurrentColumn = False, CurrentRow = False, LastRow = False, - SOurce = False, SourceType = False, XComponent = False, XControlModel = False, +serviceproperties = dict(ColumnHeaders = False, CurrentColumn = False, CurrentRow = False, + DatabaseFileName = False, LastRow = False, ParentDatabase = False, Source = False, + SourceType = False, XComponent = False, XControlModel = False, XTabControllerModel = False) def Activate(self): @@ -1790,6 +1791,9 @@ class SFDatabases: def CloseDatasheet(self): return self.ExecMethod(self.vbMethod, 'CloseDatasheet') +def CreateMenu(self, menuheader, before = '', submenuchar = '>'): +return self.ExecMethod(self.vbMethod, 'CreateMenu', menuheader, before, submenuchar) + def GetText(self, column = 0): return self.ExecMethod(self.vbMethod, 'GetText', column) @@ -1802,6 +1806,9 @@ class SFDatabases: def OrderBy(self, order = ''): return self.ExecMethod(self.vbMethod, 'OrderBy', order) +def RemoveMenu(self, menuheader): +return self.ExecMethod(self.vbMethod, 'RemoveMenu', menuheader) + # # # SFDialogs CLASS(alias of SFDialogs Basic library) ### diff --git a/wizards/source/sfdatabases/SF_Database.xba b/wizards/source/sfdatabases/SF_Database.xba index 6994f791a433..f0dec87c294e 100644 --- a/wizards/source/sfdatabases/SF_Database.xba +++ b/wizards/source/sfdatabases/SF_Database.xba @@ -897,7 +897,7 @@ Try: Setup the dispatcher Set oURL = New com.sun.star.util.URL oURL.Complete = .component:DB/DataSourceBrowser - Set oDispatch = StarDesktop.queryDispatch(oURL, _Blank, 8) + Set oDispatch = StarDesktop.queryDispatch(oURL, _blank, com.sun.star.frame.FrameSearchFlag.CREATE) Setup the arguments of the component to cre
[Libreoffice-commits] core.git: wizards/Package_sfdatabases.mk wizards/source
wizards/Package_sfdatabases.mk |1 wizards/source/scriptforge/SF_Services.xba |2 wizards/source/scriptforge/SF_UI.xba | 31 wizards/source/scriptforge/python/scriptforge.py | 117 ++- wizards/source/sfdatabases/SF_Database.xba | 189 + wizards/source/sfdatabases/SF_Datasheet.xba | 744 +++ wizards/source/sfdatabases/SF_Register.xba | 58 + wizards/source/sfdatabases/script.xlb|1 wizards/source/sfdialogs/SF_Dialog.xba |4 wizards/source/sfdocuments/SF_Base.xba | 107 +++ wizards/source/sfdocuments/SF_Calc.xba | 50 - wizards/source/sfdocuments/SF_Document.xba |4 12 files changed, 1232 insertions(+), 76 deletions(-) New commits: commit 985c77b570807dcc558ccff4a51430fe489b68fd Author: Jean-Pierre Ledure AuthorDate: Tue Nov 1 17:27:21 2022 +0100 Commit: Jean-Pierre Ledure CommitDate: Wed Nov 2 11:26:46 2022 +0100 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 diff --git a/wizards/Package_sfdatabases.mk b/wizards/Package_sfdatabases.mk index 81fc55750291..bc5636fa1b2f 100644 --- a/wizards/Package_sfdatabases.mk +++ b/wizards/Package_sfdatabases.mk @@ -21,6 +21,7 @@ $(eval $(call gb_Package_Package,wizards_basicsrvsfdatabases,$(SRCDIR)/wizards/s $(eval $(call gb_Package_add_files,wizards_basicsrvsfdatabases,$(LIBO_SHARE_FOLDER)/basic/SFDatabases,\ SF_Database.xba \ + SF_Datasheet.xba \ SF_Register.xba \ __License.xba \ dialog.xlb \ diff --git a/wizards/source/scriptforge/SF_Services.xba b/wizards/source/scriptforge/SF_Services.xba index 627dc4d2e8fe..b72298ea3046 100644 --- a/wizards/source/scriptforge/SF_Services.xba +++ b/wizards/source/scriptforge/SF_Services.xba @@ -129,7 +129,7 @@ Try: Case document, calc, writer, base, documentevent, formevent sLibrary = SFDocuments Case dialog, dialogevent : sLibrary = SFDialogs - Case database : sLibrary = SFDatabases + Case database, datasheet : sLibrary = SFDatabases Case unittest : sLibrary = SFUnitTests Case menu, popupmenu : sLibrary = SFWidgets Case Else diff --git a/wizards/source/scriptforge/SF_UI.xba b/wizards/source/scriptforge/SF_UI.xba index c8a7f9a8f861..e64011b9ed78 100644 --- a/wizards/source/scriptforge/SF_UI.xba +++ b/wizards/source/scriptforge/SF_UI.xba @@ -53,6 +53,7 @@ Type Window WindowTitle As String Only mean to identify new documents WindowFileName As String URL of file name DocumentTypeAs String Writer, Calc, ... + ParentName As String Identifier of the parent Base file when Window is a subcomponent End Type
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - wizards/source
wizards/source/sfdialogs/SF_Register.xba |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 1bce5209a93b4313e7b39932eabe5f84c39ee0ea Author: Jean-Pierre Ledure AuthorDate: Thu Oct 13 18:24:44 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Oct 17 11:11:55 2022 +0200 ScriptForge - (Dialogs) tdf#151510 fix CreateScriptService("dialog") Bug description: Programmatic access to doc-based dialog is not possible using ScriptForge.Dialog service The relevant component was identified incorrectly in routine SFDialogs.SF_Register_NewDialog() Change-Id: I13f6302330ca097b8aef8fd3cdbd0b3d05a1b58c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141337 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141359 diff --git a/wizards/source/sfdialogs/SF_Register.xba b/wizards/source/sfdialogs/SF_Register.xba index 11ee1543b412..e81dbb069fa8 100644 --- a/wizards/source/sfdialogs/SF_Register.xba +++ b/wizards/source/sfdialogs/SF_Register.xba @@ -291,7 +291,8 @@ Try: Loop Else bFound = True - vWindow = oUi._IdentifyWindow(StarDesktop.CurrentComponent) + Set oComp = StarDesktop.CurrentComponent + vWindow = oUi._IdentifyWindow(oComp) End If Case V_OBJECT com.sun.star.lang.XComponent bFound = True
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |4 1 file changed, 4 insertions(+) New commits: commit a69bca0fda60d988409f628efb21a1799a687378 Author: Jean-Pierre Ledure AuthorDate: Sun Oct 16 17:36:06 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Sun Oct 16 18:25:59 2022 +0200 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 11022984286b..c05d5349f0b4 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -727,6 +727,10 @@ class SFScriptForge: def CreateUnoService(cls, servicename): return cls.SIMPLEEXEC(cls.module + '.PyCreateUnoService', servicename) +@classmethod +def CreateUnoStruct(cls, unostructure): +return uno.createUnoStruct(unostructure) + @classmethod def DateAdd(cls, interval, number, date): if isinstance(date, datetime.datetime):
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdialogs/SF_Register.xba |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 06933af12a34aa07068c38af0ce196a7037f5119 Author: Jean-Pierre Ledure AuthorDate: Thu Oct 13 18:24:44 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Fri Oct 14 09:19:14 2022 +0200 ScriptForge - (Dialogs) tdf#151510 fix CreateScriptService("dialog") Bug description: Programmatic access to doc-based dialog is not possible using ScriptForge.Dialog service The relevant component was identified incorrectly in routine SFDialogs.SF_Register_NewDialog() Change-Id: I13f6302330ca097b8aef8fd3cdbd0b3d05a1b58c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141337 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdialogs/SF_Register.xba b/wizards/source/sfdialogs/SF_Register.xba index 11ee1543b412..e81dbb069fa8 100644 --- a/wizards/source/sfdialogs/SF_Register.xba +++ b/wizards/source/sfdialogs/SF_Register.xba @@ -291,7 +291,8 @@ Try: Loop Else bFound = True - vWindow = oUi._IdentifyWindow(StarDesktop.CurrentComponent) + Set oComp = StarDesktop.CurrentComponent + vWindow = oUi._IdentifyWindow(oComp) End If Case V_OBJECT com.sun.star.lang.XComponent bFound = True
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Exception.xba |4 wizards/source/scriptforge/SF_Root.xba | 14 wizards/source/scriptforge/po/ScriptForge.pot| 19 + wizards/source/scriptforge/po/en.po | 19 + wizards/source/scriptforge/python/scriptforge.py |4 wizards/source/sfdialogs/SF_Dialog.xba | 381 ++- wizards/source/sfdialogs/SF_DialogListener.xba | 92 + 7 files changed, 523 insertions(+), 10 deletions(-) New commits: commit 55477bf4fd3baa99f8b5d5686091d7613a1022c3 Author: Jean-Pierre Ledure AuthorDate: Wed Oct 12 16:09:11 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Wed Oct 12 17:52:59 2022 +0200 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Exception.xba b/wizards/source/scriptforge/SF_Exception.xba index 572b0fb950a6..f752e054f2b5 100644 --- a/wizards/source/scriptforge/SF_Exception.xba +++ b/wizards/source/scriptforge/SF_Exception.xba @@ -125,6 +125,7 @@ Const DIALOGNOTFOUNDERROR = DIALOGNOTFOUNDERROR Const DIALOGDEADERROR = DIALOGDEADERROR Const CONTROLTYPEERROR = CONTROLTYPEERROR Const TEXTFIELDERROR = TEXTFIELDERROR +Const PAGEMANAGERERROR = PAGEMANAGERERROR SF_Database Const DBREADONLYERROR = DBREADONLYERROR @@ -1020,6 +1021,9 @@ Try: Case TEXTFIELDERROR SF_DialogControl.WriteLine(ControlName, DialogName) sMessage = sLocation _ \n \n .GetText(TEXTFIELD, pvArgs(0), pvArgs(1)) + Case PAGEMANAGERERROR SF_Dialog.SetPageManager(PilotsList, TabsList, WizardsList) + sMessage = sLocation _ +\n \n .GetText(PAGEMANAGER, pvArgs(0), pvArgs(1), pvArgs(2), pvArgs(3), pvArgs(4), pvArgs(5)) Case DBREADONLYERROR SF_Database.RunSql() sMessage = sLocation _ \n \n .GetText(DBREADONLY, vLocation(2)) diff --git a/wizards/source/scriptforge/SF_Root.xba b/wizards/source/scriptforge/SF_Root.xba index 4db0efb42c1d..8c9a0dbcf6be 100644 --- a/wizards/source/scriptforge/SF_Root.xba +++ b/wizards/source/scriptforge/SF_Root.xba @@ -991,6 +991,20 @@ Try: %1: An identifier\n _ %2: An identifier _ ) + SF_Dialog.SetPageManager + .AddText( Context := PAGEMANAGER _ + , MsgId := The Page Manager could not be setup due to inconsistent arguments.\n\n
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |4 1 file changed, 4 insertions(+) New commits: commit 992b393be8c33103cd18ca65dfc51cdfdb3fd618 Author: Jean-Pierre Ledure AuthorDate: Sun Sep 11 15:52:21 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Sun Sep 11 17:31:34 2022 +0200 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 Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index e4a0aa5ea5b4..5535760445cd 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1022,6 +1022,10 @@ class SFScriptForge: ext = ctx.getByName('/singletons/com.sun.star.deployment.PackageInformationProvider') apso = 'apso.python.script.organizer' if len(ext.getPackageLocation(apso)) > 0: +# APSO is available. However, PythonShell() is ignored in bridge mode +# because APSO library not in pythonpath +if ScriptForge.port > 0: +return None # Directly derived from apso.oxt|python|scripts|tools.py$console # we need to load apso before import statement ctx.ServiceManager.createInstance('apso.python.script.organizer.impl')
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Document.xba |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 8f6b7429ed123526659c197663bf5d950f461037 Author: Jean-Pierre Ledure AuthorDate: Mon Aug 22 17:04:16 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Tue Aug 23 09:49:13 2022 +0200 ScriptForge - (SF_Document) fix Import/ExportFilters properties in the internal method _GetFilterNames(), in an array of PropertyValues, 2 indexes were hardcoded to optimize their access. The sequence of items has been changed in LO 7.4. The search of the correct Name-Value pairs is reviewed to make it independent of their position in the array. No impact on documentation. The function is of minor importance. Patch for LO 7.4 to make only if bug reported in bugzilla. Change-Id: I2d3147c9c7624bf79a4e077469223794dc2398bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138695 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Document.xba b/wizards/source/sfdocuments/SF_Document.xba index 7c9991124d63..30508f2e87b1 100644 --- a/wizards/source/sfdocuments/SF_Document.xba +++ b/wizards/source/sfdocuments/SF_Document.xba @@ -1318,9 +1318,9 @@ Try: For Each sFilter In vAllFilters vFilter = oFilterFactory.getByName(sFilter) - sType = vFilter(12).Value Hard-coded index for document types + sType = ScriptForge.SF_Utils._GetPropertyValue(vFilter, DocumentService) If sType = sIdentifier Then - lFlags = vFilter(10).ValueHard-coded index for flags + lFlags = ScriptForge.SF_Utils._GetPropertyValue(vFilter, Flags) export: flag is even import: flag is odd and flag/2 is even import/export: flag is odd and flag/2 is odd
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Calc.xba | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) New commits: commit 6caa4dad840542ba58570fa2bced35f63833aa8a Author: Jean-Pierre Ledure AuthorDate: Mon Aug 22 11:21:02 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Mon Aug 22 16:51:11 2022 +0200 ScriptForge - (SF_Calc) support of 16384 columns in a sheet Alignment with Calc support of 2^14 columns as from LO 7.4 instead of 2^10. Review of comments accordingly. Minor optimization of internal method _GetColumnName() More accurate control of boundaries in internal method _Offset() Change-Id: I590ae9a4fab0b90a6e9cc9bbacf6c1b582f9c6e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138666 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 3530544bc038..e32dab652166 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -134,7 +134,7 @@ REM MODULE CONSTANT Private Const cstSHEET = 1 Private Const cstRANGE = 2 -Private Const MAXCOLS = 2^10 Max number of columns in a sheet +Private Const MAXCOLS = 2^14 Max number of columns in a sheet Private Const MAXROWS = 2^20 Max number of rows in a sheet Private Const CALCREFERENCE= SF_CalcReference Object type of _Address @@ -4056,11 +4056,11 @@ End Function SFDocuments.SF_Calc._FileIdent REM - Function _GetColumnName(ByVal plColumnNumber As Long) As String - Convert a column number (range 1, 2,..1024) into its letter counterpart (range A, B,..AMJ). + Convert a column number (range 1, 2,..16384) into its letter counterpart (range A, B,..XFD). Args: - ColumnNumber: the column number, must be in the interval 1 ... 1024 + ColumnNumber: the column number, must be in the interval 1 ... 16384 Returns: - a string representation of the column name, in range A..AMJ + a string representation of the column name, in range A..XFD Adapted from a Python function by sundar nataraj http://stackoverflow.com/questions/23861680/convert-spreadsheet-number-to-column-letter @@ -4069,11 +4069,12 @@ Dim lDiv As Long Intermediate result Dim lMod As Long Result of modulo 26 operation Try: + sCol = lDiv = plColumnNumber Do While lDiv 0 lMod = (lDiv - 1) Mod 26 - sCol = Chr(65 + lMod) + sCol - lDiv = Int((lDiv - lMod)/26) + sCol = Chr(65 + lMod) sCol + lDiv = (lDiv - lMod) \ 26 Loop Finally: @@ -4172,8 +4173,8 @@ Try: lRight = lLeft + Iif(plWidth = 0, .EndColumn - .StartColumn, plWidth - 1) lBottom = lTop + Iif(plHeight = 0, .EndRow - .StartRow, plHeight - 1) If lLeft 0 Or lRight 0 Or lTop 0 Or lBottom 0 _ - Or lLeft MAXCOLS Or lRight MAXCOLS _ - Or lTop MAXROWS Or lBottom MAXROWS _ + Or lLeft = MAXCOLS Or lRight = MAXCOLS _ + Or lTop = MAXROWS Or lBottom = MAXROWS _ Then GoTo CatchAddress Set oNewRange = oSheet.getCellRangeByPosition(lLeft, lTop, lRight, lBottom) End With
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py | 16 - wizards/source/sfdocuments/SF_Calc.xba | 244 +-- 2 files changed, 149 insertions(+), 111 deletions(-) New commits: commit d57836db76fcf3133e6eb54d264c774911015e08 Author: Jean-Pierre Ledure AuthorDate: Sat Aug 20 16:33:10 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Sat Aug 20 19:35:49 2022 +0200 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 6d944d1460aa..e4a0aa5ea5b4 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -2082,14 +2082,14 @@ class SFDocuments: def Charts(self, sheetname, chartname = ''): return self.ExecMethod(self.vbMethod + self.flgArrayRet, 'Charts', sheetname, chartname) -def ClearAll(self, range): -return self.ExecMethod(self.vbMethod, 'ClearAll', range) +def ClearAll(self, range, filterformula = '', filterscope = ''): +return self.ExecMethod(self.vbMethod, 'ClearAll', range, filterformula, filterscope) -def ClearFormats(self, range): -return self.ExecMethod(self.vbMethod, 'ClearFormats', range) +def ClearFormats(self, range, filterformula = '', filterscope = ''): +return self.ExecMethod(self.vbMethod, 'ClearFormats', range, filterformula, filterscope) -def ClearValues(self, range): -return self.ExecMethod(self.vbMethod, 'ClearValues', range) +def ClearValues(self, range, filterformula = '', filterscope = ''): +return self.ExecMethod(self.vbMethod, 'ClearValues', range, filterformula, filterscope) def CompactLeft(self, range, wholecolumn = False, filterformula = ''): return self.ExecMethod(self.vbMethod, 'CompactLeft', range, wholecolumn, filterformula) @@ -2194,8 +2194,8 @@ class SFDocuments: def SetArray(self, targetcell, value): return self.ExecMethod(self.vbMethod + self.flgArrayArg, 'SetArray', targetcell, value) -def SetCellStyle(self, targetrange, style): -return self.ExecMethod(self.vbMethod, 'SetCellStyle', targetrange, style) +def SetCellStyle(self, targetrange, style, filterformula = '', filterscope = ''): +return self.ExecMethod(self.vbMethod, 'SetCellStyle', targetrange, style, filterformula, filterscope) def SetFormula(self, targetrange, formula): return self.ExecMethod(self.vbMethod + self.flgArrayArg, 'SetFormula', targetrange, formula) diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 04b4924f1924..3530544bc038 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -543,126 +543,63 @@ Catch: End Function SFDocuments.SF_Calc.Charts REM - -Public Sub ClearAll(Optional ByVal Range As Variant) As String +Public Sub ClearAll(Optional ByVal Range As Variant _ + , Optional FilterFormula As Variant _ + , Optional FilterScope As Variant _ + ) Clear entirely the given range Args: Range : the cell or the range as a string that should be cleared + FilterFormul
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Calc.xba | 258 +++-- 1 file changed, 180 insertions(+), 78 deletions(-) New commits: commit 9f4405c94bc7d9d7500aedc1ade2d90955ab69d7 Author: Jean-Pierre Ledure AuthorDate: Tue Aug 16 16:13:40 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Wed Aug 17 14:01:07 2022 +0200 ScriptForge - (Calc) redesign CompactUp() and CompactLeft() This commit is mainly about the introduction of a new internal method: _ComputeFilter(range, filterformula, filterscope) 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 concept of FilterFormula was already used by CompactUp() and CompactLeft(). Their implicit (Filter)scopes were resp. "ROW" and "COLUMN". The _ComputeFilter() method returns an array of subranges contained in the initial range that match the filter. The isolation the code for the management of filters applied on ranges makes the later use of the concepts of FilterFormula and FilterScope reusable for other methods. CompactUp() and CompactLeft() are functionally unchanged. No impact on documentation. Change-Id: I7c4e890b54f315486f29b5434a3c236167e2f9ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138368 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index b929faccd58c..61d1691f7d43 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -45,6 +45,7 @@ Option Explicit The substring SFDocuments. in the service name is optional Definitions: + Many methods require a Sheet or a Range as argument. (NB: a single cell is considered as a special case of a Range) Usually, within a specific Calc instance, sheets and ranges are given as a string: SheetX and D2:F6 Multiple ranges are not supported in this context. @@ -71,6 +72,21 @@ Option Explicit myDoc.Range(SheetX.D2:F6) A range within the sheet SheetX in file associated with the myDoc Calc instance + Several methods may receive a FilterFormula as argument. + A FilterFormula may be associated with a FilterScope: row, column or cell. + These arguments determines on which rows/columns/cells of a range the method should be applied + Examples: + oDoc.ClearAll(A1:J10, FilterFormula := =(A1=0), FilterScope := CELL) Clear all negative values + oDoc.ClearAll(A2:J10, FilterFormula := =(A2A1), FilterScope := COLUMN)Clear when identical to above cell + + FilterFormula: 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 + relative and absolute references will be interpreted correctly + FilterScope:the way the formula is applied, once by row, by column, or by individual cell + Detailed user documentation: https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_calc.html?DbPAR=BASIC @@ -544,7 +560,7 @@ Const cstSubArgs = Range Check: If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then If Not _IsStillAlive() Then GoTo Finally - If Not ScriptForge.SF_Utils._Validate(Range, Range, V_STRING) Then GoTo Finally + If Not ScriptForge.SF_Utils._Validate(Range, Range, Array(V_STRING, ScriptForge.V_OBJECT)) Then GoTo Finally End If Try: @@ -560,7 +576,7 @@ Try: + .OBJECTS _
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - wizards/source
wizards/source/scriptforge/SF_PythonHelper.xba | 12 wizards/source/scriptforge/python/scriptforge.py |9 + 2 files changed, 17 insertions(+), 4 deletions(-) New commits: commit 356bb47cb404eb54d1aea4ae7ab72c13e5f904ea Author: Jean-Pierre Ledure AuthorDate: Wed Aug 10 16:07:07 2022 +0200 Commit: Rafael Lima CommitDate: Fri Aug 12 17:30:35 2022 +0200 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 Controls EndExecute Execute (Controls is already hardcoded because returning an array) Patch on master: https://gerrit.libreoffice.org/c/core/+/137084 Patch on libreoffice-7-4: https://gerrit.libreoffice.org/c/core/+/137113 Change-Id: I1d2ef4d6e5d5e2863ac39ce646084cbd9265fe84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138093 Tested-by: Jenkins Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Reviewed-by: Rafael Lima diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba index 5b919ba5abe1..d257df3cab27 100644 --- a/wizards/source/scriptforge/SF_PythonHelper.xba +++ b/wizards/source/scriptforge/SF_PythonHelper.xba @@ -614,6 +614,7 @@ Const cstArgArray = 512 Any argument can be a 2D array Const cstRetArray = 1024 Return value can be an array Const cstUno = 256 Return value can be a UNO object Const cstObject = 2048 1st argument is a Basic object when numeric +Const cstHardCode = 4096 Method must not be executed with CallByName() Object nature in returned array Const objMODULE = 1, objCLASS = 2, objUNO = 3 @@ -792,6 +793,17 @@ Try: If Script = Controls Then vReturn = vBasicObject.Controls(vArgs(0)) End Select + Methods in class modules may better not be executed with CallByName() + ElseIf bBasicClass And ((CallType And vbMethod) + (CallType And cstHardCode)) = vbMethod + cstHardCode Then + Select Case sServiceName + Case SFDialogs.Dialog + Select Case Script + Case Activate : vReturn = vBasicObject.Activate() + Case EndExecute : vReturn = vBasicObject.EndExecute(vArgs(0)) + Case Execute: vReturn = vBasicObject.Execute(vArgs(0)) + End Select + End Select + Methods in class modules are invoked with CallByName ElseIf bBasicClass And ((CallType And vbMethod) = vbMethod) Then Select Case UBound(vArgs) diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 9dc95d21f715..894ead016574 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -445,6 +445,7 @@ class SFServices(object): flgArrayRet = 1024 # Invoked service method can return a 2D array (standard modules) or any array (class modules) flgUno = 256 # Invoked service method/property can return a UNO object flgObject = 2048 # 1st argument may be a Basic object +flgHardCode = 4096 # Force hardcoded call to method, avoid CallByName() # Basic class type moduleClass, moduleStandard = 2, 1 # @@ -1652,16 +1653,16 @@ class SFDialogs: return container, library, dialogname, ScriptForge.componentcontext def Activate(self): -return self.ExecMethod(self.vbMethod, 'Activate') +return self.ExecMethod(self.vbMethod + self.flgHardCode, 'Activate') def Controls(self, controlname = ''): -return self.ExecMethod(self.vbMethod + self.flgArrayRet, 'Controls', controlname) +return self.ExecMethod(self.vbMethod + self.flgArrayRet + self.flgHardCode, 'Controls', controlname) def EndExecute(self, returnvalue): -return self.ExecMethod(self.vbMethod, 'EndExecute', returnvalue) +return self.ExecMethod(self.vbMethod + self.flgHardCode, 'EndExecute', returnvalue) def Execute(self, modal = True): -return self.ExecMethod(self.vbMethod, 'Execute', modal) +return self.ExecMethod
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_FileSystem.xba |2 +- wizards/source/sfdocuments/SF_Calc.xba |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit 6814e4375c9c1e17b6a09dbbd0651034542dec54 Author: Jean-Pierre Ledure AuthorDate: Tue Aug 2 13:10:46 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Tue Aug 2 15:55:48 2022 +0200 ScriptForge - tdf#150203 Use RANDBETWEEN.NV i.o. RANDBETWEEN Extract of the bug report (Rafael Lima) This bug affects a method from the ScriptForge library, more specifically the GetTempName method from the FileSystem service, which relies on calling RANDBETWEEN. Because of this bug, GetTempName only works in English, but fails in other languages. Below is a sample code for testing the GetTempName error. Sub TestTempName GlobalScope.BasicLibraries.LoadLibrary("ScriptForge") fs = CreateScriptService("FileSystem") MsgBox fs.GetTempName() End sub Interestingly changing RANDBETWEEN for RANDBETWEEN.NV in the macro above will work. Occurrences of the use of RANDBETWEEN: wizards/source/scriptforge/SF_FileSystem.xba wizards/source/sfdocuments/SF_Calc.xba Change-Id: Iea38f11acb7113aa5eaab1feff7a0e64a739aada Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137691 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index 8b21ea9a70df..21464c708fe5 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -1178,7 +1178,7 @@ Check: SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Try: - lRandom = SF_Session.ExecuteCalcFunction(RANDBETWEEN, 1, 99) + lRandom = SF_Session.ExecuteCalcFunction(RANDBETWEEN.NV, 1, 99) sFile = SF_FileSystem.TemporaryFolder SF_ Right(00 lRandom, 6) Finally: diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 8cfbd3419791..b929faccd58c 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -935,7 +935,7 @@ Try: If a sheet with same name as input exists in the target sheet, rename it first with a random name sRandom = If ScriptForge.SF_Array.Contains(vSheets, .SheetName) Then - lRandom = ScriptForge.SF_Session.ExecuteCalcFunction(RANDBETWEEN, 1, 999) + lRandom = ScriptForge.SF_Session.ExecuteCalcFunction(RANDBETWEEN.NV, 1, 999) sRandom = SF_ Right(000 lRandom, 7) oSheets.getByName(.SheetName).setName(sRandom) End If @@ -944,7 +944,7 @@ Try: Rename to new sheet name oSheets.getByName(.SheetName).setName(NewName) Reset random name - If Len(sRandom) 0 Then oSheets.getByName(srandom).setName(.SheetName) + If Len(sRandom) 0 Then oSheets.getByName(sRandom).setName(.SheetName) End With End If bCopy = True
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - wizards/source
wizards/source/scriptforge/SF_PythonHelper.xba |1 + wizards/source/scriptforge/python/scriptforge.py |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) New commits: commit d1e09ee551b18eedb46c2bb4bc5cd175b94bcd93 Author: Jean-Pierre Ledure AuthorDate: Thu Jul 21 14:59:35 2022 +0200 Commit: Rafael Lima CommitDate: Thu Jul 21 16:20:32 2022 +0200 ScriptForge - tdf#149983 dialog.Execute() failure (patch https://gerrit.libreoffice.org/c/core/+/137113 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) cfr.commit on master https://gerrit.libreoffice.org/c/core/+/137289 Change-Id: Ia54f2f0a45a212f6d8f35879a1ea92f68db35111 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137301 Tested-by: Jenkins Reviewed-by: Rafael Lima diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba index 178dfcc09749..99d9f86c610c 100644 --- a/wizards/source/scriptforge/SF_PythonHelper.xba +++ b/wizards/source/scriptforge/SF_PythonHelper.xba @@ -826,6 +826,7 @@ Try: Case Center If UBound(vArgs) 0 Then vReturn = vBasicObject.Center() Else vReturn = vBasicObject.Center(vArgs(0)) Case EndExecute : vReturn = vBasicObject.EndExecute(vArgs(0)) + Case Execute: vReturn = vBasicObject.Execute(vArgs(0)) Case Resize : vReturn = vBasicObject.Resize(vArgs(0), vArgs(1), vArgs(2), vArgs(3)) End Select End Select diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 003abfb9b2ee..ebc6f147c114 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1799,7 +1799,7 @@ class SFDialogs: return self.ExecMethod(self.vbMethod + self.flgHardCode, 'EndExecute', returnvalue) def Execute(self, modal = True): -return self.ExecMethod(self.vbMethod, 'Execute', modal) +return self.ExecMethod(self.vbMethod + self.flgHardCode, 'Execute', modal) def GetTextsFromL10N(self, l10n): l10nobj = l10n.objectreference if isinstance(l10n, SFScriptForge.SF_L10N) else l10n
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_PythonHelper.xba |1 + wizards/source/scriptforge/python/scriptforge.py |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) New commits: commit cd8ab93d9b84ed34d18334e07e1e11bd1728e161 Author: Jean-Pierre Ledure AuthorDate: Thu Jul 21 12:40:15 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Thu Jul 21 14:53:30 2022 +0200 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba index 178dfcc09749..99d9f86c610c 100644 --- a/wizards/source/scriptforge/SF_PythonHelper.xba +++ b/wizards/source/scriptforge/SF_PythonHelper.xba @@ -826,6 +826,7 @@ Try: Case Center If UBound(vArgs) 0 Then vReturn = vBasicObject.Center() Else vReturn = vBasicObject.Center(vArgs(0)) Case EndExecute : vReturn = vBasicObject.EndExecute(vArgs(0)) + Case Execute: vReturn = vBasicObject.Execute(vArgs(0)) Case Resize : vReturn = vBasicObject.Resize(vArgs(0), vArgs(1), vArgs(2), vArgs(3)) End Select End Select diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 6ad4720e6686..6d944d1460aa 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1802,7 +1802,7 @@ class SFDialogs: return self.ExecMethod(self.vbMethod + self.flgHardCode, 'EndExecute', returnvalue) def Execute(self, modal = True): -return self.ExecMethod(self.vbMethod, 'Execute', modal) +return self.ExecMethod(self.vbMethod + self.flgHardCode, 'Execute', modal) def GetTextsFromL10N(self, l10n): l10nobj = l10n.objectreference if isinstance(l10n, SFScriptForge.SF_L10N) else l10n
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdialogs/SF_Dialog.xba |2 ++ 1 file changed, 2 insertions(+) New commits: commit 0a2d22ceac6236fc999db368cc6201c6153dd71b Author: Jean-Pierre Ledure AuthorDate: Mon Jul 18 17:42:31 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Tue Jul 19 11:24:03 2022 +0200 ScriptForge - (SF_Dialog) trap errors caused by dialog events A dialog is started with the Execute() method. During its life span user scripts may be executed as a consequence of mouse clicks etc. When those scripts contain errors and they are not trapped; - in the actual situation, the error is detected by ScriptForge and considered as an internal error - this new commit considers the error as a user error. The help pages should be completed to promote the use of errors trapping inside scripts triggered by events. Change-Id: Iba3eefc75d305c17e6e1d9d416496882e0f816bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137203 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba index da2afcb4a80e..4a6d1ae7a380 100644 --- a/wizards/source/sfdialogs/SF_Dialog.xba +++ b/wizards/source/sfdialogs/SF_Dialog.xba @@ -561,6 +561,8 @@ Finally: ScriptForge.SF_Utils._ExitFunction(cstThisSub) Exit Function Catch: + When an error is caused by an event error, the location is unknown + SF_Exception.Raise(, ?) GoTo Finally End Function SFDialogs.SF_Dialog.Execute
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - wizards/source
wizards/source/scriptforge/SF_PythonHelper.xba | 24 ++- wizards/source/scriptforge/python/scriptforge.py | 12 ++- 2 files changed, 26 insertions(+), 10 deletions(-) New commits: commit b56cf8b8c97215a3422532e9a98bef3110fab7c1 Author: Jean-Pierre Ledure AuthorDate: Sat Jul 16 10:31:31 2022 +0200 Commit: Rafael Lima CommitDate: Sat Jul 16 15:14:36 2022 +0200 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) Commit on master: https://gerrit.libreoffice.org/c/core/+/137084 Change-Id: I67649d86d2f0f2f76f3bdbbdbd0b22ae3e132b04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137113 Tested-by: Jenkins Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba index c3d67d8764fc..178dfcc09749 100644 --- a/wizards/source/scriptforge/SF_PythonHelper.xba +++ b/wizards/source/scriptforge/SF_PythonHelper.xba @@ -611,10 +611,11 @@ Const vbGet = 2, vbLet = 4, vbMethod = 1, vbSet = 8 Protocol flags Const cstDateArg = 64May contain a date argument Const cstDateRet = 128 Return value can be a date +Const cstUno = 256 Return value can be a UNO object Const cstArgArray = 512 Any argument can be a 2D array Const cstRetArray = 1024 Return value can be an array -Const cstUno = 256 Return value can be a UNO object Const cstObject = 2048 1st argument is a Basic object when numeric +Const cstHardCode = 4096 Method must not be executed with CallByName() Object nature in returned array Const objMODULE = 1, objCLASS = 2, objUNO = 3 @@ -625,7 +626,7 @@ Check: Ignore Null basic objects (Null = Null or Nothing) If IsNull(BasicObject) Or IsEmpty(BasicObject) Then GoTo Catch - Reinterpret arguments one by one into vArgs, examine iso-dates and conventional NoArgs/Empty/Null values + Reinterpret arguments one by one into vArgs, convert UNO date/times and conventional NoArgs/Empty/Null/Missing values iNbArgs = -1 vArgs = Array() @@ -667,14 +668,14 @@ Try: The CallByName function fails when returning an array (2) Python has tuples and tuple of tuples, not 2D arrays (3) Passing 2D arrays through a script provider always transform it into a sequence of sequences + (4) The CallByName function takes exclusive control on the targeted object up to its exit 1. Methods in usual modules are called by ExecuteBasicScript() except if they use a ParamArray 2. Properties in any service are got and set with obj.GetProperty/SetProperty(...) 3. Methods in class modules are invoked with CallByName 4. Methods in class modules using a 2D array or returning arrays, or methods using ParamArray, are hardcoded as exceptions or are not implemented - 5. Methods returning a 1D array when no arguments and a scalar otherwise (e.g. SF_Dialog.Controls()) - may be considered as properties when no argument - Requires Python and Basic update in the concerned library but is transparent for this dispatcher + 5. Due to constraint (4), a predefined list of method calls must be hardcoded to avoid blocking use of CallByName + The concerned methods are flagged with cstHardCode With _SF_ Initialize Python persistent storage at 1st call @@ -816,6 +817,19 @@ Try: End Select End If + Methods in class modules may better not be executed with CallByName() + ElseIf bBasicClass And ((CallType And vbMethod) + (CallType And cstHardCode)) = vbMethod + cstHardCode Then + Select Case sServiceName + Case SFDialogs.Dialog + Select Case Script + Case Activate : vReturn = vBasicObject.Activate() + Case Center + If UBound(vArgs) 0 Then vReturn = vBasicObject.Center() Else vReturn
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_PythonHelper.xba | 24 ++- wizards/source/scriptforge/python/scriptforge.py | 12 ++- 2 files changed, 26 insertions(+), 10 deletions(-) New commits: commit 91a1662c66e5e988d36012533fceab9221607282 Author: Jean-Pierre Ledure AuthorDate: Thu Jul 14 16:31:01 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Sat Jul 16 09:49:06 2022 +0200 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba index c3d67d8764fc..178dfcc09749 100644 --- a/wizards/source/scriptforge/SF_PythonHelper.xba +++ b/wizards/source/scriptforge/SF_PythonHelper.xba @@ -611,10 +611,11 @@ Const vbGet = 2, vbLet = 4, vbMethod = 1, vbSet = 8 Protocol flags Const cstDateArg = 64May contain a date argument Const cstDateRet = 128 Return value can be a date +Const cstUno = 256 Return value can be a UNO object Const cstArgArray = 512 Any argument can be a 2D array Const cstRetArray = 1024 Return value can be an array -Const cstUno = 256 Return value can be a UNO object Const cstObject = 2048 1st argument is a Basic object when numeric +Const cstHardCode = 4096 Method must not be executed with CallByName() Object nature in returned array Const objMODULE = 1, objCLASS = 2, objUNO = 3 @@ -625,7 +626,7 @@ Check: Ignore Null basic objects (Null = Null or Nothing) If IsNull(BasicObject) Or IsEmpty(BasicObject) Then GoTo Catch - Reinterpret arguments one by one into vArgs, examine iso-dates and conventional NoArgs/Empty/Null values + Reinterpret arguments one by one into vArgs, convert UNO date/times and conventional NoArgs/Empty/Null/Missing values iNbArgs = -1 vArgs = Array() @@ -667,14 +668,14 @@ Try: The CallByName function fails when returning an array (2) Python has tuples and tuple of tuples, not 2D arrays (3) Passing 2D arrays through a script provider always transform it into a sequence of sequences + (4) The CallByName function takes exclusive control on the targeted object up to its exit 1. Methods in usual modules are called by ExecuteBasicScript() except if they use a ParamArray 2. Properties in any service are got and set with obj.GetProperty/SetProperty(...) 3. Methods in class modules are invoked with CallByName 4. Methods in class modules using a 2D array or returning arrays, or methods using ParamArray, are hardcoded as exceptions or are not implemented - 5. Methods returning a 1D array when no arguments and a scalar otherwise (e.g. SF_Dialog.Controls()) - may be considered as properties when no argument - Requires Python and Basic update in the concerned library but is transparent for this dispatcher + 5. Due to constraint (4), a predefined list of method calls must be hardcoded to avoid blocking use of CallByName + The concerned methods are flagged with cstHardCode With _SF_ Initialize Python persistent storage at 1st call @@ -816,6 +817,19 @@ Try: End Select End If + Methods in class modules may better not be executed with CallByName() + ElseIf bBasicClass And ((CallType And vbMethod) + (CallType And cstHardCode)) = vbMethod + cstHardCode Then + Select Case sServiceName + Case SFDialogs.Dialog + Select Case Script + Case Activate : vReturn = vBasicObject.Activate() + Case Center + If UBound(vArgs) 0 Then vReturn = vBasicObject.Center() Else vReturn = vBasicObject.Center(vArgs(0
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_FileSystem.xba | 44 - wizards/source/scriptforge/python/ScriptForgeHelper.py | 17 +- wizards/source/scriptforge/python/scriptforge.py |3 + wizards/source/sfdocuments/SF_Calc.xba |2 wizards/source/sfunittests/SF_UnitTest.xba |4 - 5 files changed, 64 insertions(+), 6 deletions(-) New commits: commit 7c0f0afd58c00211236b138ddd4804099c5aec83 Author: Jean-Pierre Ledure AuthorDate: Tue Jul 5 17:47:56 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Wed Jul 6 12:27:09 2022 +0200 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 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index 39ea4888e3d1..8b21ea9a70df 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -1268,6 +1268,7 @@ Public Function Methods() As Variant , HashFile _ , MoveFile _ , MoveFolder _ + , Normalize _ , OpenTextFile _ , PickFile _ , PickFolder _ @@ -1383,6 +1384,47 @@ Catch: GoTo Finally End Function ScriptForge.SF_FileSystem.MoveFolder +REM - +Public Function Normalize(Optional ByVal FileName As Variant) As String + 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. + Args: + FileName: a string representing a file. The file may not exist. + Returns: + The normalized filename in filenaming notation + Example: + Print SF_FileSystem.Normalize(A/foo/../B/C/./D//E)A/B/C/D/E + +Dim sNorm As String Return value +Const cstPyHelper = $ _SF_FileSystem__Normalize +Const cstThisSub = FileSystem.Normalize +Const cstSubArgs = FileName + + If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch + sNorm = + +Check: + If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then + If Not SF_Utils._ValidateFile(FileName, FileName) Then GoTo Finally + End If + +Try: + With ScriptForge.SF_Session + sNorm = .ExecutePythonScript(.SCRIPTISSHARED, _SF_.PythonHelper cstPyHelper _ + , _ConvertFromUrl(FileName)) + The Python os.path expects and returns a file name in os notation + If SF_FileSystem.FileNaming SYS Then sNorm = ConvertToUrl(sNorm) + End With + +Finally: + Normalize = sNorm + SF_Utils._ExitFunction(cstThisSub) + Exit Function +Catch: + GoTo Finally +End Function ScriptForge.SF_FileSystem.Normalize + REM - Public Function OpenTextFile(Optional ByVal FileName As Variant _ , Optional ByVal IOMode As Variant _ @@ -1759,7 +1801,7 @@ End Function ScriptForge.FileSystem._ConvertFromUrl REM - Private Function _ConvertToUrl(psFile) As String Execute the builtin ConvertToUrl function only when relevant - i.e. when FileNaming (how arguments and return values are provided) = SYS + i.e. when FileNaming (how arguments and return values are provided) URL Called at the top of methods receiving file names as arguments Remark: psFile might contain wildcards diff --git a/wizards/source/scriptforge/python/ScriptForgeHelper.py b/wizards/source/scriptforge/python
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_Exception.xba |2 wizards/source/sfdocuments/SF_Calc.xba | 73 +++- wizards/source/sfdocuments/SF_Document.xba |3 - 3 files changed, 53 insertions(+), 25 deletions(-) New commits: commit e58a75251a4c877ff4ded94ede01310135b996db Author: Jean-Pierre Ledure AuthorDate: Sun Jun 26 16:30:11 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Sun Jun 26 17:17:53 2022 +0200 ScriptForge - (SF_Calc) accurate sheet name check The parsing of sheet names and range addresses has been reviewed to include the exact rules for sheet naming: must not be empty must not contain []*?:/\ must not use ' (apostrophe) as 1st and last character Additionally (ScriptForge only) it must not contain "~" which, by convention, indicates the active sheet. The code accepts exotic sheet names like: "$" "$Sheet99" "$Sheet'99" "$.Sheet'99" "!'@#$%^&()-_=+{}|;,<.>""" and exotic addresses like: "'$'.A1" "'$Sheet99'.A1" "'$Sheet''99'.A1" "'$.Sheet''99'.A1" "'!''@#$%^&()-_=+{}|;,<.>""'.A1" Target is to match completely the Calc constraints for writing formulas and sheet names.. The same rules are applicable evenly for user scripts written either in Basic or in Python. Change-Id: I759d7700152a3d811b89f156c4d9eee0071c2a7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136446 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_Exception.xba b/wizards/source/scriptforge/SF_Exception.xba index 11e97b02b753..572b0fb950a6 100644 --- a/wizards/source/scriptforge/SF_Exception.xba +++ b/wizards/source/scriptforge/SF_Exception.xba @@ -962,7 +962,7 @@ Try: pvArgs(0) = _RightCase(pvArgs(0)) : pvArgs(2) = _RightCase(pvArgs(2)) sMessage = sLocation _ \n \n \n .GetText(VALIDATEERROR, pvArgs(0)) _ -\n \n .GetText(CALCADDRESS Iif(pvArgs(0) = Sheet, 1, 2), pvArgs(0), pvArgs(1), pvArgs(2), pvArgs(3)) +\n \n .GetText(CALCADDRESS Iif(Left(pvArgs(0), 5) = Sheet, 1, 2), pvArgs(0), pvArgs(1), pvArgs(2), pvArgs(3)) Case DUPLICATESHEETERROR SF_Calc.InsertSheet(arg, SheetName, Document) pvArgs(0) = _RightCase(pvArgs(0)) sMessage = sLocation _ diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 0b7b88ae8f76..57d3d0fb63cf 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -127,7 +127,7 @@ Private Const SERVICEREFERENCE = SFDocuments.CalcReference Private Const ISCALCFORM = 2 Form is stored in a Calc document -Private Const cstSPECIALCHARS = `~!@#$%^()-_=+{}|;:,. +Private Const cstSPECIALCHARS = `~!@#$%^()-_=+{}|;,. Presence of a special character forces surrounding the sheet name with single quotes in absolute addresses @@ -4080,6 +4080,7 @@ Private Function _ParseAddress(ByVal psAddress As String) As Object Dim oAddress As Object Return value Dim sAddress As String Alias of psAddress +Dim vRangeName As VariantArray Sheet/Range Dim lStart As Long Position of found regex Dim sSheet As String Sheet component Dim sRange As String Range component @@ -4112,23 +4113,17 @@ Dim oSelect As Object Current selection .RawAddress = psAddress Set .XSpreadSheet = Nothing : Set .XCellRange = Nothing - Remove leading $ - If Left(psAddress, 1) = $ Then sAddress = Mid(psAddress, 2) Else sAddress = psAddress - Split in sheet and range components - Check presence of surrounding single quotes or dot - If Left(sAddress, 1) = Then - lStart = 1 - sSheet = ScriptForge.SF_String.FindRegex(sAddress, ^[^\[\]*?:\/\\]+) - If lStart = 0 Then GoTo CatchAddress Invalid sheet name - If Len(sAddress) Len(sSheet) + 1 Then - If Mid(sAddress, Len(sSheet) + 1, 1) = . then sRange = Mid(sAddress, Len(sSheet) + 2) - End If - sShee
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - wizards/source
wizards/source/scriptforge/SF_String.xba |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit f79501f6fd42f58da091b525321f81495fd798fb Author: Jean-Pierre Ledure AuthorDate: Thu Jun 23 12:22:48 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Thu Jun 23 13:14:34 2022 +0200 ScriptForge - (SF_String) FIX Unquote() with "'" as quoting char The quoting character (2nd argument of the method) can be the single or the double quote. The single quote was erroneously ignored. Additionally comments are added in the code about non-symmetrical escaping approaches: "" or \' (maybe to be added in help texts ?) Cfr. commit on master: https://gerrit.libreoffice.org/c/core/+/136292 Change-Id: Id2988e6c6cef3a07d46e4d67f33d47e56a4a6e29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136304 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_String.xba b/wizards/source/scriptforge/SF_String.xba index 10ce48045ab8..888cf672c5da 100644 --- a/wizards/source/scriptforge/SF_String.xba +++ b/wizards/source/scriptforge/SF_String.xba @@ -2539,6 +2539,9 @@ Public Function Unquote(Optional ByRef InputStr As Variant _ ) As String Reset a quoted string to its original content (used f.i. for parsing of csv-like records) + When the input string contains the quote character, the latter must be escaped: + - QuoteChar = double quote, by doubling it () + - QuoteChar = single quote, with a preceding backslash (\) Args: InputStr: the input string QuoteChar: either (default) or @@ -2567,7 +2570,7 @@ Check: End If Try: - If Left(InputStr, 1) Then No need to parse further + If Left(InputStr, 1) QuoteChar Then No need to parse further sUnquote = InputStr Else Set oCharacterClass = SF_Utils._GetUNOService(CharacterClass)
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/SF_String.xba |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 30a6bf3960c37124c9c3cdbaec4794153e24c83a Author: Jean-Pierre Ledure AuthorDate: Wed Jun 22 18:10:36 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Thu Jun 23 12:14:01 2022 +0200 ScriptForge - (SF_String) FIX Unquote() with "'" as quoting char The quoting character (2nd argument of the method) can be the single or the double quote. The single quote was erroneously ignored. Additionally comments are added in the code about non-symmetrical escaping approaches: "" or \' (maybe to be added in help texts ?) Commit to push to libreoffice-7-4 branch too. Change-Id: Ifd8f66ee9e60310fdc292aa0f338e88d941b2e21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136292 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_String.xba b/wizards/source/scriptforge/SF_String.xba index 10ce48045ab8..888cf672c5da 100644 --- a/wizards/source/scriptforge/SF_String.xba +++ b/wizards/source/scriptforge/SF_String.xba @@ -2539,6 +2539,9 @@ Public Function Unquote(Optional ByRef InputStr As Variant _ ) As String Reset a quoted string to its original content (used f.i. for parsing of csv-like records) + When the input string contains the quote character, the latter must be escaped: + - QuoteChar = double quote, by doubling it () + - QuoteChar = single quote, with a preceding backslash (\) Args: InputStr: the input string QuoteChar: either (default) or @@ -2567,7 +2570,7 @@ Check: End If Try: - If Left(InputStr, 1) Then No need to parse further + If Left(InputStr, 1) QuoteChar Then No need to parse further sUnquote = InputStr Else Set oCharacterClass = SF_Utils._GetUNOService(CharacterClass)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - wizards/source
wizards/source/sfdocuments/SF_Calc.xba |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit cb62be830fae6e42e94c42813923e635e895eae7 Author: Jean-Pierre Ledure AuthorDate: Tue Jun 21 18:29:03 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Tue Jun 21 19:34:04 2022 +0200 ScriptForge - (SF_Calc)FIX wrong sheet name validation When the name of a sheet contains a "." or a space, when passed as an argument, the name must be surrounded with sinle quotes (like in usual Calc formulas). The validation of the sheet name goes thru the comparison with the list of existing sheet names in the document. The comparison compared erroneously the name with quotes and sheet name without quotes. Gave an unjustified user error. Example: calc.Sheet("'Commits 7.4'") Cfr. commit on master: https://gerrit.libreoffice.org/c/core/+/136233 Change-Id: I7a47c9dfe1c7b507e99a37d5714046dd6d8e7567 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136258 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 4b42163753bb..0b7b88ae8f76 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -,6 +,7 @@ Private Function _ValidateSheet(Optional ByRef pvSheetName As Variant _ DUPLICATESHEETERROR A sheet with the given name exists already Dim vSheets As Variant List of sheets +Dim sSheet As String Sheet name without single quotes Dim lSheet As Long Index in list of sheets Dim vTypes As VariantArray of accepted variable types Dim bValid As BooleanReturn value @@ -4474,12 +4475,13 @@ Try: pvSheetName = _Component.CurrentController.ActiveSheet.Name Else vSheets = _Component.getSheets.getElementNames() + sSheet = Replace(pvSheetName, , ) If pvNew Then - If ScriptForge.SF_Array.Contains(vSheets, pvSheetName) Then GoTo CatchDuplicate + If ScriptForge.SF_Array.Contains(vSheets, sSheet) Then GoTo CatchDuplicate Else - If Not ScriptForge.SF_Utils._Validate(pvSheetName, psArgName, V_STRING, vSheets) Then GoTo Finally + If Not ScriptForge.SF_Utils._Validate(sSheet, psArgName, V_STRING, vSheets) Then GoTo Finally If pvResetSheet Then - lSheet = ScriptForge.SF_Array.IndexOf(vSheets, pvSheetName, CaseSensitive := False) + lSheet = ScriptForge.SF_Array.IndexOf(vSheets, sSheet, CaseSensitive := False) pvSheetName = vSheets(lSheet) End If End If
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Calc.xba |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit 7f2464c41adf3e45fe020e87198fb0cb939e6e34 Author: Jean-Pierre Ledure AuthorDate: Tue Jun 21 16:30:03 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Tue Jun 21 18:23:10 2022 +0200 ScriptForge - (SF_Calc)FIX wrong sheet name validation When the name of a sheet contains a "." or a space, when passed as an argument, the name must be surrounded with sinle quotes (like in usual Calc formulas). The validation of the sheet name goes thru the comparison with the list of existing sheet names in the document. The comparison compared erroneously the name with quotes and sheet name without quotes. Gave an unjustified user error. Example: calc.Sheet("'Commits 7.4'") Actual commit should be pushed to LibreOffice 7.4 too. Change-Id: I1ffd1dc42a0fd4a28fcea87de297c4cb02da6a5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136233 Tested-by: Jean-Pierre Ledure Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 4b42163753bb..0b7b88ae8f76 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -,6 +,7 @@ Private Function _ValidateSheet(Optional ByRef pvSheetName As Variant _ DUPLICATESHEETERROR A sheet with the given name exists already Dim vSheets As Variant List of sheets +Dim sSheet As String Sheet name without single quotes Dim lSheet As Long Index in list of sheets Dim vTypes As VariantArray of accepted variable types Dim bValid As BooleanReturn value @@ -4474,12 +4475,13 @@ Try: pvSheetName = _Component.CurrentController.ActiveSheet.Name Else vSheets = _Component.getSheets.getElementNames() + sSheet = Replace(pvSheetName, , ) If pvNew Then - If ScriptForge.SF_Array.Contains(vSheets, pvSheetName) Then GoTo CatchDuplicate + If ScriptForge.SF_Array.Contains(vSheets, sSheet) Then GoTo CatchDuplicate Else - If Not ScriptForge.SF_Utils._Validate(pvSheetName, psArgName, V_STRING, vSheets) Then GoTo Finally + If Not ScriptForge.SF_Utils._Validate(sSheet, psArgName, V_STRING, vSheets) Then GoTo Finally If pvResetSheet Then - lSheet = ScriptForge.SF_Array.IndexOf(vSheets, pvSheetName, CaseSensitive := False) + lSheet = ScriptForge.SF_Array.IndexOf(vSheets, sSheet, CaseSensitive := False) pvSheetName = vSheets(lSheet) End If End If
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1d5ed2fdd14a8dc6871b687e795507b4f06fa67e Author: Jean-Pierre Ledure AuthorDate: Tue Jun 7 17:57:11 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Wed Jun 8 12:22:46 2022 +0200 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 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index ce6bbae81691..86c70b26be50 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -51,7 +51,7 @@ ScriptForge(hostname = 'localhost', port = 2021) Specific documentation about the use of ScriptForge from Python scripts: - https://help.libreoffice.org/7.3/en-US/text/sbasic/shared/03/sf_intro.html + https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_intro.html?DbPAR=BASIC """ import uno
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfunittests/SF_UnitTest.xba | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) New commits: commit b4735aac82c6db0afd5692f485364510ac2d9a5d Author: Jean-Pierre Ledure AuthorDate: Tue Jun 7 11:48:48 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Tue Jun 7 13:11:26 2022 +0200 ScriptForge - (SF_UnitTest) fix typos + layout reviews Typos in comment lines Minor improvements of test report layout Change-Id: Ic19e55a84475b098959055ac1c573de629e21731 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135466 Tested-by: Jean-Pierre Ledure Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/sfunittests/SF_UnitTest.xba b/wizards/source/sfunittests/SF_UnitTest.xba index 5237bb7ce88b..5007fb6a7255 100644 --- a/wizards/source/sfunittests/SF_UnitTest.xba +++ b/wizards/source/sfunittests/SF_UnitTest.xba @@ -271,7 +271,7 @@ End Property SFUnitTests.SF_UnitTest.ReturnCode (get) REM - Property Get Verbose() As Variant - The Verbose property indicates if all assertions are reported + The Verbose property indicates if all assertions (True AND False) are reported Verbose = _PropertyGet(Verbose) End Property SFUnitTests.SF_UnitTest.Verbose (get) @@ -975,8 +975,6 @@ End Function SFUnitTests.SF_UnitTest.AssertTrue REM - Public Sub Fail(Optional ByVal Message As Variant) Forces a test failure - Args: - Dim bAssert As Boolean Fictive return value Const cstThisSub = UnitTest.Fail @@ -996,7 +994,7 @@ End Sub SFUnitTests.SF_UnitTest.Fail REM - Public Sub Log(Optional ByVal Message As Variant) - Forces to record the given message in the test report (console) + Records the given message in the test report (console) Dim bAssert As Boolean Fictive return value Dim bVerbose As Boolean: bVerbose = _Verbose @@ -1170,7 +1168,7 @@ Public Function RunTest(Optional ByVal TestSuite As Variant _ The default pattern is Test_* Message: the message to be displayed in the console when the test starts. Returns: - The return code of the execution (RCxxx constants) + One of the return codes of the execution (RCxxx constants) Examples: GlobalScope.BasicLibraries.loadLibrary(ScriptForge) Dim test: test = CreateScriptService(UnitTest, ThisComponent, Tests) @@ -1326,7 +1324,7 @@ Public Function SkipTest(Optional ByVal Message As Variant) As Boolean Args: Message: the message to be displayed in the console Returns: - The return code of the execution (RCxxx constants) + True when successful Examples: GlobalScope.BasicLibraries.loadLibrary(ScriptForge) Dim test: test = CreateScriptService(UnitTest, ThisComponent, Tests) @@ -1357,7 +1355,7 @@ Try: _ReturnCode = RCSKIPTEST bSkip = True Exit message - sSkipMessage = _Duration(Test, True) SKIPTEST TESTSUITE= _Module + sSkipMessage = SKIPTEST testsuite= LibraryName . _Module _Duration(Suite, True) _ReportMessage(sSkipMessage, Message) End If @@ -1630,7 +1628,7 @@ Try: End Select If Not IsNull(oTimer) Then sDuration = CStr(oTimer.Duration) - If pvBrackets Then sDuration = ( Trim(sDuration) sec) + If pvBrackets Then sDuration = ( Trim(sDuration) sec) Else sDuration = End If @@ -1817,4 +1815,4 @@ Const cstMaxLength = 50 Maximum length for items End Function SFUnitTests.SF_UnitTest._Repr REM == END OF SFUNITTESTS.SF_UNITTEST - + \ No newline at end of file
[Libreoffice-commits] core.git: desktop/CppunitTest_desktop_lib.mk Repository.mk scp2/source wizards/Module_wizards.mk wizards/Package_sfunittests.mk wizards/source
Repository.mk |1 desktop/CppunitTest_desktop_lib.mk|1 scp2/source/ooo/directory_ooo.scp |5 wizards/Module_wizards.mk |1 wizards/Package_sfunittests.mk| 30 wizards/source/configshare/dialog.xlc |1 wizards/source/configshare/script.xlc |1 wizards/source/scriptforge/SF_Exception.xba | 10 wizards/source/scriptforge/SF_Root.xba| 15 wizards/source/scriptforge/SF_Services.xba|1 wizards/source/scriptforge/SF_Utils.xba |7 wizards/source/scriptforge/po/ScriptForge.pot | 22 wizards/source/scriptforge/po/en.po | 22 wizards/source/sfunittests/SF_Register.xba| 202 ++ wizards/source/sfunittests/SF_UnitTest.xba| 1820 ++ wizards/source/sfunittests/__License.xba | 26 wizards/source/sfunittests/dialog.xlb |3 wizards/source/sfunittests/script.xlb |7 18 files changed, 2171 insertions(+), 4 deletions(-) New commits: commit 14c7bc1c90d671743c2f25b6958bb54f03140597 Author: Jean-Pierre Ledure AuthorDate: Fri Jun 3 17:51:57 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Sat Jun 4 12:08:36 2022 +0200 ScriptForge - New 'UnitTest' service for Basic The "UnitTest" service is implemented as a new Basic library called 'SFUnitTests'. ScriptForge unit tests (SF_UnitTest class module) == Class providing a framework to execute and check sets of unit tests. The UnitTest unit testing framework was originally inspired by unittest.py in Python and has a similar flavor as major unit testing frameworks in other languages. It supports - test automation - sharing of setupand shutdown code - aggregation of tests into collections. Both the - code describing the unit tests - code to be tested must be written exclusively in Basic (the code might call functions written in other languages). The code to be tested may be released as an extension. It does not need to make use of ScriptForge services. The test reporting device is the Console. Definitions: - Test Case: each test case is a Basic Sub. - Test Suite: a collection of test cases stored in 1 Basic module. - Unit test: a set of test suites stored in 1 library. Two modes: - the normal mode ("full mode"), using test suites and test cases The UnitTest service is passed as argument to each test case. - the "simple mode" limited to the use of the Assert...() methods. Service invocation examples: - In full mode, the service creation is external to test cases Dim myUnitTest As Variant myUnitTest = CreateScriptService("UnitTest", ThisComponent, "Tests") 'Test code is in the library "Tests" 'located in the current document - In simple mode, the service creation is internal to every test case Dim myUnitTest As Variant myUnitTest = CreateScriptService("UnitTest") With myUnitTest If Not .AssertTrue(...) Then ... '... .Dispose() End With Error handling To support the debugging of the tested code, the UnitTest service, in cases of - assertion failure - Basic run-time error in the tested code - Basic run-time error in the testing code (the unit tests) will comment the error location and description in a message box and in the console log, providing every test case (in either mode) implements an error handler containing at least a call to the ReportError() method. Change-Id: I9d9b889b148f172cd868af455493c8c696d1e953 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135365 Tested-by: Jean-Pierre Ledure Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/Repository.mk b/Repository.mk index 5532b993dfde..4004cbe142df 100644 --- a/Repository.mk +++ b/Repository.mk @@ -1002,6 +1002,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\ wizards_basicsrvsfdatabases \ wizards_basicsrvsfdialogs \ wizards_basicsrvsfdocuments \ + wizards_basicsrvsfunittests \ wizards_basicsrvsfwidgets \ wizards_basicsrvstandard \ wizards_basicsrvtemplate \ diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk index 61d5cb1f31c5..d8f58cac18da 100644 --- a/desktop/CppunitTest_desktop_lib.mk +++ b/desktop/CppunitTest_desktop_lib.mk @@ -75,6 +75,7 @@ $(eval $(call gb_CppunitTest_use_packages,desktop_lib, \ wizards_basicsrvsfdatabases \ wizards_basicsrvsfdialogs \ wizards_basicsrvsfdocuments \ +wizards_basicsrvsfunit
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdocuments/SF_Calc.xba |2 ++ 1 file changed, 2 insertions(+) New commits: commit f9fa11e1c273e6aeba0d7656d518eaea0b14890b Author: Jean-Pierre Ledure AuthorDate: Sun May 15 17:51:45 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Mon May 16 16:22:55 2022 +0200 ScriptForge - (SF_Calc) FIX CompactUp/Left whan range is 1 row/col When the range to compact spans only 1 row (CompactUp) or 1 column (CompactLeft), a GetValue() method returns a scalar and not an array as expected in usual cases. This caused an abort of the script when invoking the UBound() value of the returned array with a Basic run-time error Object variable not set A test on being scalar or array of the result of the GetValue() method avoids the error. To be done in both CompactXXX() methods. Impact only on Basic code. Python not involved. No changes due in documentation. Change-Id: I74cf2b274944b442f843e1f4b7ac3a05dd6eaae7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134352 Tested-by: Jean-Pierre Ledure Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index bc17d4abe578..4b42163753bb 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -714,6 +714,7 @@ Try: SetFormula(sFormulaRange, FilterFormula) Get the columns to compact: 0 = False, 1 = True vCompact = GetValue(sFormulaRange) + If Not IsArray(vCompact) Then vCompact = Array(vCompact) ClearAll(sFormulaRange) Iterates from the last to the first column of the range and remove the columns that match the filter @@ -823,6 +824,7 @@ Try: SetFormula(sFormulaRange, FilterFormula) Get the rows to compact: 0 = False, 1 = True vCompact = GetValue(sFormulaRange) + If Not IsArray(vCompact) Then vCompact = Array(vCompact) ClearAll(sFormulaRange) Iterates from the last to the first row of the range and remove the rows that match the filter
[Libreoffice-commits] core.git: wizards/source
wizards/source/sfdialogs/SF_Dialog.xba | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) New commits: commit 56810b5b3dcae39dea1462ac1e2a490af375a0c3 Author: Jean-Pierre Ledure AuthorDate: Mon May 9 15:45:23 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Tue May 10 18:55:45 2022 +0200 ScriptForge - (SF_Dialog) FIX comments in Resize() method Fix mix-up of the definitions of the Left and Top arguments. The patch changes mainly a few comment lines. Additional changes: the list of methods includes Center() and Resize(). (patchset 3) Change-Id: Id049d42b053e5ef1971ee62fb2b8b9342053583f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134078 Tested-by: Jean-Pierre Ledure Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba index beb865b6a2dd..da2afcb4a80e 100644 --- a/wizards/source/sfdialogs/SF_Dialog.xba +++ b/wizards/source/sfdialogs/SF_Dialog.xba @@ -341,7 +341,6 @@ Dim oParentPosSize As Object Parent com.sun.star.awt.Rectangle Dim lParentX As Long X position of parent dialog Dim lParentY As Long Y position of parent dialog Dim oPosSize As Object Dialog com.sun.star.awt.Rectangle -Dim iFlags As Integer com.sun.star.awt.PosSize constants Const cstThisSub = SFDialogs.Dialog.Center Const cstSubArgs = [Parent] @@ -696,10 +695,12 @@ Public Function Methods() As Variant Methods = Array( _ Activate _ + , Center _ , Controls _ , EndExecute _ , Execute _ , GetTextsFromL10N _ + , Resize _ , Terminate _ ) @@ -739,12 +740,12 @@ Public Function Resize(Optional ByVal Left As Variant _ , Optional ByVal Width As Variant _ , Optional ByVal Height As Variant _ ) As Boolean - Move the topleft corner of a dialog to new coordinates and/or modify its dimensions - All distances are expressed in 1/100th mm + Move the top-left corner of a dialog to new coordinates and/or modify its dimensions + All distances are expressed in 1/100 mm. Without arguments, the method resets the initial dimensions Args: - Left : the vertical distance from the topleft corner - Top : the horizontal distance from the topleft corner + Left : the horizontal distance from the top-left corner + Top : the vertical distance from the top-left corner Width : the horizontal width of the rectangle containing the Dialog Height : the vertical height of the rectangle containing the Dialog Negative or missing arguments are left unchanged @@ -1107,4 +1108,4 @@ Private Function _Repr() As String End Function SFDialogs.SF_Dialog._Repr REM END OF SFDIALOGS.SF_DIALOG - + \ No newline at end of file
[Libreoffice-commits] core.git: wizards/source
wizards/source/access2base/access2base.py |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) New commits: commit baa1583a7b9b8a4ea5859e4fc320e570f2d10741 Author: Jean-Pierre Ledure AuthorDate: Mon Apr 25 16:30:16 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Tue Apr 26 10:28:04 2022 +0200 Access2Base - (access2base.py) FIX remove duplicate In class _Module, the ProcStartLine item is defined both as a property (by its presence in classProperties) and as method def ProcSTartLine (...): This is of course irrelevant. The property must be removed and the method kept as is. Bug signalled by Paul M on Telegram. Change-Id: I33bec829244543dbbd88b53e35cdff6c5468692f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133388 Tested-by: Jean-Pierre Ledure Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/access2base/access2base.py b/wizards/source/access2base/access2base.py index ce88057247e1..ff0a9fbaa9cc 100644 --- a/wizards/source/access2base/access2base.py +++ b/wizards/source/access2base/access2base.py @@ -1323,9 +1323,8 @@ class _Form(_BasicObject): class _Module(_BasicObject): -classProperties = dict(CountOfDeclarationLines = False, CountOfLines = False -, ProcStartLine = False, Type = False -) +classProperties = dict(CountOfDeclarationLines = False, CountOfLines = False, Type = False) + def __init__(self, reference = -1, objtype = None, name = ''): super().__init__(reference, objtype, name) self.localProperties = ('startline', 'startcolumn', 'endline', 'endcolumn', 'prockind')
[Libreoffice-commits] core.git: wizards/source
wizards/source/access2base/access2base.py |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 49dfec0a061ca4595a3c5122e92e6a5524cb768b Author: Jean-Pierre Ledure AuthorDate: Fri Apr 22 16:28:12 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Fri Apr 22 18:18:46 2022 +0200 Access2Base - (access2base.py) Don't use bare except: statement The exception hierarchy described on page https://docs.python.org/3.5/library/exceptions.html#exception-hierarchy indicates that the default exception in bare except: statements is BaseException. This induces that the SystemExit, KeyboardInterrupt and GeneratorExit are also handled by the user script. This is a not recommended practice. Better is to use the explicit Exception built-in exception except Exception: Bug reported by Paul M on Telegram Change-Id: Ie1ae1f732ebc60a881e7d40ba8141aa704e9cd5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133328 Tested-by: Jean-Pierre Ledure Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/access2base/access2base.py b/wizards/source/access2base/access2base.py index 00b9c894488d..ce88057247e1 100644 --- a/wizards/source/access2base/access2base.py +++ b/wizards/source/access2base/access2base.py @@ -43,7 +43,7 @@ from platform import system as _opsys import datetime, os, sys, traceback _LIBRARY = '' # Should be 'Access2Base' or 'Access2BaseDev' -_VERSION = '7.1'# Actual version number +_VERSION = '7.4'# Actual version number _WRAPPERMODULE = 'Python' # Module name in the Access2Base library containing Python interfaces # CallByName types @@ -608,7 +608,7 @@ class _A2B(object, metaclass = _Singleton): Script = cls.xScript(script, module) try: Returned = Script.invoke((args), (), ())[0] -except: +except Exception: raise TypeError("Access2Base error: method '" + script + "' in Basic module '" + module + "' call error. Check its arguments.") else: if Returned == None: @@ -643,7 +643,7 @@ class _A2B(object, metaclass = _Singleton): args = (action,) + (basic,) + (script,) + args try: Returned = Script.invoke((args), (), ()) -except: +except Exception: raise TypeError("Access2Base error: method '" + script + "' call error. Check its arguments.") if isinstance(Returned[0], tuple):
[Libreoffice-commits] core.git: wizards/source
wizards/source/scriptforge/python/scriptforge.py |6 wizards/source/sfdocuments/SF_Calc.xba | 198 +++ 2 files changed, 204 insertions(+) New commits: commit bf51fd3de33967b76cbe9a2de54fdfd18bd3 Author: Jean-Pierre Ledure AuthorDate: Mon Apr 18 18:11:00 2022 +0200 Commit: Jean-Pierre Ledure CommitDate: Mon Apr 18 18:53:53 2022 +0200 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 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 13a4a5e8a7aa..ce6bbae81691 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -2114,6 +2114,12 @@ class SFDocuments: def CreateChart(self, chartname, sheetname, range, columnheader = False, rowheader = False): return self.ExecMethod(self.vbMethod, 'CreateChart', chartname, sheetname, range, columnheader, rowheader) +def CreatePivotTable(self, pivottablename, sourcerange, targetcell, datafields = ScriptForge.cstSymEmpty, + rowfields = ScriptForge.cstSymEmpty, columnfields = ScriptForge.cstSymEmpty, + filterbutton = True, rowtotals = True, columntotals = True): +return self.ExecMethod(self.vbMethod, 'CreatePivotTable', pivottablename, sourcerange, targetcell, + datafields, rowfields, columnfields, filterbutton, rowtotals, columntotals) + def DAvg(self, range): return self.ExecMethod(self.vbMethod, 'DAvg', range) diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index af702126d692..bc17d4abe578 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -1286,6 +1286,204 @@ CatchDuplicate: GoTo Finally End Function SFDocuments.SF_Calc.CreateChart +REM - +Public Function CreatePivotTable(Optional ByVal PivotTableName As Variant _ + , Optional ByVal SourceRange As Variant _ + , Optional ByVal TargetCell As Variant _ + , Optional ByRef DataFields As Variant _ + , Optional ByRef RowFields As Variant _ + , Optional ByRef ColumnFields As Variant _ + , Optional ByVal FilterButton As Variant _ + , Optional ByVal RowTotals As Variant _ + , Optional ByVal ColumnTotals As Variant _ + ) As String + Crea