PATCH (tweaking the "fill in character" support in Calc Number Format Strings)

Eike Rathke erack at redhat.com
Mon Aug 27 09:29:40 PDT 2012


Hi Noel,

On Monday, 2012-08-27 14:54:57 +0100, Noel Power wrote:

> a) to change the how the formatter marks the repeating character, it
> looks like now 0x1b is 'before' the char to repeat, previously it
> was after ( makes more sense to me to have the marker preceding the
> repeat char )
> Eike, was there any reason for the original scheme that you recall
> or any objections to changing

I don't recall anything special there, we just had it wrong ;-)  in fact
Excel puts the '*' before the character to repeat, so that's what we
should do as well.


> b) in cellform.cxx let cells with type CELLTYPE_STRING apply the
> format with the repeating code also. Hmmm now I did see this
> previously but I didn't see why the a string type cell would need to
> apply the numeric format, so I left it out, I presume this change is
> necessary for some types of non numberic cell content, I would guess
> maybe dates or something? is that correct ? ( or if not I'd be
> interested in the scenario that requires it )

The text format may have embedded characters, so a cell containing "foo"
displayed with a format code of '"bar "@" baz"' shows as "bar foo baz".

Each number format may also have a text subformat (the 4th
subformat) in case the cell content is text and not number, e.g.

0;-0;"";"text:"* @

in Excel works as expected.


> c) same as above except for CELLTYPE_FORMULA, so yes, this was
> oversight by me, formulas can have numeric results for sure that
> could use the repeating character format support so that part is
> needed. I guess the change to the format for the else leg of the 'if
> ( pFCell->IsValue() )' test probably has some similar rational as in
> the string case.
> 
> d) some additional checks to prevent potential div/0 which are fine
> 
> e) the new built-in formats, Eike are they ok for you?

In general yes, there just should be no gaps in the formatindex="..."
values, so continue with whatever each locale's last index is.

> if they are I
> also not sure what ( if any ) additional effort is required to
> internationalise those formats :/

I'd leave that to localizers. There are 16 possibilities to display
a negative currency amount (with/without blanks between symbol and
amount, symbol preceding or following amount, minus before or after
amount or before or after symbol, or no minus but parentheses, ...) plus
variants whether some character's width gap is included or not.

Excel's default en-US accounting format code is

_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)

while for de-DE it is

_-* #.##0,00 €_-;-* #.##0,00 €_-;_-* "-"?? €_-;_- at _-

...

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120827/ec8049e1/attachment.pgp>


More information about the LibreOffice mailing list