ScriptForge - (SF_Dialog) new Resize() and Center() methods

The "dialog" service receives 2 new methods for easy
move/resize of the concerned dialog.

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

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

Both methods are available from Basic and Python user scripts

Change-Id: Ic3680739c9d518da3d76d3588943ae5ce6bad8ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132418
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
This commit is contained in:
Jean-Pierre Ledure
2022-04-01 14:09:40 +02:00
parent ede4b852cd
commit 7c8e9db0e4
3 changed files with 198 additions and 5 deletions
@@ -1784,6 +1784,12 @@ class SFDialogs:
def Activate(self):
return self.ExecMethod(self.vbMethod, 'Activate')
def Center(self, parent = ScriptForge.cstSymMissing):
parentclasses = (SFDocuments.SF_Document, SFDocuments.SF_Base, SFDocuments.SF_Calc, SFDocuments.SF_Writer,
SFDialogs.SF_Dialog)
parentobj = parent.objectreference if isinstance(parent, parentclasses) else parent
return self.ExecMethod(self.vbMethod + self.flgObject, 'Center', parentobj)
def Controls(self, controlname = ''):
return self.ExecMethod(self.vbMethod + self.flgArrayRet, 'Controls', controlname)
@@ -1797,6 +1803,9 @@ 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):
return self.ExecMethod(self.vbMethod, 'Resize', left, top, width, height)
def Terminate(self):
return self.ExecMethod(self.vbMethod, 'Terminate')