diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-05-25 10:22:25 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-05-28 15:59:44 +0200 |
commit | 1ff55a4409f088ab5665e63fc1b429553c27ace6 (patch) | |
tree | 988fc7791e31f7a86387ccbd9821afaa776ec887 /canvas | |
parent | d3ef215486cfa669cc12543243c7ff5c3004a093 (diff) |
Log used / selected canvas service
Change-Id: If62dcbffe6514966418bbf78ef3392cc3219f159
Reviewed-on: https://gerrit.libreoffice.org/73074
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/factory/cf_service.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index f971df139f31..26be9d34b1c0 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -18,6 +18,7 @@ */ #include <sal/config.h> +#include <sal/log.hxx> #include <algorithm> #include <utility> @@ -30,6 +31,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/lang/XSingleComponentFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/propertysequence.hxx> @@ -447,13 +449,18 @@ Reference<XInterface> CanvasFactory::createInstanceWithArgumentsAndContext( OUString const & preferredOne, Sequence<Any> const & args, Reference<XComponentContext> const & xContext ) { - Reference<XInterface> xCanvas( - lookupAndUse( preferredOne, args, xContext ) ); - if(xCanvas.is()) - return xCanvas; + Reference<XInterface> xCanvas(lookupAndUse(preferredOne, args, xContext)); + if (!xCanvas.is()) + // last resort: try service name directly + xCanvas = use(preferredOne, args, xContext); - // last resort: try service name directly - return use( preferredOne, args, xContext ); + if (xCanvas.is()) + { + Reference<lang::XServiceName> xServiceName(xCanvas, uno::UNO_QUERY); + SAL_INFO("canvas", "using " << (xServiceName.is() ? xServiceName->getServiceName() + : OUString("(unknown)"))); + } + return xCanvas; } // XMultiServiceFactory |