Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hello Kohei,

I've Worked around ScrollBar and Made it appear. But still not able to
get the event handling thing working. Also I've improved some previous
code which handles sizing and positioning of button and other
controls. Also in order to delay the call to InitEditEngine, I think
we can make use of the GainFocus() method. The call should be made
only after the textbox has got focus. Firstly, I want you to guide me
in syncing the ScrollBar event with the textbox and after that I'll go
for fixing the EditEngine thing.

I've attached the patch over here, awaiting your suggestions.

Thanks and regards.

-- 
Anurag Jain
Final yr B.Tech CSE
SASTRA University
Thanjavur(T.N.)-613402
From e65f6a604ee51e9feb01cbf39d72217255d629c4 Mon Sep 17 00:00:00 2001
From: Anurag Jain <anuragjainfzd@gmail.com>
Date: Sat, 20 Aug 2011 23:09:40 +0530
Subject: [PATCH] Made Scrollbar to appear and resize improved.

---
 sc/source/ui/app/inputwin.cxx |   64 +++++++++++++++++++++++-----------------
 sc/source/ui/inc/inputwin.hxx |    3 ++
 2 files changed, 40 insertions(+), 27 deletions(-)

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 3130d54..bff10cb 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -512,10 +512,10 @@ void ScInputWindow::Resize()
         }
         else
         {
-        aSize.Height()=33;
+        aSize.Height()=38;
         }
         SetSizePixel(aSize);
-        //Invalidate();
+        Invalidate();
         aTextWindow.Resize();
     }
     else
@@ -759,15 +759,24 @@ void ScInputWindow::SetMultiLineStatus(bool bMode)
 ScInputBarGroup::ScInputBarGroup(Window* pParent)
     :   ScTextWndBase        ( pParent, WinBits(WB_HIDE) ),
         aMultiTextWnd        ( this ),
-        aButton              ( this)
+        aButton              ( this ),
+        aScrollBar           ( this, WB_VERT )
 {
       aMultiTextWnd.Show();
       aMultiTextWnd.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) );
       aMultiTextWnd.SetHelpId          ( HID_INSWIN_INPUT );
 
       aButton.SetClickHdl      ( LINK( this, ScInputBarGroup, ClickHdl ) );
-      aButton.Show();
+      aButton.SetSizePixel(Size(0.5*TBX_WINDOW_HEIGHT,TBX_WINDOW_HEIGHT));
       aButton.Enable();
+      aButton.Show();
+
+      aScrollBar.SetSizePixel( Size(0.5*TBX_WINDOW_HEIGHT,TBX_WINDOW_HEIGHT) );
+
+      aScrollBar.SetPageSize( 1 );
+      aScrollBar.SetVisibleSize( 1 );
+      aScrollBar.SetLineSize( 1 );
+      aScrollBar.Show();
 }
 
 ScInputBarGroup::~ScInputBarGroup()
@@ -811,9 +820,10 @@ void ScInputBarGroup::Resize()
     }
 
     long nWidth = pParent->GetSizePixel().Width();
-    Point aPos  = GetPosPixel();
+    long nLeft  = GetPosPixel().X();
+
     Size aSize  = GetSizePixel();
-    aSize.Width() = Max( ((long)(nWidth - aPos.X() - LEFT_OFFSET)), (long)0 );
+    aSize.Width() = Max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 );
 
     if(pParent->GetMultiLineStatus())
     {
@@ -823,11 +833,12 @@ void ScInputBarGroup::Resize()
     {
         aSize.Height()=TBX_WINDOW_HEIGHT;
     }
-    SetPosSizePixel(aPos,aSize);
-    Invalidate();
+    SetSizePixel(aSize);
 
-    
aButton.SetPosSizePixel(Point(aSize.Width()-3*LEFT_OFFSET,0),Size(0.5*TBX_WINDOW_HEIGHT,TBX_WINDOW_HEIGHT));
+    aButton.SetPosPixel(Point(aSize.Width()-4*LEFT_OFFSET,0));
+    aScrollBar.SetPosPixel(Point(aSize.Width()-2*LEFT_OFFSET,0));
 
+    Invalidate();
     aMultiTextWnd.Resize();
 }
 
