[Libreoffice-commits] core.git: framework/inc framework/source vcl/source

Caolán McNamara caolanm at redhat.com
Wed Aug 19 12:29:00 PDT 2015


 framework/inc/services/desktop.hxx         |    2 -
 framework/source/services/desktop.cxx      |    7 ++-
 vcl/source/app/settings.cxx                |   25 ++++++++++++-
 vcl/source/app/svapp.cxx                   |   10 +++--
 vcl/source/font/PhysicalFontCollection.cxx |   11 +++++-
 vcl/source/outdev/font.cxx                 |   37 ++++++++++++--------
 vcl/source/window/window.cxx               |   52 +++++++++++++++++++----------
 7 files changed, 103 insertions(+), 41 deletions(-)

New commits:
commit f0e90c712b701b2d3b4f4725dfbed8c5ea924b0f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 19 15:27:07 2015 +0100

    for testing allow disabling configmgr for time critical paths
    
    Change-Id: I83396e7c90d3b182f353a77c9bdf06fd17af92a1

diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index dc3d4d7..1d47522 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -409,7 +409,7 @@ class Desktop : private cppu::BaseMutex,
         css::uno::Reference< css::frame::XFrame >                       m_xLastFrame;             /// last target of "loadComponentFromURL()"!
         css::uno::Any                                                   m_aInteractionRequest;
         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_sTitle;
         css::uno::Reference< css::frame::XDispatchRecorderSupplier >    m_xDispatchRecorderSupplier;
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 32add3f..9c2eb1c 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -63,6 +63,7 @@
 #include <vcl/svapp.hxx>
 
 #include <tools/errinf.hxx>
