Issue 81544 - Page desc changes if header is inserted
Summary: Page desc changes if header is inserted
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: 680m226
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: michael.ruess
QA Contact: issues@sw
Depends on:
Blocks: 72764
  Show dependency tree
Reported: 2007-09-13 08:53 UTC by frank.meies
Modified: 2013-08-07 14:43 UTC (History)
5 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---

bugdoc (9.17 KB, application/vnd.oasis.opendocument.text)
2007-09-13 08:54 UTC, frank.meies
no flags Details
patch file (863 bytes, text/plain)
2008-02-28 13:07 UTC,
no flags Details
pat (522 bytes, text/plain)
2008-03-03 02:47 UTC,
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description frank.meies 2007-09-13 08:53:01 UTC
Open bugdoc, go to page 7, insert header. Page 7 changes from "right page" to
"left page".
Comment 1 frank.meies 2007-09-13 08:54:00 UTC
Created attachment 48206 [details]
Comment 2 frank.meies 2007-09-13 08:54:34 UTC
This is a follow-up of issue 80890.
Comment 3 frank.meies 2007-12-04 07:46:18 UTC
Comment 4 2008-02-27 14:18:15 UTC
lijian->fme:This issue seems to have no relationship with the insertion of 
Please act like this :
open this bugdoc, format-page, and then click 'OK'. Then this issue appears.
I found that the style "Impressum" was a custom style. After clicking "OK",
style of second page changes from "Impressum" to "Index". Maybe it's the 
I have not found the root cause. I still need some time.
Comment 5 2008-02-28 08:56:01 UTC
I have found a way to solve this problem. Please wait for my patch.
I will attatch it soon for your review. :-)
Comment 6 2008-02-28 13:07:25 UTC
Created attachment 51787 [details]
patch file
Comment 7 2008-02-28 13:10:15 UTC
Hi frank, I just submitted a patch for this issue.
Please review this patch and I will wait for your reply.
Comment 8 frank.meies 2008-02-28 16:01:11 UTC
fme->lijian: Thank you for your patch! Yes, you found the right piece of code
that has to be changed. I'll have to dig into that code somewhat deeper. A first
comment from my side: You do not need the 'if' here:

if (((SwPageFrm*)GetPrev())->IsEmptyPage())
    some code
    pRet = ((SwPageFrm*)GetPrev())->GetPageDesc()->GetFollow();

because the 'some code' case is also correct for non-empty pages.
Comment 9 2008-02-29 02:04:26 UTC
I don't know what do you mean by "'some code' case is also correct for non-
empty pages. Will you please give more details ?
I think this case is as follows for this bugdoc:
When you click "Format-Page", and then click "OK" in the dialog "Page Style :
Default", a while loop for all pages in function SwFrm::CheckPageDescs() will 
be done. So,
The first page(page number 1) style is "First page" whose following style 
is "Impressum".
The second page(page number 2) is an empty page and is not visible whose style 
is "Impressum" and following style is "Index".
So far so fine with "SwPageFrm::FindPageDesc().
Then goto the third page(page number 3) with function FindPageDesc.
Because the second page is an empty page, then pFlow and pRet will be NULL.
And the third page is not an empty page, so codes below will be done:

if ( !pRet )
	pRet = GetPrev() ?
((SwPageFrm*)GetPrev())->GetPageDesc()->GetFollow() : 0;

While GetPrev() here is the second page, GetFollow() will be "Index".
And the third page style will be changed to "Index" other than "Impressum".
That's the problem. Right ?
Thus, I think the current page style should be the following style of the first
non-empty page before the current page.
That's what I think. Hope you can give me some help.
Comment 10 frank.meies 2008-02-29 09:23:28 UTC
fme->lijian: You analysis is correct. But what's puzzling me is the fact that
the second page has the 'Impressum' page description. Let's make a smaller
example. First page is 'first page' with follow style 'right page' and 'right
page' has follow style 'left page'. If you create a second page (by entering a
hard page break), the an empty page has to be created, because the new page
should be a 'right page'. The empty page in this scenario is created as a copy
of the first page, therefore the empty page is also a 'first page'. If for some
reason CheckPageDescs() is called again, the second (empty) page will change
it's description from 'first page' to 'right page', see 3. in FindPageDesc(). If
point 3. in FindPageDesc() is changed to return 'first page' for the empty page,
the bug also does not occur anymore. I think this needs some more investigation. 
Comment 11 frank.meies 2008-03-01 07:40:06 UTC
fme->lijian: I think we should fix this issue by changing 3. in FindPageDesc()
to make sure that an empty page has the same page description as its Prev().
What do you think?
Comment 12 2008-03-03 02:47:07 UTC
Created attachment 51855 [details]
Comment 13 2008-03-03 02:49:48 UTC
I just submitted my patch2 to issuezilla, because I could log on. :)
Comment 14 frank.meies 2008-03-03 08:12:27 UTC
fme->lijian: Thank you. Fixed in cws fmepatches02, pagechg.cxx, rev.
Comment 15 frank.meies 2008-05-23 18:12:35 UTC
FME->QA: Ready for QA. Please do some testing of the page description stuff.
Comment 16 michael.ruess 2008-06-03 18:56:59 UTC
Verified fix in CWS fmepatches02.
Comment 17 michael.ruess 2008-07-11 13:28:52 UTC
Checked in DEV300m24.