[Libreoffice-commits] core.git: canvas/source
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 28 14:00:36 UTC 2019
canvas/source/factory/cf_service.cxx | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
New commits:
commit 1ff55a4409f088ab5665e63fc1b429553c27ace6
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sat May 25 10:22:25 2019 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue May 28 15:59:44 2019 +0200
Log used / selected canvas service
Change-Id: If62dcbffe6514966418bbf78ef3392cc3219f159
Reviewed-on: https://gerrit.libreoffice.org/73074
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
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
More information about the Libreoffice-commits
mailing list