Difference between revisions of "Framework/Article/Generic UNO Interfaces for complex toolbar controls"

From Apache OpenOffice Wiki
Jump to: navigation, search
(17 intermediate revisions by 4 users not shown)
Line 5: Line 5:
 
== State before OpenOffice.org 2.0.3 ==
 
== State before OpenOffice.org 2.0.3 ==
  
The current user interface framework implemented for OpenOffice 2.0 gives developers the ability to integrate more complex controls (other than simple buttons) into their add-on toolbar. Although it's possible implementing these kind of controls for an add-on it's not an easy task. The developer has to implement a toolbar controller (com.sun.star.ui.ToolbarController) and register it in the Controller.xcu file. The controller must provide an awt control to the framework which puts it into the toolbar. To have full control over the created control a developer has to implement and use several interfaces (e.g. com.sun.star.ui.XToolbarController). This complexity doesn't attract developers who just want to use complex controls without the need to have full control.
+
The current user interface framework implemented for OpenOffice 2.0 gives developers the ability to integrate more complex controls (other than simple buttons) into their add-on toolbar. Although it's possible implementing these kind of controls for an add-on it's not an easy task. The developer has to implement a toolbar controller ([http://api.openoffice.org/docs/common/ref/com/sun/star/frame/ToolbarController.html com.sun.star.frame.ToolbarController]) and register it in the Controller.xcu file. The controller must provide an awt control to the framework which puts it into the toolbar. To have full control over the created control a developer has to implement and use several interfaces (e.g. [http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XToolbarController.html com.sun.star.frame.XToolbarController]). This complexity doesn't attract developers who just want to use complex controls without the need to have full control.
  
 
== Solution ==
 
== Solution ==
Line 90: Line 90:
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="26%" |
 
| width="26%" |
DropdownBox
+
Dropdownbox
 
| width="74%" |
 
| width="74%" |
 
A normal drop down box (only read only edit field).
 
A normal drop down box (only read only edit field).
Line 129: Line 129:
 
The user interface framework generates the controls when the add-on toolbar is created via the toolbar controller factory. Every add-on which wants to support a toolbar must be a dispatch provider. Therefore one communication protocol for the new controls will be the normal duo com.sun.star.frame.XDispatch / com.sun.star.frame.XStatusListener. The new controls are listener at the dispatch object they get after calling queryDispatch. The new controls will listen for special updates where a new struct called "ControlCommand" is provided. The ControlCommand struct offers developers a way to send commands to the control. It uses a string as command descriptor and a sequence of com.sun.star.beans.NamedValues for the arguments. This solution can be extended in the future and makes the implementation on the control side much easier.
 
The user interface framework generates the controls when the add-on toolbar is created via the toolbar controller factory. Every add-on which wants to support a toolbar must be a dispatch provider. Therefore one communication protocol for the new controls will be the normal duo com.sun.star.frame.XDispatch / com.sun.star.frame.XStatusListener. The new controls are listener at the dispatch object they get after calling queryDispatch. The new controls will listen for special updates where a new struct called "ControlCommand" is provided. The ControlCommand struct offers developers a way to send commands to the control. It uses a string as command descriptor and a sequence of com.sun.star.beans.NamedValues for the arguments. This solution can be extended in the future and makes the implementation on the control side much easier.
  
<code>[cpp]
+
<source lang="idl">
 
module com { module sun { module star { module frame {
 
module com { module sun { module star { module frame {
  
Line 149: Line 149:
  
 
}; }; }; };
 
}; }; }; };
</code>
+
</source>
Depending on the control type the command calls are interpreted. The following table gives an overview which commands could be supported by the new controls. The table can be extended without any problems regarding incompatibility.
+
=== Control commands ===
 +
 
 +
Depending on the control type the command calls are interpreted. The following table gives an overview which commands could be supported by the new controls. The table can be extended without any problems regarding incompatibility. Please be aware that this table only shows the current state. New commands can be added in later OpenOffice.org versions.
  
 
{| width="100%" border="1" cellpadding="4"
 
{| width="100%" border="1" cellpadding="4"
Line 195: Line 197:
 
RemoveEntryPos
 
RemoveEntryPos
 
| width="19%" |
 
| width="19%" |
Entry=Long
+
Pos=Long
 
| width="47%" |
 
| width="47%" |
Remove entry at position Entry.
+
Remove entry at position Pos.
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="17%" |
 
| width="17%" |
Line 213: Line 215:
 
InsertEntry
 
InsertEntry
 
| width="19%" |
 
| width="19%" |
Entry=Long<br />Text=String
+
Pos=Long<br />Text=String
 
| width="47%" |
 
| width="47%" |
Insert entry at position Entry with text Text.
+
Insert entry at position Pos with text Text.
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="17%" |
 
| width="17%" |
DropdownBox
+
Dropdownbox
 
| width="17%" |
 
| width="17%" |
 
SelectEntry
 
SelectEntry
Line 240: Line 242:
 
RemoveEntryPos
 
RemoveEntryPos
 
| width="19%" |
 
| width="19%" |
Entry=Long
+
Pos=Long
 
| width="47%" |
 
| width="47%" |
Remove entry at position Entry.
+
Remove entry at position Pos.
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="17%" |
 
| width="17%" |
Line 258: Line 260:
 
InsertEntry
 
InsertEntry
 
| width="19%" |
 
| width="19%" |
Entry=Long<br />Text=String
+
Pos=Long<br />Text=String
 
| width="47%" |
 
| width="47%" |
Insert entry at position Entry with text Text.
+
Insert entry at position Pos with text Text.
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="17%" |
 
| width="17%" |
Line 270: Line 272:
 
| width="47%" |
 
| width="47%" |
 
A new value for the edit field.
 
A new value for the edit field.
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
SetValues
 +
| width="19%" |
 +
Value=Long/Double<br/>
 +
Step=Long/Double<br/>
 +
LowerLimit=Long/Double<br/>
 +
UpperLimit=Long/Double<br/>
 +
OutputFormat=String
 +
| width="47%" |
 +
Set all possible values for the spin field at once.
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="17%" |
 
| width="17%" |
Line 276: Line 291:
 
SetLowerLimit
 
SetLowerLimit
 
| width="19%" |
 
| width="19%" |
Lower=Long/Double
+
LowerLimit=Long/Double
 
| width="47%" |
 
| width="47%" |
 
Set lower limit for the spin field.
 
Set lower limit for the spin field.
Line 285: Line 300:
 
SetUpperLimit
 
SetUpperLimit
 
| width="19%" |
 
| width="19%" |
Upper=Long/Double
+
UpperLimit=Long/Double
 
| width="47%" |
 
| width="47%" |
 
Set upper limit for the spin field.
 
Set upper limit for the spin field.
Line 297: Line 312:
 
| width="47%" |
 
| width="47%" |
 
Set single step value for the spin field.
 
Set single step value for the spin field.
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
SetOutputFormat
 +
| width="19%" |
 +
OutputFormat=String
 +
| width="47%" |
 +
Sets an optional output format string.
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="17%" |
 
| width="17%" |
Line 332: Line 356:
 
List=Sequence&lt;String&gt;
 
List=Sequence&lt;String&gt;
 
| width="47%" |
 
| width="47%" |
A new list for the listbox which get displayed when the user activates the dropdown button.
+
A new list for the drop down box which get displayed when the user activates the drop down button.
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
AddEntry
 +
| width="19%" |
 +
Text=String
 +
| width="47%" |
 +
Adds an entry at the end of the list.
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
InsertEntry
 +
| width="19%" |
 +
Pos=Long<br/>Text=String
 +
| width="47%" |
 +
Inserts a new entry with text Text to the list at position Pos
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
RemoveEntryPos
 +
| width="19%" |
 +
Pos=Long
 +
| width="47%" |
 +
Removes an entry from the listbox at position Pos
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
RemoveEntryText
 +
| width="19%" |
 +
Text=String
 +
| width="47%" |
 +
Remove entry at position Pos.
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="17%" |
 
| width="17%" |
Line 342: Line 402:
 
| width="47%" |
 
| width="47%" |
 
A new list for the listbox which get displayed when the user activates the dropdown button.
 
A new list for the listbox which get displayed when the user activates the dropdown button.
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
CheckItemPos
 +
| width="19%" |
 +
Pos=Long
 +
| width="47%" |
 +
Checks the item at position Pos
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
AddEntry
 +
| width="19%" |
 +
Text=String
 +
| width="47%" |
 +
Adds a new entry at the end of the list.
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
InsertEntry
 +
| width="19%" |
 +
Pos=Long<br/>Text=String
 +
| width="47%" |
 +
Inserts a new entry with text Text to the list at position Pos
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
RemoveEntryPos
 +
| width="19%" |
 +
Pos=Long
 +
| width="47%" |
 +
Removes an entry from the listbox at position Pos
 +
|- valign="TOP"
 +
| width="17%" |
 +
<br />
 +
| width="17%" |
 +
RemoveEntryText
 +
| width="19%" |
 +
Text=String
 +
| width="47%" |
 +
Remove entry at position Pos.
 
|}
 
|}
  
Line 348: Line 453:
 
The following code snippet shows how a command to set a new list for a "ToggleDropdownButton" can look like in C++.
 
The following code snippet shows how a command to set a new list for a "ToggleDropdownButton" can look like in C++.
  
<code>[cpp]
+
<source lang="cpp">
 
// The command "SetList" currently supports only one parameter
 
// The command "SetList" currently supports only one parameter
 
Sequence< NamedValue > aArgs( 1 );
 
Sequence< NamedValue > aArgs( 1 );
Line 378: Line 483:
 
// send command via statusChanged to the control
 
// send command via statusChanged to the control
 
xControl->statusChanged( aEvent );
 
xControl->statusChanged( aEvent );
</code>
+
</source>
  
 
To enable add-on developers to get notifications from the new controls a new interface must be added. It will be called 'com.sun.star.frame.XControlNotificationListener' and should be implemented by the dispatch object provided by 'XDispatchProvider::queryDispatch'. The new controls will send notifications for important events. The notification is not send when a user executes a function with the control itself (e.g. clicking on a button to execute a function will not be notified. 'XDispatch::dispatch(...)' is called instead).
 
To enable add-on developers to get notifications from the new controls a new interface must be added. It will be called 'com.sun.star.frame.XControlNotificationListener' and should be implemented by the dispatch object provided by 'XDispatchProvider::queryDispatch'. The new controls will send notifications for important events. The notification is not send when a user executes a function with the control itself (e.g. clicking on a button to execute a function will not be notified. 'XDispatch::dispatch(...)' is called instead).
  
<code>[cpp]
+
<source lang="idl">
 
module com { module sun { module star { module frame {  
 
module com { module sun { module star { module frame {  
  
interface XControlNotificationListener : com::sun::star::uno::XInterface
+
interface XControlNotificationListener
 
{  
 
{  
 
   //-------------------------------------------------------------------------
 
   //-------------------------------------------------------------------------
Line 396: Line 501:
  
 
}; }; }; };
 
}; }; }; };
</code>
+
</source>
  
 
The function controlEvent uses another struct called ControlEvent. The following code snippet shows the details of the structure.
 
The function controlEvent uses another struct called ControlEvent. The following code snippet shows the details of the structure.
  
<code>[cpp]
+
<source lang="idl">
 
module com { module sun { module star { module frame
 
module com { module sun { module star { module frame
  
Line 425: Line 530:
  
 
}; }; }; };
 
}; }; }; };
</code>
+
</source>
  
 
As the event name is defined as a string and additional information provided as a sequence com.sun.star.beans.Named the event system can be extended easily. Depending on the control type the different events are notified. The following table gives an overview which events could be supported by the control types.
 
As the event name is defined as a string and additional information provided as a sequence com.sun.star.beans.Named the event system can be extended easily. Depending on the control type the different events are notified. The following table gives an overview which events could be supported by the control types.
Line 486: Line 591:
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="20%" |
 
| width="20%" |
DropdownBox
+
Dropdownbox
 
| width="15%" |
 
| width="15%" |
 
ListChanged
 
ListChanged
Line 628: Line 733:
 
| width="47%" |
 
| width="47%" |
 
Called when a new list for the context menu has been set.
 
Called when a new list for the context menu has been set.
 +
|- valign="TOP"
 +
| width="20%" |
 +
<br/>
 +
| width="15%" |
 +
ItemChecked
 +
| width="19%" |
 +
Pos=Long
 +
| width="47%" |
 +
Called when an entry at position Pos has been checked.
 
|}
 
|}
  