+#include <unotools/configmgr.hxx>
 #include <comphelper/extract.hxx>
 
 namespace framework{
@@ -162,7 +163,6 @@ Desktop::Desktop( const css::uno::Reference< css::uno::XComponentContext >& xCon
         ,   m_xLastFrame            (                                               )
         ,   m_aInteractionRequest   (                                               )
         ,   m_bSuspendQuickstartVeto( false                                     )
-        ,   m_aCommandOptions       (                                               )
         ,   m_sName                 (                                               )
         ,   m_sTitle                (                                               )
         ,   m_xDispatchRecorderSupplier(                                            )
@@ -646,8 +646,11 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL Desktop::queryDispatch( co
     if ( aURL.Protocol.equalsIgnoreAsciiCase(".uno:") )
         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
-    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 >();
     else
     {
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 33674f8..a8fb56a 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -50,6 +50,7 @@
 #include "unotools/localedatawrapper.hxx"
 #include "unotools/collatorwrapper.hxx"
 #include "unotools/confignode.hxx"
+#include "unotools/configmgr.hxx"
 #include "unotools/syslocaleoptions.hxx"
 
 using namespace ::com::sun::star;
@@ -687,7 +688,10 @@ void ImplStyleData::SetStandardStyles()
     vcl::Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
     aStdFont.SetCharSet( osl_getThreadTextEncoding() );
     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;
     maHelpFont                  = aStdFont;
     maMenuFont                  = aStdFont;
@@ -2707,7 +2711,8 @@ ImplAllSettingsData::ImplAllSettingsData()
     mpUILocaleDataWrapper       = NULL;
     mpI18nHelper                = NULL;
     mpUII18nHelper              = NULL;
-    maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
+    if (!utl::ConfigManager::IsAvoidConfig())
+        maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
 }
 
 ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
@@ -2913,16 +2918,26 @@ namespace
 
 bool AllSettings::GetLayoutRTL()
 {
+    if (utl::ConfigManager::IsAvoidConfig())
+        return false;
     return GetConfigLayoutRTL(false);
 }
 
 bool AllSettings::GetMathLayoutRTL()
 {
+    if (utl::ConfigManager::IsAvoidConfig())
+        return false;
     return GetConfigLayoutRTL(true);
 }
 
 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
     if ( mxData->maLocale.isSystemLocale() )
         mxData->maLocale = mxData->maSysLocale.GetLanguageTag();
@@ -2932,6 +2947,12 @@ const LanguageTag& AllSettings::GetLanguageTag() const
 
 const LanguageTag& AllSettings::GetUILanguageTag() const
 {
+    if (utl::ConfigManager::IsAvoidConfig())
+    {
+        static LanguageTag aRet("en-US");
+        return aRet;
+    }
+
     // the UILocale is never changed
     if ( mxData->maUILocale.isSystemLocale() )
         mxData->maUILocale = mxData->maSysLocale.GetUILanguageTag();
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 265d0b2..2c8f41d 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -33,7 +33,8 @@
 
 #include "i18nlangtag/mslangid.hxx"
 
-#include "unotools/syslocaleoptions.hxx"
+#include <unotools/configmgr.hxx>
+#include <unotools/syslocaleoptions.hxx>
 
 #include "vcl/settings.hxx"
 #include "vcl/keycod.hxx"
@@ -629,9 +630,12 @@ void Application::InitSettings(ImplSVData* pSVData)
 {
     assert(!pSVData->maAppData.mpSettings && "initialization should not happen twice!");
 
-    pSVData->maAppData.mpCfgListener = new LocaleConfigurationListener;
     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 )
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index dc4c185..8ff985b 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -23,6 +23,7 @@
 #include <vector>
 
 #include <i18nlangtag/mslangid.hxx>
+#include <unotools/configmgr.hxx>
 #include <tools/debug.hxx>
 
 #include <config_graphite.h>
@@ -459,6 +460,9 @@ void PhysicalFontCollection::InitMatchData() const
         return;
     mbMatchData = true;
 
+    if (utl::ConfigManager::IsAvoidConfig())
+        return;
+
     // calculate MatchData for all entries
     const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get();
 
@@ -1175,7 +1179,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
 
     // use font fallback
     const utl::FontNameAttr* pFontAttr = NULL;
-    if( !aSearchName.isEmpty() )
+    if (!aSearchName.isEmpty() && !utl::ConfigManager::IsAvoidConfig())
     {
         // get fallback info using FontSubstConfiguration and
         // 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() )
     {
         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 );
         if( pFoundData )
             return pFoundData;
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index a28ff06..5c1d00d 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -19,6 +19,7 @@
 
 #include "i18nlangtag/mslangid.hxx"
 
+#include <unotools/configmgr.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/print.hxx>
 #include <vcl/outdev.hxx>
@@ -779,22 +780,27 @@ void ImplFontSubstitute( OUString& rFontName )
 vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLang,
                                         GetDefaultFontFlags nFlags, const OutputDevice* pOutDev )
 {
-    if (!pOutDev) // default is NULL
+    if (!pOutDev && !utl::ConfigManager::IsAvoidConfig()) // default is NULL
         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;
+    if (!utl::ConfigManager::IsAvoidConfig())
+    {
+        LanguageTag aLanguageTag(
+                ( eLang == LANGUAGE_NONE || eLang == LANGUAGE_SYSTEM || eLang == LANGUAGE_DONTKNOW ) ?
+                Application::GetSettings().GetUILanguageTag() :
+                LanguageTag( eLang ));
 
-    if( !aDefault.isEmpty() )
-        aSearch = aDefault;
+        utl::DefaultFontConfiguration& rDefaults = utl::DefaultFontConfiguration::get();
+        OUString aDefault = rDefaults.getDefaultFont( aLanguageTag, nType );
+
+        if( !aDefault.isEmpty() )
+            aSearch = aDefault;
+        else
+            aSearch = rDefaults.getUserInterfaceFont( aLanguageTag ); // use the UI font as a fallback
+    }
     else
-        aSearch = rDefaults.getUserInterfaceFont( aLanguageTag ); // use the UI font as a fallback
+        aSearch = "Liberation Serif";
 
     vcl::Font aFont;
     aFont.SetPitch( PITCH_VARIABLE );
@@ -1498,9 +1504,12 @@ void OutputDevice::InitFont() const
     {
         // decide if antialiasing is appropriate
         bool bNonAntialiased(GetAntialiasing() & AntialiasingFlags::DisableText);
-        const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-        bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable);
-        bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontEntry->maFontSelData.mnHeight);
+        if (!utl::ConfigManager::IsAvoidConfig())
+        {
+            const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+            bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable);
+            bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontEntry->maFontSelData.mnHeight);
+        }
         mpFontEntry->maFontSelData.mbNonAntialiased = bNonAntialiased;
 
         // select font in the device layers
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 8a0d521..e112a36 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -22,7 +22,6 @@
 #include <tools/rc.h>
 
 #include <sal/types.h>
-
 #include <vcl/salgtype.hxx>
 #include <vcl/event.hxx>
 #include <vcl/help.hxx>
@@ -65,6 +64,7 @@
 #include <com/sun/star/rendering/CanvasFactory.hpp>
 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
 #include <comphelper/processfactory.hxx>
+#include <unotools/configmgr.hxx>
 
 #include <cassert>
 #include <set>
@@ -1142,7 +1142,8 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
                 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
     mnDPIScaleFactor = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY);
 
-    const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings();
-    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 )
+    if (!utl::ConfigManager::IsAvoidConfig())
     {
-        SetTextColor( rStyleSettings.GetButtonTextColor() );
-        SetBackground( Wallpaper( rStyleSettings.GetFaceColor() ) );
+        const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings();
+        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
     {
-        SetTextColor( rStyleSettings.GetWindowTextColor() );
-        SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
+        mnDPIX          = 96;
+        mnDPIY          = 96;
+        maFont = GetDefaultFont( DefaultFontType::FIXED, LANGUAGE_ENGLISH_US, GetDefaultFontFlags::NONE );
     }
 
+    ImplPointToLogic(*this, maFont);
+
     (void)ImplUpdatePos();
 
     // 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
 {
     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())
     {
@@ -1483,7 +1497,11 @@ void Window::ImplPointToLogic(vcl::RenderContext& rRenderContext, vcl::Font& rFo
 void Window::ImplLogicToPoint(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const
 {
     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())
         aSize = rRenderContext.LogicToPixel(aSize);


More information about the Libreoffice-commits mailing list