Author: orw
Date: Thu Feb 20 11:01:04 2014
New Revision: 1570146

URL: http://svn.apache.org/r1570146
Log:
123243: allow in-place editing of Input Fields in protected areas (e.g. 
protected sections)


Modified:
    openoffice/trunk/main/sw/inc/pam.hxx
    openoffice/trunk/main/sw/sdi/_basesh.sdi
    openoffice/trunk/main/sw/sdi/_textsh.sdi
    openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx
    openoffice/trunk/main/sw/source/core/crsr/pam.cxx
    openoffice/trunk/main/sw/source/core/edit/eddel.cxx
    openoffice/trunk/main/sw/source/core/edit/edfcol.cxx
    openoffice/trunk/main/sw/source/core/edit/ednumber.cxx
    openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx
    openoffice/trunk/main/sw/source/ui/shells/basesh.cxx
    openoffice/trunk/main/sw/source/ui/shells/textsh1.cxx

Modified: openoffice/trunk/main/sw/inc/pam.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/pam.hxx?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/pam.hxx (original)
+++ openoffice/trunk/main/sw/inc/pam.hxx Thu Feb 20 11:01:04 2014
@@ -253,7 +253,7 @@ public:
 
        // steht in etwas geschuetztem oder in die Selektion umspannt
        // etwas geschuetztes.
-    sal_Bool HasReadonlySel( bool bFormView ) const;
+    sal_Bool HasReadonlySel( const bool bFormView ) const;
 
     sal_Bool ContainsPosition(const SwPosition & rPos)
     { return *Start() <= rPos && rPos <= *End(); }

Modified: openoffice/trunk/main/sw/sdi/_basesh.sdi
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/sdi/_basesh.sdi?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/sdi/_basesh.sdi (original)
+++ openoffice/trunk/main/sw/sdi/_basesh.sdi Thu Feb 20 11:01:04 2014
@@ -37,7 +37,6 @@ interface BaseTextSelection
                ExecMethod = ExecDelete ;
                StateMethod = GetState ;
                FastCall = FALSE ;
-               DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
        ]
 
        FN_BACKSPACE  // status(final|play)
@@ -45,7 +44,6 @@ interface BaseTextSelection
                ExecMethod = ExecDelete ;
                StateMethod = GetState ;
                FastCall = FALSE ;
-               DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
        ]
 
        FN_SHIFT_BACKSPACE // status()

Modified: openoffice/trunk/main/sw/sdi/_textsh.sdi
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/sdi/_textsh.sdi?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/sdi/_textsh.sdi (original)
+++ openoffice/trunk/main/sw/sdi/_textsh.sdi Thu Feb 20 11:01:04 2014
@@ -240,12 +240,13 @@ interface BaseText
         StateMethod = GetState ;
         DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
     ]
+
     FN_INSERT_BREAK // status(final|play)
-       [
-               ExecMethod = ExecInsert ;
-               StateMethod = GetState ;
-               DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
-       ]
+    [
+        ExecMethod = ExecInsert ;
+        StateMethod = GetState ;
+    ]
+
        FN_INSERT_PAGEBREAK // status(final|play)
        [
                ExecMethod = ExecInsert ;

Modified: openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx (original)
+++ openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx Thu Feb 20 11:01:04 
2014
@@ -2429,9 +2429,7 @@ sal_Bool SwCrsrShell::IsOverReadOnlyPos(
        Point aPt( rPt );
        SwPaM aPam( *pCurCrsr->GetPoint() );
     GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt );
-    // --> FME 2004-06-29 #114856# Formular view
     return aPam.HasReadonlySel( GetViewOptions()->IsFormView() );
-    // <--
 }
 
 
