Module: Uno

Defined in:
lib/rubyloader.rb,
lib/rubyuno/uno.rb,
lib/rubyuno/uno/connector.rb

Defined Under Namespace

Modules: Connector, UnoBase, UnoComponentBase

Constant Summary collapse

UNO_TYPES =
{}
@@ctx =

initialize runo internal

Rubyuno.get_component_context

Class Method Summary collapse

Class Method Details

.msgbox(message = "", title = "", buttons = 1, type = "messbox", peer = nil) ⇒ Fixnum

Uno.msgbox(message=“”, title=“”, buttons=1, type=“messbox”, peer=nil) -> Integer Shows message dialog on top frame window or specific window.

Parameters:

  • type (String) (defaults to: "messbox")

    can be messbox, infobox, warningbox, errorbox or querybox.

  • buttons (Fixnum) (defaults to: 1)

    is combination of constants css.awt.MessageBoxButtons.

  • peer (object) (defaults to: nil)

    window peer to show the dialog.

Returns:

  • (Fixnum)

    depends on buttons, see buttons



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rubyuno/uno.rb', line 33

def Uno.msgbox(message="", title="", buttons=1, type="messbox", peer=nil)
  unless peer
    ctx = Rubyuno.get_component_context
    desktop = ctx.getServiceManager.createInstanceWithContext(
                 "com.sun.star.frame.Desktop", ctx)
    doc = desktop.getCurrentComponent
    peer = doc.getCurrentController.getFrame.getContainerWindow if doc
  end
  if peer
    rectangle = Rubyuno.uno_require("com.sun.star.awt.Rectangle")
    msgbox = peer.getToolkit.createMessageBox(
        peer, rectangle.new, type, buttons, title, message)
    n = msgbox.execute
    msgbox.dispose
    return n
  end
end