Line 636: Line 750:
 
<br/>
 
<br/>
  
There is a demo add-on for Windows and Linux x86 available (source code is also available). The add-on needs at least OOo 2.0.3 (SRC680m168) to work correctly. You need at least the OOo 2.0.3 (SRC680m168) SDK to build the add-on.
+
There is an example add-on for Windows and Linux x86 available (source code is also available). The add-on needs at least OOo 2.0.3 to work correctly. You need at least the OOo 2.0.3 SDK to build the add-on. This example is part of the OpenOffice.org 2.2 SDK. You can find it in the folder ''examples/cpp/complextoolbarcontrols''.
  
 
{| width="100%" border="1" cellpadding="4"
 
{| width="100%" border="1" cellpadding="4"
Line 648: Line 762:
 
Demo add-on (Windows/Linux x86)
 
Demo add-on (Windows/Linux x86)
 
| width="62%" |
 
| width="62%" |
http://framework.openoffice.org/files/documents/25/3460/DemoAddOn_cpp.uno.pkg
+
http://framework.openoffice.org/files/documents/25/4121/DemoAddOn_cpp.oxt
 
|- valign="TOP"
 
|- valign="TOP"
 
| width="38%" |
 
| width="38%" |
 
Demo add-on source code (C++)
 
Demo add-on source code (C++)
 
| width="62%" |
 
| width="62%" |
http://framework.openoffice.org/files/documents/25/3461/complextoolbarcontrols.zip
+
http://framework.openoffice.org/files/documents/25/4122/complextoolbarcontrols.zip
 
|}
 
|}
 
