summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnurag Jain <anuragjainfzd@gmail.com>2011-05-13 11:45:23 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-05-13 11:45:23 -0400
commitd8d8ec02458018e5cb4a71c09ec5f0d6ca70fdbb (patch)
treed80a2d89bdfb1b781fccf08ce60ea44cae5d8805
parent1430657bc04f6f37b3067b632ffb22e4bed19cb9 (diff)
Initial check-in of on-going work for multi-line input bar in Calc.
-rw-r--r--sc/source/ui/app/inputwin.cxx44
-rw-r--r--sc/source/ui/inc/inputwin.hxx4
2 files changed, 42 insertions, 6 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index a293c222c..8019fee6b 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -31,6 +31,8 @@
#include <algorithm>
+#include<stdio.h>
+
#include "scitems.hxx"
#include <editeng/eeitem.hxx>
@@ -137,10 +139,11 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) :
// mit WB_CLIPCHILDREN, sonst Flicker
ToolBox ( pParent, WinBits(WB_BORDER|WB_3DLOOK|WB_CLIPCHILDREN) ),
aWndPos ( this ),
+// maScrollBar ( this, WB_VERT | WB_DRAG ),
aTextWindow ( this ),
pInputHdl ( NULL ),
pBindings ( pBind ),
- aTextOk ( ScResId( SCSTR_QHELP_BTNOK ) ), // nicht immer neu aus Resource
+ aTextOk ( ScResId( SCSTR_QHELP_BTNOK ) ), // not always new from Resource
aTextCancel ( ScResId( SCSTR_QHELP_BTNCANCEL ) ),
aTextSum ( ScResId( SCSTR_QHELP_BTNSUM ) ),
aTextEqual ( ScResId( SCSTR_QHELP_BTNEQUAL ) ),
@@ -161,7 +164,7 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) :
}
DBG_ASSERT( pViewSh, "no view shell for input window" );
- // Positionsfenster, 3 Buttons, Eingabefenster
+ // Position window, 3 buttons, input window
InsertWindow ( 1, &aWndPos, 0, 0 );
InsertSeparator ( 1 );
InsertItem ( SID_INPUT_FUNCTION, IMAGE( SID_INPUT_FUNCTION ), 0, 2 );
@@ -169,12 +172,21 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) :
InsertItem ( SID_INPUT_EQUAL, IMAGE( SID_INPUT_EQUAL ), 0, 4 );
InsertSeparator ( 5 );
InsertWindow ( 7, &aTextWindow, 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 );
+/*
+ maScrollBar.SetPageSize( 1 );
+ maScrollBar.SetVisibleSize( 1 );
+ maScrollBar.SetLineSize( 1 );
+ maScrollBar.SetRange( Range( 0, 1 ) );
+ maScrollBar.SetThumbPos( 10 );
+*/
+
// kein SetHelpText, die Hilfetexte kommen aus der Hilfe
SetItemText ( SID_INPUT_FUNCTION, ScResId( SCSTR_QHELP_BTNCALC ) );
@@ -189,6 +201,7 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) :
SetHelpId( HID_SC_INPUTWIN ); // fuer die ganze Eingabezeile
aWndPos .Show();
+// maScrollBar .Show();
aTextWindow .Show();
pInputHdl = SC_MOD()->GetInputHdl( pViewSh, false ); // use own handler even if ref-handler is set
@@ -489,7 +502,11 @@ void ScInputWindow::Resize()
long nLeft = aTextWindow.GetPosPixel().X();
Size aSize = aTextWindow.GetSizePixel();
- aSize.Width() = Max( ((long)(nWidth - nLeft - 5)), (long)0 );
+ 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();
}
@@ -534,10 +551,15 @@ void ScInputWindow::SetPosString( const String& rStr )
void ScInputWindow::SetTextString( const String& rString )
{
+ int i = rString.Len();
if (rString.Len() <= 32767)
+ {
aTextWindow.SetTextString(rString);
+ printf("%d ScInputWnd:SetTextString(), if \n",i);
+ }
else
{
+ printf("%d ScInputWnd:SetTextString(), else \n",i);
String aNew = rString;
aNew.Erase(32767);
aTextWindow.SetTextString(aNew);
@@ -705,7 +727,7 @@ void ScInputWindow::DataChanged( const DataChangedEvent& rDCEvt )
}
//========================================================================
-// Eingabefenster
+// Input Window
//========================================================================
ScTextWnd::ScTextWnd( Window* pParent )
@@ -779,6 +801,8 @@ void ScTextWnd::Paint( const Rectangle& rRec )
// LayoutMode isn't changed as long as ModifyRTLDefaults doesn't include SvxFrameDirectionItem
}
+ printf("ScTextWnd::Paint() nDiff: %ld GOSP height %ld text height \n",nDiff, GetOutputSizePixel().Height(), LogicToPixel( Size( 0, GetTextHeight() ) ).Height());
+
DrawText( PixelToLogic( Point( nStartPos, nDiff/2 ) ), aString );
}
}
@@ -793,6 +817,8 @@ void ScTextWnd::Resize()
aSize.Width() -= 2 * TEXT_STARTPOS - 1;
+ printf("ScTextWnd:Resize() width %ld \n",aSize.Width());
+
pEditView->SetOutputArea(
PixelToLogic( Rectangle( Point( TEXT_STARTPOS, (nDiff > 0) ? nDiff/2 : 1 ),
aSize ) ) );
@@ -1036,8 +1062,16 @@ void ScTextWnd::StartEditEngine()
pNew->SetExecuteURL( false );
pEditEngine = pNew;
+ Size barSize=GetOutputSizePixel();
+
+ long barHeight=barSize.Height();
+ long textHeight=LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
+ long nDiff = barHeight - textHeight;
+
+ barSize.Height()=nDiff+barHeight;
+ barSize.Width() -= 2*TEXT_STARTPOS-4;
pEditEngine->SetUpdateMode( false );
- pEditEngine->SetPaperSize( Size( bIsRTL ? USHRT_MAX : THESIZE, 300 ) );
+ pEditEngine->SetPaperSize( PixelToLogic(barSize) );
pEditEngine->SetWordDelimiters(
ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 6c3785d16..338020ac8 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -34,6 +34,7 @@
#include <sfx2/childwin.hxx>
#include <svl/lstner.hxx>
#include <vcl/combobox.hxx>
+#include <vcl/scrbar.hxx>
#include <vcl/window.hxx>
#include <svtools/transfer.hxx>
@@ -115,7 +116,7 @@ private:
//========================================================================
-class ScPosWnd : public ComboBox, public SfxListener // Positionsanzeige
+class ScPosWnd : public ComboBox, public SfxListener // Position window
{
private:
String aPosStr;
@@ -199,6 +200,7 @@ protected:
private:
ScPosWnd aWndPos;
+// ScrollBar maScrollBar;
ScTextWnd aTextWindow;
ScInputHandler* pInputHdl;
SfxBindings* pBindings;