You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2006/03/27 17:53:51 UTC

DO NOT REPLY [Bug 39118] New: - [PATCH] Handling of page-number-citation-last

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39118>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39118

           Summary: [PATCH] Handling of page-number-citation-last
           Product: Fop
           Version: 1.0dev
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: page-master/layout
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: phkraus@skynet.be


This patch add the handling of the page-number-citation-last element defined in
the XSL 1.1 spec

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Re: DO NOT REPLY [Bug 39118] New: - [PATCH] Handling of page-number-citation-last

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
I have trouble making updates to Bugzilla right now, so.....

Pierre-Henri,

very cool! I'm looking forward to reviewing the patch. In the meantime,
would you please submit the ICLA (by fax) I was talking about in an
earlier mail? We need it since your patch contains a new file, not just
minor fixes to existing files. See http://www.apache.org/licenses/#clas.

And please write a test case for the
test/layoutengine/standard-testcases directory to demonstrate the new FO
element and so we can automatically test its functionality for all times.
A guide to writing layout engine test cases can be found here:
http://wiki.apache.org/xmlgraphics-fop/HowToCreateLayoutEngineTests
It's very easy to do. And there are LOTS of examples. :-)

Thank you!

On 27.03.2006 17:53:51 bugzilla wrote:
> This patch add the handling of the page-number-citation-last element defined in
> the XSL 1.1 spec


Jeremias Maerki


Re: DO NOT REPLY [Bug 39118] - [PATCH] Handling of page-number-citation-last

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 26.04.2006 11:53:59 Chris Bowditch wrote:
> bugzilla@apache.org wrote:
> 
> Hi Jeremias,
> 
> can you clarify some of the comments you made on this. It's not 100% 
> clear to me.
> 
> <snip/>
> 
> > ------- Additional Comments From jeremias@apache.org  2006-04-23 09:41 -------
> > Pierre-Henri, I've applied your patch with modifications. See:
> > http://svn.apache.org/viewcvs?rev=396243&view=rev
> > 
> > Thanks a lot for that and sorry for the delay.
> > 
> > I found a remaining problem with your patch. When a formatting object spans
> > multiple pages, forward references are not properly resolved. You can see that
> > in the *_basic.xml test case which I've modified and disabled. It looks like you
> > didn't entirely get my hint last time. The problem is that addAreas() can be
> > called multiple times. An example: If a block spans multiple pages, it is called
> > once for each page it generates area for. Since you notify the AreaTreeHandler
> > after each call to addAreas (and not only after the last) a forward reference
> > gets the wrong page number (i.e. the one of the first area). Determining the
> > last call to addAreas for a formatting objects might be a little tricky, however.
> 
> Are you saying that forward references using page-number-citation is 
> broken when the Area being referenced spans multiple pages?

Not for page-number-citation, only for page-number-citation-last.

> > 
> > Furthermore, you've only addressed block-level formatting objects and
> > page-sequence for ID processing, but some of the inline-level formatting objects
> > can similarly span multiple pages (like fo:inline for example). I don't think
> > this is critical since you might rarely refer to an inline-level ID with
> > page-number-citation-last. The most important use case is certainly referring to
> > an ID from page-sequence to achieve reliable "page x of y" without the "empty
> > block with ID" hack we've used until today.
> 
> I don't understand what you mean by reference an inline-level ID with 
> page-number-citation-last? Surely page-number-citation-last does not 
> reference an ID, merely return the last page number in the document. So 
> do you mean reference an inline level id with page-number-citation?

Ok, to be precise: page-number-citation(-last) references the first/last
area generated by the formatting object with the "id" referenced by the
"ref-id" property.

So my "referencing an inline-level ID" is this:
[..]
<fo:inline id="myid">hiccup</fo:inline>
[..]
<fo:page-number-citation-last ref-id="myid"/>
[..]

> > 
> > I'm leaving the issue open for now.
> > 
> 
> Is it worth raising a separate bug for this, so this issue can be 
> tracked more easily?

Hmm, doesn't matter to me.


Jeremias Maerki


Re: DO NOT REPLY [Bug 39118] - [PATCH] Handling of page-number-citation-last

