[Libreoffice-commits] core.git: sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Tue Jun 25 12:22:39 PDT 2013
sw/inc/crsrsh.hxx | 2 ++
sw/source/core/crsr/crsrsh.cxx | 28 +++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
New commits:
commit 61533b8c54077bf1aa203f503e271037b6553411
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 25 20:19:49 2013 +0100
Resolves: fdo#65743 MovePara gets stuck on hidden para fields
Change-Id: I03b26aaa9be491e760335185c5a9ffd5d04990bb
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index d38329f..a652acc 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 c8ed632..44de565 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();
More information about the Libreoffice-commits
mailing list