<br/>
 
<br/>
 
<br/>
 
<br/>
 +
 
== Appendix ==
 
== Appendix ==
  
Line 663: Line 778:
 
[[Image:ComplexToolbarControls.jpg]]
 
[[Image:ComplexToolbarControls.jpg]]
  
[[Category:Development]]
+
 
 
[[Category:Framework:Article]]
 
[[Category:Framework:Article]]

Revision as of 11:37, 28 March 2010

Technical specification

Generic and easy to use complex tool bar controls for add-ons

State before OpenOffice.org 2.0.3

The current user interface framework implemented for OpenOffice 2.0 gives developers the ability to integrate more complex controls (other than simple buttons) into their add-on toolbar. Although it's possible implementing these kind of controls for an add-on it's not an easy task. The developer has to implement a toolbar controller (com.sun.star.frame.ToolbarController) and register it in the Controller.xcu file. The controller must provide an awt control to the framework which puts it into the toolbar. To have full control over the created control a developer has to implement and use several interfaces (e.g. com.sun.star.frame.XToolbarController). This complexity doesn't attract developers who just want to use complex controls without the need to have full control.

Solution

The Addon.xcu file provides a way to describe the user interface for an add-on. It will be enhanced to enable users to provide the control type of every toolbar item. The following table shows all properties which are supported for toolbar items in Addons configuration file. The bold properties mark the new properties.

