xref: /aoo41x/main/vcl/source/app/session.cxx (revision 9f62ea84)
1*9f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9f62ea84SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9f62ea84SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9f62ea84SAndrew Rist  * distributed with this work for additional information
6*9f62ea84SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9f62ea84SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9f62ea84SAndrew Rist  * "License"); you may not use this file except in compliance
9*9f62ea84SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9f62ea84SAndrew Rist  *
11*9f62ea84SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9f62ea84SAndrew Rist  *
13*9f62ea84SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9f62ea84SAndrew Rist  * software distributed under the License is distributed on an
15*9f62ea84SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9f62ea84SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9f62ea84SAndrew Rist  * specific language governing permissions and limitations
18*9f62ea84SAndrew Rist  * under the License.
19*9f62ea84SAndrew Rist  *
20*9f62ea84SAndrew Rist  *************************************************************/
21*9f62ea84SAndrew Rist 
22*9f62ea84SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <cppuhelper/compbase1.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <tools/debug.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <vcl/svapp.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <svdata.hxx>
34cdf0e10cSrcweir #include <salinst.hxx>
35cdf0e10cSrcweir #include <salsession.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <com/sun/star/frame/XSessionManagerClient.hpp>
38cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39cdf0e10cSrcweir #include <com/sun/star/frame/XSessionManagerListener2.hpp>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <list>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace {
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace css = com::sun::star;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir }
48cdf0e10cSrcweir 
49cdf0e10cSrcweir using namespace com::sun::star::uno;
50cdf0e10cSrcweir using namespace com::sun::star::lang;
51cdf0e10cSrcweir using namespace com::sun::star::frame;
52cdf0e10cSrcweir using namespace rtl;
53cdf0e10cSrcweir 
~SalSession()54cdf0e10cSrcweir SalSession::~SalSession()
55cdf0e10cSrcweir {
56cdf0e10cSrcweir }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient >
59cdf0e10cSrcweir {
60cdf0e10cSrcweir     struct Listener
61cdf0e10cSrcweir     {
62cdf0e10cSrcweir         css::uno::Reference< XSessionManagerListener >		m_xListener;
63cdf0e10cSrcweir         bool										m_bInteractionRequested;
64cdf0e10cSrcweir         bool										m_bInteractionDone;
65cdf0e10cSrcweir         bool										m_bSaveDone;
66cdf0e10cSrcweir 
ListenerVCLSession::Listener67cdf0e10cSrcweir         Listener( const css::uno::Reference< XSessionManagerListener >& xListener )
68cdf0e10cSrcweir                 : m_xListener( xListener ),
69cdf0e10cSrcweir                   m_bInteractionRequested( false ),
70cdf0e10cSrcweir                   m_bInteractionDone( false ),
71cdf0e10cSrcweir                   m_bSaveDone( false )
72cdf0e10cSrcweir         {}
73cdf0e10cSrcweir     };
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     std::list< Listener >							m_aListeners;
76cdf0e10cSrcweir     SalSession*										m_pSession;
77cdf0e10cSrcweir     osl::Mutex										m_aMutex;
78cdf0e10cSrcweir     bool											m_bInteractionRequested;
79cdf0e10cSrcweir     bool											m_bInteractionGranted;
80cdf0e10cSrcweir     bool											m_bInteractionDone;
81cdf0e10cSrcweir     bool											m_bSaveDone;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     static void SalSessionEventProc( SalSessionEvent* pEvent );
84cdf0e10cSrcweir     static VCLSession* pOneInstance;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     void callSaveRequested( bool bShutdown, bool bCancelable );
87cdf0e10cSrcweir     void callShutdownCancelled();
88cdf0e10cSrcweir     void callInteractionGranted( bool bGranted );
89cdf0e10cSrcweir     void callQuit();
90cdf0e10cSrcweir public:
91cdf0e10cSrcweir     VCLSession();
92cdf0e10cSrcweir     virtual ~VCLSession();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     virtual void SAL_CALL addSessionManagerListener( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
95cdf0e10cSrcweir     virtual void SAL_CALL removeSessionManagerListener( const css::uno::Reference< XSessionManagerListener>& xListener ) throw( RuntimeException );
96cdf0e10cSrcweir     virtual void SAL_CALL queryInteraction( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
97cdf0e10cSrcweir     virtual void SAL_CALL interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
98cdf0e10cSrcweir     virtual void SAL_CALL saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException );
99cdf0e10cSrcweir     virtual sal_Bool SAL_CALL cancelShutdown() throw( RuntimeException );
100cdf0e10cSrcweir };
101cdf0e10cSrcweir 
102cdf0e10cSrcweir VCLSession* VCLSession::pOneInstance = NULL;
103cdf0e10cSrcweir 
VCLSession()104cdf0e10cSrcweir VCLSession::VCLSession()
105cdf0e10cSrcweir         : cppu::WeakComponentImplHelper1< XSessionManagerClient >( m_aMutex ),
106cdf0e10cSrcweir           m_bInteractionRequested( false ),
107cdf0e10cSrcweir           m_bInteractionGranted( false ),
108cdf0e10cSrcweir           m_bInteractionDone( false ),
109cdf0e10cSrcweir           m_bSaveDone( false )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir     DBG_ASSERT( pOneInstance == 0, "One instance  of VCLSession only !" );
112cdf0e10cSrcweir     pOneInstance = this;
113cdf0e10cSrcweir     m_pSession = ImplGetSVData()->mpDefInst->CreateSalSession();
114cdf0e10cSrcweir     if( m_pSession )
115cdf0e10cSrcweir         m_pSession->SetCallback( SalSessionEventProc );
116cdf0e10cSrcweir }
117cdf0e10cSrcweir 
~VCLSession()118cdf0e10cSrcweir VCLSession::~VCLSession()
119cdf0e10cSrcweir {
120cdf0e10cSrcweir     DBG_ASSERT( pOneInstance == this, "Another instance of VCLSession in destructor !" );
121cdf0e10cSrcweir     pOneInstance = NULL;
122cdf0e10cSrcweir     delete m_pSession;
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
callSaveRequested(bool bShutdown,bool bCancelable)125cdf0e10cSrcweir void VCLSession::callSaveRequested( bool bShutdown, bool bCancelable )
126cdf0e10cSrcweir {
127cdf0e10cSrcweir     std::list< Listener > aListeners;
128cdf0e10cSrcweir     {
129cdf0e10cSrcweir         osl::MutexGuard aGuard( m_aMutex );
130cdf0e10cSrcweir         // reset listener states
131cdf0e10cSrcweir         for( std::list< Listener >::iterator it = m_aListeners.begin();
132cdf0e10cSrcweir              it != m_aListeners.end(); ++it )
133cdf0e10cSrcweir         {
134cdf0e10cSrcweir             it->m_bSaveDone = it->m_bInteractionRequested = it->m_bInteractionDone = false;
135cdf0e10cSrcweir         }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir         // copy listener list since calling a listener may remove it.
138cdf0e10cSrcweir         aListeners = m_aListeners;
139cdf0e10cSrcweir         // set back interaction state
140cdf0e10cSrcweir         m_bSaveDone = false;
141cdf0e10cSrcweir         m_bInteractionDone = false;
142cdf0e10cSrcweir         // without session we assume UI is always possible,
143cdf0e10cSrcweir         // so it was reqeusted and granted
144cdf0e10cSrcweir         m_bInteractionRequested = m_bInteractionGranted = m_pSession ? false : true;
145cdf0e10cSrcweir 
146cdf0e10cSrcweir         // answer the session manager even if no listeners available anymore
147cdf0e10cSrcweir         DBG_ASSERT( ! aListeners.empty(), "saveRequested but no listeners !" );
148cdf0e10cSrcweir         if( aListeners.empty() )
149cdf0e10cSrcweir         {
150cdf0e10cSrcweir             if( m_pSession )
151cdf0e10cSrcweir                 m_pSession->saveDone();
152cdf0e10cSrcweir             return;
153cdf0e10cSrcweir         }
154cdf0e10cSrcweir     }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
157cdf0e10cSrcweir     for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
158cdf0e10cSrcweir         it->m_xListener->doSave( bShutdown, bCancelable );
159cdf0e10cSrcweir     Application::AcquireSolarMutex( nAcquireCount );
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
callInteractionGranted(bool bInteractionGranted)162cdf0e10cSrcweir void VCLSession::callInteractionGranted( bool bInteractionGranted )
163cdf0e10cSrcweir {
164cdf0e10cSrcweir     std::list< Listener > aListeners;
165cdf0e10cSrcweir     {
166cdf0e10cSrcweir         osl::MutexGuard aGuard( m_aMutex );
167cdf0e10cSrcweir         // copy listener list since calling a listener may remove it.
168cdf0e10cSrcweir         for( std::list< Listener >::const_iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it )
169cdf0e10cSrcweir             if( it->m_bInteractionRequested )
170cdf0e10cSrcweir                 aListeners.push_back( *it );
171cdf0e10cSrcweir 
172cdf0e10cSrcweir         m_bInteractionGranted = bInteractionGranted;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir         // answer the session manager even if no listeners available anymore
175cdf0e10cSrcweir         DBG_ASSERT( ! aListeners.empty(), "interactionGranted but no listeners !" );
176cdf0e10cSrcweir         if( aListeners.empty() )
177cdf0e10cSrcweir         {
178cdf0e10cSrcweir             if( m_pSession )
179cdf0e10cSrcweir                 m_pSession->interactionDone();
180cdf0e10cSrcweir             return;
181cdf0e10cSrcweir         }
182cdf0e10cSrcweir     }
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
185cdf0e10cSrcweir     for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
186cdf0e10cSrcweir         it->m_xListener->approveInteraction( bInteractionGranted );
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     Application::AcquireSolarMutex( nAcquireCount );
189cdf0e10cSrcweir }
190cdf0e10cSrcweir 
callShutdownCancelled()191cdf0e10cSrcweir void VCLSession::callShutdownCancelled()
192cdf0e10cSrcweir {
193cdf0e10cSrcweir     std::list< Listener > aListeners;
194cdf0e10cSrcweir     {
195cdf0e10cSrcweir         osl::MutexGuard aGuard( m_aMutex );
196cdf0e10cSrcweir         // copy listener list since calling a listener may remove it.
197cdf0e10cSrcweir         aListeners = m_aListeners;
198cdf0e10cSrcweir         // set back interaction state
199cdf0e10cSrcweir         m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false;
200cdf0e10cSrcweir     }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir     sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
203cdf0e10cSrcweir     for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
204cdf0e10cSrcweir         it->m_xListener->shutdownCanceled();
205cdf0e10cSrcweir     Application::AcquireSolarMutex( nAcquireCount );
206cdf0e10cSrcweir }
207cdf0e10cSrcweir 
callQuit()208cdf0e10cSrcweir void VCLSession::callQuit()
209cdf0e10cSrcweir {
210cdf0e10cSrcweir     std::list< Listener > aListeners;
211cdf0e10cSrcweir     {
212cdf0e10cSrcweir         osl::MutexGuard aGuard( m_aMutex );
213cdf0e10cSrcweir         // copy listener list since calling a listener may remove it.
214cdf0e10cSrcweir         aListeners = m_aListeners;
215cdf0e10cSrcweir         // set back interaction state
216cdf0e10cSrcweir         m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false;
217cdf0e10cSrcweir     }
218cdf0e10cSrcweir 
219cdf0e10cSrcweir     sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
220cdf0e10cSrcweir     for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
221cdf0e10cSrcweir     {
222cdf0e10cSrcweir         css::uno::Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY );
223cdf0e10cSrcweir         if( xListener2.is() )
224cdf0e10cSrcweir             xListener2->doQuit();
225cdf0e10cSrcweir     }
226cdf0e10cSrcweir     Application::AcquireSolarMutex( nAcquireCount );
227cdf0e10cSrcweir }
228cdf0e10cSrcweir 
SalSessionEventProc(SalSessionEvent * pEvent)229cdf0e10cSrcweir void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent )
230cdf0e10cSrcweir {
231cdf0e10cSrcweir     switch( pEvent->m_eType )
232cdf0e10cSrcweir     {
233cdf0e10cSrcweir         case Interaction:
234cdf0e10cSrcweir         {
235cdf0e10cSrcweir             SalSessionInteractionEvent* pIEv = static_cast<SalSessionInteractionEvent*>(pEvent);
236cdf0e10cSrcweir             pOneInstance->callInteractionGranted( pIEv->m_bInteractionGranted );
237cdf0e10cSrcweir         }
238cdf0e10cSrcweir         break;
239cdf0e10cSrcweir         case SaveRequest:
240cdf0e10cSrcweir         {
241cdf0e10cSrcweir             SalSessionSaveRequestEvent* pSEv = static_cast<SalSessionSaveRequestEvent*>(pEvent);
242cdf0e10cSrcweir             pOneInstance->callSaveRequested( pSEv->m_bShutdown, pSEv->m_bCancelable );
243cdf0e10cSrcweir         }
244cdf0e10cSrcweir         break;
245cdf0e10cSrcweir         case ShutdownCancel:
246cdf0e10cSrcweir             pOneInstance->callShutdownCancelled();
247cdf0e10cSrcweir             break;
248cdf0e10cSrcweir         case Quit:
249cdf0e10cSrcweir             pOneInstance->callQuit();
250cdf0e10cSrcweir             break;
251cdf0e10cSrcweir     }
252cdf0e10cSrcweir }
253cdf0e10cSrcweir 
addSessionManagerListener(const css::uno::Reference<XSessionManagerListener> & xListener)254cdf0e10cSrcweir void SAL_CALL VCLSession::addSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException )
255cdf0e10cSrcweir {
256cdf0e10cSrcweir     osl::MutexGuard aGuard( m_aMutex );
257cdf0e10cSrcweir 
258cdf0e10cSrcweir     m_aListeners.push_back( Listener( xListener ) );
259cdf0e10cSrcweir }
260cdf0e10cSrcweir 
removeSessionManagerListener(const css::uno::Reference<XSessionManagerListener> & xListener)261cdf0e10cSrcweir void SAL_CALL VCLSession::removeSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException )
262cdf0e10cSrcweir {
263cdf0e10cSrcweir     osl::MutexGuard aGuard( m_aMutex );
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     std::list< Listener >::iterator it = m_aListeners.begin();
266cdf0e10cSrcweir     while( it != m_aListeners.end() )
267cdf0e10cSrcweir     {
268cdf0e10cSrcweir         if( it->m_xListener == xListener )
269cdf0e10cSrcweir         {
270cdf0e10cSrcweir             m_aListeners.erase( it );
271cdf0e10cSrcweir             it = m_aListeners.begin();
272cdf0e10cSrcweir         }
273cdf0e10cSrcweir         else
274cdf0e10cSrcweir             ++it;
275cdf0e10cSrcweir     }
276cdf0e10cSrcweir }
277cdf0e10cSrcweir 
queryInteraction(const css::uno::Reference<XSessionManagerListener> & xListener)278cdf0e10cSrcweir void SAL_CALL VCLSession::queryInteraction( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException )
279cdf0e10cSrcweir {
280cdf0e10cSrcweir     if( m_bInteractionGranted )
281cdf0e10cSrcweir     {
282cdf0e10cSrcweir         if( m_bInteractionDone )
283cdf0e10cSrcweir             xListener->approveInteraction( false );
284cdf0e10cSrcweir         else
285cdf0e10cSrcweir             xListener->approveInteraction( true );
286cdf0e10cSrcweir         return;
287cdf0e10cSrcweir     }
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     osl::MutexGuard aGuard( m_aMutex );
290cdf0e10cSrcweir     if( ! m_bInteractionRequested )
291cdf0e10cSrcweir     {
292cdf0e10cSrcweir         m_pSession->queryInteraction();
293cdf0e10cSrcweir         m_bInteractionRequested = true;
294cdf0e10cSrcweir     }
295cdf0e10cSrcweir     for( std::list< Listener >::iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it )
296cdf0e10cSrcweir     {
297cdf0e10cSrcweir         if( it->m_xListener == xListener )
298cdf0e10cSrcweir         {
299cdf0e10cSrcweir             it->m_bInteractionRequested	= true;
300cdf0e10cSrcweir             it->m_bInteractionDone		= false;
301cdf0e10cSrcweir         }
302cdf0e10cSrcweir     }
303cdf0e10cSrcweir }
304cdf0e10cSrcweir 
interactionDone(const css::uno::Reference<XSessionManagerListener> & xListener)305cdf0e10cSrcweir void SAL_CALL VCLSession::interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException )
306cdf0e10cSrcweir {
307cdf0e10cSrcweir     osl::MutexGuard aGuard( m_aMutex );
308cdf0e10cSrcweir     int nRequested = 0, nDone = 0;
309cdf0e10cSrcweir     for( std::list< Listener >::iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it )
310cdf0e10cSrcweir     {
311cdf0e10cSrcweir         if( it->m_bInteractionRequested )
312cdf0e10cSrcweir         {
313cdf0e10cSrcweir             nRequested++;
314cdf0e10cSrcweir             if( xListener == it->m_xListener )
315cdf0e10cSrcweir                 it->m_bInteractionDone = true;
316cdf0e10cSrcweir         }
317cdf0e10cSrcweir         if( it->m_bInteractionDone )
318cdf0e10cSrcweir             nDone++;
319cdf0e10cSrcweir     }
320cdf0e10cSrcweir     if( nDone == nRequested && nDone > 0 )
321cdf0e10cSrcweir     {
322cdf0e10cSrcweir         m_bInteractionDone = true;
323cdf0e10cSrcweir         if( m_pSession )
324cdf0e10cSrcweir             m_pSession->interactionDone();
325cdf0e10cSrcweir     }
326cdf0e10cSrcweir }
327cdf0e10cSrcweir 
saveDone(const css::uno::Reference<XSessionManagerListener> & xListener)328cdf0e10cSrcweir void SAL_CALL VCLSession::saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException )
329cdf0e10cSrcweir {
330cdf0e10cSrcweir     osl::MutexGuard aGuard( m_aMutex );
331cdf0e10cSrcweir 
332cdf0e10cSrcweir     bool bSaveDone = true;
333cdf0e10cSrcweir     for( std::list< Listener >::iterator it = m_aListeners.begin();
334cdf0e10cSrcweir          it != m_aListeners.end(); ++it )
335cdf0e10cSrcweir     {
336cdf0e10cSrcweir         if( it->m_xListener == xListener )
337cdf0e10cSrcweir             it->m_bSaveDone = true;
338cdf0e10cSrcweir         if( ! it->m_bSaveDone )
339cdf0e10cSrcweir             bSaveDone = false;
340cdf0e10cSrcweir     }
341cdf0e10cSrcweir     if( bSaveDone )
342cdf0e10cSrcweir     {
343cdf0e10cSrcweir         m_bSaveDone = true;
344cdf0e10cSrcweir         if( m_pSession )
345cdf0e10cSrcweir             m_pSession->saveDone();
346cdf0e10cSrcweir     }
347cdf0e10cSrcweir }
348cdf0e10cSrcweir 
cancelShutdown()349cdf0e10cSrcweir sal_Bool SAL_CALL VCLSession::cancelShutdown() throw( RuntimeException )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir     return m_pSession ? (sal_Bool)m_pSession->cancelShutdown() : sal_False;
352cdf0e10cSrcweir }
353cdf0e10cSrcweir 
354cdf0e10cSrcweir // service implementation
355cdf0e10cSrcweir 
vcl_session_getImplementationName()356cdf0e10cSrcweir OUString SAL_CALL vcl_session_getImplementationName()
357cdf0e10cSrcweir {
358cdf0e10cSrcweir 	static OUString aImplementationName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.VCLSessionManagerClient" ) );
359cdf0e10cSrcweir 	return aImplementationName;
360cdf0e10cSrcweir }
361cdf0e10cSrcweir 
vcl_session_getSupportedServiceNames()362cdf0e10cSrcweir Sequence< rtl::OUString > SAL_CALL vcl_session_getSupportedServiceNames()
363cdf0e10cSrcweir {
364cdf0e10cSrcweir 	Sequence< OUString > aRet(1);
365cdf0e10cSrcweir 	aRet[0] = OUString::createFromAscii("com.sun.star.frame.SessionManagerClient");
366cdf0e10cSrcweir 	return aRet;
367cdf0e10cSrcweir }
368cdf0e10cSrcweir 
vcl_session_createInstance(const css::uno::Reference<XMultiServiceFactory> &)369cdf0e10cSrcweir css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( const css::uno::Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ )
370cdf0e10cSrcweir {
371cdf0e10cSrcweir     ImplSVData* pSVData = ImplGetSVData();
372cdf0e10cSrcweir     if( ! pSVData->xSMClient.is() )
373cdf0e10cSrcweir         pSVData->xSMClient = new VCLSession();
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 	return css::uno::Reference< XInterface >(pSVData->xSMClient, UNO_QUERY );
376cdf0e10cSrcweir }
377