--- sc/source/ui/app/inputhdl.cxx 2008-04-13 08:22:38.000000000 +0530 +++ sc/source/ui/app/inputhdl.cxx 2008-05-14 15:54:09.000000000 +0530 @@ -1792,13 +1792,56 @@ void ScInputHandler::DataChanged( BOOL b void ScInputHandler::UpdateFormulaMode() { SfxApplication* pSfxApp = SFX_APP(); + bool bRefMode=false; - if ( pEngine->GetParagraphCount() == 1 && - ( pEngine->GetText((USHORT)0).GetChar(0) == '=' || + if( pEngine->GetText((USHORT)0).GetChar(0) == '=' || pEngine->GetText((USHORT)0).GetChar(0) == '+' || - pEngine->GetText((USHORT)0).GetChar(0) == '-' ) && + pEngine->GetText((USHORT)0).GetChar(0) == '-' ) + { + String aString = GetEditString(); + EditView* pActiveView = pTopView ? pTopView : pTableView; + if (pActiveView) + { + ESelection aSel = pActiveView->GetSelection(); + if(aSel.nStartPos != aSel.nEndPos) + { + aString = String(aString, 0, aSel.nStartPos); + } + } + + if(aString.Len() == 1) + { + bRefMode=true; + } + else + { + if ( !GetSelIsRef() && aString.Len() > 2 && + ( aString.GetChar(0) == '+' || aString.GetChar(0) == '-' ) ) + { + String aStr('='); + aStr += aString; + aString = aStr; + } + if(pActiveViewSh) + { + ScViewData* pViewData = pActiveViewSh->GetViewData(); + ScDocument* pDoc = pViewData->GetDocument(); + ScAddress aPos( pViewData->GetCurPos() ); + ScCompiler aComp( pDoc, aPos ); + aComp.SetCloseBrackets( false ); + ScTokenArray* pArr = aComp.CompileString( aString ); + if ( pArr->MayReferenceFollow() ) + { + bRefMode = true; + } + } + } + } + + if ( pEngine->GetParagraphCount() == 1 && + ( bRefMode == true ) && !bProtected ) - { + { if (!bFormulaMode) { bFormulaMode = TRUE; --- sc/source/ui/view/tabvwsha.cxx 2007-10-02 20:52:06.000000000 +0530 +++ sc/source/ui/view/tabvwsha.cxx 2008-05-06 15:50:32.000000000 +0530 @@ -469,35 +469,9 @@ void ScTabViewShell::ExecuteCellFormatDl //------------------------------------------------------------------ void ScTabViewShell::ExecuteInputDirect() { - bool bRefInputMode = false; ScModule* pScMod = SC_MOD(); - if ( pScMod->IsFormulaMode() ) - { - ScInputHandler* pHdl = pScMod->GetInputHdl(); - String aString = pHdl->GetEditString(); - - if ( !pHdl->GetSelIsRef() && aString.Len() > 1 && - ( aString.GetChar(0) == '+' || aString.GetChar(0) == '-' ) ) - { - ScViewData* pViewData = GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - ScAddress aPos( pViewData->GetCurPos() ); - ScCompiler aComp( pDoc, aPos ); - aComp.SetCloseBrackets( false ); - ScTokenArray* pArr = aComp.CompileString( aString ); - if ( pArr->MayReferenceFollow() ) - { - bRefInputMode = true; - } - } - else - { - bRefInputMode = true; - } - } - - if ( !bRefInputMode ) + if ( !pScMod->IsFormulaMode() ) { pScMod->InputEnterHandler(); } --- sc/source/ui/view/viewfunc.cxx 2008-04-13 08:22:38.000000000 +0530 +++ sc/source/ui/view/viewfunc.cxx 2008-05-19 12:29:15.000000000 +0530 @@ -743,7 +743,7 @@ void ScViewFunc::EnterData( SCCOL nCol, if ( !bSimple && aEngine.GetParagraphCount() == 1 ) { String aParStr = aEngine.GetText( (USHORT) 0 ); - if ( aParStr.GetChar(0) == '=' ) + if ( aParStr.GetChar(0) == '=' || aParStr.GetChar(0) == '+' || aParStr.GetChar(0) == '-') bSimple = TRUE; } @@ -755,7 +755,11 @@ void ScViewFunc::EnterData( SCCOL nCol, } if (bSimple) + { aString = aEngine.GetText(); + EnterData(nCol, nRow, nTab, aString, bRecord); + return; + } } // --- sc/source/ui/view/cellsh3.cxx 2008-04-13 08:22:38.000000000 +0530 +++ sc/source/ui/view/cellsh3.cxx 2008-05-19 12:31:29.000000000 +0530 @@ -252,7 +252,7 @@ void ScCellShell::Execute( SfxRequest& r if (nSlot == FID_INPUTLINE_BLOCK) pTabViewShell->EnterBlock( String(), pData ); else - pTabViewShell->EnterData( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), pData ); + pTabViewShell->EnterData( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), pData, TRUE, TRUE ); } else {