summaryrefslogtreecommitdiff
path: root/vcl/source/app/session.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-06-19 11:28:42 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-06-20 14:44:03 +0200
commite100891fecc777f0d25aef9044373633ae6a34af (patch)
tree09c3649e492d6032db99ec3193eff713524bbe8c /vcl/source/app/session.cxx
parent1cdb792368ed26d58828eead2848422e7dec4c7d (diff)
Some clean up
Change-Id: Ib8ed8c866eece8a57a5532a65d1229e5dd92a422
Diffstat (limited to 'vcl/source/app/session.cxx')
-rw-r--r--vcl/source/app/session.cxx38
1 files changed, 18 insertions, 20 deletions
diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx
index 47a39d87e2b9..0ac6bffe869d 100644
--- a/vcl/source/app/session.cxx
+++ b/vcl/source/app/session.cxx
@@ -26,7 +26,9 @@
*
************************************************************************/
+#include "sal/config.h"
+#include <boost/scoped_ptr.hpp>
#include <cppuhelper/compbase1.hxx>
#include <tools/debug.hxx>
@@ -77,7 +79,7 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient
};
std::list< Listener > m_aListeners;
- SalSession* m_pSession;
+ boost::scoped_ptr< SalSession > m_pSession;
osl::Mutex m_aMutex;
bool m_bInteractionRequested;
bool m_bInteractionGranted;
@@ -86,13 +88,7 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient
static void SalSessionEventProc( void* pData, SalSessionEvent* pEvent );
- void callSaveRequested( bool bShutdown, bool bCancelable );
- void callShutdownCancelled();
- void callInteractionGranted( bool bGranted );
- void callQuit();
-public:
- VCLSession();
- virtual ~VCLSession();
+ virtual ~VCLSession() {}
virtual void SAL_CALL addSessionManagerListener( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
virtual void SAL_CALL removeSessionManagerListener( const css::uno::Reference< XSessionManagerListener>& xListener ) throw( RuntimeException );
@@ -100,25 +96,28 @@ public:
virtual void SAL_CALL interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
virtual void SAL_CALL saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
virtual sal_Bool SAL_CALL cancelShutdown() throw( RuntimeException );
+
+ void callSaveRequested( bool bShutdown, bool bCancelable );
+ void callShutdownCancelled();
+ void callInteractionGranted( bool bGranted );
+ void callQuit();
+
+public:
+ VCLSession();
};
VCLSession::VCLSession()
: cppu::WeakComponentImplHelper1< XSessionManagerClient >( m_aMutex ),
+ m_pSession( ImplGetSVData()->mpDefInst->CreateSalSession() ),
m_bInteractionRequested( false ),
m_bInteractionGranted( false ),
m_bInteractionDone( false ),
m_bSaveDone( false )
{
- m_pSession = ImplGetSVData()->mpDefInst->CreateSalSession();
if( m_pSession )
m_pSession->SetCallback( SalSessionEventProc, this );
}
-VCLSession::~VCLSession()
-{
- delete m_pSession;
-}
-
void VCLSession::callSaveRequested( bool bShutdown, bool bCancelable )
{
std::list< Listener > aListeners;
@@ -138,7 +137,7 @@ void VCLSession::callSaveRequested( bool bShutdown, bool bCancelable )
m_bInteractionDone = false;
// without session we assume UI is always possible,
// so it was reqeusted and granted
- m_bInteractionRequested = m_bInteractionGranted = m_pSession ? false : true;
+ m_bInteractionRequested = m_bInteractionGranted = !m_pSession;
// answer the session manager even if no listeners available anymore
DBG_ASSERT( ! aListeners.empty(), "saveRequested but no listeners !" );
@@ -346,25 +345,24 @@ void SAL_CALL VCLSession::saveDone( const css::uno::Reference< XSessionManagerLi
sal_Bool SAL_CALL VCLSession::cancelShutdown() throw( RuntimeException )
{
- return m_pSession ? (sal_Bool)m_pSession->cancelShutdown() : sal_False;
+ return m_pSession && m_pSession->cancelShutdown();
}
// service implementation
OUString SAL_CALL vcl_session_getImplementationName()
{
- static OUString aImplementationName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.VCLSessionManagerClient" ) );
- return aImplementationName;
+ return OUString( "com.sun.star.frame.VCLSessionManagerClient" );
}
Sequence< rtl::OUString > SAL_CALL vcl_session_getSupportedServiceNames()
{
Sequence< OUString > aRet(1);
- aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.SessionManagerClient"));
+ aRet[0] = "com.sun.star.frame.SessionManagerClient";
return aRet;
}
-css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( const css::uno::Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ )
+css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( SAL_UNUSED_PARAMETER const css::uno::Reference< XMultiServiceFactory > & )
{
return static_cast< cppu::OWeakObject * >(new VCLSession);
}