summaryrefslogtreecommitdiff
path: root/svx/source/dialog
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-01 10:17:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-09-28 08:48:07 +0100
commit792a4cc0f88e97ab210171dd6d0e166eab435f08 (patch)
treeeaedfae842b3d81ec6152381c439b62ee40d87f8 /svx/source/dialog
parentd2c9f39b7dffce9dfabe8ee53d94863738fd68c0 (diff)
implement a basic optimal size for the preview window
Diffstat (limited to 'svx/source/dialog')
-rw-r--r--svx/source/dialog/fntctrl.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 004a88dde4a3..01e884805207 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -338,11 +338,14 @@ Size FontPrevWin_Impl::CalcTextSize( OutputDevice* pWin, OutputDevice* _pPrinter
nAscent = 0;
long nCJKAscent = 0;
long nCTLAscent = 0;
+
do
{
const SvxFont& rFnt = (nScript==com::sun::star::i18n::ScriptType::ASIAN) ? aCJKFont : ((nScript==com::sun::star::i18n::ScriptType::COMPLEX) ? aCTLFont : rFont);
sal_uIntPtr nWidth = rFnt.GetTxtSize( _pPrinter, aText, nStart, nEnd-nStart ).
Width();
+ if (nIdx >= aTextWidth.size())
+ break;
aTextWidth[ nIdx++ ] = nWidth;
nTxtWidth += nWidth;
switch(nScript)
@@ -513,6 +516,7 @@ void SvxFontPrevWindow::Init()
SvxFontPrevWindow::SvxFontPrevWindow( Window* pParent, const ResId& rId ) :
Window( pParent, rId )
{
+ m_aInitialSize = GetSizePixel();
Init();
}
@@ -1482,4 +1486,12 @@ void SvxFontPrevWindow::SetFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp,
Invalidate();
}
+Size SvxFontPrevWindow::GetOptimalSize(WindowSizeType eType) const
+{
+ if (eType == WINDOWSIZE_MAXIMUM)
+ return Window::GetOptimalSize(eType);
+
+ return m_aInitialSize;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */