Hello,

I have doubts about the Format dialog box:
-> Colors

Where is the code of this dialog box in the source code?

Imagen integrada 1

Regards.


2013/3/11 Ariel Constenla-Haile <arielch@apache.org>
Hi Ivan,

On Mon, Mar 11, 2013 at 09:49:51PM -0600, jorge ivan poot diaz wrote:
> Hello,
> I'm seeing the files in the source code in draw, examples:
>
> https://svn.apache.org/repos/asf/openoffice/trunk/main/sd/uiconfig/sdraw/toolbar/drawingobjectbar.xml
>
> I want to know where the source code files are declared Icons Standard
> Toolbar and Formatting.

Do you want to know which of these xml files belongs to the "Standard"
toolbar, which to the "Text Formatting" toolbar, etc.? Or where is the
code that converts these xml into toolbars?

> I want to know how I can add another icon in the toolbar.

If you look at the file, you notice that the concept of an icon does not
exist there; all you have is what is called a UNO command, for example

".uno:FormatLine"

The UNO command is the central point; from the UNO command the
application framework retrieves the label/text of the toolbar item, and
the icon bound to it.

The command to label binding is done in the XxxCommands.xcu that you
already know, with the "Label"/"ContextLabel" proeprty; if the "Property"
property has a value of 1, it indicates that the command is bound to an
icon.

Icons bound to UNO commands are located at
https://svn.apache.org/repos/asf/openoffice/trunk/main/default_images/res/commandimagelist/

the naming scheme is the following:

* prefix:

    sc_     16x16 image
    sch_    16x16 high-contrast image
    lc_     26x26 image
    lch_    26x26 h-c image

* the UNO command without the protocol part (.uno:), in lowercase.

For examle, for .uno:FormatLine:

https://svn.apache.org/repos/asf/openoffice/trunk/main/default_images/res/commandimagelist/sc_formatline.png
https://svn.apache.org/repos/asf/openoffice/trunk/main/default_images/res/commandimagelist/sch_formatline.png
https://svn.apache.org/repos/asf/openoffice/trunk/main/default_images/res/commandimagelist/lc_formatline.png
https://svn.apache.org/repos/asf/openoffice/trunk/main/default_images/res/commandimagelist/lch_formatline.png

In short, you don't add an icon to the toolbar; you add a UNO command.
If this UNO command is new (it does not exist in the current source
code), you'll have to implement the functionality that executes the
command (you click the toolbar item, the UNO command is "dispatched",
that is, the functionality bound to it is executed), and also gives
information about the status of the functionality this command
represents (toolbar items are context sensitive, they are enabled or
disabled, etc., depending on the state of the feature they represent).


> Similarly, I've noticed that there are several xml files at this address:
>
> https://svn.apache.org/repos/asf/openoffice/trunk/main/sd/uiconfig/sdraw/toolbar/

Yes, because there are several toolbars in Draw.

> What are the interface need to draw the toolbar?

There is a lot of code involved in transforming this xml file into
a toolbar, spread in several modules. The central part is the
application framework, drawing the toolbar onto the screen happens in
vcl. If you want to dive into this, the best -IMO - is setting a break
point in the framework code:

framework::ToolbarLayoutManager::implts_createElement

Note that it's better to start the application from withing the
debugger, because UI elements are cached, you won't see it's creation
from zero (reading that xml file) if you attach to an already opened
document.

If you want to see the creation of the other UI elements (menubar,
statusbar), break in framework::LayoutManager::createElement


Regards
--
Ariel Constenla-Haile
La Plata, Argentina