Bug 45470 - Better support for overriding default LayoutManagerMaker needed
Summary: Better support for overriding default LayoutManagerMaker needed
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: page-master/layout (show other bugs)
Version: 0.94
Hardware: All All
: P3 enhancement
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-23 12:38 UTC by Rainer Langbehn
Modified: 2012-04-01 07:01 UTC (History)
0 users



Attachments
Proposed patch for the improvement (9.52 KB, patch)
2008-07-23 12:53 UTC, Jeremias Maerki
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Langbehn 2008-07-23 12:38:55 UTC
I have the requirement to replace the default BlockContainerLayoutManagerMaker with my own implementation. After searching the code base I think the suggested way is by using the setLayoutManagerMakerOverride(LayoutManagerMaker) method of the FopFactory to override the default LayoutManagerMaker implementation.

My own LayoutManagerMaker is a subclass of the default LayoutManagerMapping.
Unfortunately, 'cause the map of LayoutManagerMakers is private and no protected setter is given to change the default mapping set during initialize(), one has to provide a second map of LayoutManagerMakers and duplicate a lot of code to tell fop to use this new mapping.

My suggestion:
Either make the map of LayoutManagerMakers protected or preferably provide a protected setter to change the default mapping.

Thanks in advance
Rainer
Comment 1 Jeremias Maerki 2008-07-23 12:53:37 UTC
Created attachment 22308 [details]
Proposed patch for the improvement

Agreed, this is indeed not a good situation at the moment. I guess nobody really needed that feature. I prefer a protected setter. I'll attach a patch as proposal. If I don't hear any objections in the next 72 hours I'll commit the patch. Out of curiosity: what do you need to replace the block-container LM for?
Comment 2 Rainer Langbehn 2008-07-23 13:47:14 UTC
(In reply to comment #1)
> Created an attachment (id=22308) [details]
> Proposed patch for the improvement
> 
> Agreed, this is indeed not a good situation at the moment. I guess nobody
> really needed that feature. I prefer a protected setter. I'll attach a patch as
> proposal. If I don't hear any objections in the next 72 hours I'll commit the
> patch. Out of curiosity: what do you need to replace the block-container LM
> for?
> 

Jeremias,
...you're really fast :-) Thanks for the patch.

FYI, I'm working on a collection of XSL Transformation stylesheets (XSLT) to convert documents/forms from Adobe's XML Data Package (XDP) vocabulary into documents in the W3C's XSL Formatting Objects (XSL-FO) vocabulary (eventually with embedded XForms), http://xdp2fo.sourceforge.net. This project is still
in an early phase but the already produced outputs are very promising.

Some of the XDP container elements, which I map to absolute positioned block containers, use the concept of an anchor point for positioned layout. The location of the container's anchor point can be: topLeft, topCenter, topRight, middleLeft, middleCenter, middleRight, bottomLeft, bottomCenter, bottomRight.
The given top and left coordinates are always related to the anchor point. In
my opinion there is no corresponding concept in XSL-FO. Therefore you have to transform the left and top coordinates (writing mode is currently not respected) in accordance to the anchor type given.

After some research my choosen solution looks like this:

1. During transformation embed the XDP anchorType attribute in the
   corresponding block-container element (with XDP namespace).
2. Provide an extended BlockContainerLayoutManager that looks for this special
   attribute during layout processing. If such an attribute is found, perform
   the position adjustment after bpd and ipd are computed.
3. Remove the XDP attribute after processing.

What do you think about this solution? Do you know a better or simpler solution? The drawback of my solution is, you have to provide this extension
for every possible XSL-FO processor.

BTW, for barcode processing I'm using Barcode4J. Thanks for all your great work.

Bye Rainer
Comment 3 Jeremias Maerki 2008-07-23 23:33:31 UTC
(In reply to comment #2)
> What do you think about this solution? Do you know a better or simpler
> solution? The drawback of my solution is, you have to provide this extension
> for every possible XSL-FO processor.

Sorry, but I don't have a qualified opinion here as I know nothing of this XDP. But it definitely sounds suboptimal if you have to hack a FO processor to make this work.
Comment 4 Jeremias Maerki 2008-07-28 07:27:38 UTC
Change done as proposed: http://svn.apache.org/viewvc?view=rev&revision=680369
Comment 5 Glenn Adams 2012-04-01 07:01:50 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed