[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #26 from V Stuart Foote  ---
(In reply to V Stuart Foote from comment #25)
> Created attachment 176108 [details]
> sample Writer ODF with 60 column table, using cell formulas
> but IMHO consistency would be better in the long run.

For what it is worth, Word 2019 chokes on the ODF.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #25 from V Stuart Foote  ---
Created attachment 176108
  --> https://bugs.documentfoundation.org/attachment.cgi?id=176108=edit
sample Writer ODF with 60 column table, using cell formulas

So in this attached Writer ODF with a 60 column table, it shows the column
notation is -- A-Z,a-z,AA-AZ, etc.

It probably would be better to make the cell labeling in Writer match the
labeling in Calc, i.e  A-Z,AA-AZ,BA-BZ, etc. 

That is, to eliminate the a-z labeling like calc by using the
rtl::isAsciiAlpha() and rtl::toAsciiUpperCase() conversion as Eike suggested in
comment 6

There would need to be a convert on edit/save for any existing documents, but
IMHO consistency would be better in the long run.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #24 from Dave McKellar  ---
On unparsable formulas:
If you enter a syntax error like: +
The formula is retained but the value "** Expression is faulty **" is
displayed.
But if you enter something wrong inside angle brackets - eg  it is
changed into 
That's inconsistent.  Perhaps the representation of a range could be expanded
to hold things it can not parse as a string.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #23 from Mike Kaganski  ---
(In reply to Mike Kaganski from comment #22)
> It *looks* reasonable, but dangerous. Personally I support this - but I'd
> suggest you to post a message to the dev mailing list asking for opinions on
> the proposal.

OTOH, the formula is written into file format using this convention, so the
change of this, however undocumented, convention would be incompatible.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #22 from Mike Kaganski  ---
(In reply to Dave McKellar from comment #20)
> Since the difference between Writer and Calc doesn't appear to be
> documented, perhaps Writer can be changed and then documented.  To help
> users transition if it sees lowercase call names it can display a message. 
> That would be best in the long run.

It *looks* reasonable, but dangerous. Personally I support this - but I'd
suggest you to post a message to the dev mailing list asking for opinions on
the proposal.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #21 from Mike Kaganski  ---
Fun detail is that it's even can't be justified "for compatibility with Word",
since Word uses normal 26-base reference scheme.

Wrt "unfriendly to delete something the user entered": IIUC, the formula text
is never kept, it's parsed, tokenized, and the result is stored. Whatever can't
be tokenized is not stored. 

Without much change that would highlight the problem, keeping the formula
intact and only displaying "invalid reference" would make fixing formulas next
to impossible, when user doesn't see which part is wrong.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #20 from Dave McKellar  ---
It seems very unfriendly to delete something the user entered.  Better to keep
the formula and display "invalid reference" (or something) for the value.

Since the difference between Writer and Calc doesn't appear to be documented,
perhaps Writer can be changed and then documented.  To help users transition if
it sees lowercase call names it can display a message.  That would be best in
the long run.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #19 from Mike Kaganski  ---
(In reply to Dave McKellar from comment #18)

The same way as when you try to put '=' in a table with three columns.
Unrelated to upper-vs-lowercase, and specific to the way Writer's tables
validate formula references. Self-consistent in a sense...

I am very disappointed to learn that Writer uses totally different column
naming convention compared to Calc. But anyway, there is help missing on this
topic.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #18 from Dave McKellar  ---
But in my original bug it changed the formula.  That seems wrong.  Even if it
was out of range.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #17 from Mike Kaganski  ---
Heh, so it is NOTABUG.
Try to insert a table with e.g. 60 columns, and check its columns :-)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #16 from Dave McKellar  ---
> It seems that the address is case-sensitive, with A != a, and the full
> character repertoire being uppercase then lowercase, with Z followed by a,
> and z followed by AA. Then 52 makes perfect sense being 26*2.

Its doing base 52 math.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #15 from Mike Kaganski  ---
Now thinking about it a bit more

It seems that the address is case-sensitive, with A != a, and the full
character repertoire being uppercase then lowercase, with Z followed by a, and
z followed by AA. Then 52 makes perfect sense being 26*2.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #14 from Mike Kaganski  ---
(In reply to himajin10 from comment #11)
> by the way, what do you think this line of the orignal code is doing ?
> num = num * 52 + cChar;

This looks a separate problem, doing nonsense to handle two-character column
numbers like AA.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #13 from Mike Kaganski  ---
(In reply to Dave McKellar from comment #10)

Ah - indeed 'a' - '[' == 6, not 32 as it should be to convert to lowercase.
Please do submit your fix to gerrit!

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #12 from Dave McKellar  ---
Good question!
At that point cChar is binary zero for 'A' and binary 25 for 'Z'.
Adding 52 to that gets nonsense ASCII: 'A' becomes '4' and 'Z' becomes 'M'.
So its probably not an ASCII conversion.
(The difference between 'A' and 'a' is 32 - sort of like 52.)
I guess its making it into the range that the caller of that function expects.
Why?, not sure.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #11 from himajin100...@gmail.com ---
by the way, what do you think this line of the orignal code is doing ?
num = num * 52 + cChar;

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #10 from Dave McKellar  ---
I did a test and my change does fix the code.  Sorry if this post is too big.
I made a test program.  First with the original code and some print's:

#include 
#include 

void convertName(const char *name) {
printf("name in=%s\n", name);
for (const char *p = name; *p; p++) {
char cChar = *p;
if ((cChar<'A' || cChar>'Z') && (cChar<'a' || cChar>'z'))
break;
cChar -= 'A';
if( cChar >= 26 )
cChar -= 'a' - '[';
printf("out cChar=0x%02x\n", cChar);
}
printf("\n");
}

int main() {
convertName("A55");
convertName("a55");
return 0;
}

Which prints out:

name in=A55
out cChar=0x00

name in=a55
out cChar=0x1a

In other words, lowercase and uppercase get different results.

Then I added one toupper() line:

#include 
#include 

void convertName(const char *name) {
printf("name in=%s\n", name);
for (const char *p = name; *p; p++) {
char cChar = *p;
if ((cChar<'A' || cChar>'Z') && (cChar<'a' || cChar>'z'))
break;
if (islower(cChar)) cChar = toupper(cChar); // NEW NEW
cChar -= 'A';
if( cChar >= 26 )
cChar -= 'a' - '[';
printf("out cChar=0x%02x\n", cChar);
}
printf("\n");
}

int main() {
convertName("A55");
convertName("a55");
return 0;
}

It has the same output for uppercase and lowercase:

name in=A55
out cChar=0x00

name in=a55
out cChar=0x00

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #9 from V Stuart Foote  ---
For calc don't we use it like that for lcl_a1_get_col () in address.cxx [1]. We
wouldn't need it to be as complex, but validating input of writer table cell
addresses seems worth doing.

=-ref-=

[1]
https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/address.cxx?r=96f97eb0#924

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-04 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #8 from Mike Kaganski  ---
(In reply to Dave McKellar from comment #7)

And you even may remove one check that is already built into the inline
toAsciiUpperCase [1]:

> if (!rtl::isAsciiAlpha(cChar))
> break;
> cChar = rtl::toAsciiUpperCase(cChar) - 'A';

That would be a nice cleanup, and I see how it would improve the code; but I
don't see how would that *change* current behavior.

[1]
https://opengrok.libreoffice.org/xref/core/include/rtl/character.hxx?r=b1fb6338#290

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-03 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #7 from Dave McKellar  ---
Thanks for the info, Eike.  I am new to LibreOffice.  That makes my suggestion:

   if (!rtl::isAsciiAlpha(cChar)) break
   if (rtl::isAsciiLowerCase(cChar)) cChar = rtl::toAsciiUpperCase(cChar);
   cChar -= 'A';

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-03 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #6 from Eike Rathke  ---
No, never use isalpha(), islower(), toupper() or similar standard C/C++ library
functions if you want to operate on exactly ASCII characters, because these
functions may be localized and thus yield unexpected results.

Instead, use rtl::isAsciiAlpha() and rtl::toAsciiUpperCase()

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-01 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #5 from Dave McKellar  ---
Perhaps use standard functions for that code:

   if (!isalpha(cChar)) break
   if (islower(cChar)) cChar = toupper(cChar);
   cChar -= 'A';

To replace:

if ((cChar<'A' || cChar>'Z') && (cChar<'a' || cChar>'z'))
break;
cChar -= 'A';
if( cChar >= 26 )
cChar -= 'a' - '[';

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-01 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #4 from himajin100...@gmail.com ---
currently reading...

https://opengrok.libreoffice.org/xref/core/sw/source/core/table/swtable.cxx?r=546e7d14=GetBoxNum#1276

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-11-01 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

--- Comment #3 from himajin100...@gmail.com ---
haven't looked closer into the code, but POSSIBLY related.

https://opengrok.libreoffice.org/xref/core/sw/source/core/bastyp/calc.cxx?r=78cee244#SwCalc

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-10-30 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

Mike Kaganski  changed:

   What|Removed |Added

 Blocks|123370  |


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=123370
[Bug 123370] [META] "Expression is faulty" regressions
-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 145384] Lowercase cell references not tolerated in formulas for Writer table cells

2021-10-29 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=145384

V Stuart Foote  changed:

   What|Removed |Added

  Component|LibreOffice |Writer
 Blocks||120200, 123370
   Severity|normal  |enhancement
 CC||er...@redhat.com,
   ||olivier.hallot@libreoffice.
   ||org, vstuart.fo...@utsa.edu
Summary|Doesn't tolerate lowercase  |Lowercase cell references
   |in formula range|not tolerated in formulas
   ||for Writer table cells

--- Comment #2 from V Stuart Foote  ---
The edit shell for Calc tables corrects lowercase entered cell refs to
uppercase in resulting formula.  

So this is about Writer Table cell formula entry *only*.

Can a similar input validation be added to the edit shell for Writer tables?

Not a regression, but adding to bug 123370

All documentation (help & the 7.2 Writer Guide) shows cell refs Upper case. But
has no caution or note of effect of using a cell reference entered with lower
case.

Strange it has never been reported against Writer, also checked the AOO
bugzilla as well with no clear dupe.


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=120200
[Bug 120200] [META] Update or correct help for features
https://bugs.documentfoundation.org/show_bug.cgi?id=123370
[Bug 123370] [META] "Expression is faulty" regressions
-- 
You are receiving this mail because:
You are the assignee for the bug.