[PATCH] [WIP] fdo#45747 - [EasyHack] remove the limitation to 3 sort entries in calc, part 2

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Apr 29 07:37:05 PDT 2012

Hey Albert,

> So I have hacked a bit on the UI for the new sort dialog in calc. I'm
> posting my work-in-progress patch hoping to get confirmation that I'm
> on the right track and also help with the specific issues below.

> As you suggested I've used the same concept for as in namedlg, where I
> created ScSortKeyDlg class which defines the dialog for a single sort
> key entry. this class is then instantiated via a control class.

It is a bit more complex in this case. We have the Dialog class that
contains the window. In the dialog class we will have some buttons and
a control that provides the list functionality. This control will then
contain all sort entries which are itself new controls. We have at
least one dialog which is already working like that:

So what we need to do right now is to first create the control for a
sort entry. That should be quite straight forward and will mostly be
copying the existing elements into an own control. Then create a
control that provides a list functionality (we already have such
controls, we just need to adapt some methods) and write the scroll
handler for this control.

Then we should be nearly ready to include it into the Dialog.

> So far so good I think, then comes the ugly bits:
> 1.) Obviously I'm using the wrong widget class for ScSortKeyDlg since
> each dialog opens in a separate window and are not embedded in the
> main dialog.
> Which widget should I use here?

Yeap. You need to derive from a Control and not from a Window. A good
example for such a concept is SfxDocumentInfoDialog with the
CustomProperties* classes. They already implement something similar
and we can copy most of the ideas from there.

> 2.)  Related to the above is the question about how to position the
> sort key dialogs relative to each other.

We need to write the code that calculates the position of sort
entries. We will position them inside another control so the
positioning has to be done only relative to the control.

> 3.)  The Listbox handler. The handler is used to enable/disable the
> widigets of the subsequent sort key(s). Now that each sort key is an
> instance of its own I'm not sure how to get "the signal across" form
> one instance to the other. Can I catch this event in the control
> class?

There are at least two solutions to this. First one is to give the
sort entry a reference to the class that needs to know about it or
implement the handler already in that class.


More information about the LibreOffice mailing list