diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-11-19 11:47:22 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-11-19 11:52:13 +0100 |
commit | e93181f05d42705b4d205aef0881340fd5ae985e (patch) | |
tree | 7393aed4e1a79849d0fd36b6bfedbc0420a0d617 | |
parent | 5b20c40cd210941bf525f9bdcc7698392be003ea (diff) |
Enhanced fields navigation enhancements
Fixes the following bugs:
* n#423729: Select the first field by default
* n#639288: When double-clicking in an enhanced field, select the whole
content of the field and don't complain about read-only selection
* When navigating between the fields using Tab / Shift+Tab, select only
the content of the field without the field delimiters
Some comments cleanup is also included.
-rw-r--r-- | sw/source/core/crsr/bookmrk.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/crsr/crbm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 17 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/wrtsh1.cxx | 6 |
6 files changed, 17 insertions, 30 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 3b8f8bccea..9497f8f556 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -96,6 +96,7 @@ namespace if ( aEndMark && ( ch_end != aEndMark ) ) { io_pDoc->InsertString(aEndPaM, aEndMark); + rEnd.nContent++; } io_pDoc->EndUndo(UNDO_UI_REPLACE, NULL); }; @@ -119,7 +120,7 @@ namespace sw { namespace mark bool MarkBase::IsCoveringPosition(const SwPosition& rPos) const { - return GetMarkStart() <= rPos && rPos <= GetMarkEnd(); + return GetMarkStart() <= rPos && rPos < GetMarkEnd(); } void MarkBase::SetMarkPos(const SwPosition& rNewPos) diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 39ee7c1f24..b3fba00d72 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -252,8 +252,8 @@ bool SwCrsrShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark) // watch Crsr-Moves CrsrStateHelper aCrsrSt(*this); aCrsrSt.SetCrsrToMark(pMark); - //aCrsrSt.m_pCrsr->GetPoint()->nContent--; - //aCrsrSt.m_pCrsr->GetMark()->nContent++; + aCrsrSt.m_pCrsr->GetPoint()->nContent++; + aCrsrSt.m_pCrsr->GetMark()->nContent--; if(aCrsrSt.RollbackIfIllegal()) return false; UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 85aa4aba54..5a778e23e2 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2991,26 +2991,17 @@ void SwCrsrShell::SetReadOnlyAvailable( BOOL bFlag ) BOOL SwCrsrShell::HasReadonlySel() const { BOOL bRet = FALSE; - if( IsReadOnlyAvailable() || - // --> FME 2004-06-29 #114856# Formular view - GetViewOptions()->IsFormView() ) - // <-- + if( IsReadOnlyAvailable() || GetViewOptions()->IsFormView() ) { if( pTblCrsr ) bRet = pTblCrsr->HasReadOnlyBoxSel() || - pTblCrsr->HasReadonlySel( - // --> FME 2004-06-29 #114856# Formular view - GetViewOptions()->IsFormView() ); - // <-- + pTblCrsr->HasReadonlySel( GetViewOptions()->IsFormView() ); else { const SwPaM* pCrsr = pCurCrsr; do { - if( pCrsr->HasReadonlySel( - // --> FME 2004-06-29 #114856# Formular view - GetViewOptions()->IsFormView() ) ) - // <-- + if( pCrsr->HasReadonlySel( GetViewOptions()->IsFormView() ) ) bRet = TRUE; } while( !bRet && pCurCrsr != ( pCrsr = (SwPaM*)pCrsr->GetNext() )); } diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 1bf513da74..fad70d89a4 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -690,24 +690,18 @@ BOOL SwPaM::HasReadonlySel( bool bFormView ) const else pFrm = 0; - // --> FME 2004-06-29 #114856# Formular view // Will be set if point/mark are inside edit-in-readonly environment const SwFrm* pSttEIRFrm = 0; const SwFrm* pEndEIRFrm = 0; if( pFrm && ( pFrm->IsProtected() || - // --> FME 2004-06-29 #114856# Formular view - ( bFormView && - 0 == ( pSttEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) ) - // <-- + ( bFormView && 0 == ( pSttEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) ) bRet = TRUE; else if( pNd ) { const SwSectionNode* pSNd = pNd->GetSectionNode(); if( pSNd && ( pSNd->GetSection().IsProtectFlag() || - // --> FME 2004-06-29 #114856# Formular view (bFormView && !pSNd->GetSection().IsEditInReadonlyFlag()) ) ) - // <-- bRet = TRUE; } @@ -719,22 +713,16 @@ BOOL SwPaM::HasReadonlySel( bool bFormView ) const pFrm = 0; if( pFrm && ( pFrm->IsProtected() || - // --> FME 2004-06-29 #114856# Formular view - ( bFormView && - 0 == ( pEndEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) ) - // <-- + ( bFormView && 0 == ( pEndEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) ) bRet = TRUE; else if( pNd ) { const SwSectionNode* pSNd = pNd->GetSectionNode(); if( pSNd && ( pSNd->GetSection().IsProtectFlag() || - // --> FME 2004-06-29 #114856# Formular view (bFormView && !pSNd->GetSection().IsEditInReadonlyFlag()) ) ) - // <-- bRet = TRUE; } - // --> FME 2004-06-29 #114856# Formular view if ( !bRet && bFormView ) { // Check if start and end frame are inside the _same_ @@ -742,7 +730,6 @@ BOOL SwPaM::HasReadonlySel( bool bFormView ) const if ( pSttEIRFrm != pEndEIRFrm ) bRet = TRUE; } - // <-- // oder sollte eine geschuetzte Section innerhalb der // Selektion liegen? diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index d95d5df63d..6b4f8f96a6 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1379,6 +1379,7 @@ BOOL SwCursor::SelectWordWT( sal_Int16 nWordType, const Point* pPt ) const SwPosition rStart = pMark->GetMarkStart(); GetPoint()->nNode = rStart.nNode; GetPoint()->nContent = rStart.nContent; + GetPoint()->nContent++; // Don't select the start delimiter const SwPosition rEnd = pMark->GetMarkEnd(); @@ -1387,6 +1388,7 @@ BOOL SwCursor::SelectWordWT( sal_Int16 nWordType, const Point* pPt ) SetMark(); GetMark()->nNode = rEnd.nNode; GetMark()->nContent = rEnd.nContent; + GetMark()->nContent--; //Don't select the end delimiter } bRet = TRUE; } diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index aee940f40d..d045affeb2 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -1775,6 +1775,12 @@ SwWrtShell::SwWrtShell( SwDoc& rDoc, Window *_pWin, SwView &rShell, SET_CURR_SHELL( this ); SetSfxViewShell( (SfxViewShell *)&rShell ); SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) ); + + // place the cursor on the first field... + IFieldmark *pBM = NULL; + if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=NULL ) { + GotoFieldmark(pBM); + } } /* |