Kaydet (Commit) b664d929 authored tarafından Michael Meeks's avatar Michael Meeks

Disable gtk3 at run-time, unless in experimental mode.

üst 55b9dc00
......@@ -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: */
......@@ -57,6 +57,7 @@ class VCL_DLLPUBLIC SalGenericSystem : public SalSystem
static const char *getFrameResName();
static const char *getFrameClassName();
static rtl::OString getFrameResName( SalExtStyle nStyle );
static bool enableExperimentalFeatures();
};
#endif // _SV_GENSYS_H
......
......@@ -33,6 +33,7 @@
#include "rtl/ustrbuf.hxx"
#include "salinst.hxx"
#include "generic/gensys.h"
#include "generic/gendata.hxx"
#include "unx/desktops.hxx"
#include "vcl/printerinfomanager.hxx"
......@@ -52,6 +53,11 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
{
SalInstance* pInst = NULL;
// Disable gtk3 plugin load except in experimental mode for now.
if( rModuleBase.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "gtk3" ) ) &&
!SalGenericSystem::enableExperimentalFeatures() )
return NULL;
OUStringBuffer aModName( 128 );
aModName.appendAscii( SAL_DLLPREFIX"vclplug_" );
aModName.append( rModuleBase );
......
......@@ -39,7 +39,6 @@
#include "vcl/help.hxx"
#include "vcl/print.hxx"
#include "vcl/svapp.hxx"
#include "vcl/unohelp.hxx"
#include "vcl/window.hxx"
#include <gtk/gtk.h>
......@@ -53,7 +52,6 @@
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSpreadsheetView.hpp>
......@@ -180,73 +178,10 @@ lcl_getGtkSalInstance()
return *static_cast<GtkInstance*>(GetGtkSalData()->m_pInstance);
}
bool
lcl_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_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_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;
}
bool
lcl_useSystemPrintDialog()
{
return vcl::useSystemPrintDialog() && lcl_enableExperimentalFeatures()
return vcl::useSystemPrintDialog() && SalGenericSystem::enableExperimentalFeatures()
&& lcl_getGtkSalInstance().getPrintWrapper()->supportsPrinting();
}
......
......@@ -3285,7 +3285,7 @@ gboolean GtkSalFrame::signalMap( GtkWidget *pWidget, GdkEvent*, gpointer frame )
RevertToParent, CurrentTime );
}
#else
(void)pWidget;
(void)pWidget; (void)bSetFocus;
# warning FIXME no set input focus ...
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment