[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Simple KWord patch for frames extending beyond the page
From:       David Faure <dfaure () klaralvdalens-datakonsult ! se>
Date:       2003-10-16 8:54:25
[Download RAW message or body]

On Thursday 16 October 2003 01:05, Michael Fair wrote:
> I'm not really asking it to map a relative coordinate so much as I am asking 
> how many units in view space is this "distance".  The result is the number of 
> units in the view space the width/height distances are from normal space.

Wrong, normalToView is not only about a scaling factor, it's also about absolute
positioning. normalToView(0,pageHeight*1.5) is the middle of the 2nd page,
and in "preview mode", that's at something like (pageWidth, pageHeight*0.5)
since the 2nd page is on the RIGHT of the first page.

> In this case both coordinate systems are linear 
Not really. And it's an assumption.
> and the function always  
> returns the correct result so long as the frame height <= the page height 
Right, it's broken if not. So why not do it correctly?

> If your frame is higher than your page height then it starts on the previous 
> page and the patch "Does the Right Thing". 
No, because normalToView(width,height) will give you something like
(much bigger width, much smaller height) - see above.

> > KWViewModePreview should simply reimplement QRect normalToView( const QRect
> > & nRect ) (make it virtual) and do the right thing there.
> 
> 
> I'll work on this but until it's decided that frames can cross page boundaries 
> and the behavior is well defined, and there is a commitment that all the 
> other supporting will work get done I don't have a good vision of what the 
> right thing to do is much beyond the patch I've submited.

The same thing, but without passing a relative coordinate to normalToView.
The previewmode's normalToView can just keep the width and height of the input
rect, they're both in pixels. It only has to call normalToView on the topleft coord.
Of course if it keeps the height it will still go beyond the bottom, hence the improvement
discussed below:

> The only improvement I was looking at was not assume the frame was shorter 
> than the page.  To keep the same "Just extend past the bottom of the page" 
> rendering, the alogirthm is pretty simple.  
> 
> Here's the psudocode to get the new frame height:
> while (bottomY > pageHeight) { 
>     nHeight += normalToView( pageHeight );
>     bottomY -= pageHeight;
> }
> nHeight += normalToView( bottomY );
> 
> This then gets added to the topLeft view point as the Y component.
> This algorithm will work for both "Page Mode" and "Preview Mode".
I don't see the need for a loop though.
You could simply set the height so that top+height < pagebottom,
i.e. set it to pagebottom-top if top+height > pagebottom.

> Are you saying that you want to do the work now support a single frame 
> spanning multiple pages? 
No no no ;)

-- 
David Faure -- faure@kde.org, dfaure@klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic