Kohei Yoshida schrieb:
As Ingo suggested, I'm forwarding this question (back) to where it started. :-)

Do you guys have a good suggestion?

Thanks,
Kohei

---------- Forwarded message ----------
From: Kohei Yoshida <[EMAIL PROTECTED]>
Date: Nov 5, 2006 4:07 PM
Subject: How to add menu dynamically
To: dev@installation.openoffice.org


Hi there,

This question is related to this thread:

http://framework.openoffice.org/servlets/ReadMsg?list=dev&msgNo=863

where I asked how best to add a menu item dynamically when
--enable-scsolver is given at configure time, which enables the calc
solver feature during the build.  On that thread, we concluded that
the best way to add the new "Solver..." menu is to use a UNO API to
insert a new menu item at a desired location.  Carsten Driesner
demonstrated this in Basic, which I later ported to C++.  I confirmed
that it works.

Now, I need to somehow find a way to make that UNO call before the
user launches Calc for the first time after installation, but I'm not
sure how that could be achieved.  I've been thinking of finding a
suitable UNO interface to implement in my Solver component and have it
called during or post installation in order to add the new menu item.
But I need some help on this.

Is there a good UNO interface to implement for a simple task like
this, and is there a way to call its exported method sometime before
the first launch of Calc after installation?

a)

You can use the job mechanism of OOo as described inside the Developers Guide chapter "4 Writing UNO Components" especial "4.7.2 Jobs".
Please have a look on:
"http://api.openoffice.org/docs/DevelopersGuide/Components/Components#1_7_2_Jobs";

Such jobs can be bound to events (triggered by the office) as e.g. "OnStartApp", "OnNew", "OnLoad". If such event occure the job will be executed and can e.g. patch the menu of an application.

But - for your use case it seams to be the wrong way. You should think about:

b)

Patching the menu.xml file of the calc module directly. Because such job will be used everytime the event is triggered and it will be called everytime during startup of the office it can be a performance issue.

Because you patch already the calc source directly using a build flag, you should do the same with corresponding menu.xml file. It should be easy to diplicate the orginal file and deploy/pack it instead of using the original file.

This way is easier and more simple.


Thanks for your advice,

Kohei


Best Regards
Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to