for testing allow disabling configmgr for time critical paths

Change-Id: I83396e7c90d3b182f353a77c9bdf06fd17af92a1
This commit is contained in:
Caolán McNamara 2015-08-19 15:27:07 +01:00
parent b274176238
commit f0e90c712b
7 changed files with 103 additions and 41 deletions

View File

@ -409,7 +409,7 @@ class Desktop : private cppu::BaseMutex,
css::uno::Reference< css::frame::XFrame > m_xLastFrame; /// last target of "loadComponentFromURL()"! css::uno::Reference< css::frame::XFrame > m_xLastFrame; /// last target of "loadComponentFromURL()"!
css::uno::Any m_aInteractionRequest; css::uno::Any m_aInteractionRequest;
bool m_bSuspendQuickstartVeto; /// don't ask quickstart for a veto bool m_bSuspendQuickstartVeto; /// don't ask quickstart for a veto
SvtCommandOptions m_aCommandOptions; /// ref counted class to support disabling commands defined by configuration file std::unique_ptr<SvtCommandOptions> m_xCommandOptions; /// ref counted class to support disabling commands defined by configuration file
OUString m_sName; OUString m_sName;
OUString m_sTitle; OUString m_sTitle;
css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier; css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier;

View File

@ -63,6 +63,7 @@
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <tools/errinf.hxx> #include <tools/errinf.hxx>
#include <unotools/configmgr.hxx>
#include <comphelper/extract.hxx> #include <comphelper/extract.hxx>
namespace framework{ namespace framework{
@ -162,7 +163,6 @@ Desktop::Desktop( const css::uno::Reference< css::uno::XComponentContext >& xCon
, m_xLastFrame ( ) , m_xLastFrame ( )
, m_aInteractionRequest ( ) , m_aInteractionRequest ( )
, m_bSuspendQuickstartVeto( false ) , m_bSuspendQuickstartVeto( false )
, m_aCommandOptions ( )
, m_sName ( ) , m_sName ( )
, m_sTitle ( ) , m_sTitle ( )
, m_xDispatchRecorderSupplier( ) , m_xDispatchRecorderSupplier( )
@ -646,8 +646,11 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL Desktop::queryDispatch( co
if ( aURL.Protocol.equalsIgnoreAsciiCase(".uno:") ) if ( aURL.Protocol.equalsIgnoreAsciiCase(".uno:") )
aCommand = aURL.Path; aCommand = aURL.Path;
if (!m_xCommandOptions && !utl::ConfigManager::IsAvoidConfig())
m_xCommandOptions.reset(new SvtCommandOptions);
// Make std::unordered_map lookup if the current URL is in the disabled list // Make std::unordered_map lookup if the current URL is in the disabled list
if ( m_aCommandOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aCommand ) ) if (m_xCommandOptions && m_xCommandOptions->Lookup(SvtCommandOptions::CMDOPTION_DISABLED, aCommand))
return css::uno::Reference< css::frame::XDispatch >(); return css::uno::Reference< css::frame::XDispatch >();
else else
{ {

View File

@ -50,6 +50,7 @@
#include "unotools/localedatawrapper.hxx" #include "unotools/localedatawrapper.hxx"
#include "unotools/collatorwrapper.hxx" #include "unotools/collatorwrapper.hxx"
#include "unotools/confignode.hxx" #include "unotools/confignode.hxx"
#include "unotools/configmgr.hxx"
#include "unotools/syslocaleoptions.hxx" #include "unotools/syslocaleoptions.hxx"
using namespace ::com::sun::star; using namespace ::com::sun::star;
@ -687,7 +688,10 @@ void ImplStyleData::SetStandardStyles()
vcl::Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) ); vcl::Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
aStdFont.SetCharSet( osl_getThreadTextEncoding() ); aStdFont.SetCharSet( osl_getThreadTextEncoding() );
aStdFont.SetWeight( WEIGHT_NORMAL ); aStdFont.SetWeight( WEIGHT_NORMAL );
aStdFont.SetName( utl::DefaultFontConfiguration::get().getUserInterfaceFont( LanguageTag("en")) ); if (!utl::ConfigManager::IsAvoidConfig())
aStdFont.SetName(utl::DefaultFontConfiguration::get().getUserInterfaceFont(LanguageTag("en")));
else
aStdFont.SetName("Liberation Serif");
maAppFont = aStdFont; maAppFont = aStdFont;
maHelpFont = aStdFont; maHelpFont = aStdFont;
maMenuFont = aStdFont; maMenuFont = aStdFont;
@ -2707,7 +2711,8 @@ ImplAllSettingsData::ImplAllSettingsData()
mpUILocaleDataWrapper = NULL; mpUILocaleDataWrapper = NULL;
mpI18nHelper = NULL; mpI18nHelper = NULL;
mpUII18nHelper = NULL; mpUII18nHelper = NULL;
maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() ); if (!utl::ConfigManager::IsAvoidConfig())
maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
} }
ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) : ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
@ -2913,16 +2918,26 @@ namespace
bool AllSettings::GetLayoutRTL() bool AllSettings::GetLayoutRTL()
{ {
if (utl::ConfigManager::IsAvoidConfig())
return false;
return GetConfigLayoutRTL(false); return GetConfigLayoutRTL(false);
} }
bool AllSettings::GetMathLayoutRTL() bool AllSettings::GetMathLayoutRTL()
{ {
if (utl::ConfigManager::IsAvoidConfig())
return false;
return GetConfigLayoutRTL(true); return GetConfigLayoutRTL(true);
} }
const LanguageTag& AllSettings::GetLanguageTag() const const LanguageTag& AllSettings::GetLanguageTag() const
{ {
if (utl::ConfigManager::IsAvoidConfig())
{
static LanguageTag aRet("en-US");
return aRet;
}
// SYSTEM locale means: use settings from SvtSysLocale that is resolved // SYSTEM locale means: use settings from SvtSysLocale that is resolved
if ( mxData->maLocale.isSystemLocale() ) if ( mxData->maLocale.isSystemLocale() )
mxData->maLocale = mxData->maSysLocale.GetLanguageTag(); mxData->maLocale = mxData->maSysLocale.GetLanguageTag();
@ -2932,6 +2947,12 @@ const LanguageTag& AllSettings::GetLanguageTag() const
const LanguageTag& AllSettings::GetUILanguageTag() const const LanguageTag& AllSettings::GetUILanguageTag() const
{ {
if (utl::ConfigManager::IsAvoidConfig())
{
static LanguageTag aRet("en-US");
return aRet;
}
// the UILocale is never changed // the UILocale is never changed
if ( mxData->maUILocale.isSystemLocale() ) if ( mxData->maUILocale.isSystemLocale() )
mxData->maUILocale = mxData->maSysLocale.GetUILanguageTag(); mxData->maUILocale = mxData->maSysLocale.GetUILanguageTag();

View File

@ -33,7 +33,8 @@
#include "i18nlangtag/mslangid.hxx" #include "i18nlangtag/mslangid.hxx"
#include "unotools/syslocaleoptions.hxx" #include <unotools/configmgr.hxx>
#include <unotools/syslocaleoptions.hxx>
#include "vcl/settings.hxx" #include "vcl/settings.hxx"
#include "vcl/keycod.hxx" #include "vcl/keycod.hxx"
@ -629,9 +630,12 @@ void Application::InitSettings(ImplSVData* pSVData)
{ {
assert(!pSVData->maAppData.mpSettings && "initialization should not happen twice!"); assert(!pSVData->maAppData.mpSettings && "initialization should not happen twice!");
pSVData->maAppData.mpCfgListener = new LocaleConfigurationListener;
pSVData->maAppData.mpSettings = new AllSettings(); pSVData->maAppData.mpSettings = new AllSettings();
pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().AddListener( pSVData->maAppData.mpCfgListener ); if (!utl::ConfigManager::IsAvoidConfig())
{
pSVData->maAppData.mpCfgListener = new LocaleConfigurationListener;
pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().AddListener( pSVData->maAppData.mpCfgListener );
}
} }
void Application::NotifyAllWindows( DataChangedEvent& rDCEvt ) void Application::NotifyAllWindows( DataChangedEvent& rDCEvt )

View File

@ -23,6 +23,7 @@
#include <vector> #include <vector>
#include <i18nlangtag/mslangid.hxx> #include <i18nlangtag/mslangid.hxx>
#include <unotools/configmgr.hxx>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <config_graphite.h> #include <config_graphite.h>
@ -459,6 +460,9 @@ void PhysicalFontCollection::InitMatchData() const
return; return;
mbMatchData = true; mbMatchData = true;
if (utl::ConfigManager::IsAvoidConfig())
return;
// calculate MatchData for all entries // calculate MatchData for all entries
const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get(); const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get();
@ -1175,7 +1179,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
// use font fallback // use font fallback
const utl::FontNameAttr* pFontAttr = NULL; const utl::FontNameAttr* pFontAttr = NULL;
if( !aSearchName.isEmpty() ) if (!aSearchName.isEmpty() && !utl::ConfigManager::IsAvoidConfig())
{ {
// get fallback info using FontSubstConfiguration and // get fallback info using FontSubstConfiguration and
// the target name, it's shortened name and family name in that order // the target name, it's shortened name and family name in that order
@ -1199,7 +1203,10 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
if( rFSD.IsSymbolFont() ) if( rFSD.IsSymbolFont() )
{ {
LanguageTag aDefaultLanguageTag( OUString( "en")); LanguageTag aDefaultLanguageTag( OUString( "en"));
aSearchName = utl::DefaultFontConfiguration::get().getDefaultFont( aDefaultLanguageTag, DefaultFontType::SYMBOL ); if (utl::ConfigManager::IsAvoidConfig())
aSearchName = "OpenSymbol";
else
aSearchName = utl::DefaultFontConfiguration::get().getDefaultFont( aDefaultLanguageTag, DefaultFontType::SYMBOL );
PhysicalFontFamily* pFoundData = ImplFindByTokenNames( aSearchName ); PhysicalFontFamily* pFoundData = ImplFindByTokenNames( aSearchName );
if( pFoundData ) if( pFoundData )
return pFoundData; return pFoundData;

View File

@ -19,6 +19,7 @@
#include "i18nlangtag/mslangid.hxx" #include "i18nlangtag/mslangid.hxx"
#include <unotools/configmgr.hxx>
#include <vcl/virdev.hxx> #include <vcl/virdev.hxx>
#include <vcl/print.hxx> #include <vcl/print.hxx>
#include <vcl/outdev.hxx> #include <vcl/outdev.hxx>
@ -779,22 +780,27 @@ void ImplFontSubstitute( OUString& rFontName )
vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLang, vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLang,
GetDefaultFontFlags nFlags, const OutputDevice* pOutDev ) GetDefaultFontFlags nFlags, const OutputDevice* pOutDev )
{ {
if (!pOutDev) // default is NULL if (!pOutDev && !utl::ConfigManager::IsAvoidConfig()) // default is NULL
pOutDev = Application::GetDefaultDevice(); pOutDev = Application::GetDefaultDevice();
LanguageTag aLanguageTag(
( eLang == LANGUAGE_NONE || eLang == LANGUAGE_SYSTEM || eLang == LANGUAGE_DONTKNOW ) ?
Application::GetSettings().GetUILanguageTag() :
LanguageTag( eLang ));
utl::DefaultFontConfiguration& rDefaults = utl::DefaultFontConfiguration::get();
OUString aDefault = rDefaults.getDefaultFont( aLanguageTag, nType );
OUString aSearch; OUString aSearch;
if (!utl::ConfigManager::IsAvoidConfig())
{
LanguageTag aLanguageTag(
( eLang == LANGUAGE_NONE || eLang == LANGUAGE_SYSTEM || eLang == LANGUAGE_DONTKNOW ) ?
Application::GetSettings().GetUILanguageTag() :
LanguageTag( eLang ));
if( !aDefault.isEmpty() ) utl::DefaultFontConfiguration& rDefaults = utl::DefaultFontConfiguration::get();
aSearch = aDefault; OUString aDefault = rDefaults.getDefaultFont( aLanguageTag, nType );
if( !aDefault.isEmpty() )
aSearch = aDefault;
else
aSearch = rDefaults.getUserInterfaceFont( aLanguageTag ); // use the UI font as a fallback
}
else else
aSearch = rDefaults.getUserInterfaceFont( aLanguageTag ); // use the UI font as a fallback aSearch = "Liberation Serif";
vcl::Font aFont; vcl::Font aFont;
aFont.SetPitch( PITCH_VARIABLE ); aFont.SetPitch( PITCH_VARIABLE );
@ -1498,9 +1504,12 @@ void OutputDevice::InitFont() const
{ {
// decide if antialiasing is appropriate // decide if antialiasing is appropriate
bool bNonAntialiased(GetAntialiasing() & AntialiasingFlags::DisableText); bool bNonAntialiased(GetAntialiasing() & AntialiasingFlags::DisableText);
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if (!utl::ConfigManager::IsAvoidConfig())
bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable); {
bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontEntry->maFontSelData.mnHeight); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable);
bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontEntry->maFontSelData.mnHeight);
}
mpFontEntry->maFontSelData.mbNonAntialiased = bNonAntialiased; mpFontEntry->maFontSelData.mbNonAntialiased = bNonAntialiased;
// select font in the device layers // select font in the device layers

View File

@ -22,7 +22,6 @@
#include <tools/rc.h> #include <tools/rc.h>
#include <sal/types.h> #include <sal/types.h>
#include <vcl/salgtype.hxx> #include <vcl/salgtype.hxx>
#include <vcl/event.hxx> #include <vcl/event.hxx>
#include <vcl/help.hxx> #include <vcl/help.hxx>
@ -65,6 +64,7 @@
#include <com/sun/star/rendering/CanvasFactory.hpp> #include <com/sun/star/rendering/CanvasFactory.hpp>
#include <com/sun/star/rendering/XSpriteCanvas.hpp> #include <com/sun/star/rendering/XSpriteCanvas.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <unotools/configmgr.hxx>
#include <cassert> #include <cassert>
#include <set> #include <set>
@ -1142,7 +1142,8 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
mpWindowImpl->meAlwaysInputMode = pParent->mpWindowImpl->meAlwaysInputMode; mpWindowImpl->meAlwaysInputMode = pParent->mpWindowImpl->meAlwaysInputMode;
} }
OutputDevice::SetSettings( pParent->GetSettings() ); if (!utl::ConfigManager::IsAvoidConfig())
OutputDevice::SetSettings( pParent->GetSettings() );
} }
} }
@ -1150,25 +1151,34 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
// setup the scale factor for Hi-DPI displays // setup the scale factor for Hi-DPI displays
mnDPIScaleFactor = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); mnDPIScaleFactor = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY);
const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings(); if (!utl::ConfigManager::IsAvoidConfig())
sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100;
mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100;
maFont = rStyleSettings.GetAppFont();
ImplPointToLogic(*this, maFont);
if ( nStyle & WB_3DLOOK )
{ {
SetTextColor( rStyleSettings.GetButtonTextColor() ); const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings();
SetBackground( Wallpaper( rStyleSettings.GetFaceColor() ) ); sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100;
mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100;
maFont = rStyleSettings.GetAppFont();
if ( nStyle & WB_3DLOOK )
{
SetTextColor( rStyleSettings.GetButtonTextColor() );
SetBackground( Wallpaper( rStyleSettings.GetFaceColor() ) );
}
else
{
SetTextColor( rStyleSettings.GetWindowTextColor() );
SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
}
} }
else else
{ {
SetTextColor( rStyleSettings.GetWindowTextColor() ); mnDPIX = 96;
SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) ); mnDPIY = 96;
maFont = GetDefaultFont( DefaultFontType::FIXED, LANGUAGE_ENGLISH_US, GetDefaultFontFlags::NONE );
} }
ImplPointToLogic(*this, maFont);
(void)ImplUpdatePos(); (void)ImplUpdatePos();
// calculate app font res (except for the Intro Window or the default window) // calculate app font res (except for the Intro Window or the default window)
@ -1458,7 +1468,11 @@ void Window::ImplInitResolutionSettings()
void Window::ImplPointToLogic(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const void Window::ImplPointToLogic(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const
{ {
Size aSize = rFont.GetSize(); Size aSize = rFont.GetSize();
sal_uInt16 nScreenFontZoom = rRenderContext.GetSettings().GetStyleSettings().GetScreenFontZoom(); sal_uInt16 nScreenFontZoom;
if (!utl::ConfigManager::IsAvoidConfig())
nScreenFontZoom = rRenderContext.GetSettings().GetStyleSettings().GetScreenFontZoom();
else
nScreenFontZoom = 100;
if (aSize.Width()) if (aSize.Width())
{ {
@ -1483,7 +1497,11 @@ void Window::ImplPointToLogic(vcl::RenderContext& rRenderContext, vcl::Font& rFo
void Window::ImplLogicToPoint(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const void Window::ImplLogicToPoint(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const
{ {
Size aSize = rFont.GetSize(); Size aSize = rFont.GetSize();
sal_uInt16 nScreenFontZoom = rRenderContext.GetSettings().GetStyleSettings().GetScreenFontZoom(); sal_uInt16 nScreenFontZoom;
if (!utl::ConfigManager::IsAvoidConfig())
nScreenFontZoom = rRenderContext.GetSettings().GetStyleSettings().GetScreenFontZoom();
else
nScreenFontZoom = 100;
if (rRenderContext.IsMapModeEnabled()) if (rRenderContext.IsMapModeEnabled())
aSize = rRenderContext.LogicToPixel(aSize); aSize = rRenderContext.LogicToPixel(aSize);