Hello Reinis,

@Reinis: I CCed you, but send the answer to [email protected]. It would 
be 
better to ask directly there, because you can get feedback from other people 
and ask directly OOo core developers. If you are not subscribed yet, please 
send a mail to [email protected] and follow the instructions on 
the mail you'll get back.

@people on d...@api: this comes from 
http://www.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=2263410

On Friday 09 October 2009, 10:41, My Th wrote:
> Hi!
> 
> I'm working on JChemPaint plug-in for OO.o (oochemistry) 

I guess you're talking about http://sourceforge.net/projects/oochemistry/

> using Jmol plug-in example as reference. 

@people on d...@api: he's referring to 
http://arielch.fedorapeople.org/devel/JmolEmbeddedObject.oxt
sources:
http://arielch.fedorapeople.org/devel/JmolEmbeddedObject.tar.gz

> I have managed to make a NetBeans project
> to compile and install into OpenOffice, but it still doesn't do
> anything. 

by "anything" you mean...? could you at least instantiate the factory?

> I created a menu command, but when I click on it I get error:
> 
> This operation is not supported on this operating system.

If I understood you clearly, you can not insert your embedded object in an OOo 
document, so you can not test if it works (so your "it does not do anything" 
above).

The simplest way of inserting an embedded object is from the menu Insert > 
Object > OLE Object

This will open a dialog like the one you can see here:
http://arielch.fedorapeople.org/images/jmol_ole.png

For your embedded object to appear on the list, you need a configuration file, 
in the sample on JmolEmbeddedObject/registry/org/openoffice/Office/Embedding.xcu

You have to set the ObjectUIName , which can be localized (on the sample "Jmol 
3-D chemical structure") [and it may be needed that your factory works; don't 
know how this is implemented internally, but in other cases I've seen OOo 
instantiating the factories before filling a list with available features]

You may have noticed that you need a UUID as CLSID for your embedded object 
(you need it both in the Embedding.xcu and the sources). On Linux it's easy to 
create them

~]$ uuid -v4 -m -n 6 -1

will give you six different UUIDs.


You can also try to insert your embedded object using OOo API. See the code on 
the OOo Basic library inside the Jmol sample 
(EmbedObjectFactory/EmbedObjectFactoryTest.xba), you can find it among the 
office 
libraries if you install the sample OXT.


If you want your own menu entry under Insert > Object, (like OOo Math has its 
own under Insert > Object > Formula), you'll need a ProtocolHandler; and 
you'll need a little more work (as you have to insert the object, you need to 
take care of the document type [OLE objects are inserted in a different way on 
the different OOo applications], the current selection, etc.; and once inserted 
you have to call a doVerb() on the object to open the UI).


> I have built Jmol plug-in from the code you provided in mailing list, so
> my build setup should be ok. 

take care of the settings in Embedding.xcu, they must match the ones you use 
in the source code, otherwise your factory can not be instantiated.

> I'm using NetBeans 6.5 with OpenOffice.org
> API plug-in 2.0.4 and OpenOffice 3.1.1.
> 
> I actually have several questions:
> - How does Jmol example plug-in creates embedded object? I see it is
> provided in example document, but is it created manually?

this may be clear from the answers above.

> - It looks that my menu command doesn't get to the plug-in code at all,
> which part is the entrance point into the plug-ins logic?

the class implementing com.sun.star.embed.XEmbedObjectFactory.
You will have to study this by debugging.
Take the Jmol sample NB project, and set breakpoints in every method 
(specially JmolEmbeddedObjectFactory.createInstanceUserInit() )

Select the NB menu to debug the extension in the target office [this is IMHO 
the 
best practice, because it creates a new user directory inside the NB project, 
that is deleted when you clean the project], then insert a new embedded object 
via Insert > Object > OLE Object > "Jmol 3-D chemical structure", and start 
debugging.

> - Which files usually are put under revision control? Should I include
> NetBeans project files?

this is up to you. The best may be to arrange everything so that the sources 
are independent from the IDE you choose. This way you can create a NB project, 
a Maven project, an Eclipse project, etc.

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to