Calc(86)ActionTriggerContainer、ActionTrigger、ActionTriggerSeparatorのサービスとインターフェイスの一覧

2018-03-06

旧ブログ

t f B! P L
コンテクストメニューのカスタマイズに使う3つのオブジェクトのサービスとインターフェイスの一覧です。

前の関連記事:Calc(85)データを保持するグリッドコントロール


サービスとインターフェイスの一覧を出力するのに使うマクロ

from com.sun.star.ui import XContextMenuInterceptor
from com.sun.star.ui import ActionTriggerSeparatorType  # 定数
from com.sun.star.ui.ContextMenuInterceptorAction import EXECUTE_MODIFIED  # enum
TCU = None
def macro(): 
 ctx = XSCRIPTCONTEXT.getComponentContext()  # コンポーネントコンテクストの取得。
 smgr = ctx.getServiceManager()  # サービスマネージャーの取得。 
 global TCU
 TCU = smgr.createInstanceWithContext("pq.Tcu", ctx)  # サービス名か実装名でインスタンス化。
 doc = XSCRIPTCONTEXT.getDocument()  # ドキュメントのモデルを取得。 
 controller = doc.getCurrentController()  # コントローラーを取得。
 contextmenuinterceptor = ContextMenuInterceptor()
 controller.registerContextMenuInterceptor(contextmenuinterceptor)
class ContextMenuInterceptor(unohelper.Base, XContextMenuInterceptor):
 def notifyContextMenuExecute(self, contextmenuexecuteevent):  # com.sun.star.ui.ActionTriggerにsetPropertyValuesでは設定できない。エラーも出ない。
  contextmenu = contextmenuexecuteevent.ActionTriggerContainer
  TCU.wtree(contextmenu)
  submenucontainer = contextmenu.createInstance("com.sun.star.ui.ActionTriggerContainer") 
  actiontrigger = addMenuentry(submenucontainer, "ActionTrigger", 0, {"Text": "Content", "CommandURL": ".uno:HelpIndex", "HelpURL": "5401"})
#       TCU.wtree(actiontrigger)
  addMenuentry(submenucontainer, "ActionTrigger", 1, {"Text": "Tips", "CommandURL": ".uno:HelpTip", "HelpURL": "5404"})
  addMenuentry(contextmenu, "ActionTrigger", 0, {"Text": "Help", "CommandURL": ".uno:HelpMenu", "HelpURL": "5410", "SubContainer": submenucontainer})
  actiontriggerseparator = addMenuentry(contextmenu, "ActionTriggerSeparator", 1, {"SeparatorType": ActionTriggerSeparatorType.LINE})
#       TCU.wtree(actiontriggerseparator)
  return EXECUTE_MODIFIED
def addMenuentry(menucontainer, menutype, i, props):  # i: index, propsは辞書。menutypeはActionTriggerかActionTriggerSeparator。
 menuentry = menucontainer.createInstance("com.sun.star.ui.{}".format(menutype))  # ActionTriggerContainerからインスタンス化する。
 [menuentry.setPropertyValue(key, val) for key, val in props.items()]  #setPropertyValuesでは設定できない。エラーも出ない。
 menucontainer.insertByIndex(i, menuentry)  # submenucontainer[i]やsubmenucontainer[i:i]は不可。挿入以降のメニューコンテナの項目のインデックスは1増える。
 return menuentry  # TCUの引数にするだけの目的で返す。
g_exportedScripts = macro, #マクロセレクターに限定表示させる関数をタプルで指定。
Calc(28)コンテクストメニューをカスタマイズする: その1の例にハイライトした行を挿入しています。

Calcドキュメントでマクロセレクターからこのマクロを実行してシートで右クリックするとブラウザにサービスとインターフェイス一覧が出力されます。

17行目をコメントアウトして、20行目や24行目をコメント行を有効にするとそれぞれActionTriggerとActionTriggerSeparatorのサービスやインターフェイスが出力されます。

ActionTriggerContainerのサービスとインターフェイスの一覧


