[EMAIL PROTECTED] wrote:
Thanks, Carsten!

Selon Carsten Driesner <[EMAIL PROTECTED]>:

Currently I only have a hard way to get this done. If you really need
it, just tell me and I can give you a description.

So you mean it's possible after all? If so, please just give a brief outline of
the procedure so I can have an idea what burden is involved.

Hi Jorge,

I want to give you a brief overview what have to be done:

I can think of three different solutions. The first may work, but it depends on your client. If he already use your add-on it's not possible. The second one is more general and I am also not sure that you can use it. The third one is a special solution, but much harder to implement.

First solution:
1. Create a <Module>WindowState.xcu file for every module your add-on works with (e.g. WriterWindowState.xcu for the Writer module). You have to add some nodes using the key "private:resource/toolbar/addon_<n>". There you have to add one property called "Docked" and set it to "true".
See the following example:

<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI">
 <node oor:name="UIElements">
  <node oor:name="States">
   <node oor:name="private:resource/toolbar/addon_0" oor:op="replace">
    <prop oor:name="Docked" oor:type="xs:boolean">
     <value>true</value>
    </prop>
   </node>
   <node oor:name="private:resource/toolbar/addon_1" oor:op="replace">
    <prop oor:name="Docked" oor:type="xs:boolean">
     <value>true</value>
    </prop>
   </node>
   <node oor:name="private:resource/toolbar/addon_2" oor:op="replace">
    <prop oor:name="Docked" oor:type="xs:boolean">
     <value>true</value>
    </prop>
   </node>
   <node oor:name="private:resource/toolbar/addon_3" oor:op="replace">
    <prop oor:name="Docked" oor:type="xs:boolean">
     <value>true</value>
    </prop>
   </node>
  </node>
 </node>
</oor:component-data>
You have to add these WindowState.xcu files to your add-on. This is a brute force method and will/can also influence future add-ons as they could use one of the private resource definitions. As the user layer of the configuration has a higher priority this solution doesn't work if your client already use the add-on.

Second solution:
Do the same as solution one, but with a job at runtime. It has the same drawbacks as you don't know which number your add-on use. You have to change some more add-on window settings.

1. You have to be a job to get notifications for OnStartupApp.
2. Use the com.sun.star.ui.WindowStateConfigurationManagerSupplier service to retrieve the module window state configurations. You have to provide a sequence of com.sun.star.beans.PropertyValue. As you only want to change the docked property use "Docked" and set it to "true". Use replaceByName or insertByName to change/insert the settings for the add-on toolbars.

Third solution:
This solution only changes the window state data of your add-on toolbar. That's why is more complex than the other ones.
1. You have to use OpenOffice.org 2.0.2 as we need a new enhancement.
2. You have to be a job to get notifications if a new document window is created. You have to register for the following notifications: OnViewCreated. 3. You have to create a simple toolbar controller to get the necessary information about your add-on toolbar. You can get information how to do it from the snippet database and from this mailing list. You only need to implement a simple button. 4. The initialize method of your controller receives the needed reference to your parent XWindow (toolbar). 5. Use the com.sun.star.beans.XPropertySet of your parent window to retrieve the toolbar title. Use the property name "Title". 6. Normally the toolbar title uses the form "Add-on <n>". Where n can be any value > 0. 7. This value is the key to the module window state configuration. You have to use the resource identifier "private:resource/toolbar/addon_<n>" to get the window state data of your add-on toolbar. 8. You have to use the XFrame reference also provided by initialize and the com.sun.star.frame.ModuleManager service to determine the application module identifier where your toolbar is currently running. Then you can use the com.sun.star.ui.WindowStateConfigurationManagerSupplier service to retrieve the module 8. Now change the properties "Docked" to "true" and you should also set a new title for your add-on toolbar (use "UIName" for this). 9. From now on your add-on toolbar should be docked and use the new title, but this is not true for the current toolbar instance. 10. Now your job implementation need to do the rest. This step should only be done on the first startup. You should use a flag if you need to do the following: If you get the notification you can use the XFrame reference to retrieve the layout manager with com.sun.star.beans.XPropertySet and key "LayoutManager". Use the layout manager to call dockWindow( "private:resource/toolbar/addon_<your number>"...) to dock your current toolbar instance.

You only have to this procedure once as we changed the persistent module window state configuration. You should use the title of your add-on toolbar as a flag if you need to trigger step 10.

This is only a very complex workaround, but it should work. As I mentioned before we are aware of this limitation and want to fix it as soon as possible. So a fourth solution would be to just wait until we have a solution.

If you need more information, please ask.

Regards,
Carsten

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

Reply via email to