[Libreoffice-commits] core.git: filter/source

Caolán McNamara caolanm at redhat.com
Mon Mar 20 09:00:16 UTC 2017


 filter/source/config/cache/filtercache.cxx |   78 +++++++++++++++--------------
 1 file changed, 41 insertions(+), 37 deletions(-)

New commits:
commit 91e6638708c3a615f19b9018fd57e5d7a09fd08d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 20 08:59:05 2017 +0000

    ofz#912 support avoiding config
    
    Change-Id: I10bef028badc1a3d1d96adaa1757fa7d9c6d2dc8

diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 1065eb1bcb73..1b1f53232ccf 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -45,6 +45,7 @@
 
 #include <o3tl/make_unique.hxx>
 
+#include <unotools/configmgr.hxx>
 #include <unotools/configpaths.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/uri.hxx>
@@ -902,49 +903,52 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess
 
     css::uno::Reference< css::uno::XInterface > xCfg;
 
-    try
+    if (!utl::ConfigManager::IsAvoidConfig())
     {
-        css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider(
-            css::configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ) );
+        try
+        {
+            css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider(
+                css::configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ) );
 
-        ::std::vector< css::uno::Any > lParams;
-        css::beans::NamedValue aParam;
+            ::std::vector< css::uno::Any > lParams;
+            css::beans::NamedValue aParam;
 
-        // set root path
-        aParam.Name = "nodepath";
-        aParam.Value <<= sRoot;
-        lParams.push_back(css::uno::makeAny(aParam));
+            // set root path
+            aParam.Name = "nodepath";
+            aParam.Value <<= sRoot;
+            lParams.push_back(css::uno::makeAny(aParam));
 
-        // enable "all locales mode" ... if required
-        if (bLocalesMode)
+            // enable "all locales mode" ... if required
+            if (bLocalesMode)
+            {
+                aParam.Name = "locale";
+                aParam.Value <<= OUString("*");
+                lParams.push_back(css::uno::makeAny(aParam));
+            }
+
+            // open it
+            if (bReadOnly)
+                xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONACCESS,
+                        comphelper::containerToSequence(lParams));
+            else
+                xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONUPDATEACCESS,
+                        comphelper::containerToSequence(lParams));
+
+            // If configuration could not be opened ... but factory method does not throwed an exception
+            // trigger throwing of our own CorruptedFilterConfigurationException.
+            // Let message empty. The normal exception text show enough information to the user.
+            if (! xCfg.is())
+                throw css::uno::Exception(
+                        "Got NULL reference on opening configuration file ... but no exception.",
+                        css::uno::Reference< css::uno::XInterface >());
+        }
+        catch(const css::uno::Exception& ex)
         {
-            aParam.Name = "locale";
-            aParam.Value <<= OUString("*");
-            lParams.push_back(css::uno::makeAny(aParam));
+            throw css::document::CorruptedFilterConfigurationException(
+                    "filter configuration, caught: " + ex.Message,
+                    css::uno::Reference< css::uno::XInterface >(),
+                    ex.Message);
         }
-
-        // open it
-        if (bReadOnly)
-            xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONACCESS,
-                    comphelper::containerToSequence(lParams));
-        else
-            xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONUPDATEACCESS,
-                    comphelper::containerToSequence(lParams));
-
-        // If configuration could not be opened ... but factory method does not throwed an exception
-        // trigger throwing of our own CorruptedFilterConfigurationException.
-        // Let message empty. The normal exception text show enough information to the user.
-        if (! xCfg.is())
-            throw css::uno::Exception(
-                    "Got NULL reference on opening configuration file ... but no exception.",
-                    css::uno::Reference< css::uno::XInterface >());
-    }
-    catch(const css::uno::Exception& ex)
-    {
-        throw css::document::CorruptedFilterConfigurationException(
-                "filter configuration, caught: " + ex.Message,
-                css::uno::Reference< css::uno::XInterface >(),
-                ex.Message);
     }
 
     return xCfg;


More information about the Libreoffice-commits mailing list