Posted by Chris Bowditch <bo...@hotmail.com>.
bugzilla@apache.org wrote:

Hi Jeremias,

can you clarify some of the comments you made on this. It's not 100% 
clear to me.

<snip/>

> ------- Additional Comments From jeremias@apache.org  2006-04-23 09:41 -------
> Pierre-Henri, I've applied your patch with modifications. See:
> http://svn.apache.org/viewcvs?rev=396243&view=rev
> 
> Thanks a lot for that and sorry for the delay.
> 
> I found a remaining problem with your patch. When a formatting object spans
> multiple pages, forward references are not properly resolved. You can see that
> in the *_basic.xml test case which I've modified and disabled. It looks like you
> didn't entirely get my hint last time. The problem is that addAreas() can be
> called multiple times. An example: If a block spans multiple pages, it is called
> once for each page it generates area for. Since you notify the AreaTreeHandler
> after each call to addAreas (and not only after the last) a forward reference
> gets the wrong page number (i.e. the one of the first area). Determining the
> last call to addAreas for a formatting objects might be a little tricky, however.

Are you saying that forward references using page-number-citation is 
broken when the Area being referenced spans multiple pages?

> 
> Furthermore, you've only addressed block-level formatting objects and
> page-sequence for ID processing, but some of the inline-level formatting objects
> can similarly span multiple pages (like fo:inline for example). I don't think
> this is critical since you might rarely refer to an inline-level ID with
> page-number-citation-last. The most important use case is certainly referring to
> an ID from page-sequence to achieve reliable "page x of y" without the "empty
> block with ID" hack we've used until today.

I don't understand what you mean by reference an inline-level ID with 
page-number-citation-last? Surely page-number-citation-last does not 
reference an ID, merely return the last page number in the document. So 
do you mean reference an inline level id with page-number-citation?

> 
> I'm leaving the issue open for now.
> 

Is it worth raising a separate bug for this, so this issue can be 
tracked more easily?

Chris



DO NOT REPLY [Bug 39118] - [PATCH] Handling of page-number-citation-last

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39118>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39118


jeremias@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Additional Comments From jeremias@apache.org  2006-04-23 09:41 -------
Pierre-Henri, I've applied your patch with modifications. See:
http://svn.apache.org/viewcvs?rev=396243&view=rev

Thanks a lot for that and sorry for the delay.

I found a remaining problem with your patch. When a formatting object spans
multiple pages, forward references are not properly resolved. You can see that
in the *_basic.xml test case which I've modified and disabled. It looks like you
didn't entirely get my hint last time. The problem is that addAreas() can be
called multiple times. An example: If a block spans multiple pages, it is called
once for each page it generates area for. Since you notify the AreaTreeHandler
after each call to addAreas (and not only after the last) a forward reference
gets the wrong page number (i.e. the one of the first area). Determining the
last call to addAreas for a formatting objects might be a little tricky, however.

Furthermore, you've only addressed block-level formatting objects and
page-sequence for ID processing, but some of the inline-level formatting objects
can similarly span multiple pages (like fo:inline for example). I don't think
this is critical since you might rarely refer to an inline-level ID with
page-number-citation-last. The most important use case is certainly referring to
an ID from page-sequence to achieve reliable "page x of y" without the "empty
block with ID" hack we've used until today.

I'm leaving the issue open for now.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 39118] - [PATCH] Handling of page-number-citation-last

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39118>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39118





------- Additional Comments From phkraus@skynet.be  2006-03-30 11:39 -------
Created an attachment (id=18004)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18004&action=view)
Basic testcase to check the page-number-citation-last element

OK, sorry for the delay but JUnit was acting strange :p
2 questions:
- This test uses the "linefeed-treatment=preserve" property, is it ok ?
- Do you want more test for the element ?

And to Jeremias, i'll try to fax the ICLA today or tommorow (asking someone as
i don't have a fax myself), and if i can't i'll send it by mail...

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 39118] - [PATCH] Handling of page-number-citation-last

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39118>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39118