├─.ui.ActionTriggerContainer
│   ├─.container.XContainer
│   │     void  addContainerListener( [in] .container.XContainerListener xListener)
│   │     void  removeContainerListener( [in] .container.XContainerListener xListener)
│   ├─.container.XEnumerationAccess
│   │   │   .container.XEnumeration  createEnumeration()
│   │   └─.container.XElementAccess
│   │           type  getElementType()
│   │        boolean  hasElements()
│   ├─.container.XIndexContainer
│   │   │   void  insertByIndex( [in] long Index,
│   │   │                        [in]  any Element
│   │   │             ) raises ( .lang.WrappedTargetException,
│   │   │                        .lang.IndexOutOfBoundsException,
│   │   │                        .lang.IllegalArgumentException)
│   │   │   void  removeByIndex( [in] long Index
│   │   │             ) raises ( .lang.WrappedTargetException,
│   │   │                        .lang.IndexOutOfBoundsException)
│   │   └─.container.XIndexReplace
│   │     │   void  replaceByIndex( [in] long Index,
│   │     │                         [in]  any Element
│   │     │              ) raises ( .lang.WrappedTargetException,
│   │     │                         .lang.IndexOutOfBoundsException,
│   │     │                         .lang.IllegalArgumentException)
│   │     └─.container.XIndexAccess
│   │            any  getByIndex( [in] long Index
│   │                  ) raises ( .lang.WrappedTargetException,
│   │                             .lang.IndexOutOfBoundsException)
│   │           long  getCount()
│   └─.lang.XMultiServiceFactory
│        .uno.XInterface  createInstance( [in] string aServiceSpecifier
│                              ) raises ( .uno.Exception)
│        .uno.XInterface  createInstanceWithArguments( [in] string ServiceSpecifier,
│                                                      [in]  [any] Arguments
│                                           ) raises ( .uno.Exception)
│               [string]  getAvailableServiceNames()
└─.container.XNamed
     string  getName()
       void  setName( [in] string aName)

ActionTriggerのサービスとインターフェイスの一覧


├─.ui.ActionTrigger
│                         string  CommandURL
│                         string  HelpURL
│                   .awt.XBitmap  Image
│     .container.XIndexContainer  SubContainer
│                         string  Text
├─.beans.XFastPropertySet
│      any  getFastPropertyValue( [in] long nHandle
│                      ) raises ( .lang.WrappedTargetException,
│                                 .beans.UnknownPropertyException)
│     void  setFastPropertyValue( [in] long nHandle,
│                                 [in]  any aValue
│                      ) raises ( .lang.WrappedTargetException,
│                                 .lang.IllegalArgumentException,
│                                 .beans.PropertyVetoException,
│                                 .beans.UnknownPropertyException)
├─.beans.XMultiPropertySet
│                        void  addPropertiesChangeListener( [in]                         [string] aPropertyNames,
│                                                           [in] .beans.XPropertiesChangeListener xListener)
│                        void  firePropertiesChangeEvent( [in]                         [string] aPropertyNames,
│                                                         [in] .beans.XPropertiesChangeListener xListener)
│     .beans.XPropertySetInfo  getPropertySetInfo()
│                       [any]  getPropertyValues( [in] [string] aPropertyNames)
│                        void  removePropertiesChangeListener( [in] .beans.XPropertiesChangeListener xListener)
│                        void  setPropertyValues( [in] [string] aPropertyNames,
│                                                 [in]    [any] aValues
│                                      ) raises ( .lang.WrappedTargetException,
│                                                 .lang.IllegalArgumentException,
│                                                 .beans.PropertyVetoException)
└─.beans.XPropertySet
                        void  addPropertyChangeListener( [in]                         string aPropertyName,
                                                         [in] .beans.XPropertyChangeListener xListener
                                              ) raises ( .lang.WrappedTargetException,
                                                         .beans.UnknownPropertyException)
                        void  addVetoableChangeListener( [in]                         string PropertyName,
                                                         [in] .beans.XVetoableChangeListener aListener
                                              ) raises ( .lang.WrappedTargetException,
                                                         .beans.UnknownPropertyException)
     .beans.XPropertySetInfo  getPropertySetInfo()
                         any  getPropertyValue( [in] string PropertyName
                                     ) raises ( .lang.WrappedTargetException,
                                                .beans.UnknownPropertyException)
                        void  removePropertyChangeListener( [in]                         string aPropertyName,
                                                            [in] .beans.XPropertyChangeListener aListener
                                                 ) raises ( .lang.WrappedTargetException,
                                                            .beans.UnknownPropertyException)
                        void  removeVetoableChangeListener( [in]                         string PropertyName,
                                                            [in] .beans.XVetoableChangeListener aListener
                                                 ) raises ( .lang.WrappedTargetException,
                                                            .beans.UnknownPropertyException)
                        void  setPropertyValue( [in] string aPropertyName,
                                                [in]    any aValue
                                     ) raises ( .lang.WrappedTargetException,
                                                .lang.IllegalArgumentException,
                                                .beans.PropertyVetoException,
                                                .beans.UnknownPropertyException)

