summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnurag Jain <anuragjainfzd@gmail.com>2011-06-22 20:19:30 +0100
committerNoel Power <noel.power@novell.com>2011-06-22 20:19:30 +0100
commit692518586d50126f495f12659925cc6554eacd8b (patch)
tree9b3e8525ae587454d5cf1a58cf42316d78e43b52
parent21f851bd32d7f7a8a7e89aa9694b1ade7526a75c (diff)
initial commit of Input bar group control
note: group container window and child ( textbox ) elements size are incorrect so not yet drawing with this version
-rw-r--r--sc/source/ui/app/inputwin.cxx141
-rw-r--r--sc/source/ui/inc/inputwin.hxx34
2 files changed, 131 insertions, 44 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 ),
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index d62937606..94481582f 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -33,6 +33,7 @@
#include <vcl/toolbox.hxx>
#include <sfx2/childwin.hxx>
#include <svl/lstner.hxx>
+#include <vcl/button.hxx>
#include <vcl/combobox.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/window.hxx>
@@ -109,7 +110,6 @@ private:
sal_Bool bIsRTL;
sal_Bool bIsInsertMode;
sal_Bool bFormulaMode;
-
// #102710#; this flag should be true if a key input or a command is handled
// it prevents the call of InputChanged in the ModifyHandler of the EditEngine
sal_Bool bInputMode;
@@ -150,6 +150,34 @@ private:
void ReleaseFocus_Impl();
};
+//==================================================================
+
+class ScInputBarGroup : public Window
+{
+
+public:
+ ScInputBarGroup( Window* Parent );
+ virtual ~ScInputBarGroup();
+// virtual void Paint(const Rectangle& rRec );
+ void SetTextString( const String& rString );
+ void StartEditEngine();
+ EditView* GetEditView();
+ void SetSize(Size aSize);
+ virtual void Resize();
+ void InitEditEngine(SfxObjectShell* pObjSh);
+ void GainFocus();
+ void SetFormulaMode( bool bSet );
+ bool IsFocus();
+ void MakeDialogEditView();
+ bool IsInputActive();
+private:
+
+ ScTextWnd aTextWindow;
+ ScrollBar maScrollBar;
+ bool bIsMultiLine;
+
+};
+
//========================================================================
class ScInputWindow : public ToolBox // Parent-Toolbox
@@ -201,8 +229,7 @@ protected:
private:
ScPosWnd aWndPos;
-// ScrollBar maScrollBar;
- ScTextWnd aTextWindow;
+ ScInputBarGroup aBarGroup;
ScInputHandler* pInputHdl;
SfxBindings* pBindings;
String aTextOk;
@@ -225,7 +252,6 @@ public:
SFX_DECL_CHILDWINDOW(ScInputWindowWrapper);
};
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */