Apache OpenOffice (AOO) Bugzilla – Issue 81544
Page desc changes if header is inserted
Last modified: 2013-08-07 14:43:03 UTC
Open bugdoc, go to page 7, insert header. Page 7 changes from "right page" to "left page".
Created attachment 48206 [details] bugdoc
This is a follow-up of issue 80890.
.
lijian->fme:This issue seems to have no relationship with the insertion of header. 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 problem. I have not found the root cause. I still need some time.
lijian->fme: I have found a way to solve this problem. Please wait for my patch. I will attatch it soon for your review. :-)
Created attachment 51787 [details] patch file
lijian->fme: Hi frank, I just submitted a patch for this issue. Please review this patch and I will wait for your reply.
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 } else pRet = ((SwPageFrm*)GetPrev())->GetPageDesc()->GetFollow(); because the 'some code' case is also correct for non-empty pages.
lijian->fme: 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.
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.
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?
Created attachment 51855 [details] pat
lijian->fme: I just submitted my patch2 to issuezilla, because I could log on. :)
fme->lijian: Thank you. Fixed in cws fmepatches02, pagechg.cxx, rev. 1.47.28.1
FME->QA: Ready for QA. Please do some testing of the page description stuff.
Verified fix in CWS fmepatches02.
Checked in DEV300m24.