summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-06-25 20:19:49 +0100
committerFridrich Strba <fridrich@documentfoundation.org>2013-06-28 07:15:14 +0000
commit0b8045b8992c366dcc52093a2db2dfc3193bdb78 (patch)
tree77651ebe1942a671afe343f9a091ff1adc1d631a
parentbdc91dd1c7ba74ff37fd89e7a0a9f130d7949210 (diff)
Resolves: fdo#65743 MovePara gets stuck on hidden para fields
Change-Id: I03b26aaa9be491e760335185c5a9ffd5d04990bb (cherry picked from commit 61533b8c54077bf1aa203f503e271037b6553411) Reviewed-on: https://gerrit.libreoffice.org/4568 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-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 d3f65cf73b00..38b75c99abe7 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();