Make use of new-style AccessBridge ctor

Change-Id: I9239fb1c8b139ee2bdb27cdf55222d54e488f6d5
This commit is contained in:
Stephan Bergmann
2013-03-08 15:37:56 +01:00
parent f6c8220f5c
commit c78f40a6d8
3 changed files with 27 additions and 40 deletions

View File

@@ -41,6 +41,7 @@
#include "xconnection.hxx" #include "xconnection.hxx"
#include "com/sun/star/lang/XComponent.hpp"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
@@ -339,7 +340,7 @@ struct ImplSVData
oslThreadIdentifier mnMainThreadId; oslThreadIdentifier mnMainThreadId;
rtl::Reference< vcl::DisplayConnection > mxDisplayConnection; rtl::Reference< vcl::DisplayConnection > mxDisplayConnection;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxAccessBridge; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxAccessBridge;
::vcl::SettingsConfigItem* mpSettingsConfigItem; ::vcl::SettingsConfigItem* mpSettingsConfigItem;
std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList; std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList;
boost::unordered_map< int, rtl::OUString >* mpPaperNames; boost::unordered_map< int, rtl::OUString >* mpPaperNames;

View File

@@ -45,7 +45,7 @@
#include "salsys.hxx" #include "salsys.hxx"
#include "svids.hrc" #include "svids.hrc"
#include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/accessibility/AccessBridge.hpp"
#include "com/sun/star/awt/XExtendedToolkit.hpp" #include "com/sun/star/awt/XExtendedToolkit.hpp"
#include "com/sun/star/java/JavaNotConfiguredException.hpp" #include "com/sun/star/java/JavaNotConfiguredException.hpp"
#include "com/sun/star/java/JavaVMCreationFailureException.hpp" #include "com/sun/star/java/JavaVMCreationFailureException.hpp"
@@ -303,8 +303,6 @@ bool ImplInitAccessBridge(bool bAllowCancel, bool &rCancelled)
try try
{ {
bool bSuccess = true;
// No error messages when env var is set .. // No error messages when env var is set ..
static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" ); static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" );
if( pEnv && *pEnv ) if( pEnv && *pEnv )
@@ -315,45 +313,34 @@ bool ImplInitAccessBridge(bool bAllowCancel, bool &rCancelled)
ImplSVData* pSVData = ImplGetSVData(); ImplSVData* pSVData = ImplGetSVData();
if( ! pSVData->mxAccessBridge.is() ) if( ! pSVData->mxAccessBridge.is() )
{ {
css::uno::Reference< XMultiServiceFactory > xFactory(comphelper::getProcessServiceFactory()); css::uno::Reference< XComponentContext > xContext(comphelper::getProcessComponentContext());
if( xFactory.is() ) css::uno::Reference< XExtendedToolkit > xToolkit =
css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
// Disable default java error messages on startup, because they were probably unreadable
// for a disabled user. Use native message boxes which are accessible without java support.
// No need to do this when activated by Tools-Options dialog ..
if( bAllowCancel )
{ {
css::uno::Reference< XExtendedToolkit > xToolkit = // customize the java-not-available-interaction-handler entry within the
css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY); // current context when called at startup.
com::sun::star::uno::ContextLayer layer(
new AccessBridgeCurrentContext( com::sun::star::uno::getCurrentContext() ) );
Sequence< Any > arguments(1); pSVData->mxAccessBridge
arguments[0] = makeAny(xToolkit); = css::accessibility::AccessBridge::createWithToolkit(
xContext, xToolkit);
// Disable default java error messages on startup, because they were probably unreadable }
// for a disabled user. Use native message boxes which are accessible without java support. else
// No need to do this when activated by Tools-Options dialog .. {
if( bAllowCancel ) pSVData->mxAccessBridge
{ = css::accessibility::AccessBridge::createWithToolkit(
// customize the java-not-available-interaction-handler entry within the xContext, xToolkit);
// current context when called at startup.
com::sun::star::uno::ContextLayer layer(
new AccessBridgeCurrentContext( com::sun::star::uno::getCurrentContext() ) );
pSVData->mxAccessBridge = xFactory->createInstanceWithArguments(
OUString("com.sun.star.accessibility.AccessBridge"),
arguments
);
}
else
{
pSVData->mxAccessBridge = xFactory->createInstanceWithArguments(
OUString("com.sun.star.accessibility.AccessBridge"),
arguments
);
}
if( !pSVData->mxAccessBridge.is() )
bSuccess = false;
} }
} }
return bSuccess; return true;
} }
catch (const ::com::sun::star::java::JavaNotConfiguredException&) catch (const ::com::sun::star::java::JavaNotConfiguredException&)
{ {

View File

@@ -175,11 +175,10 @@ int ImplSVMain()
// be some events in the AWT EventQueue, which need the SolarMutex which // be some events in the AWT EventQueue, which need the SolarMutex which
// - on the other hand - is destroyed in DeInitVCL(). So empty the queue // - on the other hand - is destroyed in DeInitVCL(). So empty the queue
// here .. // here ..
uno::Reference< lang::XComponent > xComponent(pSVData->mxAccessBridge, uno::UNO_QUERY); if( pSVData->mxAccessBridge.is() )
if( xComponent.is() )
{ {
sal_uLong nCount = Application::ReleaseSolarMutex(); sal_uLong nCount = Application::ReleaseSolarMutex();
xComponent->dispose(); pSVData->mxAccessBridge->dispose();
Application::AcquireSolarMutex(nCount); Application::AcquireSolarMutex(nCount);
pSVData->mxAccessBridge.clear(); pSVData->mxAccessBridge.clear();
} }