[Libreoffice-commits] .: Branch 'libreoffice-3-3' - sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Fri Nov 19 02:57:10 PST 2010


 sw/source/core/crsr/bookmrk.cxx |    3 ++-
 sw/source/core/crsr/crbm.cxx    |    4 ++--
 sw/source/core/crsr/crsrsh.cxx  |   15 +++------------
 sw/source/core/crsr/pam.cxx     |   17 ++---------------
 sw/source/core/crsr/swcrsr.cxx  |    2 ++
 sw/source/ui/wrtsh/wrtsh1.cxx   |    6 ++++++
 6 files changed, 17 insertions(+), 30 deletions(-)

New commits:
commit e93181f05d42705b4d205aef0881340fd5ae985e
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Fri Nov 19 11:47:22 2010 +0100

    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.

diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 3b8f8bc..9497f8f 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 39ee7c1..b3fba00 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 85aa4ab..5a778e2 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 1bf513d..fad70d8 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 d95d5df..6b4f8f9 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 aee940f..d045aff 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);
+    }
 }
 
 /*


More information about the Libreoffice-commits mailing list