Thursday, June 28, 2007

XEMBED, Mono and OpenOffice.org

In my last post I talked about the hack I did to get some Java applets running in an OpenOffice.org docking window.

I played a little more with the code and managed to get a XEMBED socket running in an OpenOffice.org docking window. The picture below shows an OpenOffice.org running with a XEMBED ready docking window:



The title bar of the docking window shows the socket id to which XEMBED applications can connect.

I used the following Mono code to connect to the XEMBED socket:

using System;
using Gtk;

// Compile with:
// mcs -pkg:gtk-sharp SamplePlug.cs

public class SamplePlug
{

public static void Main(string[] args) {
if (args.Length != 1) {
Console.WriteLine("Need socket id as an argument.");
return;
}
uint socket_id = UInt32.Parse(args[0]);

Console.WriteLine("using socket "+socket_id);

Application.Init();

Plug plug= new Plug(socket_id);
// plug.Add(new Label("HELLO"));
plug.Add(new Entry("HELLO"));
plug.ShowAll();

Console.WriteLine("running..");
Application.Run();
}
}


The picture below shows it all running:


In theory this'll work not only with Mono but with any application which can talk the XEMBED protocol like e.g. GTK- and QT-based applications.

3 comments:

Benjamin said...

Does this mean that, for example, you could embed Pidgin IM inside of OOo? It might be pretty cool to be able to chat while working on a file--asking coworkers questions as you develop your marketing plan, or something like that!

Also, I think it would be awesome to flesh this out into a "widget system" for OOo, just as you can install widgets in the Opera web browser, Mac OS X, or Google Homepage (and KDE too, I think).

Even better would be if you could use any web standards-based widget like those already compatible with OSX and KDE, and the iPhone. You'd have a huge range of widgets already available for use, and a big developer community to tap into.

This is exciting!

Florian Reuter said...

Hell YES --- what an interresting idea.

I must confess that at the moment I was just thinking in the direction of having a "SmartDocument" alternative, but you are so right.

I need to take a look at Silverlight and then --- sure --- the Mozilla engine is already a part of OpenOffice.org so why not make it available here...

However the real power is in interaction with your documents here. I have not yet blogged about it, but the ultimate goal would be to define an interface which allows XEMBED clients to also access and modify parts of the document.

Thanks for the brainstorming session ;-)

Anonymous said...

This is great info to know.