Re: Initial questions

From: Martin Sevior <msevior_at_gmail.com>
Date: Fri Nov 20 2009 - 15:47:05 CET

On Fri, Nov 20, 2009 at 10:37 AM, Ersin Akinci <ersin.akinci@gmail.com> wrote:
> Hi Martin,
>
> Thanks for the heads up, I joined the group and now I have access to
> the NLNet documents.
>
> I took a break yesterday from coding and went back at it again today,
> and now I've got vertical alignment working reliably when the table
> isn't broken across multiple pages.

Excellent that unbroken tables work.

  As you predicted, broken tables
> are problematic.  It seems to be getting caught in a loop in the
> fp_TableContainer::_brokenDraw function, specifically when evaluating
> whether pCell->getY() > getYBottom().  It effectively "skips"
> formatting that cell without moving pCell to the next cell container,
> and since pCell never increments and the rendering logic is nested
> within a while(pCell) loop, it never breaks out.
>

OK A simple solution is to just add the m_iYOffset to pCell->getY()

ie ((pCell->getY() + pCell->getYOffset()) > getYBottom())

> I'm guessing that this check is never normally made because pCell's
> ypos is magically never set to be greater than the table's y bottom,
> otherwise this loop would be unavoidable with all broken tables.

Right.

> However, my vertical alignment code works by adding m_iYOffset to ypos
> in fpCellContainer::setToAllocation.  BTW, I reworked everything so
> that fl_CellLayout::format calculates the YOffset for each cell and
> assigns it to m_iYOffset in each cell layout's container with an
> accessor function.  I tried overloading getY, but it proved to be
> messy, and at any rate I'm not sure how viable it is in the long term
> to overload basic accessor functions like that since at some point
> down the line a new function might be written that assumes that getY
> returns the true ypos of the cell.
>

All good solutions.I think simply adding the offset as suggested above
will fix you up.

> Could you give me a brief overview of how tables work when broken over
> pages?

The idea is that there is a mater table which is as big as it needs to
be. It could be over a pages long for table. Then table that are
actually displayed in columns are "broken" at the appropriate y
position.

So suppose a table has a total height of 100,000 layout units. each
column on a page might be 10,000 units. The top of the table is
positioned at position 5,000 in a column.

Then first broken table is has a broken position of 0. ie there is 0
offset between the top of this table and the top of the master table.

The second broken table is broken at 5000. ie There is an offset
between the top of this table and the top of the master table. (the
first broken table fill the second half of the column and takes up
5000 units).

The third broken table has a broken position of 15000, the 4th 25000,
5th 35000 etc.

So the idea is that the code in fb_ColumnBreaker puts tables into the
columns one after the other. Then code in brokenDraw knows which
elements are contained in each broken table and draws them.

> Also, I wanted to clear up some confusion over the
> terminology: is the term "broken" used to refer both to tables split
> over multiple pages as well as tables split up by cells?

No. "broken" means it is a table container that is placed in a column
and can be drawn.

> Right now
> I'm thinking about adding a check somewhere so that if the ypos cell +
> height cell > ybottom of the table then it manually
> shifts...something, but I don't know what.  Shifting the ypos of each
> cell in each row below it would be horribly messy.  Perhaps nipping
> the problem in the bud by changing the allocations?  I don't know yet
> because while I feel like I have a good grasp on how unbroken tables
> and cells are rendered, I still know very little about when they are
> broken.
>

Hopefully the suggestion I made above will work. Maybe you should
submit a patch to the mailing list if it doesn;t work? I'll take a
look and see if it can be fixed. I finally have a bit of time to do
some coding.

Cheers

Martin

Cheers
> Thanks,
> Ersin
>
> On 11/18/09, Martin Sevior <msevior@gmail.com> wrote:
>> Hi Ersin,
>>             Please join the
>>
>> abi_nlnet
>>
>> Group. The document describing the NLnet sponsored bugs is:
>> cell alignment
>> abi_nlnet.abw
>>
>> https://abicollab.net/documents/edit/1751/0
>>
>> You do not have to implement the UI for vertical cell alignment but
>> you do need to implement import/export to odt format.
>>
>> Cheers
>>
>> Martin
>>
>
>
> --
>
> =========
>
> Ersin Y. Akinci -- http://www.ersinakinci.com
>
Received on Fri Nov 20 15:48:42 2009

This archive was generated by hypermail 2.1.8 : Fri Nov 20 2009 - 15:48:42 CET