diff options
Diffstat (limited to 'sc/source/ui/app/inputwin.cxx')
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 141 |
1 files changed, 101 insertions, 40 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 0fed0377a..c3d0ffcf4 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -140,7 +140,7 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) : ToolBox ( pParent, WinBits(WB_BORDER|WB_3DLOOK|WB_CLIPCHILDREN) ), aWndPos ( this ), // maScrollBar ( this, WB_VERT | WB_DRAG ), - aTextWindow ( this ), + aBarGroup ( this ), pInputHdl ( NULL ), pBindings ( pBind ), aTextOk ( ScResId( SCSTR_QHELP_BTNOK ) ), // not always new from Resource @@ -171,13 +171,13 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) : InsertItem ( SID_INPUT_SUM, IMAGE( SID_INPUT_SUM ), 0, 3 ); InsertItem ( SID_INPUT_EQUAL, IMAGE( SID_INPUT_EQUAL ), 0, 4 ); InsertSeparator ( 5 ); - InsertWindow ( 7, &aTextWindow, 0, 6 ); + InsertWindow ( 7, &aBarGroup, 0, 6 ); // InsertWindow ( 8, &maScrollBar, 0, 8 ); aWndPos .SetQuickHelpText( ScResId( SCSTR_QHELP_POSWND ) ); aWndPos .SetHelpId ( HID_INSWIN_POS ); - aTextWindow.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); - aTextWindow.SetHelpId ( HID_INSWIN_INPUT ); +// aTextWindow.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); +// aTextWindow.SetHelpId ( HID_INSWIN_INPUT ); /* maScrollBar.SetPageSize( 1 ); @@ -202,7 +202,7 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) : aWndPos .Show(); // maScrollBar .Show(); - aTextWindow .Show(); + aBarGroup .Show(); pInputHdl = SC_MOD()->GetInputHdl( pViewSh, false ); // use own handler even if ref-handler is set if (pInputHdl) @@ -214,7 +214,7 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) : // -> Inhalt des Funktionsautopiloten wieder anzeigen //! auch Selektion (am InputHdl gemerkt) wieder anzeigen - aTextWindow.SetTextString( pInputHdl->GetFormString() ); + aBarGroup.SetTextString( pInputHdl->GetFormString() ); } else if ( pInputHdl && pInputHdl->IsInputMode() ) { @@ -222,7 +222,7 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) : // (Editieren einer Formel, dann umschalten zu fremdem Dokument/Hilfe), // wieder den gerade editierten Text aus dem InputHandler anzeigen - aTextWindow.SetTextString( pInputHdl->GetEditString() ); // Text anzeigen + aBarGroup.SetTextString( pInputHdl->GetEditString() ); // Text anzeigen if ( pInputHdl->IsTopMode() ) pInputHdl->SetMode( SC_INPUT_TABLE ); // Focus kommt eh nach unten } @@ -365,7 +365,7 @@ void ScInputWindow::Select() case SID_INPUT_OK: pScMod->InputEnterHandler(); SetSumAssignMode(); - aTextWindow.Invalidate(); // sonst bleibt Selektion stehen + aBarGroup.Invalidate(); // sonst bleibt Selektion stehen break; case SID_INPUT_SUM: @@ -472,13 +472,13 @@ void ScInputWindow::Select() case SID_INPUT_EQUAL: { - aTextWindow.StartEditEngine(); + aBarGroup.StartEditEngine(); if ( pScMod->IsEditMode() ) // nicht, wenn z.B. geschuetzt { - aTextWindow.GrabFocus(); - aTextWindow.SetTextString( '=' ); + aBarGroup.GainFocus(); + aBarGroup.SetTextString( '=' ); - EditView* pView = aTextWindow.GetEditView(); + EditView* pView = aBarGroup.GetEditView(); if (pView) { pView->SetSelection( ESelection(0,1, 0,1) ); @@ -496,17 +496,7 @@ void ScInputWindow::Resize() { ToolBox::Resize(); - long nWidth = GetSizePixel().Width(); - long nLeft = aTextWindow.GetPosPixel().X(); - Size aSize = aTextWindow.GetSizePixel(); - - aSize.Width() = Max( ((long)(nWidth - nLeft - 40)), (long)0 ); - -// printf("Inside ScInputWindow:Resize()\n"); -// printf("nWidth %ld nLeft %ld aSize.Width%ld \n",nWidth, nLeft, aSize.Width()); - - aTextWindow.SetSizePixel( aSize ); - aTextWindow.Invalidate(); + aBarGroup.Resize(); } void ScInputWindow::SetFuncString( const String& rString, sal_Bool bDoEdit ) @@ -514,15 +504,15 @@ void ScInputWindow::SetFuncString( const String& rString, sal_Bool bDoEdit ) //! new method at ScModule to query if function autopilot is open SfxViewFrame* pViewFrm = SfxViewFrame::Current(); EnableButtons( pViewFrm && !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) ); - aTextWindow.StartEditEngine(); + aBarGroup.StartEditEngine(); ScModule* pScMod = SC_MOD(); if ( pScMod->IsEditMode() ) { if ( bDoEdit ) - aTextWindow.GrabFocus(); - aTextWindow.SetTextString( rString ); - EditView* pView = aTextWindow.GetEditView(); + aBarGroup.GainFocus(); + aBarGroup.SetTextString( rString ); + EditView* pView = aBarGroup.GetEditView(); if (pView) { xub_StrLen nLen = rString.Len(); @@ -552,7 +542,7 @@ void ScInputWindow::SetTextString( const String& rString ) int i = rString.Len(); if (rString.Len() <= 32767) { - aTextWindow.SetTextString(rString); + aBarGroup.SetTextString(rString); // printf("%d ScInputWnd:SetTextString(), if \n",i); } else @@ -560,7 +550,7 @@ void ScInputWindow::SetTextString( const String& rString ) // printf("%d ScInputWnd:SetTextString(), else \n",i); String aNew = rString; aNew.Erase(32767); - aTextWindow.SetTextString(aNew); + aBarGroup.SetTextString(aNew); } } @@ -614,7 +604,7 @@ void ScInputWindow::SetSumAssignMode() void ScInputWindow::SetFormulaMode( sal_Bool bSet ) { aWndPos.SetFormulaMode(bSet); - aTextWindow.SetFormulaMode(bSet); + aBarGroup.SetFormulaMode(bSet); } void ScInputWindow::SetText( const String& rString ) @@ -629,43 +619,43 @@ String ScInputWindow::GetText() const sal_Bool ScInputWindow::IsInputActive() { - return aTextWindow.IsInputActive(); + return aBarGroup.IsInputActive(); } EditView* ScInputWindow::GetEditView() { - return aTextWindow.GetEditView(); + return aBarGroup.GetEditView(); } void ScInputWindow::MakeDialogEditView() { - aTextWindow.MakeDialogEditView(); + aBarGroup.MakeDialogEditView(); } void ScInputWindow::StopEditEngine( sal_Bool bAll ) { - aTextWindow.StopEditEngine( bAll ); +// aTextWindow.StopEditEngine( bAll ); } void ScInputWindow::TextGrabFocus() { - aTextWindow.GrabFocus(); + aBarGroup.GainFocus(); } void ScInputWindow::TextInvalidate() { - aTextWindow.Invalidate(); + aBarGroup.Invalidate(); } void ScInputWindow::SwitchToTextWin() { // used for shift-ctrl-F2 - aTextWindow.StartEditEngine(); + aBarGroup.StartEditEngine(); if ( SC_MOD()->IsEditMode() ) { - aTextWindow.GrabFocus(); - EditView* pView = aTextWindow.GetEditView(); + aBarGroup.GainFocus(); + EditView* pView = aBarGroup.GetEditView(); if (pView) { xub_StrLen nLen = pView->GetEditEngine()->GetTextLen(0); @@ -725,11 +715,82 @@ void ScInputWindow::DataChanged( const DataChangedEvent& rDCEvt ) } //======================================================================== +// ScInputBarGroup +//======================================================================== + +ScInputBarGroup::ScInputBarGroup(Window* pParent) + : Window ( pParent, WinBits(WB_HIDE | WB_BORDER) ), + aTextWindow ( this ), + maScrollBar ( this, WB_VERT | WB_DRAG ), + bIsMultiLine ( false ) +{ + + aTextWindow.Show(); + aTextWindow.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); + aTextWindow.SetHelpId ( HID_INSWIN_INPUT ); + + +} + +ScInputBarGroup::~ScInputBarGroup() +{ + +} +void ScInputBarGroup::SetTextString( const String& rString ) +{ + aTextWindow.SetTextString(rString); +} + +void ScInputBarGroup::Resize() +{ + long nWidth = GetSizePixel().Width(); + long nLeft = aTextWindow.GetPosPixel().X(); + Size aSize = aTextWindow.GetSizePixel(); + + aSize.Width() = Max( ((long)(nWidth - nLeft - 40)), (long)0 ); + + aTextWindow.SetSizePixel( aSize ); + aTextWindow.Invalidate(); +} + +void ScInputBarGroup::GainFocus() +{ + aTextWindow.GrabFocus(); +} + + +void ScInputBarGroup::StartEditEngine() +{ + aTextWindow.StartEditEngine(); +} + +void ScInputBarGroup::MakeDialogEditView() +{ + aTextWindow.MakeDialogEditView(); +} + + +EditView* ScInputBarGroup::GetEditView() +{ + return aTextWindow.GetEditView(); +} + +bool ScInputBarGroup::IsInputActive() +{ + return aTextWindow.IsInputActive(); +} + +void ScInputBarGroup::SetFormulaMode(bool bSet) +{ + aTextWindow.SetFormulaMode(bSet); +} + +//======================================================================== // Input Window //======================================================================== ScTextWnd::ScTextWnd( Window* pParent ) - : Window ( pParent, WinBits(WB_HIDE | WB_BORDER) ), + : Window ( pParent, WinBits(WB_HIDE | WB_BORDER) ), DragSourceHelper( this ), pEditEngine ( NULL ), pEditView ( NULL ), |