diff --git a/canvas/Library_canvasfactory.mk b/canvas/Library_canvasfactory.mk index d3992fcc84d5..8f7f606a04d2 100644 --- a/canvas/Library_canvasfactory.mk +++ b/canvas/Library_canvasfactory.mk @@ -29,6 +29,7 @@ $(eval $(call gb_Library_use_libraries,canvasfactory,\ cppu \ cppuhelper \ sal \ + utl \ vcl \ $(gb_UWINAPI) \ )) diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index e0fc9e9448f5..c0f57e906b16 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -43,6 +43,7 @@ #if HAVE_FEATURE_OPENGL #include #endif +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -123,76 +124,79 @@ CanvasFactory::CanvasFactory( Reference const & xContext ) : m_bCacheHasUseAcceleratedEntry(), m_bCacheHasUseAAEntry() { - try + if (!utl::ConfigManager::IsAvoidConfig()) { - // read out configuration for preferred services: - Reference xConfigProvider( - configuration::theDefaultProvider::get( m_xContext ) ); - - Any propValue( - Any( beans::PropertyValue( - "nodepath", -1, - Any( OUString("/org.openoffice.Office.Canvas") ), - beans::PropertyState_DIRECT_VALUE ) ) ); - - m_xCanvasConfigNameAccess.set( - xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", - Sequence( &propValue, 1 ) ), - UNO_QUERY_THROW ); - - propValue <<= - beans::PropertyValue( - "nodepath", -1, - Any( OUString("/org.openoffice.Office.Canvas/CanvasServiceList") ), - beans::PropertyState_DIRECT_VALUE ); - - Reference xNameAccess( - xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", - Sequence( &propValue, 1 ) ), UNO_QUERY_THROW ); - Reference xHierarchicalNameAccess( - xNameAccess, UNO_QUERY_THROW); - - Sequence serviceNames = xNameAccess->getElementNames(); - const OUString* pCurr = serviceNames.getConstArray(); - const OUString* const pEnd = pCurr + serviceNames.getLength(); - while( pCurr != pEnd ) + try { - Reference xEntryNameAccess( - xHierarchicalNameAccess->getByHierarchicalName(*pCurr), - UNO_QUERY ); + // read out configuration for preferred services: + Reference xConfigProvider( + configuration::theDefaultProvider::get( m_xContext ) ); - if( xEntryNameAccess.is() ) + Any propValue( + Any( beans::PropertyValue( + "nodepath", -1, + Any( OUString("/org.openoffice.Office.Canvas") ), + beans::PropertyState_DIRECT_VALUE ) ) ); + + m_xCanvasConfigNameAccess.set( + xConfigProvider->createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", + Sequence( &propValue, 1 ) ), + UNO_QUERY_THROW ); + + propValue <<= + beans::PropertyValue( + "nodepath", -1, + Any( OUString("/org.openoffice.Office.Canvas/CanvasServiceList") ), + beans::PropertyState_DIRECT_VALUE ); + + Reference xNameAccess( + xConfigProvider->createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", + Sequence( &propValue, 1 ) ), UNO_QUERY_THROW ); + Reference xHierarchicalNameAccess( + xNameAccess, UNO_QUERY_THROW); + + Sequence serviceNames = xNameAccess->getElementNames(); + const OUString* pCurr = serviceNames.getConstArray(); + const OUString* const pEnd = pCurr + serviceNames.getLength(); + while( pCurr != pEnd ) { - Sequence implementationList; - if( (xEntryNameAccess->getByName("PreferredImplementations") >>= implementationList) ) + Reference xEntryNameAccess( + xHierarchicalNameAccess->getByHierarchicalName(*pCurr), + UNO_QUERY ); + + if( xEntryNameAccess.is() ) { - m_aAvailableImplementations.push_back( std::make_pair(*pCurr,implementationList) ); - } - if( (xEntryNameAccess->getByName("AcceleratedImplementations") >>= implementationList) ) - { - m_aAcceleratedImplementations.push_back( std::make_pair(*pCurr,implementationList) ); - } - if( (xEntryNameAccess->getByName("AntialiasingImplementations") >>= implementationList) ) - { - m_aAAImplementations.push_back( std::make_pair(*pCurr,implementationList) ); + Sequence implementationList; + if( (xEntryNameAccess->getByName("PreferredImplementations") >>= implementationList) ) + { + m_aAvailableImplementations.push_back( std::make_pair(*pCurr,implementationList) ); + } + if( (xEntryNameAccess->getByName("AcceleratedImplementations") >>= implementationList) ) + { + m_aAcceleratedImplementations.push_back( std::make_pair(*pCurr,implementationList) ); + } + if( (xEntryNameAccess->getByName("AntialiasingImplementations") >>= implementationList) ) + { + m_aAAImplementations.push_back( std::make_pair(*pCurr,implementationList) ); + } + } + ++pCurr; } - - ++pCurr; + } + catch (const RuntimeException &) + { + throw; + } + catch (const Exception&) + { } } - catch (const RuntimeException &) - { - throw; - } - catch (const Exception&) - { - } - if( m_aAvailableImplementations.empty() ) + if (m_aAvailableImplementations.empty()) { // Ugh. Looks like configuration is borked. Fake minimal // setup.