[Libreoffice-commits] .: sw/source

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


 sw/source/core/crsr/bookmrk.cxx |    3 ++-
 sw/source/core/crsr/crbm.cxx    |    2 ++
 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(+), 28 deletions(-)

New commits:
commit 29f764a2cda4811eeb1d7752cd204a778e0e30e3
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 639e56e..7b9ad5d 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 239c7b1..b3fba00 100644
--- a/sw/source/core/crsr/crbm.cxx
+++ b/sw/source/core/crsr/crbm.cxx
@@ -252,6 +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--;
     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 b341360..171233c 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2961,26 +2961,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 cc42054..8721557 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 2115984..266a612 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 9d76bf4..e1a8e9e 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -1771,6 +1771,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