summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-08 08:18:58 +0200
committerNoel Grandin <noel@peralex.com>2013-01-15 09:56:01 +0200
commit54f141882400731e75d25ac137fa516d9093f4fc (patch)
treec79e464168f2faa59a561bbb670d8525df21763b
parent92f14ced5e6f613772792d863a8c2cfeddfdae04 (diff)
fdo#46808, Adapt frame::SessionListener UNO service to new style
The service already existed, it just did not have an IDL file. Change-Id: I88b914995eaa52708c1d51271455478fedb65a63
-rw-r--r--desktop/source/app/app.cxx19
-rw-r--r--framework/inc/services.h1
-rw-r--r--framework/source/services/sessionlistener.cxx6
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/frame/SessionListener.idl44
5 files changed, 59 insertions, 12 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index fc8248b65de9..96010c91bf9d 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -36,6 +36,7 @@
#include <svtools/javacontext.hxx>
#include <com/sun/star/frame/AutoRecovery.hpp>
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
+#include <com/sun/star/frame/SessionListener.hpp>
#include <com/sun/star/frame/XSessionManagerListener.hpp>
#include <com/sun/star/frame/XSynchronousDispatch.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
@@ -2325,20 +2326,20 @@ void Desktop::OpenClients()
}
}
- Reference< XInitialization > xSessionListener;
+ Reference< XSessionManagerListener2 > xSessionListener;
try
{
- xSessionListener = Reference< XInitialization >(::comphelper::getProcessServiceFactory()->createInstance(
- OUString("com.sun.star.frame.SessionListener")), UNO_QUERY_THROW);
-
// specifies whether the UI-interaction on Session shutdown is allowed
sal_Bool bAllowUI = isUIOnSessionShutdownAllowed();
- css::beans::NamedValue aProperty( ::rtl::OUString( "AllowUserInteractionOnQuit" ),
- css::uno::makeAny( bAllowUI ) );
- css::uno::Sequence< css::uno::Any > aArgs( 1 );
- aArgs[0] <<= aProperty;
- xSessionListener->initialize( aArgs );
+ xSessionListener = SessionListener::createWithOnQuitFlag(::comphelper::getProcessComponentContext(), bAllowUI);
+
+// css::beans::NamedValue aProperty( ::rtl::OUString( "AllowUserInteractionOnQuit" ),
+ // css::uno::makeAny( bAllowUI ) );
+ // css::uno::Sequence< css::uno::Any > aArgs( 1 );
+ // aArgs[0] <<= aProperty;
+
+ // xSessionListener->initialize( aArgs );
}
catch(const com::sun::star::uno::Exception& e)
{
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 38f8f59a4546..3a5496a565ea 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -54,7 +54,6 @@ namespace framework{
#define SERVICENAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.ui.StatusBarFactory" )
#define SERVICENAME_UICATEGORYDESCRIPTION DECLARE_ASCII("com.sun.star.ui.UICategoryDescription" )
#define SERVICENAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.StatusbarControllerFactory" )
-#define SERVICENAME_SESSIONLISTENER DECLARE_ASCII("com.sun.star.frame.SessionListener" )
#define SERVICENAME_STATUSBARCONTROLLER DECLARE_ASCII("com.sun.star.frame.StatusbarController" )
#define SERVICENAME_TABWINFACTORY DECLARE_ASCII("com.sun.star.frame.TabWindowFactory" )
#define SERVICENAME_TABWINDOW DECLARE_ASCII("com.sun.star.frame.TabWindow" )
diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx
index 51f7a398ee86..d9881c0f0ee1 100644
--- a/framework/source/services/sessionlistener.cxx
+++ b/framework/source/services/sessionlistener.cxx
@@ -93,7 +93,7 @@ DEFINE_XTYPEPROVIDER_5(
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE(
SessionListener,
cppu::OWeakObject,
- SERVICENAME_SESSIONLISTENER,
+ "com.sun.star.frame.SessionListener",
IMPLEMENTATIONNAME_SESSIONLISTENER)
DEFINE_INIT_SERVICE(SessionListener,
@@ -195,7 +195,9 @@ void SAL_CALL SessionListener::initialize(const Sequence< Any >& args)
SAL_INFO("fwk.session", "SessionListener::initialize");
OUString aSMgr("com.sun.star.frame.SessionManagerClient");
- if (args.getLength() > 0)
+ if ( (args.getLength() == 1) && (args[0] >>= m_bAllowUserInteractionOnQuit) )
+ ;// do nothing
+ else if (args.getLength() > 0)
{
NamedValue v;
for (int i = 0; i < args.getLength(); i++)
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 3276a7bd8cb3..2b133498317d 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -132,6 +132,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\
MediaTypeDetectionHelper \
ModuleManager \
PopupMenuControllerFactory \
+ SessionListener \
StartModule \
ToolBarControllerFactory \
TaskCreator \
diff --git a/offapi/com/sun/star/frame/SessionListener.idl b/offapi/com/sun/star/frame/SessionListener.idl
new file mode 100644
index 000000000000..5e4d15f3e091
--- /dev/null
+++ b/offapi/com/sun/star/frame/SessionListener.idl
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_frame_SessionListener_idl__
+#define __com_sun_star_frame_SessionListener_idl__
+
+#include <com/sun/star/frame/XSessionManagerListener2.idl>
+
+
+ module com { module sun { module star { module frame {
+
+
+
+/**
+ This was created from it's sole place of use, so it might be incomplete.
+
+ @since LibreOffice 4.1
+*/
+service SessionListener : com::sun::star::frame::XSessionManagerListener2
+{
+ createWithOnQuitFlag([in] boolean AllowUserInteractionOnQuit);
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */