summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-06-25 20:19:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-06-25 20:22:18 +0100
commit61533b8c54077bf1aa203f503e271037b6553411 (patch)
treecca699b68ee2a89fb36371edeca948c909b97ba1 /sw
parentffe5c9ce94234971a8c2081610842a2542f5cfb8 (diff)
Resolves: fdo#65743 MovePara gets stuck on hidden para fields
Change-Id: I03b26aaa9be491e760335185c5a9ffd5d04990bb
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/crsrsh.hxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx28
2 files changed, 25 insertions, 5 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index d38329f44954..a652acc076c0 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -258,6 +258,8 @@ private:
SW_DLLPRIVATE short GetTextDirection( const Point* pPt = 0 ) const;
+ SW_DLLPRIVATE bool isInHiddenTxtFrm(SwShellCrsr* pShellCrsr);
+
typedef sal_Bool (SwCursor:: *FNCrsr)();
SW_DLLPRIVATE sal_Bool CallCrsrFN( FNCrsr );
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index c8ed632429cb..44de565e014e 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -570,14 +570,34 @@ sal_Bool SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage )
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 )
{
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 );
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();
+ }
return bRet;
}
@@ -1215,10 +1235,8 @@ void SwCrsrShell::UpdateCrsrPos()
++mnStartAction;
SwShellCrsr* pShellCrsr = getShellCrsr( true );
Size aOldSz( GetDocSize() );
- SwCntntNode *pCNode = pShellCrsr->GetCntntNode();
- SwCntntFrm *pFrm = pCNode ?
- pCNode->getLayoutFrm( GetLayout(), &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), sal_False ) :0;
- if( !pFrm || (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow()) )
+
+ if( isInHiddenTxtFrm(pShellCrsr) )
{
SwCrsrMoveState aTmpState( MV_NONE );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();