Property

Type

Description

URL

String

The command which is bound to the toolbar item.

Title

String/localized

A localized text which is used as a label and/or quick help text.

ImageIdentifier

String

An optional identifier to an image. Normally not used as the set "UserImages" associates images to commands.

Target

String

Defines how to find a dispatcher for the command.

Context

String

Determines for which contexts the control should be visible.

ControlType

String

Defines the type of control.

Width

Long

Defines the width of the control. Only controls with a dynamic width support this property (e.g. Combo box, edit field, spin field)


The following control types should be supported.

Control

Description

ImageButton

A normal toggle button, but the size of the button depends on the image. At least the width, the height must follow some rules to prevent non-useful toolbars.

Combobox

A normal combo box with edit field inside.

Dropdownbox

A normal drop down box (only read only edit field).

Spinfield

A edit field with two buttons to increase/decrease numerical values.

Editfield

A normal edit field.

Button

A simple button without any need for status updates. This can useful if the button is always enabled and loading the add-on code on startup is costly.

ToggleButton

A simple button which can be controlled by status updates.

DropdownButton

A drop-down only button. Newly introduced by OpenOffice.org 2.0.

ToggleDropdownButton

A toggle button with a drop-down button. Newly introduced by OpenOffice.org 2.0.



The user interface framework generates the controls when the add-on toolbar is created via the toolbar controller factory. Every add-on which wants to support a toolbar must be a dispatch provider. Therefore one communication protocol for the new controls will be the normal duo com.sun.star.frame.XDispatch / com.sun.star.frame.XStatusListener. The new controls are listener at the dispatch object they get after calling queryDispatch. The new controls will listen for special updates where a new struct called "ControlCommand" is provided. The ControlCommand struct offers developers a way to send commands to the control. It uses a string as command descriptor and a sequence of com.sun.star.beans.NamedValues for the arguments. This solution can be extended in the future and makes the implementation on the control side much easier.

