diff options
author | Michael Meeks <michael.meeks@suse.com> | 2011-12-13 17:52:01 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2011-12-13 17:54:14 +0000 |
commit | b664d9290852f3f4f07ea86f9c2234df6e83b2cf (patch) | |
tree | bd5b61cf3c8eea3f5f67bd2bc0ded7fd81743cb1 /vcl/generic | |
parent | 55b9dc002a7ffbf5d3abdece74a09029e2da94a5 (diff) |
Disable gtk3 at run-time, unless in experimental mode.
Diffstat (limited to 'vcl/generic')
-rw-r--r-- | vcl/generic/app/gensys.cxx | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/vcl/generic/app/gensys.cxx b/vcl/generic/app/gensys.cxx index 2fae4840bbd2..f7d3f0a8b43a 100644 --- a/vcl/generic/app/gensys.cxx +++ b/vcl/generic/app/gensys.cxx @@ -40,6 +40,13 @@ #include <osl/process.h> #include <osl/thread.h> +#include "vcl/unohelp.hxx" +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +using namespace com::sun::star; + SalGenericSystem::SalGenericSystem() { } @@ -174,4 +181,67 @@ rtl::OString SalGenericSystem::getFrameResName( SalExtStyle nStyle ) return aBuf.makeStringAndClear(); } +bool +SalGenericSystem::enableExperimentalFeatures() +{ + bool bEnable = true; + try + { + // get service provider + uno::Reference<lang::XMultiServiceFactory> const xSMgr(vcl::unohelper::GetMultiServiceFactory()); + // create configuration hierachical access name + if (xSMgr.is()) + { + try + { + uno::Reference<lang::XMultiServiceFactory> const xConfigProvider( + uno::Reference<lang::XMultiServiceFactory>( + xSMgr->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider"))), + uno::UNO_QUERY)) + ; + if (xConfigProvider.is()) + { + uno::Sequence<uno::Any> aArgs(1); + beans::PropertyValue aVal; + aVal.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")); + aVal.Value <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/Misc")); + aArgs.getArray()[0] <<= aVal; + uno::Reference<container::XNameAccess> const xConfigAccess( + uno::Reference<container::XNameAccess>( + xConfigProvider->createInstanceWithArguments( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), + aArgs), + uno::UNO_QUERY)) + ; + if (xConfigAccess.is()) + { + try + { + sal_Bool bValue = sal_False; + uno::Any const aAny(xConfigAccess->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExperimentalMode")))); + if (aAny >>= bValue) + bEnable = bValue; + } + catch (container::NoSuchElementException const&) + { + } + catch (lang::WrappedTargetException const&) + { + } + } + } + } + catch (uno::Exception const&) + { + } + } + } + catch (lang::WrappedTargetException const&) + { + } + + return bEnable; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |