[Libreoffice-commits] .: Branch 'feature/calc-multiline-input' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Jul 25 09:09:25 PDT 2011


 sc/source/ui/app/inputwin.cxx |   76 +++++++++++++++++++++++++++---------------
 sc/source/ui/inc/inputwin.hxx |   11 ++----
 2 files changed, 55 insertions(+), 32 deletions(-)

New commits:
commit 86913d79da5e3a6e6153d98ca2cf2aecdc802b51
Author: ANURAG JAIN <anuragjainfzd at gmail.com>
Date:   Mon Jul 25 00:07:42 2011 +0530

    Made the tool bar to resize. But still the transition is not smooth.

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 943eb82..58d9af8 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -161,7 +161,8 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) :
         aTextCancel		( ScResId( SCSTR_QHELP_BTNCANCEL ) ),
         aTextSum		( ScResId( SCSTR_QHELP_BTNSUM ) ),
         aTextEqual		( ScResId( SCSTR_QHELP_BTNEQUAL ) ),
-        bIsOkCancelMode ( false )
+        bIsOkCancelMode ( false ),
+        bIsMultiLine    ( false )
 {
     ScModule*		 pScMod  = SC_MOD();
     SfxImageManager* pImgMgr = SfxImageManager::GetImageManager( pScMod );
@@ -505,8 +506,20 @@ void ScInputWindow::Resize()
 
     if ( lcl_isExperimentalMode() )
     {
-        //aSize.Height()= TBX_WINDOW_HEIGHT;
+        Size aSize = GetSizePixel();
         //aTextWindow.SetSizePixel( aSize );
+        if( bIsMultiLine )
+        {
+        printf("increased\n");
+        aSize.Height()=77;
+        }
+        else
+        {
+        printf("reduced\n");
+        aSize.Height()=33;
+        }
+        SetSizePixel(aSize);
+        //Invalidate();
         aTextWindow.Resize();
     }
     else
@@ -705,7 +718,7 @@ void ScInputWindow::EnableButtons( sal_Bool bEnable )
 void ScInputWindow::StateChanged( StateChangedType nType )
 {
     ToolBox::StateChanged( nType );
-
+    printf("here\n");
     if ( nType == STATE_CHANGE_INITSHOW ) Resize();
 }
 
@@ -734,6 +747,17 @@ void ScInputWindow::DataChanged( const DataChangedEvent& rDCEvt )
     ToolBox::DataChanged( rDCEvt );
 }
 
+bool ScInputWindow::GetMultiLineStatus()
+{
+    return bIsMultiLine;
+}
+
+void ScInputWindow::SetMultiLineStatus(bool bMode)
+{
+    bIsMultiLine=bMode;
+}
+
+
 //========================================================================
 //                  ScInputBarGroup
 //========================================================================
@@ -741,8 +765,7 @@ void ScInputWindow::DataChanged( const DataChangedEvent& rDCEvt )
 ScInputBarGroup::ScInputBarGroup(Window* pParent)
     :   ScTextWndBase        ( pParent, WinBits(WB_HIDE) ),
         aMultiTextWnd        ( this ),
-        aButton              ( this),
-        bIsMultiLine         ( false )
+        aButton              ( this)
 {
       aMultiTextWnd.Show();
       aMultiTextWnd.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) );
@@ -783,11 +806,16 @@ void ScInputBarGroup::SetTextString( const String& rString )
 
 void ScInputBarGroup::Resize()
 {
-    long nWidth = GetParent()->GetSizePixel().Width();
+    Window *w=GetParent();
+    ScInputWindow *sw;
+    sw=dynamic_cast<ScInputWindow*>(w);
+
+    long nWidth = sw->GetSizePixel().Width();
     long nLeft  = GetPosPixel().X();
     Size aSize  = GetSizePixel();
-    aSize.Width() = Max( ((long)(nWidth - nLeft - 2*LEFT_OFFSET)), (long)0 );
-    if(bIsMultiLine)
+    aSize.Width() = Max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 );
+
+    if(sw->GetMultiLineStatus())
     {
         aSize.Height()=3*TBX_WINDOW_HEIGHT;
     }