------- Additional Comments From phkraus@skynet.be  2006-04-15 12:30 -------
Created an attachment (id=18109)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18109&action=view)
This file is the *complete* patch to handle page-number-citation-last in the
different FO elements requested

Ignore the precedent patch, this one applies the same modifications + new ones
		
		Patch Explanation
		-----------------
		
OK, this is a file to help you understand the changes applied
to the source code to handle the page-number-citation-last
element. 

New Data Structures
-------------------

2 java.util.HashSet in AreaTreeHandler.java :

    private Set unresolvedLayoutManagers = new HashSet();
    private Set alreadyResolvedIDs = new HashSet();

The role of unresolvedLayoutManagers is to keep a list of 
"which formatting objects contributes IDs" as you proposed it.

The role of alreadyResolvedIDs is to keep a list of IDs already
resolved. That role might seems unnecessary, so here's a little 
example that i came across while doing the modification :

...
  <fo:block>page: <fo:page-number/>, bof2 is on page <fo:page-number-citation
ref-id="bof2"/></fo:block>
    <fo:block linefeed-treatment="preserve" id="bof3">page: <fo:page-number/>
      test
      test
      test
      test
      test
      test
    </fo:block>
    <fo:block break-before="page">page: <fo:page-number/></fo:block>
    <fo:block>page: <fo:page-number/></fo:block>
    <fo:block>page: <fo:page-number/> of <fo:page-number-citation
ref-id="eof1"/></fo:block>
    <fo:block>page(-last): <fo:page-number/> of <fo:page-number-citation-last
ref-id="bof3"/></fo:block>
...

Withouth the second Set, the problem that we come across is that the
layout of the block with the id 'bof3' is finished before the creation
of the page-number-citation-last layout manager. Due to the construction
of the PNCL-LM, the first step it does is to add the UnresolvedPageNumber
in the unresolvedLayoutManager list (there is no way to known in advance
if the page number can be resolved or not at this point). Each layout manager
is responsible of removing its ID from the unresolvedLayoutManager's list
and, at the same time to call for the resolution of the IDs its possess.
But as the ID of the block of the block layout manager is inexisting in the
list as the PNCL-LM haven't addded yet, it is not resolved when "it should".
The solution that i chose is to add each ID resolved "in advance" in a Set,
that the PNCL-LM will check to see if it can skip the "wait for resolve"
step, so it can immediately be resolved. 

I hope that this little explanation helped you to understand the changes.

What have been done -> handling of PageSequence ids and Block ids + Block level

ids (as page-number-citation)

Known limits -> no handling of IDs contained in a root, flow, and the table
related ids : table-header, table-footer, table-body ...
And, i don't know if it's a problem, but when the actual UnresolvedPageNumber
object is resolved, the font associated to it is null (this is due to the
"transient" state of the object i guess...) and the IPD can't be updated (only
the case with PageSequences).

New Code
--------
As explained above.
The source code changes are avail in the patch file.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 39118] - [PATCH] Handling of page-number-citation-last

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39118>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39118





------- Additional Comments From jeremias@apache.org  2006-03-30 19:05 -------
(In reply to comment #2)
> Created an attachment (id=18004)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18004&action=view) [edit]
> Basic testcase to check the page-number-citation-last element
> 
> OK, sorry for the delay but JUnit was acting strange :p
> 2 questions:
> - This test uses the "linefeed-treatment=preserve" property, is it ok ?

Yes, but I don't see what its function is in this particular test case.

> - Do you want more test for the element ?

If you don't mind, I have an additional wish: Testing page-number-citation-last
referencing an id on the page-sequence because that will be the major use case
for it. The most interesting part is then to combine that with a
page-position="last" where the last page is a blank page (see
page-position_last_1.xml).

> And to Jeremias, i'll try to fax the ICLA today or tommorow (asking someone as
> i don't have a fax myself), and if i can't i'll send it by mail...

Thank you! If possible, please try fax because we've had bad experiences with
normal mail.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 39118] - [PATCH] Handling of page-number-citation-last

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39118>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39118





------- Additional Comments From phkraus@skynet.be  2006-03-27 16:54 -------
Created an attachment (id=17995)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17995&action=view)
The patch file


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.