You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/08/10 21:01:59 UTC
svn commit: r684572 - in /xmlgraphics/fop/branches/fop-0_95:
src/java/org/apache/fop/area/BookmarkData.java status.xml
test/layoutengine/standard-testcases/bookmarks_2.xml
Author: jeremias
Date: Sun Aug 10 12:01:59 2008
New Revision: 684572
URL: http://svn.apache.org/viewvc?rev=684572&view=rev
Log:
Fixed ID resolution for nested bookmarks with duplicated IDs.
Modified:
xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/area/BookmarkData.java
xmlgraphics/fop/branches/fop-0_95/status.xml
xmlgraphics/fop/branches/fop-0_95/test/layoutengine/standard-testcases/bookmarks_2.xml
Modified: xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/area/BookmarkData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/area/BookmarkData.java?rev=684572&r1=684571&r2=684572&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/area/BookmarkData.java (original)
+++ xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/area/BookmarkData.java Sun Aug 10 12:01:59 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.area;
import java.util.Collection;
@@ -33,7 +33,7 @@
* child bookmark-items under it.
*/
public class BookmarkData extends AbstractOffDocumentItem implements Resolvable {
-
+
private List subData = new java.util.ArrayList();
// bookmark-title for this fo:bookmark
@@ -92,7 +92,7 @@
}
refs.add(bd);
}
-
+
/**
* Create a new bookmark data root object.
* This constructor is called by the AreaTreeParser when the
@@ -218,25 +218,24 @@
* id reference.
*
* {@inheritDoc} List)
- * @todo check to make sure it works if multiple bookmark-items
- * have the same idref
*/
public void resolveIDRef(String id, List pages) {
- if (!id.equals(idRef)) {
- Collection refs = (Collection)unresolvedIDRefs.get(id);
- if (refs != null) {
- Iterator iter = refs.iterator();
- while (iter.hasNext()) {
- BookmarkData bd = (BookmarkData)iter.next();
- bd.resolveIDRef(id, pages);
- }
- unresolvedIDRefs.remove(id);
- }
- } else {
+ if (id.equals(idRef)) {
+ //Own ID has been resolved, so note the page
pageRef = (PageViewport) pages.get(0);
- // TODO get rect area of id on page
- unresolvedIDRefs.remove(idRef);
+ //Note: Determining the placement inside the page is the renderer's job.
+ }
+
+ //Notify all child bookmarks
+ Collection refs = (Collection)unresolvedIDRefs.get(id);
+ if (refs != null) {
+ Iterator iter = refs.iterator();
+ while (iter.hasNext()) {
+ BookmarkData bd = (BookmarkData)iter.next();
+ bd.resolveIDRef(id, pages);
+ }
}
+ unresolvedIDRefs.remove(id);
}
/**
Modified: xmlgraphics/fop/branches/fop-0_95/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-0_95/status.xml?rev=684572&r1=684571&r2=684572&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-0_95/status.xml (original)
+++ xmlgraphics/fop/branches/fop-0_95/status.xml Sun Aug 10 12:01:59 2008
@@ -52,14 +52,12 @@
</contexts>
<changes>
- <!--release version="FOP Trunk" date="TBD"-->
- <!-- change reverted, to be added back later
- <action context="Renderers" dev="AC" importance="high" type="add">
- Added SVG support for AFP (GOCA).
- </action>
- -->
- <!--/release-->
- <release version="0.95" date="TBD">
+ <release version="FOP Trunk" date="TBD">
+ <action context="Layout" dev="JM" type="fix">
+ Fixed ID resolution for nested bookmarks with duplicated IDs.
+ </action>
+ </release>
+ <release version="0.95" date="05 August 2008">
<notes>
<section>
<title>Notes</title>
Modified: xmlgraphics/fop/branches/fop-0_95/test/layoutengine/standard-testcases/bookmarks_2.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-0_95/test/layoutengine/standard-testcases/bookmarks_2.xml?rev=684572&r1=684571&r2=684572&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-0_95/test/layoutengine/standard-testcases/bookmarks_2.xml (original)
+++ xmlgraphics/fop/branches/fop-0_95/test/layoutengine/standard-testcases/bookmarks_2.xml Sun Aug 10 12:01:59 2008
@@ -34,10 +34,16 @@
<fo:bookmark-tree>
<fo:bookmark internal-destination="chapter1">
<fo:bookmark-title>Chapter 1</fo:bookmark-title>
+ <fo:bookmark internal-destination="chapter1">
+ <fo:bookmark-title>Nested Chapter 1</fo:bookmark-title>
+ </fo:bookmark>
</fo:bookmark>
<fo:bookmark internal-destination="chapter1" starting-state="hide">
<fo:bookmark-title>Again Chapter 1</fo:bookmark-title>
</fo:bookmark>
+ <fo:bookmark internal-destination="chapter2">
+ <fo:bookmark-title>Chapter 2</fo:bookmark-title>
+ </fo:bookmark>
</fo:bookmark-tree>
<fo:page-sequence id="page-sequence" master-reference="normal">
<fo:flow flow-name="xsl-region-body">
@@ -58,10 +64,13 @@
<eval expected="Chapter 1" xpath="//bookmarkTree/bookmark[1]/@title"/>
<eval expected="true" xpath="//bookmarkTree/bookmark[1]/@show-children"/>
+ <eval expected="Nested Chapter 1" xpath="//bookmarkTree/bookmark[1]/bookmark[1]/@title"/>
+ <eval expected="true" xpath="//bookmarkTree/bookmark[1]/bookmark[1]/@show-children"/>
<eval expected="Again Chapter 1" xpath="//bookmarkTree/bookmark[2]/@title"/>
<eval expected="false" xpath="//bookmarkTree/bookmark[2]/@show-children"/>
<eval expected="(P1,chapter1)" xpath="//bookmarkTree/bookmark[1]/@internal-link"/>
+ <eval expected="(P1,chapter1)" xpath="//bookmarkTree/bookmark[1]/bookmark[1]/@internal-link"/>
<eval expected="(P1,chapter1)" xpath="//bookmarkTree/bookmark[2]/@internal-link"/>
</checks>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org