@@ -3058,32 +3056,30 @@ void SwCrsrShell::SetReadOnlyAvailable( 
 
 sal_Bool SwCrsrShell::HasReadonlySel() const
 {
-       sal_Bool bRet = sal_False;
-       if( IsReadOnlyAvailable() ||
-        // --> FME 2004-06-29 #114856# Formular view
-        GetViewOptions()->IsFormView() )
-        // <--
-       {
-               if( pTblCrsr )
-                       bRet = pTblCrsr->HasReadOnlyBoxSel() ||
-                   pTblCrsr->HasReadonlySel(
-                            // --> FME 2004-06-29 #114856# Formular view
-                            GetViewOptions()->IsFormView() );
-                            // <--
+    sal_Bool bRet = sal_False;
+    if ( IsReadOnlyAvailable() || GetViewOptions()->IsFormView() )
+    {
+        if ( pTblCrsr != NULL )
+        {
+            bRet = pTblCrsr->HasReadOnlyBoxSel()
+                   || pTblCrsr->HasReadonlySel( GetViewOptions()->IsFormView() 
);
+        }
         else
-               {
-                       const SwPaM* pCrsr = pCurCrsr;
+        {
+            const SwPaM* pCrsr = pCurCrsr;
 
-                       do {
-                if( pCrsr->HasReadonlySel(
-                        // --> FME 2004-06-29 #114856# Formular view
-                        GetViewOptions()->IsFormView() ) )
-                        // <--
-                                       bRet = sal_True;
-                       } while( !bRet && pCurCrsr != ( pCrsr = 
(SwPaM*)pCrsr->GetNext() ));
-               }
-       }
-       return bRet;
+            do
+            {
+                if ( pCrsr->HasReadonlySel( GetViewOptions()->IsFormView() ) )
+                {
+                    bRet = sal_True;
+                }
+
+                pCrsr = (SwPaM*)pCrsr->GetNext();
+            } while ( !bRet && pCrsr != pCurCrsr );
+        }
+    }
+    return bRet;
 }
 
 sal_Bool SwCrsrShell::IsSelFullPara() const

Modified: openoffice/trunk/main/sw/source/core/crsr/pam.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/pam.cxx?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/pam.cxx (original)
+++ openoffice/trunk/main/sw/source/core/crsr/pam.cxx Thu Feb 20 11:01:04 2014
@@ -671,74 +671,80 @@ const SwFrm* lcl_FindEditInReadonlyFrm( 
 
 // steht in etwas geschuetztem oder in die Selektion umspannt
 // etwas geschuetztes.
-sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const
+sal_Bool SwPaM::HasReadonlySel( const bool bFormView ) const
 {
     sal_Bool bRet = sal_False;
-    Point aTmpPt;
-    const SwCntntNode *pNd;
-    const SwCntntFrm *pFrm;
 
-    if( 0 != ( pNd = GetPoint()->nNode.GetNode().GetCntntNode() ))
+    const SwCntntNode* pNd = GetPoint()->nNode.GetNode().GetCntntNode();
+    const SwCntntFrm *pFrm = NULL;
+    if ( pNd != NULL )
+    {
+        Point aTmpPt;
         pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, 
GetPoint(), sal_False );
-    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 ) ) 
) ) )
-                  // <--
+    // Will be set if point are inside edit-in-readonly environment
+    const SwFrm* pPointEditInReadonlyFrm = NULL;
+    if ( pFrm != NULL
+         && ( pFrm->IsProtected()
+              || ( bFormView
+                   && 0 == ( pPointEditInReadonlyFrm = 
lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
+    {
         bRet = sal_True;
-    else if( pNd )
+    }
+    else if( pNd != NULL )
     {
         const SwSectionNode* pSNd = pNd->GetSectionNode();
-        if( pSNd && ( pSNd->GetSection().IsProtectFlag() ||
-                      // --> FME 2004-06-29 #114856# Formular view
-                      (bFormView && 
!pSNd->GetSection().IsEditInReadonlyFlag()) ) )
-                      // <--
+        if ( pSNd != NULL
+             && ( pSNd->GetSection().IsProtectFlag()
+                  || ( bFormView
+                       && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
+        {
             bRet = sal_True;
+        }
     }
 
-    if( !bRet && HasMark() && GetPoint()->nNode != GetMark()->nNode )
-    {
-        if( 0 != ( pNd = GetMark()->nNode.GetNode().GetCntntNode() ))
+    if ( !bRet
+         && HasMark()
+         && GetPoint()->nNode != GetMark()->nNode )
+    {
+        pNd = GetMark()->nNode.GetNode().GetCntntNode();
+        pFrm = NULL;
+        if ( pNd != NULL )
+        {
+            Point aTmpPt;
             pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), 
&aTmpPt, GetMark(), sal_False );
-        else
-            pFrm = 0;
+        }
 
-        if( pFrm && ( pFrm->IsProtected() ||
-                  // --> FME 2004-06-29 #114856# Formular view
-                  ( bFormView &&
-                     0 == ( pEndEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) 
) ) )
-                  // <--
+        const SwFrm* pMarkEditInReadonlyFrm = NULL;
+        if ( pFrm != NULL
+             && ( pFrm->IsProtected()
+                  || ( bFormView
+                       && 0 == ( pMarkEditInReadonlyFrm = 
lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
+        {
             bRet = sal_True;
-        else if( pNd )
+        }
+        else if( pNd != NULL )
         {
             const SwSectionNode* pSNd = pNd->GetSectionNode();
-            if( pSNd && ( pSNd->GetSection().IsProtectFlag() ||
-                          // --> FME 2004-06-29 #114856# Formular view
-                          (bFormView && 
!pSNd->GetSection().IsEditInReadonlyFlag()) ) )
-                          // <--
+            if ( pSNd != NULL
+                 && ( pSNd->GetSection().IsProtectFlag()
+                      || ( bFormView
+                           && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
+            {
                 bRet = sal_True;
+            }
         }
 
-        // --> FME 2004-06-29 #114856# Formular view
         if ( !bRet && bFormView )
         {
            // Check if start and end frame are inside the _same_
            // edit-in-readonly-environment. Otherwise we better return 'true'
-           if ( pSttEIRFrm != pEndEIRFrm )
+           if ( pPointEditInReadonlyFrm != pMarkEditInReadonlyFrm )
                 bRet = sal_True;
         }
-        // <--
 
-        // oder sollte eine geschuetzte Section innerhalb der
-        // Selektion liegen?
+        // check for protected section inside the selection
         if( !bRet )
         {
             sal_uLong nSttIdx = GetMark()->nNode.GetIndex(),
@@ -767,15 +773,6 @@ sal_Bool SwPaM::HasReadonlySel( bool bFo
                         if( nSttIdx <= nIdx && nEndIdx >= nIdx &&
                             
rCntnt.GetCntntIdx()->GetNode().GetNodes().IsDocNodes() )
                         {
-/*                          // ist es keine gelinkte Section, dann kann sie 
auch
-                            // nicht mitselektiert werden
-                            const SwSection& rSect = *pFmt->GetSection();
-                            if( CONTENT_SECTION == rSect.GetType() )
-                            {
-                                RestoreSavePos();
-                                return sal_True;
-                            }
-*/
                             bRet = sal_True;
                             break;
                         }
@@ -819,9 +816,11 @@ sal_Bool SwPaM::HasReadonlySel( bool bFo
             }
         }
     }
+
     //FIXME FieldBk
     // TODO: Form Protection when Enhanced Fields are enabled
-    if (!bRet) {
+    if (!bRet)
+    {
         const SwDoc *pDoc = GetDoc();
         sw::mark::IMark* pA = NULL;
         sw::mark::IMark* pB = NULL;
@@ -836,6 +835,7 @@ sal_Bool SwPaM::HasReadonlySel( bool bFo
         if ( bProtectForm )
             bRet |= ( pA == NULL || pB == NULL );
     }
+
     return bRet;
 }
 

Modified: openoffice/trunk/main/sw/source/core/edit/eddel.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/edit/eddel.cxx?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/edit/eddel.cxx (original)
+++ openoffice/trunk/main/sw/source/core/edit/eddel.cxx Thu Feb 20 11:01:04 2014
@@ -118,7 +118,7 @@ long SwEditShell::Delete()
 {
        SET_CURR_SHELL( this );
        long nRet = 0;
-       if( !HasReadonlySel() )
+       if ( !HasReadonlySel() || CrsrInsideInputFld() )
        {
                StartAllAction();
 

Modified: openoffice/trunk/main/sw/source/core/edit/edfcol.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/edit/edfcol.cxx?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/edit/edfcol.cxx (original)
+++ openoffice/trunk/main/sw/source/core/edit/edfcol.cxx Thu Feb 20 11:01:04 
2014
@@ -77,11 +77,10 @@ void SwEditShell::SetTxtFmtColl( SwTxtFm
     GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter);
        FOREACHPAM_START(this)
 
-        if( !PCURCRSR->HasReadonlySel(
-                    // --> FME 2004-06-29 #114856# Formular view
-                    GetViewOptions()->IsFormView() ) )
-                    // <--
+        if ( !PCURCRSR->HasReadonlySel( GetViewOptions()->IsFormView() ) )
+        {
             GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs 
);
+        }
 
        FOREACHPAM_END()
     GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter);

Modified: openoffice/trunk/main/sw/source/core/edit/ednumber.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/edit/ednumber.cxx?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/edit/ednumber.cxx (original)
+++ openoffice/trunk/main/sw/source/core/edit/ednumber.cxx Thu Feb 20 11:01:04 
2014
@@ -696,35 +696,36 @@ sal_Bool SwEditShell::IsOutlineCopyable(
 }
 
 
-sal_Bool SwEditShell::NumOrNoNum( sal_Bool bNumOn, sal_Bool bChkStart ) // 
#115901#
+sal_Bool SwEditShell::NumOrNoNum(
+    sal_Bool bNumOn,
+    sal_Bool bChkStart )
 {
-       sal_Bool bRet = sal_False;
-       SwPaM* pCrsr = GetCrsr();
-       if( pCrsr->GetNext() == pCrsr && !pCrsr->HasMark() &&
-               ( !bChkStart || !pCrsr->GetPoint()->nContent.GetIndex()) )
-       {
-               StartAllAction();               // Klammern fuers Updaten !!
-        // #115901#
-               bRet = GetDoc()->NumOrNoNum( pCrsr->GetPoint()->nNode, !bNumOn 
); // #i29560#
-               EndAllAction();
-       }
-       return bRet;
+    sal_Bool bRet = sal_False;
+
+    if ( !IsMultiSelection()
+         && !HasSelection()
+         && ( !bChkStart || IsSttPara() ) )
+    {
+        StartAllAction();
+        bRet = GetDoc()->NumOrNoNum( GetCrsr()->GetPoint()->nNode, !bNumOn );
+        EndAllAction();
+    }
+    return bRet;
 }
 
+
 sal_Bool SwEditShell::IsNoNum( sal_Bool bChkStart ) const
 {
-       // ein Backspace im Absatz ohne Nummer wird zum Delete
     sal_Bool bResult = sal_False;
-       SwPaM* pCrsr = GetCrsr();
 
-    if (pCrsr->GetNext() == pCrsr && !pCrsr->HasMark() &&
-               (!bChkStart || !pCrsr->GetPoint()->nContent.GetIndex()))
+    if ( !IsMultiSelection()
+         && !HasSelection()
+         && ( !bChkStart || IsSttPara() ) )
     {
-        const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode();
-
-        if (pTxtNd)
+        const SwTxtNode* pTxtNd = GetCrsr()->GetNode()->GetTxtNode();
+        if ( pTxtNd != NULL )
         {
-            bResult =  ! pTxtNd->IsCountedInList();
+            bResult =  !pTxtNd->IsCountedInList();
         }
     }
 
@@ -740,12 +741,12 @@ sal_uInt8 SwEditShell::GetNumLevel() con
     SwPaM* pCrsr = GetCrsr();
     const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode();
 
-    ASSERT( pTxtNd, "GetNumLevel() without text node" )
-    if ( !pTxtNd )
+    ASSERT( pTxtNd != NULL, "GetNumLevel() without text node" )
+    if ( pTxtNd == NULL )
         return nLevel;
 
     const SwNumRule* pRule = pTxtNd->GetNumRule();
-    if(pRule)
+    if ( pRule != NULL )
     {
         const int nListLevelOfTxtNode( pTxtNd->GetActualListLevel() );
         if ( nListLevelOfTxtNode >= 0 )
@@ -774,7 +775,7 @@ void SwEditShell::SetCurNumRule( const S
     GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
 
     SwPaM* pCrsr = GetCrsr();
-    if( pCrsr->GetNext() != pCrsr )                    // Mehrfachselektion ?
+    if( IsMultiSelection() )
     {
         SwPamRanges aRangeArr( *pCrsr );
         SwPaM aPam( *pCrsr->GetPoint() );

Modified: openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx Thu Feb 20 11:01:04 2014
@@ -301,7 +301,7 @@ void SwEditWin::UpdatePointer(const Poin
     if( pApplyTempl )
     {
         PointerStyle eStyle = POINTER_FILL;
-        if( rSh.IsOverReadOnlyPos( rLPt ))
+        if ( rSh.IsOverReadOnlyPos( rLPt ) )
         {
             if( pUserMarker )
             {
@@ -1851,7 +1851,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
 
                 case KEY_BACKSPACE:
                 case KEY_BACKSPACE | KEY_SHIFT:
-                    if( !rSh.HasReadonlySel() )
+                    if ( !rSh.HasReadonlySel()
+                         && !rSh.CrsrInsideInputFld() )
                     {
                         sal_Bool bDone = sal_False;
                         // Remove the paragraph indent, if the cursor is at the
@@ -1860,12 +1861,11 @@ KEYINPUT_CHECKTABLE_INSDEL:
                         // Also try to remove indent, if current paragraph
                         // has numbering rule, but isn't counted and only
                         // key <backspace> is hit.
-                        const bool bOnlyBackspaceKey(
-                                    KEY_BACKSPACE == rKeyCode.GetFullCode() );
-                        if ( rSh.IsSttPara() &&
-                             !rSh.HasSelection() && // i40834
-                             ( NULL == rSh.GetCurNumRule() ||
-                               ( rSh.IsNoNum() && bOnlyBackspaceKey ) ) )
+                        const bool bOnlyBackspaceKey( KEY_BACKSPACE == 
rKeyCode.GetFullCode() );
+                        if ( rSh.IsSttPara()
+                             && !rSh.HasSelection()
+                             && ( rSh.GetCurNumRule() == NULL
+                                  || ( rSh.IsNoNum() && bOnlyBackspaceKey ) ) )
                         {
                             bDone = rSh.TryRemoveIndent();
                         }
@@ -1874,11 +1874,10 @@ KEYINPUT_CHECKTABLE_INSDEL:
                             eKeyState = KS_Ende;
                         else
                         {
-                            if (rSh.IsSttPara() &&
-                                ! rSh.IsNoNum())
+                            if ( rSh.IsSttPara() && !rSh.IsNoNum() )
                             {
-                                if (nKS_NUMDOWN_Count > 0 &&
-                                    0 < rSh.GetNumLevel())
+                                if (nKS_NUMDOWN_Count > 0
+                                    && rSh.GetNumLevel() > 0)
                                 {
                                     eKeyState = KS_NumUp;
                                     nKS_NUMDOWN_Count = 2;
@@ -1892,7 +1891,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
                                 }
                             }
                             // If the cursor is in an empty paragraph, which 
has
-                            // a numbering, but not the oultine numbering, and
+                            // a numbering, but not the outline numbering, and
                             // there is no selection, the numbering has to be
                             // deleted on key <Backspace>.
                             // Otherwise method <SwEditShell::NumOrNoNum(..)>
@@ -1902,37 +1901,35 @@ KEYINPUT_CHECKTABLE_INSDEL:
                             // on <shift-backspace> it is set to <true>.
                             // Thus, assure that method 
<SwEditShell::NumOrNum(..)>
                             // is only called for the intended purpose.
-                            bool bCallNumOrNoNum( false );
+                            if ( !bDone && rSh.IsSttPara() )
                             {
-                                if ( !bDone )
+                                bool bCallNumOrNoNum( false );
+                                if ( bOnlyBackspaceKey && !rSh.IsNoNum() )
                                 {
-                                    if ( bOnlyBackspaceKey && !rSh.IsNoNum() )
-                                    {
-                                        bCallNumOrNoNum = true;
-                                    }
-                                    else if ( !bOnlyBackspaceKey && 
rSh.IsNoNum() )
+                                    bCallNumOrNoNum = true;
+                                }
+                                else if ( !bOnlyBackspaceKey && rSh.IsNoNum() )
+                                {
+                                    bCallNumOrNoNum = true;
+                                }
+                                else if ( bOnlyBackspaceKey
+                                          && rSh.IsSttPara()
+                                          && rSh.IsEndPara()
+                                          && !rSh.HasSelection() )
+                                {
+                                    const SwNumRule* pCurrNumRule( 
rSh.GetCurNumRule() );
+                                    if ( pCurrNumRule != NULL
+                                         && pCurrNumRule != 
rSh.GetOutlineNumRule() )
                                     {
                                         bCallNumOrNoNum = true;
                                     }
-                                    else if ( bOnlyBackspaceKey &&
-                                              rSh.IsSttPara() && 
rSh.IsEndPara() &&
-                                              !rSh.HasSelection() )
-                                    {
-                                        const SwNumRule* pCurrNumRule( 
rSh.GetCurNumRule() );
-                                        if ( pCurrNumRule &&
-                                             pCurrNumRule != 
rSh.GetOutlineNumRule() )
-                                        {
-                                            bCallNumOrNoNum = true;
-                                        }
-                                    }
+                                }
+                                if ( bCallNumOrNoNum
+                                     && rSh.NumOrNoNum( !bOnlyBackspaceKey, 
sal_True ) )
+                                {
+                                    eKeyState = KS_NumOrNoNum;
                                 }
                             }
-                            if ( bCallNumOrNoNum &&
-                                 rSh.NumOrNoNum( !bOnlyBackspaceKey, sal_True 
) )
-                            {
-                                eKeyState = KS_NumOrNoNum;
-                            }
-                            // <--
                         }
                     }
                     break;
@@ -1960,9 +1957,9 @@ KEYINPUT_CHECKTABLE_INSDEL:
                         GetView().GetViewFrame()->GetDispatcher()->Execute( 
FN_GOTO_NEXT_INPUTFLD );
                         eKeyState = KS_Ende;
                     }
-                    else
-                    if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
-                        !rSh.HasReadonlySel() )
+                    else if( rSh.GetCurNumRule()
+                             && rSh.IsSttOfPara()
+                             && !rSh.HasReadonlySel() )
                     {
                         if ( rSh.IsFirstOfNumRule() &&
                              
numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
@@ -2019,8 +2016,9 @@ KEYINPUT_CHECKTABLE_INSDEL:
                         GetView().GetViewFrame()->GetDispatcher()->Execute( 
FN_GOTO_PREV_INPUTFLD );
                         eKeyState = KS_Ende;
                     }
-                    else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
-                         !rSh.HasReadonlySel() )
+                    else if( rSh.GetCurNumRule()
+                             && rSh.IsSttOfPara()
+                             && !rSh.HasReadonlySel() )
                     {
                         if ( rSh.IsFirstOfNumRule() &&
                              
numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
@@ -2308,10 +2306,11 @@ KEYINPUT_CHECKTABLE_INSDEL:
                 }
                 eKeyState = KS_Ende;
             }
-            else if(!rSh.HasReadonlySel())
+            else if ( !rSh.HasReadonlySel()
+                      || rSh.CrsrInsideInputFld() )
             {
-                sal_Bool bIsNormalChar = GetAppCharClass().isLetterNumeric(
-                                                            String( aCh ), 0 );
+                const sal_Bool bIsNormalChar =
+                    GetAppCharClass().isLetterNumeric( String( aCh ), 0 );
                 if( bChkInsBlank && bIsNormalChar &&
                     (aInBuffer.Len() || !rSh.IsSttPara() || !rSh.IsEndPara() ))
                 {
@@ -2321,9 +2320,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
                     aInBuffer.Expand( aInBuffer.Len() + 1, ' ' );
                 }
 
-
-                sal_Bool bIsAutoCorrectChar =  
SvxAutoCorrect::IsAutoCorrectChar( aCh );
-                sal_Bool bRunNext = pACorr && pACorr->HasRunNext();
+                const sal_Bool bIsAutoCorrectChar =  
SvxAutoCorrect::IsAutoCorrectChar( aCh );
+                const sal_Bool bRunNext = pACorr != NULL && 
pACorr->HasRunNext();
                 if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar 
|| bRunNext ) &&
                         pACfg->IsAutoFmtByInput() &&
                     (( pACorr->IsAutoCorrFlag( ChgWeightUnderl ) &&
@@ -3399,9 +3397,9 @@ void SwEditWin::MouseButtonDown(const Mo
                     const int nSelType = rSh.GetSelectionType();
                     // Check in general, if an object is selectable at given 
position.
                     // Thus, also text fly frames in background become 
selectable via Ctrl-Click.
-                    if ( nSelType & nsSelectionType::SEL_OLE ||
-                         nSelType & nsSelectionType::SEL_GRF ||
-                         rSh.IsObjSelectable( aDocPos ) )
+                    if ( ( nSelType & nsSelectionType::SEL_OLE )
+                         || ( nSelType & nsSelectionType::SEL_GRF )
+                         || rSh.IsObjSelectable( aDocPos ) )
                     {
                         MV_KONTEXT( &rSh );
                         if( !rSh.IsFrmSelected() )

Modified: openoffice/trunk/main/sw/source/ui/shells/basesh.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/shells/basesh.cxx?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/shells/basesh.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/shells/basesh.cxx Thu Feb 20 11:01:04 
2014
@@ -1541,11 +1541,16 @@ void SwBaseShell::GetState( SfxItemSet &
                                rSet.Put(SfxBoolItem(nWhich, bDisable));
                        }
                        break;
-                       case FN_BACKSPACE:
-                       case SID_DELETE:
-                               if (rSh.IsSelObjProtected( 
FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0)
-                                       rSet.DisableItem( nWhich );
-                               break;
+
+            case FN_BACKSPACE:
+            case SID_DELETE:
+                if ( ( rSh.HasReadonlySel() && !rSh.CrsrInsideInputFld() )
+                     || rSh.IsSelObjProtected( 
FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0 )
+                {
+                    rSet.DisableItem( nWhich );
+                }
+                break;
+
                        case SID_CONTOUR_DLG:
                        {
                                sal_Bool bParentCntProt = 0 != 
rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT );

Modified: openoffice/trunk/main/sw/source/ui/shells/textsh1.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/shells/textsh1.cxx?rev=1570146&r1=1570145&r2=1570146&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/shells/textsh1.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/shells/textsh1.cxx Thu Feb 20 11:01:04 
2014
@@ -1629,6 +1629,16 @@ void SwTextShell::GetState( SfxItemSet &
             }
             break;
 
+
+        case FN_INSERT_BREAK:
+            if ( rSh.HasReadonlySel()
+                 && !rSh.CrsrInsideInputFld() )
+            {
+                rSet.DisableItem( nWhich );
+            }
+            break;
+
+
         case FN_INSERT_BREAK_DLG:
         case FN_INSERT_COLUMN_BREAK:
         case FN_INSERT_PAGEBREAK:


Reply via email to