Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi Albert,

On 05/06/2013 04:13 AM, Albert Thuswaldner wrote:
Hi,
While removing the limit of 3 sort criteria in Calc, I more or less
intentionally left out fixing the saving of state.

The state is set here:
http://opengrok.libreoffice.org/xref/core/sc/source/ui/view/cellsh2.cxx#507

and retrived here:
http://opengrok.libreoffice.org/xref/core/sc/source/ui/view/cellsh2.cxx#429

As can be seen in the code above the state is only saved for 3 sort
criteria. The state is kept by six RIDs FN_PARAM_1 to FN_PARAM_6, one
integer to keep record of the position in the dropdown list, and one
boolean to hold the sort order for each criteria.

How do I solve this now when the there can be an arbitary number of
sort criteria? Is it possible to save the state as two vectors
one integer vector, and one bool vector? Vectors with arbitrary lengths.
So, in theory, you could just store the whole ScSortParam and avoid any future trouble of having to decompose the sort state in the way currently done. To do that, you need to derive a new class from SfxPoolItem that is specifically designed to store ScSortParam, store the ScSortParam state to this new class, and put that into rReq. You can keep the new class inside sc since it'd be only used in Calc code.

Doing it this way would also future-proof ourselves against any changes we might make to ScSortParam in the future. It would also eliminates having to retrieve the states individually and passing them to ScSortParam; you could just pass the whole thing in one step.

Kohei

--
Kohei Yoshida, LibreOffice Calc hacker, SUSE.


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.