module com { module sun { module star { module frame {
 
struct ControlCommand
{
  //-------------------------------------------------------------------------
  /** specifies the command which should be processed by the toolbar 
      control.
  */
  string Command;
 
  //-------------------------------------------------------------------------
  /** specifies a sequence of named values which are used as argument
      for the command. The number and type of arguments depend on the
      command and control.
  */
  sequence< com::sun::star::beans::NamedValue > Arguments;
};
 
}; }; }; };

Control commands

Depending on the control type the command calls are interpreted. The following table gives an overview which commands could be supported by the new controls. The table can be extended without any problems regarding incompatibility. Please be aware that this table only shows the current state. New commands can be added in later OpenOffice.org versions.

Control

Command/Status Update

Arguments

Description

ImageButton

SetImage

URL=String

Use the provided URL to load a new image

Combobox

SetText

Text=String

Set a new text into the edit field.


SetList

List=Sequence<String>

A new list for the combo box.


RemoveEntryPos

Pos=Long

Remove entry at position Pos.


RemoveEntryText

Text=String

Remove entry with text = Text.


InsertEntry

Pos=Long
Text=String

Insert entry at position Pos with text Text.

Dropdownbox

SelectEntry

Entry=Long

Select entry number.


SetList

List=Sequence<String>

A new list for the dropdown box.


RemoveEntryPos

Pos=Long

Remove entry at position Pos.


RemoveEntryText

Text=String

Remove entry with text = Text.


InsertEntry

Pos=Long
Text=String

Insert entry at position Pos with text Text.

Spinfield

SetValue

Value=Long/Double

A new value for the edit field.


SetValues

Value=Long/Double
Step=Long/Double
LowerLimit=Long/Double
UpperLimit=Long/Double
OutputFormat=String

Set all possible values for the spin field at once.


SetLowerLimit

LowerLimit=Long/Double

Set lower limit for the spin field.


SetUpperLimit

UpperLimit=Long/Double

Set upper limit for the spin field.


SetStep

Step=Long/Double

Set single step value for the spin field.


SetOutputFormat

OutputFormat=String

Sets an optional output format string.

Editfield

SetText

Text=String

A new text for the edit field.

Button

---


Simple button doesn't support status updates.

ToggleButton

---


Currently I don't see a useful command here.

DropdownButton

SetList

List=Sequence<String>

A new list for the drop down box which get displayed when the user activates the drop down button.


AddEntry

Text=String

Adds an entry at the end of the list.


InsertEntry

Pos=Long
Text=String

Inserts a new entry with text Text to the list at position Pos


RemoveEntryPos

Pos=Long

Removes an entry from the listbox at position Pos


RemoveEntryText

Text=String

Remove entry at position Pos.

ToggleDropdownButton

SetList

List=Sequence<String>

A new list for the listbox which get displayed when the user activates the dropdown button.


CheckItemPos

Pos=Long

Checks the item at position Pos


AddEntry

Text=String

Adds a new entry at the end of the list.


InsertEntry

Pos=Long
Text=String

Inserts a new entry with text Text to the list at position Pos


RemoveEntryPos

Pos=Long

Removes an entry from the listbox at position Pos


RemoveEntryText

Text=String

Remove entry at position Pos.



The following code snippet shows how a command to set a new list for a "ToggleDropdownButton" can look like in C++.

// The command "SetList" currently supports only one parameter
Sequence< NamedValue > aArgs( 1 );
 
// create a sequence of strings for the dropdown menu
Sequence< rtl::OUString > aContextMenu( 3 );
aContextMenu[0] = rtl::OUString::createFromAscii( "Command 1" );
aContextMenu[1] = rtl::OUString::createFromAscii( "Command 2" );
aContextMenu[2] = rtl::OUString::createFromAscii( "Command 3" );
 
// argument is called "List"
aArgs[0].Name = rtl::OUString::createFromAscii( "List" );
aArgs[0].Value <<= aContextMenu;
 
FeatureStateEvent aEvent;
 
aEvent.FeatureURL = aURL;
aEvent.Source = (::com::sun::star::frame::XDispatch*)this
aEvent.IsEnabled = bEnabled;
aEvent.Requery = sal_False;
 
// initialize control command
com::sun::star::frame::ControlCommand aCtrlCmd;
aCtrlCmd.Command = rtl::OUString::createFromAscii( "SetList" );
aCtrlCmd.Arguments = rArgs;
 