@@ -895,6 +906,12 @@ IMPL_LINK( ScInputBarGroup, ClickHdl, PushButton*, pBtn )
     return 0;
 }
 
+IMPL_LINK( ScInputBarGroup, Impl_ScrollHdl, ScrollBar*, EMPTYARG )
+{
+
+}
+
+
 //========================================================================
 //                      ScMultiTextWnd
 //========================================================================
@@ -917,7 +934,8 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec )
 {
     // We always use edit engine to draw text at all times.
     if (!pEditEngine)
-        InitEditEngine(SfxObjectShell::Current());
+        //InitEditEngine(SfxObjectShell::Current());
+        StartEditEngine();
 
     if (pEditView)
     {
@@ -939,9 +957,10 @@ void ScMultiTextWnd::Resize()
 
 
     long nWidth = GetParent()->GetSizePixel().Width();
-    Point aPos=GetPosPixel();
+    long nLeft  = GetPosPixel().X();
+
     Size aTextBoxSize  = GetSizePixel();
-    aTextBoxSize.Width() = Max( ((long)(nWidth - aPos.X() - 3*LEFT_OFFSET)), (long)0 );
+    aTextBoxSize.Width() = Max( ((long)(nWidth - nLeft - 4*LEFT_OFFSET)), (long)0 );
 
     if(pParent->GetMultiLineStatus())
     {
@@ -966,7 +985,6 @@ void ScMultiTextWnd::Resize()
 
     else
     {
-
         aTextBoxSize.Height()=TBX_WINDOW_HEIGHT;
         if(pEditView)
         {
@@ -977,17 +995,14 @@ void ScMultiTextWnd::Resize()
 
             Point aPos1(TEXT_STARTPOS,nDiff);
             Point aPos2(aOutputSize.Width()-5,(aOutputSize.Height() - nDiff));
+
             pEditView->SetOutputArea(
                 PixelToLogic(Rectangle(aPos1, aPos2)));
         }
-
     }
-
-    SetPosSizePixel(aPos,aTextBoxSize);
+    SetSizePixel(aTextBoxSize);
 }
 
-
-
 void ScMultiTextWnd::StartEditEngine()
 {
     // Bei "eigener Modalitaet" (Doc-modale Dialoge) nicht aktivieren
@@ -1067,16 +1082,11 @@ void ScMultiTextWnd::InitEditEngine(SfxObjectShell* pObjSh)
     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*nTextStartPos-4;
+    Size barSize=GetSizePixel();
+    barSize.Width() -= (2*nTextStartPos-4);
+    printf("bar size width %ld",barSize.Width());
     pEditEngine->SetUpdateMode( false );
-    pEditEngine->SetPaperSize( PixelToLogic(Size(barSize.Width(),10000)) );
+    pEditEngine->SetPaperSize( PixelToLogic(Size(994-4*LEFT_OFFSET,10000)) );
     pEditEngine->SetWordDelimiters(
                     ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
 
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 98e6c2e..bf1217b 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -35,6 +35,7 @@
 #include <svl/lstner.hxx>
 #include <vcl/button.hxx>
 #include <vcl/combobox.hxx>
+#include <vcl/scrbar.hxx>
 #include <vcl/window.hxx>
 #include <svtools/transfer.hxx>
 
@@ -209,9 +210,11 @@ private:
 
     ScMultiTextWnd  aMultiTextWnd;
     PushButton      aButton;
+    ScrollBar       aScrollBar;
 //    bool            bIsMultiLine;
 
     DECL_LINK( ClickHdl,        PushButton* );
+    DECL_LINK( Impl_ScrollHdl,  ScrollBar* );
 
 };
 
-- 
1.7.0.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.