Natural Sort to ODF

Regina Henschel rb.henschel at t-online.de
Sat Aug 23 20:38:03 UTC 2025


Hi Kohei,

thank you for your pointer. However, implementing the 'integer' case 
will be the last step. Currently I'm struggling with UNO. I can add the 
property (using a group of integer constants :) ), but I cannot use them 
in macros, because XDatabaseRange has no method to change the 
SortDescriptor2. When that is solved next step will be ODF import and 
export. And only then I can go to the 'integer' case.

Kohei Yoshida schrieb am 23.08.2025 um 03:21:
> 
> On 8/21/25 06:46, Regina Henschel wrote:
[..]
>> Thus ODF has three kinds and LO has two kinds.
>> From my tests I guess, that bNaturalSort=true corresponds to value 
>> 'double'.
> 
> Yes. In fact I remember this feature since I worked on this. You can 
> still see the spec document I wrote for this feature back in 2005: 
> https://www.openoffice.org/specs/calc/ease-of-use/natural_sort_algorithm.sxw. 

I see the same illustration as in the standard. Seems you have worked on 
the standard at that time.

> 
> It should be fairly trivial to implement the integer mode since all you 
> have to change is to not allow the decimal separator to be parsed as a 
> digit character. Here
> 
> https://git.libreoffice.org/core/+/refs/heads/master/sc/source/core/data/table3.cxx#119 
> 
> 
> is where the code retrieves the decimal separator character for the 
> current locale and plug that into the token parser. Passing an empty 
> string in lieu of that may be enough to implement the integer mode (in 
> theory.. please test this!).  Then you can switch that bNaturalSort 
> boolean flag to a tri-state flag and map that to the UNO API.

I'll remember your hints, when I'm at that point. Thank you for pointing 
me to that area.

Kind regards,
Regina


More information about the LibreOffice mailing list