Top > Extensions > OpenHelp
* 拡張ヘルプを開く [#ja0c4031] 拡張機能のヘルプをコードから開くにはいくつかの方法があります。 #contents ** ボタン [#ofc5cd24] ダイアログなどのボタンから開く場合にはボタンの種類を Help に設定、Help URL に拡張ヘルプのページやbookmark の id や ahelp の hid を指定します。[[索引への登録>Extensions/Help#dc7a4a9c]] ページのアドレスの場合には mytools.calc.WacthingWindow/index.xhp などになります。 ** コントロール [#sec609e3] ダイアログのコントロールの HelpURL に ahelp の hid を指定しておくと、そのコントロールにフォーカスがある状態で F1 キーを押した場合に該当するヘルプのページが開かれます。 ** What's this? [#z654d9b1] .uno:ExtendedHelp コマンドを実行するとマウスカーソルの形が ? マークになり、コントロールなどに設定されているツールチップとは違ったヘルプに埋め込まれたツールチップが表示されます。表示されるのは HelpURL に指定された hid を持つ ahelp タグの内容です。[[詳細ヒント>Extensions/Help#cbc87813]] ** コード [#mfd16a3d] コードから特定のヘルプのページを開く簡単な方法はありません。 下記は無理やり開きます。 #code(python){{ class ... def open_help(self): help_exists = get_configvalue( self.cast.ctx,u'/org.openoffice.Office.SFX',u'Help') if not help_exists: # cannnot open help 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: # retry 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) # open help url (vnd.sun.star.help:...) 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 # read config value from the node and the property name 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 }} ** アクティブヘルプ [#o9311aa3] アクティブヘルプは次のような URI で取得できます。 vnd.sun.star.help://swriter/.uno%3AQuit?Language=en-US&System=UNIX&Active=true |