use more officecfg in CanvasFactory
Change-Id: I3d2b09a0e951a7901af85108537485fdea1dbc43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167640 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
658a212585
commit
6555238fc6
@ -28,6 +28,10 @@ $(eval $(call gb_Library_set_componentfile,canvasfactory,canvas/source/factory/c
|
|||||||
|
|
||||||
$(eval $(call gb_Library_use_external,canvasfactory,boost_headers))
|
$(eval $(call gb_Library_use_external,canvasfactory,boost_headers))
|
||||||
|
|
||||||
|
$(eval $(call gb_Library_use_custom_headers,canvasfactory,\
|
||||||
|
officecfg/registry \
|
||||||
|
))
|
||||||
|
|
||||||
$(eval $(call gb_Library_use_sdk_api,canvasfactory))
|
$(eval $(call gb_Library_use_sdk_api,canvasfactory))
|
||||||
|
|
||||||
$(eval $(call gb_Library_use_libraries,canvasfactory,\
|
$(eval $(call gb_Library_use_libraries,canvasfactory,\
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include <o3tl/string_view.hxx>
|
#include <o3tl/string_view.hxx>
|
||||||
#include <vcl/skia/SkiaHelper.hxx>
|
#include <vcl/skia/SkiaHelper.hxx>
|
||||||
#include <comphelper/configuration.hxx>
|
#include <comphelper/configuration.hxx>
|
||||||
|
#include <officecfg/Office/Canvas.hxx>
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
using namespace ::com::sun::star::uno;
|
using namespace ::com::sun::star::uno;
|
||||||
@ -60,7 +61,6 @@ class CanvasFactory
|
|||||||
|
|
||||||
mutable std::mutex m_mutex;
|
mutable std::mutex m_mutex;
|
||||||
Reference<XComponentContext> m_xContext;
|
Reference<XComponentContext> m_xContext;
|
||||||
Reference<container::XNameAccess> m_xCanvasConfigNameAccess;
|
|
||||||
AvailVector m_aAvailableImplementations;
|
AvailVector m_aAvailableImplementations;
|
||||||
AvailVector m_aAcceleratedImplementations;
|
AvailVector m_aAcceleratedImplementations;
|
||||||
AvailVector m_aAAImplementations;
|
AvailVector m_aAAImplementations;
|
||||||
@ -71,7 +71,7 @@ class CanvasFactory
|
|||||||
|
|
||||||
void checkConfigFlag( bool& r_bFlag,
|
void checkConfigFlag( bool& r_bFlag,
|
||||||
bool& r_CacheFlag,
|
bool& r_CacheFlag,
|
||||||
const OUString& nodeName ) const;
|
bool bCurrentConfigValue ) const;
|
||||||
Reference<XInterface> use(
|
Reference<XInterface> use(
|
||||||
OUString const & serviceName,
|
OUString const & serviceName,
|
||||||
Sequence<Any> const & args,
|
Sequence<Any> const & args,
|
||||||
@ -118,30 +118,12 @@ CanvasFactory::CanvasFactory( Reference<XComponentContext> const & xContext ) :
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// read out configuration for preferred services:
|
// read out configuration for preferred services:
|
||||||
Reference<lang::XMultiServiceFactory> xConfigProvider(
|
|
||||||
configuration::theDefaultProvider::get( m_xContext ) );
|
|
||||||
|
|
||||||
uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
|
Reference<container::XNameAccess> xNameAccess = officecfg::Office::Canvas::CanvasServiceList::get();
|
||||||
{
|
|
||||||
{"nodepath", uno::Any(u"/org.openoffice.Office.Canvas"_ustr)}
|
|
||||||
}));
|
|
||||||
m_xCanvasConfigNameAccess.set(
|
|
||||||
xConfigProvider->createInstanceWithArguments(
|
|
||||||
u"com.sun.star.configuration.ConfigurationAccess"_ustr,
|
|
||||||
aArgs ),
|
|
||||||
UNO_QUERY_THROW );
|
|
||||||
|
|
||||||
uno::Sequence<uno::Any> aArgs2(comphelper::InitAnyPropertySequence(
|
|
||||||
{
|
|
||||||
{"nodepath", uno::Any(u"/org.openoffice.Office.Canvas/CanvasServiceList"_ustr)}
|
|
||||||
}));
|
|
||||||
Reference<container::XNameAccess> xNameAccess(
|
|
||||||
xConfigProvider->createInstanceWithArguments(
|
|
||||||
u"com.sun.star.configuration.ConfigurationAccess"_ustr,
|
|
||||||
aArgs2 ), UNO_QUERY_THROW );
|
|
||||||
Reference<container::XHierarchicalNameAccess> xHierarchicalNameAccess(
|
Reference<container::XHierarchicalNameAccess> xHierarchicalNameAccess(
|
||||||
xNameAccess, UNO_QUERY_THROW);
|
xNameAccess, UNO_QUERY_THROW);
|
||||||
|
|
||||||
|
|
||||||
for (auto& serviceName : xNameAccess->getElementNames())
|
for (auto& serviceName : xNameAccess->getElementNames())
|
||||||
{
|
{
|
||||||
Reference<container::XNameAccess> xEntryNameAccess(
|
Reference<container::XNameAccess> xEntryNameAccess(
|
||||||
@ -253,11 +235,9 @@ Reference<XInterface> CanvasFactory::use(
|
|||||||
|
|
||||||
void CanvasFactory::checkConfigFlag( bool& r_bFlag,
|
void CanvasFactory::checkConfigFlag( bool& r_bFlag,
|
||||||
bool& r_CacheFlag,
|
bool& r_CacheFlag,
|
||||||
const OUString& nodeName ) const
|
bool bCurrentConfigValue ) const
|
||||||
{
|
{
|
||||||
if( m_xCanvasConfigNameAccess.is() )
|
r_bFlag = bCurrentConfigValue;
|
||||||
{
|
|
||||||
m_xCanvasConfigNameAccess->getByName( nodeName ) >>= r_bFlag;
|
|
||||||
|
|
||||||
if( r_CacheFlag != r_bFlag )
|
if( r_CacheFlag != r_bFlag )
|
||||||
{
|
{
|
||||||
@ -266,7 +246,6 @@ void CanvasFactory::checkConfigFlag( bool& r_bFlag,
|
|||||||
r_CacheFlag = r_bFlag;
|
r_CacheFlag = r_bFlag;
|
||||||
m_aCachedImplementations.clear();
|
m_aCachedImplementations.clear();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -280,19 +259,19 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
|
|||||||
bool bForceLastEntry(false);
|
bool bForceLastEntry(false);
|
||||||
checkConfigFlag( bForceLastEntry,
|
checkConfigFlag( bForceLastEntry,
|
||||||
m_bCacheHasForcedLastImpl,
|
m_bCacheHasForcedLastImpl,
|
||||||
u"ForceSafeServiceImpl"_ustr );
|
officecfg::Office::Canvas::ForceSafeServiceImpl::get() );
|
||||||
|
|
||||||
// use anti-aliasing canvas, if config flag set (or not existing)
|
// use anti-aliasing canvas, if config flag set (or not existing)
|
||||||
bool bUseAAEntry(true);
|
bool bUseAAEntry(true);
|
||||||
checkConfigFlag( bUseAAEntry,
|
checkConfigFlag( bUseAAEntry,
|
||||||
m_bCacheHasUseAAEntry,
|
m_bCacheHasUseAAEntry,
|
||||||
u"UseAntialiasingCanvas"_ustr );
|
officecfg::Office::Canvas::UseAntialiasingCanvas::get() );
|
||||||
|
|
||||||
// use accelerated canvas, if config flag set (or not existing)
|
// use accelerated canvas, if config flag set (or not existing)
|
||||||
bool bUseAcceleratedEntry(true);
|
bool bUseAcceleratedEntry(true);
|
||||||
checkConfigFlag( bUseAcceleratedEntry,
|
checkConfigFlag( bUseAcceleratedEntry,
|
||||||
m_bCacheHasUseAcceleratedEntry,
|
m_bCacheHasUseAcceleratedEntry,
|
||||||
u"UseAcceleratedCanvas"_ustr );
|
officecfg::Office::Canvas::UseAcceleratedCanvas::get() );
|
||||||
|
|
||||||
// try to reuse last working implementation for given service name
|
// try to reuse last working implementation for given service name
|
||||||
const CacheVector::iterator aEnd(m_aCachedImplementations.end());
|
const CacheVector::iterator aEnd(m_aCachedImplementations.end());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user