summaryrefslogtreecommitdiff
path: root/vcl/source/app
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-05-03 23:23:06 +1000
committerChris Sherlock <chris.sherlock79@gmail.com>2014-05-04 06:32:53 +0000
commitf76026a43acc65465882924796d93e635c35fd90 (patch)
tree607708153a16190d6370c5932cce1c116976f18e /vcl/source/app
parente4d61b3c556189bf0733ab6e7bedaf975427a35a (diff)
Move ImplInitAppFontData from Window to Application
I have renamed ImplInitAppFontData to InitAppFontData and moved it from Window to Application. This is because this is something that sets *application* global variables, it just so happens it gets it from a Window parameter. But it should be set when the application starts, so I have moved it to Main(). Change-Id: I9d98aa5b533166f91352218af267930034648c7a Reviewed-on: https://gerrit.libreoffice.org/9242 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'vcl/source/app')
-rw-r--r--vcl/source/app/svapp.cxx52
1 files changed, 50 insertions, 2 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index dd213197d482..0185558141b5 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -322,12 +322,12 @@ void Application::Abort( const OUString& rErrorText )
SalAbort( rErrorText, dumpCore );
}
-sal_uLong Application::GetReservedKeyCodeCount()
+sal_uLong Application::GetReservedKeyCodeCount()
{
return ImplReservedKeys::get()->second;
}
-const KeyCode* Application::GetReservedKeyCode( sal_uLong i )
+const KeyCode* Application::GetReservedKeyCode( sal_uLong i )
{
if( i >= GetReservedKeyCodeCount() )
return NULL;
@@ -1669,4 +1669,52 @@ Application::createFolderPicker( const Reference< uno::XComponentContext >& xSM
return pSVData->mpDefInst->createFolderPicker( xSM );
}
+void Application::InitAppFontData()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ Window *pWindow = pSVData->mpDefaultWin;
+
+ long nTextHeight = pWindow->GetTextHeight();
+ long nTextWidth = pWindow->approximate_char_width() * 8;
+ long nSymHeight = nTextHeight*4;
+ // Make the basis wider if the font is too narrow
+ // such that the dialog looks symmetrical and does not become too narrow.
+ // Add some extra space when the dialog has the same width,
+ // as a little more space is better.
+ if ( nSymHeight > nTextWidth )
+ nTextWidth = nSymHeight;
+ else if ( nSymHeight+5 > nTextWidth )
+ nTextWidth = nSymHeight+5;
+ pSVData->maGDIData.mnAppFontX = nTextWidth * 10 / 8;
+ pSVData->maGDIData.mnAppFontY = nTextHeight * 10;
+
+ // FIXME: this is currently only on OS X, check with other
+ // platforms
+ if( pSVData->maNWFData.mbNoFocusRects )
+ {
+ // try to find out whether there is a large correction
+ // of control sizes, if yes, make app font scalings larger
+ // so dialog positioning is not completely off
+ ImplControlValue aControlValue;
+ Rectangle aCtrlRegion( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) );
+ Rectangle aBoundingRgn( aCtrlRegion );
+ Rectangle aContentRgn( aCtrlRegion );
+ if( pWindow->GetNativeControlRegion( CTRL_EDITBOX, PART_ENTIRE_CONTROL, aCtrlRegion,
+ CTRL_STATE_ENABLED, aControlValue, OUString(),
+ aBoundingRgn, aContentRgn ) )
+ {
+ // comment: the magical +6 is for the extra border in bordered
+ // (which is the standard) edit fields
+ if( aContentRgn.GetHeight() - nTextHeight > (nTextHeight+4)/4 )
+ pSVData->maGDIData.mnAppFontY = (aContentRgn.GetHeight()-4) * 10;
+ }
+ }
+
+ pSVData->maGDIData.mnRealAppFontX = pSVData->maGDIData.mnAppFontX;
+ if ( pSVData->maAppData.mnDialogScaleX )
+ pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*pSVData->maAppData.mnDialogScaleX)/100;
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */