summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-01-16 11:55:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-01-16 12:27:09 +0000
commit463f2d4fe211e991d551be67be74cf2090afdb7e (patch)
tree9bd7c3a2d4c7e13bd3b6664cf7e87445c00b8306 /cui
parent3c8d3ef10267fb0a50686f49c15a3e4ab35503d1 (diff)
Related: fdo#59182 make SvxShowText::GetOptimalSize match its SetFont logic
SetFont takes the window size to determine the best font size, so reverse that SetFont logic to get the desired optimal window size. Change-Id: I0d2e35a780552ca52aec20809bcb77d37b6a1bfb
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/cuicharmap.cxx8
-rw-r--r--cui/source/inc/cuicharmap.hxx2
2 files changed, 10 insertions, 0 deletions
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index f457ba390399..c88da88ba719 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -241,6 +241,14 @@ void SvxShowText::SetFont( const Font& rFont )
Invalidate();
}
+Size SvxShowText::GetOptimalSize() const
+{
+ const Font &rFont = GetFont();
+ const Size rFontSize = rFont.GetSize();
+ long nWinHeight = LogicToPixel(rFontSize).Height() * 2;
+ return Size( GetTextWidth( GetText() ) + 2 * 12, nWinHeight );
+}
+
void SvxShowText::Resize()
{
Control::Resize();
diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx
index e2e8e1c2486d..13af57378948 100644
--- a/cui/source/inc/cuicharmap.hxx
+++ b/cui/source/inc/cuicharmap.hxx
@@ -49,6 +49,8 @@ public:
virtual void Resize();
+ virtual Size GetOptimalSize() const;
+
protected:
virtual void Paint( const Rectangle& );