1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# Helpers for LibreOffice extension
import os
import traceback
import uno
from com.sun.star.beans import PropertyValue
from com.sun.star.uno import RuntimeException as _rtex
def apso_console ():
try:
ctx = uno.getComponentContext()
ctx.ServiceManager.createInstance("apso.python.script.organizer.impl")
# now we can import apso_utils library
from apso_utils import console
console()
except:
traceback.print_exc()
def xray (myObject):
"XRay - API explorer"
try:
sm = uno.getComponentContext().ServiceManager
mspf = sm.createInstanceWithContext("com.sun.star.script.provider.MasterScriptProviderFactory", uno.getComponentContext())
scriptPro = mspf.createScriptProvider("")
xScript = scriptPro.getScript("vnd.sun.star.script:XrayTool._Main.Xray?language=Basic&location=application")
xScript.invoke((myObject,), (), ())
return
except:
raise _rtex("\nBasic library Xray is not installed", uno.getComponentContext())
def mri (ctx, xTarget):
"MRI - API Explorer"
|
>
|
>
>
>
>
>
>
>
>
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# Helpers for LibreOffice extension
import os
import traceback
import subprocess
import uno
from com.sun.star.beans import PropertyValue
from com.sun.star.uno import RuntimeException as _rtex
def start_console ():
"open console from APSO extension"
try:
ctx = uno.getComponentContext()
ctx.ServiceManager.createInstance("apso.python.script.organizer.impl")
# now we can import apso_utils library
from apso_utils import console
console()
except:
try:
ctx = uno.getComponentContext()
xSvMgr = ctx.getServiceManager()
xPathSettings = xSvMgr.createInstanceWithContext("com.sun.star.util.PathSettings", ctx)
spPyInstallion = uno.fileUrlToSystemPath(xPathSettings.Module)
subprocess.Popen(spPyInstallion + os.sep + "python") # Start Python interactive Shell
except:
traceback.print_exc()
def xray (xObject):
"XRay - API explorer"
try:
sm = uno.getComponentContext().ServiceManager
mspf = sm.createInstanceWithContext("com.sun.star.script.provider.MasterScriptProviderFactory", uno.getComponentContext())
scriptPro = mspf.createScriptProvider("")
xScript = scriptPro.getScript("vnd.sun.star.script:XrayTool._Main.Xray?language=Basic&location=application")
xScript.invoke((xObject,), (), ())
return
except:
raise _rtex("\nBasic library Xray is not installed", uno.getComponentContext())
def mri (ctx, xTarget):
"MRI - API Explorer"
|