ActionTriggerSeparatorのサービスとインターフェイスの一覧


├─.ui.ActionTriggerSeparator
│     short  SeparatorType
├─.beans.XFastPropertySet
│      any  getFastPropertyValue( [in] long nHandle
│                      ) raises ( .lang.WrappedTargetException,
│                                 .beans.UnknownPropertyException)
│     void  setFastPropertyValue( [in] long nHandle,
│                                 [in]  any aValue
│                      ) raises ( .lang.WrappedTargetException,
│                                 .lang.IllegalArgumentException,
│                                 .beans.PropertyVetoException,
│                                 .beans.UnknownPropertyException)
├─.beans.XMultiPropertySet
│                        void  addPropertiesChangeListener( [in]                         [string] aPropertyNames,
│                                                           [in] .beans.XPropertiesChangeListener xListener)
│                        void  firePropertiesChangeEvent( [in]                         [string] aPropertyNames,
│                                                         [in] .beans.XPropertiesChangeListener xListener)
│     .beans.XPropertySetInfo  getPropertySetInfo()
│                       [any]  getPropertyValues( [in] [string] aPropertyNames)
│                        void  removePropertiesChangeListener( [in] .beans.XPropertiesChangeListener xListener)
│                        void  setPropertyValues( [in] [string] aPropertyNames,
│                                                 [in]    [any] aValues
│                                      ) raises ( .lang.WrappedTargetException,
│                                                 .lang.IllegalArgumentException,
│                                                 .beans.PropertyVetoException)
└─.beans.XPropertySet
                        void  addPropertyChangeListener( [in]                         string aPropertyName,
                                                         [in] .beans.XPropertyChangeListener xListener
                                              ) raises ( .lang.WrappedTargetException,
                                                         .beans.UnknownPropertyException)
                        void  addVetoableChangeListener( [in]                         string PropertyName,
                                                         [in] .beans.XVetoableChangeListener aListener
                                              ) raises ( .lang.WrappedTargetException,
                                                         .beans.UnknownPropertyException)
     .beans.XPropertySetInfo  getPropertySetInfo()
                         any  getPropertyValue( [in] string PropertyName
                                     ) raises ( .lang.WrappedTargetException,
                                                .beans.UnknownPropertyException)
                        void  removePropertyChangeListener( [in]                         string aPropertyName,
                                                            [in] .beans.XPropertyChangeListener aListener
                                                 ) raises ( .lang.WrappedTargetException,
                                                            .beans.UnknownPropertyException)
                        void  removeVetoableChangeListener( [in]                         string PropertyName,
                                                            [in] .beans.XVetoableChangeListener aListener
                                                 ) raises ( .lang.WrappedTargetException,
                                                            .beans.UnknownPropertyException)
                        void  setPropertyValue( [in] string aPropertyName,
                                                [in]    any aValue
                                     ) raises ( .lang.WrappedTargetException,
                                                .lang.IllegalArgumentException,
                                                .beans.PropertyVetoException,
                                                .beans.UnknownPropertyException)

ブログ検索 by Blogger

Translate

最近のコメント

Created by Calendar Gadget

QooQ