Kaydet (Commit) a964cf66 authored tarafından Miklos Vajna's avatar Miklos Vajna

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 9ff68a28, 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
üst af4df7ac
...@@ -2742,10 +2742,28 @@ SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, ...@@ -2742,10 +2742,28 @@ SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
SwPageFrm *pRet; SwPageFrm *pRet;
SwDoc *pDoc = ((SwLayoutFrm*)pUpper)->GetFmt()->GetDoc(); SwDoc *pDoc = ((SwLayoutFrm*)pUpper)->GetFmt()->GetDoc();
SwFrmFmt *pFmt = 0; SwFrmFmt *pFmt = 0;
// rDesc can't know if the first page will be 'left' or 'right', so if if (bFirst)
// first is shared, let's ignore first here. {
if (bFirst && !rDesc.IsFirstShared()) 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(); pFmt = rDesc.GetFirstFmt();
if (!pFmt)
{
pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt();
}
}
else else
pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt(); pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt();
//Wenn ich kein FrmFmt fuer die Seite gefunden habe, muss ich eben //Wenn ich kein FrmFmt fuer die Seite gefunden habe, muss ich eben
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment