summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnurag Jain <anuragjainfzd@gmail.com>2011-08-15 19:14:14 +0530
committerKohei Yoshida <kohei.yoshida@suse.com>2011-08-15 15:19:34 -0400
commit4f78e3ddd5554514df2c6c26c6152dfdbcff8a14 (patch)
tree9dd0833533fb805e93715b434bb67523029292b5
parentd028facc9173094bcb5e9fffc265704e1430abbb (diff)
Implemented new resize logic for textbox. Looks more clean.feature/calc-multiline-input
-rw-r--r--sc/source/ui/app/inputwin.cxx62
1 files changed, 35 insertions, 27 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index f1c2598dd..418d7d818 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -814,9 +814,9 @@ void ScInputBarGroup::Resize()
}
long nWidth = pParent->GetSizePixel().Width();
- long nLeft = GetPosPixel().X();
+ Point aPos = GetPosPixel();
Size aSize = GetSizePixel();
- aSize.Width() = Max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 );
+ aSize.Width() = Max( ((long)(nWidth - aPos.X() - LEFT_OFFSET)), (long)0 );
if(pParent->GetMultiLineStatus())
{
@@ -826,7 +826,7 @@ void ScInputBarGroup::Resize()
{
aSize.Height()=TBX_WINDOW_HEIGHT;
}
- SetSizePixel(aSize);
+ SetPosSizePixel(aPos,aSize);
Invalidate();
aButton.SetPosSizePixel(Point(aSize.Width()-3*LEFT_OFFSET,0),Size(0.5*TBX_WINDOW_HEIGHT,TBX_WINDOW_HEIGHT));
@@ -940,45 +940,53 @@ void ScMultiTextWnd::Resize()
return;
}
+
long nWidth = GetParent()->GetSizePixel().Width();
- long nLeft = GetPosPixel().X();
- Size cSize = GetSizePixel();
- cSize.Width() = Max( ((long)(nWidth - nLeft - 3*LEFT_OFFSET)), (long)0 );
+ Point aPos=GetPosPixel();
+ Size aTextBoxSize = GetSizePixel();
+ aTextBoxSize.Width() = Max( ((long)(nWidth - aPos.X() - 3*LEFT_OFFSET)), (long)0 );
if(pParent->GetMultiLineStatus())
{
- cSize.Height()=3*TBX_WINDOW_HEIGHT;
+ aTextBoxSize.Height()=3*LogicToPixel(Size(0,GetTextHeight())).Height()+8;
- if (pEditView)
+ 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)));
+ Size aOutputSize=GetOutputSizePixel();
+ Size aLineSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
+
+ int nDiff = (aOutputSize.Height() - 3*aLineSize.Height())/2;
+
+ Point aPos1(TEXT_STARTPOS,nDiff);
+ Point aPos2(aOutputSize.Width()-5,aOutputSize.Height()-2);
+
+ pEditView->SetOutputArea(
+ PixelToLogic(Rectangle(aPos1, aPos2)));
+
}
+
}
+
else
{
- cSize.Height()=TBX_WINDOW_HEIGHT;
- if (pEditView)
+ aTextBoxSize.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());
+ Size aOutputSize=GetOutputSizePixel();
+ Size aLineSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
+
+ int nDiff = (aOutputSize.Height() - aLineSize.Height())/2;
+
+ Point aPos1(TEXT_STARTPOS,nDiff);
+ Point aPos2(aOutputSize.Width()-5,(aOutputSize.Height() - nDiff));
pEditView->SetOutputArea(
- PixelToLogic(Rectangle(aPos, aPos2)));
- }
+ PixelToLogic(Rectangle(aPos1, aPos2)));
+ }
+
}
- SetSizePixel(cSize);
-
+ SetPosSizePixel(aPos,aTextBoxSize);
}