Class: RubyScriptProvider::ScriptProviderImpl
- Includes:
- Runo::Com::Sun::Star::Container::XNameContainer, Runo::Com::Sun::Star::Lang::XServiceInfo, Runo::Com::Sun::Star::Script::Provider::XScriptProvider, Uno::UnoComponentBase
- Defined in:
- lib/rubyscriptprovider.rb
Overview
The script provider for Ruby.
Constant Summary collapse
- IMPLE_NAME =
"mytools.script.provider.ScriptProviderForRuby"- SERVICE_NAMES =
[ "com.sun.star.script.provider.ScriptProviderForRuby", "com.sun.star.script.provider.LanguageScriptProvider"]
- NODE_TYPE =
BrowseNodeTypes::ROOT
Instance Attribute Summary
Attributes inherited from BaseNode
Instance Method Summary collapse
- #getChildNodes ⇒ Object
- #getPropertyValue(name) ⇒ Object
- #getScript(uri) ⇒ Object
-
#initialize(ctx, args) ⇒ ScriptProviderImpl
constructor
A new instance of ScriptProviderImpl.
- #invoke(name, params, arg2, arg3) ⇒ Object
Methods inherited from BaseNode
#addPropertyChangeListener, #addVetoableChangeListener, #getIntrospection, #getPropertySetInfo, #getType, #getValue, #hasChildNodes, #hasMethod, #hasProperty, #removePropertyChangeListener, #removeVetoableChangeListener, #rename, #setPropertyValue, #setValue, #update
Methods included from Uno::UnoBase
#getImplementationId, #getTypes
Constructor Details
#initialize(ctx, args) ⇒ ScriptProviderImpl
Returns a new instance of ScriptProviderImpl.
962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 |
# File 'lib/rubyscriptprovider.rb', line 962 def initialize(ctx, args) @name = RubyScriptProvider::LANGUAGE doc = nil inv = nil is_package = false context = "" if args[0].kind_of?(String) context = args[0] is_package = context.end_with?(":uno_packages") doc = RubyScriptProvider.get_document_model(ctx, context) if context.start_with?(DOC_PROTOCOL) else inv = args[0] doc = inv.ScriptContainer context = RubyScriptProvider.get_context(ctx, doc) end @script_context = ScriptContext.new(ctx, doc, inv) @url = URL.new(ctx, context, nil) @storage = Storage.new(ctx) if is_package self.extend PackageManager package_manager_init(ctx, context) @node = PackageBrowseNode.new(@url, @storage, LANGUAGE, self) else @node = DirBrowseNode.new(@url, @storage, LANGUAGE) end end |
Instance Method Details
#getChildNodes ⇒ Object
991 992 993 |
# File 'lib/rubyscriptprovider.rb', line 991 def getChildNodes @node.getChildNodes end |
#getPropertyValue(name) ⇒ Object
1016 1017 1018 1019 1020 1021 1022 |
# File 'lib/rubyscriptprovider.rb', line 1016 def getPropertyValue(name) case name when "Creatable" return @node.editable end return false end |
#getScript(uri) ⇒ Object
995 996 997 998 999 1000 1001 1002 1003 1004 1005 |
# File 'lib/rubyscriptprovider.rb', line 995 def getScript(uri) begin script = RubyScripts.get_script(@storage, @script_context, @url, uri) return script rescue StandardError, ScriptError => e ex = ScriptFrameworkErrorException.new( %Q!\n#{e.}\n#{e.backtrace.join("\n")}\n!, nil, uri, LANGUAGE, 0) raise Uno::UnoError, ex end end |
#invoke(name, params, arg2, arg3) ⇒ Object
1007 1008 1009 1010 1011 1012 1013 1014 |
# File 'lib/rubyscriptprovider.rb', line 1007 def invoke(name, params, arg2, arg3) result = [false, [0], [nil]] case name when "Creatable" result = @node.invoke(name, params, arg2, arg3) end return result end |