summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-05-05 11:54:16 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-05-05 12:27:51 +0200
commitb4107411900f5bb4c215e2d9db09fc2b2b82939b (patch)
treedb49676210a90fbc4dd56213029394a6d128c0ea
parent8f08def4aefc6b92366536fb1fb6620527474129 (diff)
Revert "Move ImplInitAppFontData from Window to Application"
This reverts commit f76026a43acc65465882924796d93e635c35fd90. This brings back the paragraph style and font name combo boxes in Writer. Change-Id: Idb28253797ef842d575fe10537f6e70faa34fe75
-rw-r--r--desktop/inc/app.hxx1
-rw-r--r--desktop/source/app/app.cxx1
-rw-r--r--include/vcl/svapp.hxx32
-rw-r--r--include/vcl/window.hxx2
-rw-r--r--vcl/source/app/svapp.cxx52
-rw-r--r--vcl/source/outdev/map.cxx11
-rw-r--r--vcl/source/window/window.cxx48
7 files changed, 76 insertions, 71 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 8b8affe06a04..67fc3fbd27a1 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -128,7 +128,6 @@ class Desktop : public Application
// throws an exception upon failure
private:
-
void RegisterServices(
css::uno::Reference< css::uno::XComponentContext > const & context);
void DeregisterServices();
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 5f4b3bbad302..377afc7f85c2 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1493,7 +1493,6 @@ int Desktop::Main()
the main thread is not yet in the event loop.
*/
Application::GetDefaultDevice();
- InitAppFontData();
#if HAVE_FEATURE_EXTENSIONS
// Check if bundled or shared extensions were added /removed
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index ddf5c63cf7ac..1b8f6e1deab0 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -265,12 +265,6 @@ public:
*/
virtual void Init();
-protected:
- /** Initialize font data for the application.
- */
- virtual void InitAppFontData();
-
-public:
/** Finish initialization of the application.
@see Init, DeInit
@@ -354,7 +348,7 @@ public:
@returns true if exited successfully, false if not able to fully exit
*/
- virtual bool QueryExit();
+ virtual bool QueryExit();
/** Send user event.
@@ -632,7 +626,7 @@ public:
@see IsInExecute, IsInModalMode
*/
- static bool IsInMain();
+ static bool IsInMain();
/** Queries whether the application is in the event loop
@@ -640,7 +634,7 @@ public:
@see IsInMain, IsInModalMode
*/
- static bool IsInExecute();
+ static bool IsInExecute();
/** Queries whether application has a modal dialog active.
@@ -648,7 +642,7 @@ public:
@see IsInMain, IsInExecute
*/
- static bool IsInModalMode();
+ static bool IsInModalMode();
/** Return how many events are being dispatched.
@@ -685,7 +679,7 @@ public:
@returns true if UI is captured, false if not
*/
- static bool IsUICaptured();
+ static bool IsUICaptured();
/** @name Settings
@@ -842,7 +836,7 @@ public:
@see PostKeyEvent
*/
- static bool HandleKey( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyEvent );
+ static bool HandleKey( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyEvent );
/** Send keypress event
@@ -908,7 +902,7 @@ public:
@return true if there is a default window and the event could be posted to it successfully.
*/
- static bool PostUserEvent( sal_uLong& rEventId, const Link& rLink, void* pCaller = NULL );
+ static bool PostUserEvent( sal_uLong& rEventId, const Link& rLink, void* pCaller = NULL );
/** Remove user event based on event ID
@@ -926,7 +920,7 @@ public:
@return true if the handler was inserted successfully, false if it couldn't be inserted.
*/
- static bool InsertIdleHdl( const Link& rLink, sal_uInt16 nPriority );
+ static bool InsertIdleHdl( const Link& rLink, sal_uInt16 nPriority );
/** Remove an idle handler from the application.
@@ -1179,7 +1173,7 @@ public:
@see RemoveAccel
*/
- static bool InsertAccel( Accelerator* pAccel );
+ static bool InsertAccel( Accelerator* pAccel );
/** Remove accelerator
@@ -1203,7 +1197,7 @@ public:
@see EnableAutoMnemonic
*/
- static bool IsAutoMnemonicEnabled();
+ static bool IsAutoMnemonicEnabled();
/** Get the number of reserved key codes used by the application.
@@ -1264,7 +1258,7 @@ public:
@see EnableAutoHelpId
*/
- static bool IsAutoHelpIdEnabled();
+ static bool IsAutoHelpIdEnabled();
///@}
@@ -1322,7 +1316,7 @@ public:
@see GetDialogCancelMode, SetDialogCancelMode
*/
- static bool IsDialogCancelEnabled();
+ static bool IsDialogCancelEnabled();
/** Make a dialog box a system window or not.
@@ -1425,7 +1419,7 @@ public:
@see EnableHeadlessMode, IsHeadlessModeRequested
*/
- static bool IsHeadlessModeEnabled();
+ static bool IsHeadlessModeEnabled();
/** Check command line arguments for \code --headless \endcode
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 9aa9a74cb4e0..001dfd5c1d7c 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -384,6 +384,8 @@ public:
DECL_DLLPRIVATE_LINK( ImplHideOwnerDrawWindowsHdl, void* );
+ SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow );
+
SAL_DLLPRIVATE Window* ImplGetFrameWindow() const;
SalFrame* ImplGetFrame() const;
SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData();
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 0185558141b5..dd213197d482 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,52 +1669,4 @@ 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: */
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 55b0c23adf45..117429dd6364 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -223,6 +223,17 @@ static void ImplCalcMapResolution( const MapMode& rMapMode,
case MAP_APPFONT:
{
ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->maGDIData.mnAppFontX )
+ {
+ if( pSVData->maWinData.mpFirstFrame )
+ Window::ImplInitAppFontData( pSVData->maWinData.mpFirstFrame );
+ else
+ {
+ WorkWindow* pWin = new WorkWindow( NULL, 0 );
+ Window::ImplInitAppFontData( pWin );
+ delete pWin;
+ }
+ }
rMapRes.mnMapScNumX = pSVData->maGDIData.mnAppFontX;
rMapRes.mnMapScDenomX = nDPIX * 40;
rMapRes.mnMapScNumY = pSVData->maGDIData.mnAppFontY;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index d1bc3491d508..2747c4547de1 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -533,6 +533,50 @@ bool Window::HasMirroredGraphics() const
return pOutDev->OutputDevice::HasMirroredGraphics();
}
+void Window::ImplInitAppFontData( Window* pWindow )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ 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;
+}
+
bool Window::ImplCheckUIFont( const Font& rFont )
{
if( ImplGetSVData()->maGDIData.mbNativeFontConfig )
@@ -1154,6 +1198,10 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste
ImplUpdatePos();
+ // calculate app font res (except for the Intro Window or the default window)
+ if ( mpWindowImpl->mbFrame && !pSVData->maGDIData.mnAppFontX && ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN)) )
+ ImplInitAppFontData( this );
+
if ( GetAccessibleParentWindow() && GetParent() != Application::GetDefDialogParent() )
GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDCREATED, this );
}