add SwFrm::OnFirstPage to avoid copy&paste

Change-Id: Ib750b832f232495ec5f4139ca907931107f34294
This commit is contained in:
Miklos Vajna 2012-07-09 14:46:40 +02:00
parent d1aaa23c53
commit 0c8190999b
4 changed files with 20 additions and 4 deletions

View file

@ -671,6 +671,7 @@ public:
sal_uInt16 GetVirtPageNum() const; // page number with offset
sal_Bool OnRightPage() const { return 0 != GetPhyPageNum() % 2; };
sal_Bool WannaRightPage() const;
bool OnFirstPage() const;
inline const SwLayoutFrm *GetPrevLayoutLeaf() const;
inline const SwLayoutFrm *GetNextLayoutLeaf() const;

View file

@ -925,8 +925,7 @@ sal_Bool SwFrm::WrongPageDesc( SwPageFrm* pNew )
if ( !pDesc )
pDesc = pNew->FindPageDesc();
SwPageFrm* pPrevFrm = dynamic_cast<SwPageFrm*>(pNew->GetPrev());
bool bFirst = pPrevFrm && pPrevFrm->GetPageDesc() != pDesc && !pDesc->IsFirstShared();
bool bFirst = pNew->OnFirstPage();
const SwFlowFrm *pNewFlow = pNew->FindFirstBodyCntnt();
// Did we find ourselves?

View file

@ -1105,8 +1105,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields )
sal_Bool bCheckEmpty = pPage->IsEmptyPage();
sal_Bool bActOdd = pPage->OnRightPage();
sal_Bool bOdd = pPage->WannaRightPage();
SwPageFrm* pPrevFrm = dynamic_cast<SwPageFrm*>(pPage->GetPrev());
bool bFirst = pPrevFrm && pPrevFrm->GetPageDesc() != pPage->GetPageDesc() && !pDesc->IsFirstShared();
bool bFirst = pPage->OnFirstPage();
SwFrmFmt *pFmtWish = 0;
if (bFirst)
pFmtWish = pDesc->GetFirstFmt();

View file

@ -1811,6 +1811,23 @@ sal_Bool SwFrm::WannaRightPage() const
return bOdd;
}
bool SwFrm::OnFirstPage() const
{
bool bRet = false;
const SwPageFrm *pPage = FindPageFrm();
if (pPage)
{
const SwPageFrm* pPrevFrm = dynamic_cast<const SwPageFrm*>(pPage->GetPrev());
if (pPrevFrm)
{
const SwPageDesc* pDesc = pPage->GetPageDesc();
bRet = pPrevFrm->GetPageDesc() != pDesc && !pDesc->IsFirstShared();
}
}
return bRet;
}
/*************************************************************************
|*
|* SwFrm::GetVirtPageNum()