Hello Kohei, I prepared the patch and then realized that you have pushed the recalculating change, it was taking longer to pull because of some problem. Also wanted to inform that I've to leave for college as I've got convocation on 6th Aug. I'll be back on 7th evening and finish things up. Also after doing resize of output are I realized following things.
1: I was setting the height to 3*TBX_WINDOW_HEIGHT thinking to accommodate 3 lines in the text box. But on resize I got 4 and half line getting there. So I've decided to change the logic of the resizing. and I guess this calculation will be proper. single line mode: Get the width from parent window and minus some offset from that. height will be TBX_WINDOW_HEIGHT(22) here. the line height comes out to be 14 so we calculate the nDiff which works as up and down offset as nDiff=( TBX_WINDOW_HEIGHT - LineHeight)/2 which comes out to be 4. output area is set accordingly as done in commit 34c374a69dcce7fe669dedec7eaa36b6c2db4ca5 Multi Line mode: Now here what I'm trying to do is the height will be calculated as textbox Height= 3* LineHeight + 2* nDiff // here we increase the size by amount that of 3 lines plus the up and down padding which remains same. And the output area will be set accordingly with a similar logic as in single line mode. I'll implement these things after returning from college. Also I'd like to know how to go about the next step.? Is it going to be scrollbar implementation or working on refreshing the windows ? Thanks and regards. -- Anurag Jain Final yr B.Tech CSE SASTRA University Thanjavur(T.N.)-613402
From 447a2feb3ce54e49a7b19fd2eebb42aba136fcd3 Mon Sep 17 00:00:00 2001 From: ANURAG JAIN <anuragjain...@gmail.com> Date: Thu, 4 Aug 2011 13:38:26 +0530 Subject: [PATCH] Implemented the resizing of output are in multi-line mode and added a NULL pointer check with a FAIL message. Still there are improvements to be done in the resizinf of the text box. --- sc/source/ui/app/inputwin.cxx | 83 +++++++++++++++++++++++++++------------- 1 files changed, 56 insertions(+), 27 deletions(-) diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 8566bf9..f1c2598 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -510,12 +510,10 @@ void ScInputWindow::Resize() //aTextWindow.SetSizePixel( aSize ); if( bIsMultiLine ) { - printf("increased\n"); aSize.Height()=77; } else { - printf("reduced\n"); aSize.Height()=33; } SetSizePixel(aSize); @@ -718,7 +716,6 @@ void ScInputWindow::EnableButtons( sal_Bool bEnable ) void ScInputWindow::StateChanged( StateChangedType nType ) { ToolBox::StateChanged( nType ); - printf("here\n"); if ( nType == STATE_CHANGE_INITSHOW ) Resize(); } @@ -807,15 +804,21 @@ void ScInputBarGroup::SetTextString( const String& rString ) void ScInputBarGroup::Resize() { Window *w=GetParent(); - ScInputWindow *sw; - sw=dynamic_cast<ScInputWindow*>(w); + ScInputWindow *pParent; + pParent=dynamic_cast<ScInputWindow*>(w); - long nWidth = sw->GetSizePixel().Width(); + if(pParent==NULL) + { + OSL_FAIL("The parent window pointer pParent is null"); + return; + } + + long nWidth = pParent->GetSizePixel().Width(); long nLeft = GetPosPixel().X(); Size aSize = GetSizePixel(); aSize.Width() = Max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 ); - if(sw->GetMultiLineStatus()) + if(pParent->GetMultiLineStatus()) { aSize.Height()=3*TBX_WINDOW_HEIGHT; } @@ -873,19 +876,25 @@ void ScInputBarGroup::SetFormulaMode(sal_Bool bSet) IMPL_LINK( ScInputBarGroup, ClickHdl, PushButton*, pBtn ) { Window *w=GetParent(); - ScInputWindow *sw; - sw=dynamic_cast<ScInputWindow*>(w); + ScInputWindow *pParent; + pParent=dynamic_cast<ScInputWindow*>(w); + + if(pParent==NULL) + { + OSL_FAIL("The parent window pointer pParent is null"); + return 1; + } - if(!sw->GetMultiLineStatus()) + if(!pParent->GetMultiLineStatus()) { - sw->SetMultiLineStatus(true); + pParent->SetMultiLineStatus(true); } else { - sw->SetMultiLineStatus(false); + pParent->SetMultiLineStatus(false); } - sw->Resize(); - sw->RecalcItems(); + pParent->Resize(); + pParent->RecalcItems(); return 0; } @@ -922,34 +931,54 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec ) void ScMultiTextWnd::Resize() { Window *w=GetParent()->GetParent(); - ScInputWindow *sw; - sw=dynamic_cast<ScInputWindow*>(w); + ScInputWindow *pParent; + pParent=dynamic_cast<ScInputWindow*>(w); + + if(pParent==NULL) + { + OSL_FAIL("The parent window pointer pParent is null"); + return; + } long nWidth = GetParent()->GetSizePixel().Width(); long nLeft = GetPosPixel().X(); Size cSize = GetSizePixel(); cSize.Width() = Max( ((long)(nWidth - nLeft - 3*LEFT_OFFSET)), (long)0 ); - if(sw->GetMultiLineStatus()) + if(pParent->GetMultiLineStatus()) { cSize.Height()=3*TBX_WINDOW_HEIGHT; + + if (pEditView) + { + + Size aSize = GetOutputSizePixel(); + Size bSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0))); + int nDiff=(aSize.Height()-bSize.Height())/2; + Point aPos(TEXT_STARTPOS,4); + Point aPos2(aSize.Width()-5,50); + pEditView->SetOutputArea( + PixelToLogic(Rectangle(aPos, aPos2))); + } } else { cSize.Height()=TBX_WINDOW_HEIGHT; + + if (pEditView) + { + Size aSize = GetOutputSizePixel(); + Size bSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0))); + int nDiff=(aSize.Height()-bSize.Height())/2; + Point aPos(TEXT_STARTPOS,nDiff*aSize.Height()/aSize.Height()); + Point aPos2(aSize.Width()-5,(aSize.Height()-nDiff)*aSize.Height()/aSize.Height()); + pEditView->SetOutputArea( + PixelToLogic(Rectangle(aPos, aPos2))); + } } SetSizePixel(cSize); - if (pEditView) - { - Size aSize = GetOutputSizePixel(); - Size bSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0))); - int nDiff=(aSize.Height()-bSize.Height())/2; - Point aPos(TEXT_STARTPOS,nDiff*aSize.Height()/aSize.Height()); - Point aPos2(aSize.Width()-5,(aSize.Height()-nDiff)*aSize.Height()/aSize.Height()); - pEditView->SetOutputArea( - PixelToLogic(Rectangle(aPos, aPos2))); - } + } -- 1.7.0.4
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice