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

sw: tell InsertNewPage() if that'll be a first page

And in that case we can unconditionally call GetFirstFmt(), as the
SwPageDesc copying methods take care of the "shared first/right" setting
already. With this, the layout handles HeaderIsSharedFirst and
FooterIsSharedFirst correctly when the first page is the first physical
page.

Change-Id: Ib6d922aebaa1384856f79f2501dfbe087a74a20f
üst 5f4302c1
...@@ -101,7 +101,7 @@ long CalcRowRstHeight( SwLayoutFrm *pRow ); ...@@ -101,7 +101,7 @@ long CalcRowRstHeight( SwLayoutFrm *pRow );
long CalcHeightWidthFlys( const SwFrm *pFrm ); long CalcHeightWidthFlys( const SwFrm *pFrm );
SwPageFrm *InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, SwPageFrm *InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
sal_Bool bOdd, sal_Bool bInsertEmpty, sal_Bool bFtn, sal_Bool bOdd, bool bFirst, sal_Bool bInsertEmpty, sal_Bool bFtn,
SwFrm *pSibling ); SwFrm *pSibling );
// connect Flys with page // connect Flys with page
......
...@@ -2695,12 +2695,16 @@ sal_uLong SqRt( BigInt nX ) ...@@ -2695,12 +2695,16 @@ sal_uLong SqRt( BigInt nX )
/*************************************************************************/ /*************************************************************************/
SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
sal_Bool bOdd, sal_Bool bInsertEmpty, sal_Bool bFtn, sal_Bool bOdd, bool bFirst, sal_Bool bInsertEmpty, sal_Bool bFtn,
SwFrm *pSibling ) SwFrm *pSibling )
{ {
SwPageFrm *pRet; SwPageFrm *pRet;
SwDoc *pDoc = ((SwLayoutFrm*)pUpper)->GetFmt()->GetDoc(); SwDoc *pDoc = ((SwLayoutFrm*)pUpper)->GetFmt()->GetDoc();
SwFrmFmt *pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt(); SwFrmFmt *pFmt = 0;
if (bFirst)
pFmt = rDesc.GetFirstFmt();
else
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
//eine Leerseite einfuegen. //eine Leerseite einfuegen.
if ( !pFmt ) if ( !pFmt )
......
...@@ -1646,7 +1646,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) ...@@ -1646,7 +1646,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
{ {
SwPageDesc *pDesc = pDoc->GetEndNoteInfo().GetPageDesc( *pDoc ); SwPageDesc *pDesc = pDoc->GetEndNoteInfo().GetPageDesc( *pDoc );
pPage = ::InsertNewPage( *pDesc, pPage->GetUpper(), pPage = ::InsertNewPage( *pDesc, pPage->GetUpper(),
!pPage->OnRightPage(), sal_False, sal_True, 0 ); !pPage->OnRightPage(), false, sal_False, sal_True, 0 );
pPage->SetEndNotePage( sal_True ); pPage->SetEndNotePage( sal_True );
bChgPage = sal_True; bChgPage = sal_True;
} }
...@@ -1690,7 +1690,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) ...@@ -1690,7 +1690,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
{ {
SwPageDesc *pDesc = pDoc->GetFtnInfo().GetPageDesc( *pDoc ); SwPageDesc *pDesc = pDoc->GetFtnInfo().GetPageDesc( *pDoc );
pPage = ::InsertNewPage( *pDesc, pPage->GetUpper(), pPage = ::InsertNewPage( *pDesc, pPage->GetUpper(),
!pPage->OnRightPage(), sal_False, sal_True, pPage->GetNext() ); !pPage->OnRightPage(), false, sal_False, sal_True, pPage->GetNext() );
bChgPage = sal_True; bChgPage = sal_True;
} }
else else
......
...@@ -652,7 +652,7 @@ sal_Bool SwLayHelper::CheckInsertPage() ...@@ -652,7 +652,7 @@ sal_Bool SwLayHelper::CheckInsertPage()
bInsertEmpty = sal_True; bInsertEmpty = sal_True;
} }
::InsertNewPage( (SwPageDesc&)*pDesc, rpPage->GetUpper(), ::InsertNewPage( (SwPageDesc&)*pDesc, rpPage->GetUpper(),
bNextPageOdd, bInsertEmpty, sal_False, rpPage->GetNext() ); bNextPageOdd, nPgNum == 1, bInsertEmpty, sal_False, rpPage->GetNext() );
if ( bEnd ) if ( bEnd )
{ {
OSL_ENSURE( rpPage->GetNext(), "No new page?" ); OSL_ENSURE( rpPage->GetNext(), "No new page?" );
......
...@@ -555,9 +555,10 @@ void SwRootFrm::Init( SwFrmFmt* pFmt ) ...@@ -555,9 +555,10 @@ void SwRootFrm::Init( SwFrmFmt* pFmt )
if ( !pDesc ) if ( !pDesc )
pDesc = &pDoc->GetPageDesc( 0 ); pDesc = &pDoc->GetPageDesc( 0 );
const sal_Bool bOdd = !nPgNum || 0 != ( nPgNum % 2 ); const sal_Bool bOdd = !nPgNum || 0 != ( nPgNum % 2 );
bool bFirst = !nPgNum || 1 == nPgNum;
// Create a page and put it in the layout // Create a page and put it in the layout
SwPageFrm *pPage = ::InsertNewPage( *pDesc, this, bOdd, sal_False, sal_False, 0 ); SwPageFrm *pPage = ::InsertNewPage( *pDesc, this, bOdd, bFirst, sal_False, sal_False, 0 );
// Find the first page in the Bodytext section. // Find the first page in the Bodytext section.
SwLayoutFrm *pLay = pPage->FindBodyCont(); SwLayoutFrm *pLay = pPage->FindBodyCont();
......
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