Kaydet (Commit) 61533b8c authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#65743 MovePara gets stuck on hidden para fields

Change-Id: I03b26aaa9be491e760335185c5a9ffd5d04990bb
üst ffe5c9ce
...@@ -258,6 +258,8 @@ private: ...@@ -258,6 +258,8 @@ private:
SW_DLLPRIVATE short GetTextDirection( const Point* pPt = 0 ) const; SW_DLLPRIVATE short GetTextDirection( const Point* pPt = 0 ) const;
SW_DLLPRIVATE bool isInHiddenTxtFrm(SwShellCrsr* pShellCrsr);
typedef sal_Bool (SwCursor:: *FNCrsr)(); typedef sal_Bool (SwCursor:: *FNCrsr)();
SW_DLLPRIVATE sal_Bool CallCrsrFN( FNCrsr ); SW_DLLPRIVATE sal_Bool CallCrsrFN( FNCrsr );
......
...@@ -570,14 +570,34 @@ sal_Bool SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage ) ...@@ -570,14 +570,34 @@ sal_Bool SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage )
return bRet; return bRet;
} }
bool SwCrsrShell::isInHiddenTxtFrm(SwShellCrsr* pShellCrsr)
{
SwCntntNode *pCNode = pShellCrsr->GetCntntNode();
SwCntntFrm *pFrm = pCNode ?
pCNode->getLayoutFrm( GetLayout(), &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), sal_False ) : 0;
return !pFrm || (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow());
}
sal_Bool SwCrsrShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) sal_Bool SwCrsrShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara )
{ {
SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed
SwCursor* pTmpCrsr = getShellCrsr( true ); SwShellCrsr* pTmpCrsr = getShellCrsr( true );
sal_Bool bRet = pTmpCrsr->MovePara( fnWhichPara, fnPosPara ); sal_Bool bRet = pTmpCrsr->MovePara( fnWhichPara, fnPosPara );
if( bRet ) if( bRet )
{
//keep going until we get something visible, i.e. skip
//over hidden paragraphs, don't get stuck at the start
//which is what SwCrsrShell::UpdateCrsrPos will reset
//the position to if we pass it a position in an
//invisible hidden paragraph field
while (isInHiddenTxtFrm(pTmpCrsr))
{
if (!pTmpCrsr->MovePara(fnWhichPara, fnPosPara))
break;
}
UpdateCrsr(); UpdateCrsr();
}
return bRet; return bRet;
} }
...@@ -1215,10 +1235,8 @@ void SwCrsrShell::UpdateCrsrPos() ...@@ -1215,10 +1235,8 @@ void SwCrsrShell::UpdateCrsrPos()
++mnStartAction; ++mnStartAction;
SwShellCrsr* pShellCrsr = getShellCrsr( true ); SwShellCrsr* pShellCrsr = getShellCrsr( true );
Size aOldSz( GetDocSize() ); Size aOldSz( GetDocSize() );
SwCntntNode *pCNode = pShellCrsr->GetCntntNode();
SwCntntFrm *pFrm = pCNode ? if( isInHiddenTxtFrm(pShellCrsr) )
pCNode->getLayoutFrm( GetLayout(), &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), sal_False ) :0;
if( !pFrm || (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow()) )
{ {
SwCrsrMoveState aTmpState( MV_NONE ); SwCrsrMoveState aTmpState( MV_NONE );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable(); aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
......
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