0
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
| | class ...
def open_help(self):
help_exists = get_configvalue(
self.cast.ctx,u'/org.openoffice.Office.SFX',u'Help')
if not help_exists:
print(u'Faild to open help files. ", "Help system is not supported by the application.')
return
system_type = get_configvalue(self.cast.ctx,
u'/org.openoffice.Office.Common/Help',u'System')
lang_type = get_configvalue(self.cast.ctx,
u'/org.openoffice.Setup/L10N',u'ooLocale')
if not system_type:
system_type = u'WIN'
if not lang_type:
lang_type = get_configvalue(self.cast.ctx,
u'/org.openoffice.Office.Linguistic/General',u'DefaultLocale')
hpage = u'vnd.sun.star.help://shared/mytools.mri%2Findex.xhp?Language=' + \
lang_type + u'&System=' + system_type + u'#bm_idindex'
help_frame = open_help(self.cast.desktop,hpage)
if not help_frame:
call_dispatch(self.cast.ctx,self.cast.desktop,u'.uno:HelpIndex')
help_frame = open_help(self.cast.desktop,hpage)
if not help_frame:
print(u'Faild to open help files. \nHelp system is not supported by the application.')
return
call_dispatch(self.cast.ctx,help_frame,hpage)
def open_help(desktop,url):
if not desktop: return None
task_frame = None
task_frame = desktop.findFrame(u'OFFICE_HELP_TASK',FSF_CHILDREN)
if not task_frame: return None
help_frame = None
help_frame = task_frame.findFrame(u'OFFICE_HELP',FSF_CHILDREN)
if not help_frame: return None
return help_frame
def call_dispatch(ctx,frame,cmdurl):
from com.sun.star.util import URL
url = URL()
url.Complete = cmdurl
transformer = ctx.ServiceManager.createInstanceWithContext(
u'com.sun.star.util.URLTransformer',ctx)
dummy,url = transformer.parseStrict(url)
dispatcher = frame.queryDispatch(url,u'_self',0)
if dispatcher:
dispatcher.dispatch(url,())
return True
return False
def get_configvalue(ctx,nodepath,prop):
from com.sun.star.beans import PropertyValue
ConfigProvider = ctx.ServiceManager.createInstanceWithContext(
u'com.sun.star.configuration.ConfigurationProvider',ctx)
node = PropertyValue()
node.Name = u'nodepath'
node.Value = nodepath
try:
ConfigReader = ConfigProvider.createInstanceWithArguments(
u'com.sun.star.configuration.ConfigurationAccess',(node,))
if ConfigReader and (ConfigReader.hasByName(prop)):
return ConfigReader.getPropertyValue(prop)
except:
return None
|