Kaydet (Commit) 83510855 authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann

123979: method <SwCursor::IsSelOvr(..)> - treat application of new position due…

123979: method <SwCursor::IsSelOvr(..)> - treat application of new position due to content frame without height to next/previous content frame as restore to saved position, if new position equals the saved one.

This avoid cursor traveling loops due to hidden content at the beginning/end of the text document.
üst fddfd6e9
...@@ -343,7 +343,8 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) ...@@ -343,7 +343,8 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
if( pNd->IsCntntNode() && !dynamic_cast<SwUnoCrsr*>(this) ) if( pNd->IsCntntNode() && !dynamic_cast<SwUnoCrsr*>(this) )
{ {
const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ); const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() );
if( pFrm && pFrm->IsValid() if( pFrm != NULL
&& pFrm->IsValid()
&& 0 == pFrm->Frm().Height() && 0 == pFrm->Frm().Height()
&& 0 != ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) ) && 0 != ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) )
{ {
...@@ -356,40 +357,51 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) ...@@ -356,40 +357,51 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
// --> LIJIAN/FME 2007-11-27 #i72394# skip to prev /next valid paragraph // --> LIJIAN/FME 2007-11-27 #i72394# skip to prev /next valid paragraph
// with a layout in case the first search did not succeed: // with a layout in case the first search did not succeed:
if( !pFrm ) if ( pFrm == NULL )
{ {
bGoNxt = !bGoNxt; bGoNxt = !bGoNxt;
pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ); pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() );
while ( pFrm && 0 == pFrm->Frm().Height() ) while ( pFrm != NULL
&& 0 == pFrm->Frm().Height() )
{ {
pFrm = bGoNxt ? pFrm->GetNextCntntFrm() pFrm = bGoNxt ? pFrm->GetNextCntntFrm() : pFrm->GetPrevCntntFrm();
: pFrm->GetPrevCntntFrm();
} }
} }
// <-- // <--
SwCntntNode* pCNd; SwCntntNode* pCNd = (pFrm != NULL) ? (SwCntntNode*)pFrm->GetNode() : NULL;
if( pFrm && 0 != (pCNd = (SwCntntNode*)pFrm->GetNode()) ) if ( pCNd != NULL )
{ {
// set this cntntNode as new position // set this cntntNode as new position
rPtIdx = *pCNd; rPtIdx = *pCNd;
pNd = pCNd; pNd = pCNd;
// ContentIndex noch anmelden: // assign corresponding ContentIndex
xub_StrLen nTmpPos = bGoNxt ? 0 : pCNd->Len(); const xub_StrLen nTmpPos = bGoNxt ? 0 : pCNd->Len();
GetPoint()->nContent.Assign( pCNd, nTmpPos ); GetPoint()->nContent.Assign( pCNd, nTmpPos );
// sollten wir in einer Tabelle gelandet sein? if ( rPtIdx.GetIndex() == pSavePos->nNode
if( IsInProtectTable( sal_True ) ) && nTmpPos == pSavePos->nCntnt )
pFrm = 0; {
// new position equals saved one
// --> trigger restore of saved pos by setting <pFrm> to NULL - see below
pFrm = NULL;
}
if ( IsInProtectTable( sal_True ) )
{
// new position in protected table
// --> trigger restore of saved pos by setting <pFrm> to NULL - see below
pFrm = NULL;
}
} }
} }
if( !pFrm ) if( pFrm == NULL )
{ {
DeleteMark(); DeleteMark();
RestoreSavePos(); RestoreSavePos();
return sal_True; // ohne Frames geht gar nichts! return sal_True;
} }
} }
......
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