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

List:       koffice-devel
Subject:    Re: Page numbering in KWord
From:       Thomas Zander <zander () kde ! org>
Date:       2009-12-21 22:32:51
Message-ID: 200912212332.52060.zander () kde ! org
[Download RAW message or body]

On Monday 21. December 2009 16.06.18 Mani N C wrote:
> I'm Working on Page numbering in KWord, which uses PageVariable to display
> page numbers in Header/Footers.
> PageVariable uses KWPageTextInfo::pagenumber() to get the current page
> number viewed. We have just one Header/Footer per document, And this is
> being reused in all the pages.
> 
> For Example, to display footer in 1st Page.
> Footer(KWTextFrameSet) created while loading odf is used to display. So
> while creating KWPageTextInfo Object, we use 1st page's KWPage object is
> used.
> While displaying page 2, Same Footer object is reused. But KWPageTextInfo
>  is created using 2nd page's KWPage Object.

Let me add some implementation details, on page 2 there is a second frame in 
the header/footer frameset and that is a 'copy frame'. Which is designed to 
just show the same content as the previous frame.
For copy shapes we set a different KWPageTextInfo on paint which may or may not 
re-layout the text frame and thus show a different framenumber.

The only frame in the header/footer that is not a copy-shape is the first, the 
rest all follow the above concept.

> So when we scroll up to first page, we have 2nd page's KWPage object. So 2
> is displayed on page 1 also.

Interesting, thats a regression, that didn't used to happen.
The reason is that the first frame is not a copy-shape.  And we can't make it 
one because we can't make the text tool edit a copy shape.
 
> I tried to connect the resourceChanged signal
>  (KoCanvasResource::CurrentPage ) So that we get page update event.
> But this is buggy, When i scroll up from page 2 to page 1, It displays '2'
> in Page 1 untill the event is fired for page 1.
> And it will fail when more than one page is visible .

As the only frame that is capable of showing the wrong page number is the first 
one, this approach is indeed wrong.
 
> I'm wondering how this issue can be solved,
> * Having header/Footer for every page ;) would solve this issue, I know it
> is not the right solution.
> * Will having a PageVariable for each KWPage would be a good idea ? But
> PageVaribale has to aware if it is moved to next/prev page.

I'm wondering where the regression came from; the first page updated just fine 
when i last looked at this and printing guaranteed the right page number. Both 
seem to have stopped working in trunk :(

> What you guys think would be the right solution for this issue?

Not sure, needs research.
As long as the designs of having a layout step completely independently of a 
painting step is uphold I'm fine with many solutions. I mention this as 
KPresenter forced the issues and broke that design, which makes everything 
much slower and more fragile.
-- 
Thomas Zander
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://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