aEvent.State <<= aCtrlCmd;
 
// send command via statusChanged to the control
xControl->statusChanged( aEvent );

To enable add-on developers to get notifications from the new controls a new interface must be added. It will be called 'com.sun.star.frame.XControlNotificationListener' and should be implemented by the dispatch object provided by 'XDispatchProvider::queryDispatch'. The new controls will send notifications for important events. The notification is not send when a user executes a function with the control itself (e.g. clicking on a button to execute a function will not be notified. 'XDispatch::dispatch(...)' is called instead).

module com { module sun { module star { module frame { 
 
interface XControlNotificationListener
{ 
  //-------------------------------------------------------------------------
  /** notifies that a control event has happened
      @param Event
        contains the event information
  */
  void controlEvent( [in] ControlEvent Event ); 
}; 
 
}; }; }; };

The function controlEvent uses another struct called ControlEvent. The following code snippet shows the details of the structure.

module com { module sun { module star { module frame
 
struct ControlEvent
{
  //-------------------------------------------------------------------------
  /** fully parsed URL describing the control that sends this
      notification.
  */
  ::com::sun::star::util::URL
 
  // -------------------------------------------------------------------------
  /** specifies the event which has occurred. 
  */
  string EventName;
 
  // -------------------------------------------------------------------------
  /** specifies a sequence of named values which are used as 
      additional values for the event. The number and types of
      named values depend on the event.
  */
  sequence< com::sun::star::beans::NamedValue > Information;
};
 
}; }; }; };

As the event name is defined as a string and additional information provided as a sequence com.sun.star.beans.Named the event system can be extended easily. Depending on the control type the different events are notified. The following table gives an overview which events could be supported by the control types.

Control

Command/Status Update

Information

Description

ImageButton

ImageChanged

URL=String

Called when a new image has been set.

Combobox

TextChanged

Text=String

Called when the text of the edit field has been changed.


ListChanged

List=Sequence<String>

Called when new list for the combo box has been set.


FocusSet

-

Called when the edit field has gained the input focus.


FocusLost

-

Called when the edit field has lost the input focus.

Dropdownbox

ListChanged

List=Sequence<String>

Called when the entry list of the combo box has been changed.


FocusSet

-

Called when the edit field has gained the input focus.


FocusLost

-

Called when the edit field has lost the input focus.

Spinfield

TextChanged

Text=String

Called when the text of the edit field has been changed.


LowerLimitChanged

Lower=Long/Double

Called when the lower limit for the spin field has been changed.


UpperLimitChanged

Upper=Long/Double

Called when the upper limit for the spin field has been changed.


StepChanged

Step=Long/Double

Called when the step value for the spin field has been changed.


FocusSet

-

Called when the edit field has gained the input focus.


FocusLost

-

Called when the edit field has lost the input focus.

Editfield

TextChanged

Text=String

Called when the text of the edit field has been changed.


FocusSet

-

Called when the edit field has gained the input focus.


FocusLost

-

Called when the edit field has lost the input focus.

Button

-


Currently I don't see a useful event here.

ToggleButton

-


Currently I don't see a useful event here.

DropdownButton

ListChanged

List=Sequence<String>

Called when a new list for the context menu has been set.

ToggleDropdownButton

ListChanged

List=Sequence<String>

Called when a new list for the context menu has been set.


ItemChecked

Pos=Long

Called when an entry at position Pos has been checked.

Final conclusion

The new controls and their interfaces should help normal developer to use complex controls in add-ons. There is also a second way to use these kind of controls which give developers more control, but need more effort. The proposed solution fits into the current framework environment. It reuses interfaces and concepts which every add-on developer already know and use.


There is an example add-on for Windows and Linux x86 available (source code is also available). The add-on needs at least OOo 2.0.3 to work correctly. You need at least the OOo 2.0.3 SDK to build the add-on. This example is part of the OpenOffice.org 2.2 SDK. You can find it in the folder examples/cpp/complextoolbarcontrols.

Add-on

Link

Demo add-on (Windows/Linux x86)

http://framework.openoffice.org/files/documents/25/4121/DemoAddOn_cpp.oxt

Demo add-on source code (C++)

http://framework.openoffice.org/files/documents/25/4122/complextoolbarcontrols.zip



Appendix

Illustration which and how the framework environment objects interact.

ComplexToolbarControls.jpg

Personal tools