Mathias Bauer wrote:
Kohei Yoshida wrote:

Hi,

I asked this question originally on the [EMAIL PROTECTED] list, but Eike
suggested that I ask this list instead.

Here is the situation.  I'm currently working on adding two new
top-level modules for the new feature (Calc Solver) I'm working on to
incorporate to the main OO.o source tree.  These two modules are made
optional at build time, with the introduction of a new configure
switch '--enable-scsolver'.  So, if the --enable-scsolver switch is
not given at configure time, they will not be built.

But there is one problem.  I need to add a new menu entry for this
feature in Calc's Tools menu below the "Goal Seek..." entry and name
it "Solver...", and want to make it conditionally present so that if
this feature is enabled at build time, the corresponding menu item
would be present, but otherwise this menu item would not be present.

The problem is that, because the application's menu structure is
controlled by a single xml file (sc/uiconfig/scalc/menubar.xml), it
does not seem possible to conditionally exclude a menu entry element
from its xml configuration file.

Do you guys have any advice on how to proceed?  The easiest and
laziest solution would be to just leave the menu entry there even when
the scsolver is disabled (selecting the menu item would then be a
no-op), but that would be ugly....

We already have such conditional items. Some functions are available
only if CTL is enabled. These items are removed by sending a special
status update, perhaps you can find it in the code (grep for
"SfxVisibilityItem") in Calc or Writer.

I know for sure that this works for toolbar items, I hope it also does
for the menu.

Hi Kohei,

I think the idea from Mathias is the best way to implement your feature.
Both user interface elements, menu bar and toolbar, support the SfxVisibilityItem/com.sun.star.frame.status.Visibility types to have make menu items/toolbar items dynamically visible/invisible. If you want to modify the XML files during build time, you can use patch/diff to apply your changes. Currently we have no separate tool which can manipulate this special kind of XML files.

Regards,
Carsten

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

Reply via email to