summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-10-04 08:23:12 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-10-04 13:19:55 +0200
commita964cf666abb0c4df4e29ea8709532b7d45c104f (patch)
tree0091ff6291272bd50e7bd4fa21b7840a1f015718
parentaf4df7ac089134df888ada3cd36b27a0b62babab (diff)
sw: proper fallback for first page in InsertNewPage()
For left/right share, the fallback is easy: the left page always falls back to the right page, if there is a fallback. In case of first page, the situation is more complicated, as there are multiple fallbacks (left/right). Since commit 9ff68a2, first page fallback was decided during registering part of the SwPageDesc to SwPageFrm, which is bad, as without a document export/import, a changed IsFirstShared() didn't have any effect: the LeftFmt/RightFmt was in use, so FirstFmt had no SwClients -> nobody was notified when that setting changed. This commit changes first pages to always use FirstFmt, and (if a fallback is needed) sets FirstFmt to point to LeftFmt/RightFmt as necessary. Change-Id: I4654baf293d72070fcf7e9eea408a43a31079e60
-rw-r--r--sw/source/core/layout/frmtool.cxx24
1 files changed, 21 insertions, 3 deletions
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 1f190aa0f87b..815ffcdd6d8c 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2742,10 +2742,28 @@ SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
SwPageFrm *pRet;
SwDoc *pDoc = ((SwLayoutFrm*)pUpper)->GetFmt()->GetDoc();
SwFrmFmt *pFmt = 0;
- // rDesc can't know if the first page will be 'left' or 'right', so if
- // first is shared, let's ignore first here.
- if (bFirst && !rDesc.IsFirstShared())
+ if (bFirst)
+ {
+ if (rDesc.IsFirstShared())
+ {
+ // We need to fallback to left or right page format, decide it now.
+ if (bOdd)
+ {
+ rDesc.GetFirst().SetFmtAttr( rDesc.GetMaster().GetHeader() );
+ rDesc.GetFirst().SetFmtAttr( rDesc.GetMaster().GetFooter() );
+ }
+ else
+ {
+ rDesc.GetFirst().SetFmtAttr( rDesc.GetLeft().GetHeader() );
+ rDesc.GetFirst().SetFmtAttr( rDesc.GetLeft().GetFooter() );
+ }
+ }
pFmt = rDesc.GetFirstFmt();
+ if (!pFmt)
+ {
+ pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt();
+ }
+ }
else
pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt();
//Wenn ich kein FrmFmt fuer die Seite gefunden habe, muss ich eben