sw/source/core/layout/frmtool.cxx | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
New commits: commit a964cf666abb0c4df4e29ea8709532b7d45c104f Author: Miklos Vajna <vmik...@suse.cz> Date: Thu Oct 4 08:23:12 2012 +0200 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 diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 1f190aa..815ffcd 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits