Author: hanya Date: Fri Jan 10 11:47:19 2014 New Revision: 1557095 URL: http://svn.apache.org/r1557095 Log: #i42309# change behavior for equal button of input line according to the current content of the cell
Modified:
openoffice/trunk/main/sc/source/ui/app/inputwin.cxx
Modified: openoffice/trunk/main/sc/source/ui/app/inputwin.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/app/inputwin.cxx?rev=1557095&r1=1557094&r2=1557095&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/app/inputwin.cxx (original)
+++ openoffice/trunk/main/sc/source/ui/app/inputwin.cxx Fri Jan 10 11:47:19 2014
@@ -461,12 +461,46 @@ void __EXPORT ScInputWindow::Select()
if ( pScMod->IsEditMode() ) //
nicht, wenn z.B. geschuetzt
{
aTextWindow.GrabFocus();
- aTextWindow.SetTextString( '=' );
+
+ xub_StrLen nStartPos = 1;
+ xub_StrLen nEndPos = 1;
+
+ ScTabViewShell* pViewSh = PTR_CAST(
ScTabViewShell, SfxViewShell::Current() );
+ if ( pViewSh )
+ {
+ const String& aString =
aTextWindow.GetTextString();
+ const xub_StrLen nLen = aString.Len();
+
+ ScDocument* pDoc =
pViewSh->GetViewData()->GetDocument();
+ CellType eCellType = pDoc->GetCellType(
pViewSh->GetViewData()->GetCurPos() );
+ switch ( eCellType )
+ {
+ case CELLTYPE_VALUE:
+ {
+ nEndPos = nLen +1;
+ String aNewStr( '=' );
+ aNewStr.Append( aString
);
+
aTextWindow.SetTextString( aNewStr );
+ break;
+ }
+ case CELLTYPE_STRING:
+ case CELLTYPE_EDIT:
+ nStartPos = 0;
+ nEndPos = nLen;
+ break;
+ case CELLTYPE_FORMULA:
+ nEndPos = nLen;
+ break;
+ default:
+
aTextWindow.SetTextString( '=' );
+ break;
+ }
+ }
EditView* pView = aTextWindow.GetEditView();
if (pView)
{
- pView->SetSelection( ESelection(0,1,
0,1) );
+ pView->SetSelection( ESelection(0,
nStartPos, 0, nEndPos) );
pScMod->InputChanged(pView);
SetOkCancelMode();
pView->SetEditEngineUpdateMode(sal_True);
