summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorANURAG JAIN <anuragjainfzd@gmail.com>2011-08-04 13:38:26 +0530
committerKohei Yoshida <kohei.yoshida@suse.com>2011-08-04 09:27:26 -0400
commitd028facc9173094bcb5e9fffc265704e1430abbb (patch)
treebe2755f5ad8cf09f8b18888c3b06f572b5406379
parent8b90a7a79520b088e22a383253b3b5486fd7bb7f (diff)
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.
-rw-r--r--sc/source/ui/app/inputwin.cxx83
1 files changed, 56 insertions, 27 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 8566bf986..f1c2598dd 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)));
- }
+
}