Hi Folks,
The other day after I committed the fix to the MS Word import of
tables, I thought I'd give it a shot on my Church's weekly
newsletter which I knew exhibted the bug.
The tables now import perfectly, great!
But I saw a lots of square empty boxes plastered over text.
These were caused by positioned images with text wrapping enabled. Our
fram import code places and size the boxes correctly. But we're lacking
the ability to put images in in them at the moment and we can't wrap text
around them.
Now I plan to solve the first problem via the escher code worked out by
Chris Layey.
However even with if we get the image code to work we had no way of
wrappping of text around them.
So I started to thing in ernest about how to do it. From my personal
sampling of documents created by ordinary everyday people, text wrapping
around images is pretty common.
OK here is the algoritithm in plain text....
------------------------------------------------------------
Object wrapping
Fundamentally a two-pass processes.
Proposal:
Do it at the page level during fb_ColumnBreaker
New method in fp_Page called UpdateForWrapping.
call this if next column is on a different page from the previous.
On the previous page call this UpdateForWrapping method
Need to deal with lines that no longer wrap objects (don't what gaps in in
lines that used to wrap objects.)
Can only do the second pass after the first pass via the layout() method
in fp_Column is called.
We use this to position frames. After the frames are positioned we do the
second pass.
Need new member for for lines that indicate if they've been "wrapped."
Need a vector of wrapped lines in each column, filled during the layout()
method.
Need a member function in columns that returns true if the column contains
any wrapped lines
Update for wrapping.
Do this if there are frames placed on the page with text wrapping enabled.
1. Check if there are 0 frames and no wrapped lines. If so return.
if no wrapped lines, Check if the there is a frame with text wrapping. If
not return.
2. If wrapped lines but no frames
Get a vector of the blocks in the page, format them, rebreak the
column at the start of the page. (output of method needs to be
whether to rebreak the column first column to break.)
3. Check if any lines overlap the frames. If not return.
OK this is our main work section.
3.1 Grab first line of the page.
3.2 Iterate through the lines in the columns until we come across a line
overlaps a positioned and text wrapped frame.
3.3 Get it's block.
3.4 Reformat the Block with a pointer to this page. This reformat will
place lines around the frames in the page via the getNewContainerForPage
method.
3.5 getnext block and reformat with pointer to this page.
4. At end of block, do layout() method on all columns
5. Check if any lines overlap the frames.
6. if overlap goto 3.1
if not, identify the next container not on this page as the first
container of the next
7. We're done!
------------------------------------------------------------------------
I think I will try out this algorithim in ABIMATH to see if it works and
to see how invasive it is and to see how robust it is.
I'm thinking of including this 2.2 since it will dramatically increase our
usefulness. I'll propose this if my tests prove successful.
Cheers
Martin
PS The abiword document descibing this is included.
This archive was generated by hypermail 2.1.8 : Sat Aug 07 2004 - 05:19:19 CEST