main/sw/source/core/layout/trvlfrm.cxx
/*-----------------26.02.01 11:25-------------------
 * SwFrm::WannaRightPage()
 * decides if the page want to be a rightpage or not.
 * If the first content of the page has a page descriptor,
 * we take the follow of the page descriptor of the last not empty page.
 * If this descriptor allows only right(left) pages and the page
 * isn't an empty page then it wanna be such right(left) page.
 * If the descriptor allows right and left pages, we look for a number offset
 * in the first content. If there is one, odd number results right pages,
 * even number results left pages.
 * If there is no number offset, we take the physical page number instead,
 * but a previous empty page don't count.
 * --------------------------------------------------*/
26.02.01 11:25
SwFrm::WannaRightPage()
decides if the page want to be a rightpage or not.
If the first content of the page has a page descriptor,
we take the follow of the page descriptor of the last not empty page.
If this descriptor allows only right(left) pages and the page
isn't an empty page then it wanna be such right(left) page.
If the descriptor allows right and left pages, we look for a number offset
in the first content. If there is one, odd number results right pages,
even number results left pages.
If there is no number offset, we take the physical page number instead,
but a previous empty page don't count.
26 . 02 . 01 11 : 25 SwFrm :: WannaRightPage () decides if the page want to be a rightpage or not . If the first content of the page has a page descriptor we take the follow of the page descriptor of the last not empty page . If this descriptor allows only right ( left ) pages and the page isn ' t an empty page then it wanna be such right ( left ) page . If the descriptor allows right and left pages we look for a number offset in the first content . If there is one odd number results right pages even number results left pages . If there is no number offset we take the physical page number instead but a previous empty page don ' t count .
sal_Bool SwFrm::WannaRightPage() const
{
	const SwPageFrm *pPage = FindPageFrm();
	if ( !pPage || !pPage->GetUpper() )
		return sal_True;
	const SwFrm *pFlow = pPage->FindFirstBodyCntnt();
	SwPageDesc *pDesc = 0;
	sal_uInt16 nPgNum = 0;
	if ( pFlow )
	{
		if ( pFlow->IsInTab() )
			pFlow = pFlow->FindTabFrm();
		const SwFlowFrm *pTmp = SwFlowFrm::CastFlowFrm( pFlow );
		if ( !pTmp->IsFollow() )
		{
			const SwFmtPageDesc& rPgDesc = pFlow->GetAttrSet()->GetPageDesc();
			pDesc = (SwPageDesc*)rPgDesc.GetPageDesc();
			nPgNum = rPgDesc.GetNumOffset();
		}
	}
	if ( !pDesc )
	{
		SwPageFrm *pPrv = (SwPageFrm*)pPage->GetPrev();
		if( pPrv && pPrv->IsEmptyPage() )
			pPrv = (SwPageFrm*)pPrv->GetPrev();
		if( pPrv )
			pDesc = pPrv->GetPageDesc()->GetFollow();
		else
		{
			const SwDoc* pDoc = pPage->GetFmt()->GetDoc();
			pDesc = (SwPageDesc*)&pDoc->GetPageDesc( 0 );
		}
	}
	ASSERT( pDesc, "No pagedescriptor" );
	sal_Bool bOdd;
	if( nPgNum )
		bOdd = nPgNum % 2 ? sal_True : sal_False;
	else
	{
		bOdd = pPage->OnRightPage();
		if( pPage->GetPrev() && ((SwPageFrm*)pPage->GetPrev())->IsEmptyPage() )
			bOdd = !bOdd;
	}
	if( !pPage->IsEmptyPage() )
	{
		if( !pDesc->GetRightFmt() )
			bOdd = sal_False;
		else if( !pDesc->GetLeftFmt() )
			bOdd = sal_True;
	}
	return bOdd;
}
sal_Bool SwFrm :: WannaRightPage ( ) const { const SwPageFrm * pPage = FindPageFrm ( ) ; if ( ! pPage || ! pPage -> GetUpper ( ) ) return sal_True ; const SwFrm * pFlow = pPage -> FindFirstBodyCntnt ( ) ; SwPageDesc * pDesc = 0 ; sal_uInt16 nPgNum = 0 ; if ( pFlow ) { if ( pFlow -> IsInTab ( ) ) pFlow = pFlow -> FindTabFrm ( ) ; const SwFlowFrm * pTmp = SwFlowFrm :: CastFlowFrm ( pFlow ) ; if ( ! pTmp -> IsFollow ( ) ) { const SwFmtPageDesc & rPgDesc = pFlow -> GetAttrSet ( ) -> GetPageDesc ( ) ; pDesc = ( SwPageDesc * ) rPgDesc . GetPageDesc ( ) ; nPgNum = rPgDesc . GetNumOffset ( ) ; } } if ( ! pDesc ) { SwPageFrm * pPrv = ( SwPageFrm * ) pPage -> GetPrev ( ) ; if ( pPrv && pPrv -> IsEmptyPage ( ) ) pPrv = ( SwPageFrm * ) pPrv -> GetPrev ( ) ; if ( pPrv ) pDesc = pPrv -> GetPageDesc ( ) -> GetFollow ( ) ; else { const SwDoc * pDoc = pPage -> GetFmt ( ) -> GetDoc ( ) ; pDesc = ( SwPageDesc * ) & pDoc -> GetPageDesc ( 0 ) ; } } ASSERT ( pDesc , " " ) ; sal_Bool bOdd ; if ( nPgNum ) bOdd = nPgNum % 2 ? sal_True : sal_False ; else { bOdd = pPage -> OnRightPage ( ) ; if ( pPage -> GetPrev ( ) && ( ( SwPageFrm * ) pPage -> GetPrev ( ) ) -> IsEmptyPage ( ) ) bOdd = ! bOdd ; } if ( ! pPage -> IsEmptyPage ( ) ) { if ( ! pDesc -> GetRightFmt ( ) ) bOdd = sal_False ; else if ( ! pDesc -> GetLeftFmt ( ) ) bOdd = sal_True ; } return bOdd ; }
26.02.01 11:25
 SwFrm::WannaRightPage()
 decides if the page want to be a rightpage or not.
26 . 02 . 01 11 : 25 SwFrm :: WannaRightPage () decides if the page want to be a rightpage or not .