Hello Noel,

On Fri, Jun 24, 2011 at 7:53 PM, Noel Power <nopo...@novell.com> wrote:
> Hi Anurag
> On 22/06/11 15:51, Anurag Jain wrote:
>>
>> Hi Noel,
>>
>> Resending the patch again along with the source files here.
>
> as mentioned on Wed on iRC I pushed the patch to the feature branch. I had
> hoped to see the latest changes you made to correct the control size problem
> that I identified that was preventing your new control from being displayed
> before reviewing the patch further, I am not *that* familiar with
> libreoffice ui bits and pieces and was hoping to have something to run to
> test. Additionally on IRC it wasn't clear how you now were calcuating the
> the ScInputBarGroup width, I'd like to have seen the code for that
>

I'm sending the fix patch here which calculates the height and width
of the ScInputbarGroup and makes the border invisible.

> Anyway some comments on what is there so far, I think the ScInputBarGroup is
> taking shape, clearly it's very rough at this stage (  understandable since
> you had problems getting it to show ). One thing I would suggest here to
> a) change the name of ScTextWindow to something like ScMultiLineTxtWin ( or
> any other suitable name )
> b) restore the orig ScTextWindow class
>

There is no class named as ScTextWindow  and never was. It has always
been ScTextWnd-->ScInputWindow and now it has become like
ScTextWnd-->ScInputBarGroup-->ScInputWidow


> I suggest this because it is intended when the gsoc code is initially
> integrated that it be configurable and for this reason it probably makes
> sense to preserve the original ScTextWindow class and distinguish it from
> your new implementation. This will make maintenance easier.

So I guess there should not be any problem with the maintenance of
code as I've not renamed any pre existing class and just inserted a
new class i.e ScInputBarGroup.

> Then next thing to concentrate on is getting the multi-line textbox
> functionality to work and to make that behaviour switchable. I believe Kohei
> suggested adding a button to the ScInputBarGroup window. So, you need to be
> able to detect the button click and switch the state of the bIsMultiLine
> flag that you have already added ( presumably for this purpose ) please do a
> grep for PushButton & SetClickHdl in sc for sample code for handling the
> button.

Next hurdle which I'm trying to get through is getting the Scrollbar
and Button at the right position after the Textbar ends. Does the
function SetPosSizePixel() or SetPosPixel() in window.hxx can be used
for getting them at the desired position. Or is there any other more
modular way to decide the ordering of these items similar to
InsertWindow() and InsetItem() methods used in ScInputWindow ?

> When you get a button click you will need to resize your InputBarGroupbox
> window based on the new state of the bIsMultiLine flag and of course
> increase the height in multiples of the calculated height of a single line.
> e.g. in Multiline mode the ScInputGroupBox height should be some multiple of
> the calculated singleline height ( maybe 10 as a default ? ) Of course the
> size of the ScMultiLineTxtWin (let's call it that for now but please rename
> it as you wish ) window needs to also be adjusted and everything resized. I
> would do this first before worrying about scrollbar behaviour.
>
yes as soon as I get things placed in right place I'll be working on
switching from single line to multiline mode on the button click.

> regards
> Noel
>
>
>

Thanks and regards

-- 
Anurag Jain
Final yr B.Tech CSE
SASTRA University
Thanjavur(T.N.)-613402
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index c3d0ffc..dc12376 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 ),
-        aBarGroup       ( this ),
+        aBarGroup       ( this),
         pInputHdl		( NULL ),
         pBindings       ( pBind ),
         aTextOk			( ScResId( SCSTR_QHELP_BTNOK ) ),		// not always new from Resource
@@ -179,14 +179,6 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) :
 //    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 ) );
@@ -496,6 +488,15 @@ void ScInputWindow::Resize()
 {
     ToolBox::Resize();
 
+    long nWidth = GetSizePixel().Width();
+    long nLeft  = aBarGroup.GetPosPixel().X();
+    Size aSize  = aBarGroup.GetSizePixel();
+
+    aSize.Width() = Max( ((long)(nWidth - nLeft - 10)), (long)0 );
+    aSize.Height()= TBX_WINDOW_HEIGHT;
+    aBarGroup.SetSizePixel( aSize );
+    aBarGroup.Invalidate();
+
     aBarGroup.Resize();
 }
 
@@ -719,7 +720,7 @@ void ScInputWindow::DataChanged( const DataChangedEvent& rDCEvt )
 //========================================================================
 
 ScInputBarGroup::ScInputBarGroup(Window* pParent)
-    :   Window          ( pParent, WinBits(WB_HIDE | WB_BORDER) ),
+    :   Window          ( pParent, WinBits(WB_HIDE) ),
         aTextWindow      ( this ),
         maScrollBar     ( this,  WB_VERT | WB_DRAG ),
         bIsMultiLine    ( false )
@@ -729,7 +730,12 @@ ScInputBarGroup::ScInputBarGroup(Window* pParent)
       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 );
+      maScrollBar.Show();
 }
 
 ScInputBarGroup::~ScInputBarGroup()
@@ -746,9 +752,8 @@ 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 );
-
+    aSize.Height()=22;
     aTextWindow.SetSizePixel( aSize );
     aTextWindow.Invalidate();
 }
@@ -820,10 +825,8 @@ ScTextWnd::ScTextWnd( Window* pParent )
 
     Size aSize(1,TBX_WINDOW_HEIGHT);
     Size aMinEditSize( Edit::GetMinimumEditSize() );
-    printf("construstor of ScTextWnd edit height %ld edit width%ld\n",aMinEditSize.Height() , aMinEditSize.Width() );
     if( aMinEditSize.Height() > aSize.Height() )
         aSize.Height() = aMinEditSize.Height();
-    printf("So aSize is %ld %ld \n",aSize.Width(), aSize.Height());
     SetSizePixel		( aSize );
     SetBackground		( aBgColor );
     SetLineColor		( COL_BLACK );
@@ -860,7 +863,6 @@ void ScTextWnd::Resize()
         Size aSize = GetOutputSizePixel();
         Size bSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
         int nDiff=(aSize.Height()-bSize.Height())/2;
-        printf("here %d %d %d\n", nDiff , bSize.Height(), aSize.Height());
         Point aPos(TEXT_STARTPOS,nDiff*aSize.Height()/aSize.Height());
         Point aPos2(aSize.Width()-5,(aSize.Height()-nDiff)*aSize.Height()/aSize.Height());
         pEditView->SetOutputArea(
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to