@@ -844,16 +872,19 @@ void ScInputBarGroup::SetFormulaMode(sal_Bool bSet)
 
 IMPL_LINK( ScInputBarGroup, ClickHdl, PushButton*, pBtn )
 {
-    if(!bIsMultiLine)
+    Window *w=GetParent();
+    ScInputWindow *sw;
+    sw=dynamic_cast<ScInputWindow*>(w);
+
+    if(!sw->GetMultiLineStatus())
     {
-        bIsMultiLine=true;
+        sw->SetMultiLineStatus(true);
     }
     else
     {
-        bIsMultiLine=false;
+        sw->SetMultiLineStatus(false);
     }
-    aMultiTextWnd.SetMultiLineStatus(bIsMultiLine);
-    Resize();
+    sw->Resize();
     return 0;
 }
 
@@ -861,22 +892,11 @@ IMPL_LINK( ScInputBarGroup, ClickHdl, PushButton*, pBtn )
 //                      ScMultiTextWnd
 //========================================================================
 
-ScMultiTextWnd::ScMultiTextWnd( Window* pParen ) : ScTextWnd( pParen ),
-                                                   bIsMultiLine(false)
+ScMultiTextWnd::ScMultiTextWnd( Window* pParen ) : ScTextWnd( pParen )
 {
     nTextStartPos = TEXT_MULTI_STARTPOS;
 }
 
-bool ScMultiTextWnd::GetMultiLineStatus()
-{
-    return bIsMultiLine;
-}
-
-void ScMultiTextWnd::SetMultiLineStatus(bool bMode)
-{
-    bIsMultiLine=bMode;
-}
-
 int ScMultiTextWnd::GetLineCount()
 {
    if(pEditView)
@@ -900,12 +920,16 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec )
 
 void ScMultiTextWnd::Resize()
 {
+    Window *w=GetParent()->GetParent();
+    ScInputWindow *sw;
+    sw=dynamic_cast<ScInputWindow*>(w);
+
     long nWidth = GetParent()->GetSizePixel().Width();
     long nLeft  = GetPosPixel().X();
     Size cSize  = GetSizePixel();
     cSize.Width() = Max( ((long)(nWidth - nLeft - 3*LEFT_OFFSET)), (long)0 );
 
-    if(bIsMultiLine)
+    if(sw->GetMultiLineStatus())
     {
         cSize.Height()=3*TBX_WINDOW_HEIGHT;
     }
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 6437bf8..dc457f2 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -172,17 +172,14 @@ public:
     ScMultiTextWnd( Window* pParent );
     virtual void StartEditEngine();
     virtual void StopEditEngine( sal_Bool bAll );
-    void SetMultiLineStatus(bool bMode);
-    bool GetMultiLineStatus();
     int GetLineCount();
-    void SetSize(bool bIsMultiLine);
     virtual void Resize();
 protected:
     void InitEditEngine(SfxObjectShell* pObjSh);
 
     virtual void Paint( const Rectangle& rRec );
 private:
-    bool bIsMultiLine;
+//    bool bIsMultiLine;
 };
 
 //================================================================================
@@ -214,7 +211,7 @@ private:
 
     ScMultiTextWnd  aMultiTextWnd;
     PushButton      aButton;
-    bool            bIsMultiLine;
+//    bool            bIsMultiLine;
 
     DECL_LINK( ClickHdl,	 PushButton* );
 
@@ -261,7 +258,8 @@ public:
 
     void			StateChanged( StateChangedType nType );
     virtual void	DataChanged( const DataChangedEvent& rDCEvt );
-
+    void SetMultiLineStatus(bool bMode);
+    bool GetMultiLineStatus();
 
 protected:
     virtual void	SetText( const String& rString );
@@ -280,6 +278,7 @@ private:
     String			aTextSum;
     String			aTextEqual;
     sal_Bool			bIsOkCancelMode;
+    bool            bIsMultiLine;
 };
 
 //==================================================================


More information about the Libreoffice-commits mailing list