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.
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice