Issue 77649 - Writer: Change of number format in table cells inconsistent
Summary: Writer: Change of number format in table cells inconsistent
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: editing (show other issues)
Version: OOo 2.2
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: michael.ruess
QA Contact: issues@sw
URL:
Keywords:
Depends on:
Blocks: 72764
  Show dependency tree
 
Reported: 2007-05-21 13:43 UTC by andreas.martens
Modified: 2013-08-07 14:42 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Bug document (7.08 KB, application/vnd.sun.xml.writer)
2007-05-21 13:44 UTC, andreas.martens
no flags Details
The patch file (768 bytes, text/plain)
2007-05-28 05:45 UTC, liuyu
no flags Details
Colored bug document (7.45 KB, application/vnd.sun.xml.writer)
2007-05-29 10:59 UTC, andreas.martens
no flags Details
the patch file (1.22 KB, text/plain)
2007-05-30 03:31 UTC, liuyu
no flags Details
the patch file (1.53 KB, text/plain)
2007-05-31 03:48 UTC, liuyu
no flags Details
the patch file (1022 bytes, text/plain)
2007-06-01 04:23 UTC, liuyu
no flags Details
the patch file (1.64 KB, text/plain)
2007-06-07 08:20 UTC, liuyu
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description andreas.martens 2007-05-21 13:43:20 UTC
Load bug document.
Expected behavior:
Change number format (from "text" to e.g. "date") is possible for cells which
contains one paragraph. It is not doable for cell with more paragraphs. Try cell
"A1" and "A2".
Wrong behavior:
Cell "B1" contains two paragraphs but the number format is changeable?!
Cell "C1" contains a table (in table), a change of the number format (of the
outer table cell) will be applied to the inner table cell?!
Comment 1 andreas.martens 2007-05-21 13:44:31 UTC
Created attachment 45291 [details]
Bug document
Comment 2 andreas.martens 2007-05-21 13:47:40 UTC
Set target.
Comment 3 liuyu 2007-05-28 05:45:08 UTC
Created attachment 45452 [details]
The patch file
Comment 4 liuyu 2007-05-28 05:52:56 UTC
Hi ama, as your suggestion in the issue 77648, I have fixed this issue. I add a 
check that if the node (behind the start node) is a start node of a table or a 
section, the fuction SwTableBox::IsValidNumTxtNd(..) will return ULONG_MAX.
please have a look at the patch file.
Comment 5 peter.junge 2007-05-28 07:48:11 UTC
Add dependency to meta issue
Comment 6 liujiaxiang 2007-05-28 08:31:27 UTC
add myself
Comment 7 andreas.martens 2007-05-29 10:59:38 UTC
Created attachment 45483 [details]
Colored bug document
Comment 8 andreas.martens 2007-05-29 11:25:35 UTC
I have attached a modified bug document.
When you select the complete table and set the number format "date" for all
table cells (of the oiuter table), the IsValidNumTxtNd(..) function is
responsible for the changing of text. But unfortunately this function works not
like expected.
How it should work:
It should change all cells with green background because their content is one
single paragraph which is allowed to be changed. The cells with red background
must not be changed because they contents more than one paragraph and/or a table
(in table).

The current implementation is not able to detect the situation correct in cell
B1, C1 and C2 which should return ULONG_MAX. Your patch would return ULONG_MAX
for B1, C1 and C2 which is fine, but it would return ULONG_MAX for B2 as well
which is wrong.
Comment 9 liuyu 2007-05-30 03:31:03 UTC
Created attachment 45502 [details]
the patch file
Comment 10 liuyu 2007-05-30 03:45:09 UTC
I think I understand. If the cell only contains a section, its number format 
can be changed, like a single paragraph in the cell.
It should reject the change only when the cell contains more than one paragraph 
or tables (in table).
Comment 11 andreas.martens 2007-05-30 11:14:29 UTC
Yes, you're absolutely right.
One situation is not covered by your patch: If a cell contains a section which
contains a table with one cell. But this seems to be the last problem I can
imagine ;-)
BTW: A SwTableNode is always a SwStartNode, it's not necessary to check both.
Comment 12 liuyu 2007-05-31 03:48:52 UTC
Created attachment 45544 [details]
the patch file
Comment 13 liuyu 2007-05-31 04:02:55 UTC
According to your suggestion, I modified the patch file.
I change the table node check to if the cell contains a table node between the 
start node of the cell position and the end the cell of the cell position, the 
fuction SwTableBox::IsValidNumTxtNd(..) will return ULONG_MAX.
I think this patch could cover any situation you mentioned.
Thank you very much for you guidance.
Comment 14 andreas.martens 2007-05-31 16:05:48 UTC
I have to construct more complex cases to break your code ;-)
Sections could be nested, please check your code if a cell contains the following:
<cell>
  <section A>
    <section B>
      <text node X/>
    </section B>
    <text node Y/>
  </section A>
</cell>
I doubt your check will identify text node B as a problem?!
BTW: The check could be less sophisticated: every section contains at least one
text node, every table contains at least one text node. You only have to check
if there is a second text node behind the first one and before the end of the
cell. There is no need to check for other start or table nodes. Okay, first you
have to check if your first paragraph is already inside an inner table of course.
Comment 15 liuyu 2007-06-01 04:23:27 UTC
Created attachment 45568 [details]
the patch file
Comment 16 liuyu 2007-06-01 04:36:55 UTC
I think the table node check is valuable. 
If the cell contains:
<cell>
  <section A>
    <table 1>
      <text node X/>
    </table 1>
  </section A>
</cell>
So, According your suggestion, I modified the check in the function 
SwTableBox::IsValidNumTxtNd(..),to check if there is a second text node behind the 
first one and before the end of the
cell, and add a table node check when the position between the cell start and the 
cell end.
Comment 17 andreas.martens 2007-06-01 16:24:50 UTC
Yes, your last patch will work for every scenario I'm able to imagine :-)
Now  we can have a look if it can be optimized. Your new code iterates the cell
content, the SwNodes::GoNexct(..) function call iterates the cell content, too.
Your iteration is necessary but the old GoNext(..) call can be removed if your
iteration delivers the correct text node.
Something like this:
SwTxtNode *pTextNode = 0;
for(..pNext..)
{
  if( IsTableNode() )
  {
    pTextNode = 0;
    break;  // Table found
  }
  if( IsTxtNode() )
  {
     if( pTextNode )
     {
        pTextNode = 0;
        break;
     }
     pTextNode = pNext;
  }
}
if( pTextNode )
{
    .....
}
else
  return ULONG_MAX;

What do you think?
Comment 18 liuyu 2007-06-07 08:20:36 UTC
Created attachment 45707 [details]
the patch file
Comment 19 liuyu 2007-06-07 08:25:07 UTC
I think you are right!
I modified the function SwTableBox::IsValidNumTxtNd(..) as your suggestion, removed 
the code (SwNodes::GoNext(..)).
Please have a look at the new patch file.
Thank you!
Comment 20 andreas.martens 2007-06-14 16:25:32 UTC
Fine, I took your code and checked it in for CWS swqbf99.
Thank you for your patch!
Comment 21 andreas.martens 2007-07-04 11:27:58 UTC
Ready for QA.
Comment 22 michael.ruess 2007-07-06 14:25:12 UTC
Verified fix in CWS swqbf99.
Comment 23 michael.ruess 2007-07-26 10:27:41 UTC
Checked in 680m222.