commit&moans -- Fix loading of documents containing pagebreaks


Subject: commit&moans -- Fix loading of documents containing pagebreaks
From: Jesper Skov (jskov@redhat.com)
Date: Sun Jun 11 2000 - 06:26:38 CDT


Seems all internal structures are in a somewhat random state after a
load until format() is called the first time.

There migth be good reasons for that (loading performance?), but I
don't like it much (I say humbly); there should be _one_ valid state
of the formatting structures - and functions should know how to deal
with that one state, and nothing else.

Unfortunately I still don't have enough of an overview of the code to
fix things up, so cue workaround hack...

Jesper

Index: fl_BlockLayout.cpp
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fl_BlockLayout.cpp,v
retrieving revision 1.156
diff -u -5 -r1.156 fl_BlockLayout.cpp
--- fl_BlockLayout.cpp 2000/06/09 06:18:50 1.156
+++ fl_BlockLayout.cpp 2000/06/11 11:19:47
@@ -730,10 +730,15 @@
 
 // Split the line the Run resides on, ensuring that the resulting two lines
 // are both valid in the sense of being able to contain the point.
 void fl_BlockLayout::_breakLineAfterRun(fp_Run* pRun)
 {
+ // When loading a document, there may not have been created
+ // lines yet. Get a first one created and hope for the best...
+ if (!m_pFirstLine)
+ _stuffAllRunsOnALine();
+
         // First make sure the old line can contain the point
         fp_Line* pLine = pRun->getLine();
         // (This is a sloppy check - may have to loop between the two Runs
         // and check that at least one Run can contain the point.)
         if (pLine->getFirstRun() == pRun)



This archive was generated by hypermail 2b25 : Sun Jun 11 2000 - 06:26:46 CDT