1*01aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*01aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*01aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*01aa44aaSAndrew Rist  * distributed with this work for additional information
6*01aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*01aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*01aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*01aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*01aa44aaSAndrew Rist  *
11*01aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*01aa44aaSAndrew Rist  *
13*01aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*01aa44aaSAndrew Rist  * software distributed under the License is distributed on an
15*01aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*01aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*01aa44aaSAndrew Rist  * specific language governing permissions and limitations
18*01aa44aaSAndrew Rist  * under the License.
19*01aa44aaSAndrew Rist  *
20*01aa44aaSAndrew Rist  *************************************************************/
21*01aa44aaSAndrew Rist 
22*01aa44aaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __DOCUMENTCLOSER_HXX_
25cdf0e10cSrcweir #define __DOCUMENTCLOSER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
28cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
29cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
32cdf0e10cSrcweir #include <com/sun/star/embed/XActionsApproval.hpp>
33cdf0e10cSrcweir #include <com/sun/star/embed/Actions.hpp>
34cdf0e10cSrcweir #include <cppuhelper/weakref.hxx>
35cdf0e10cSrcweir #include <osl/mutex.hxx>
36cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
37cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir // the service is implemented as a wrapper to be able to die by refcount
41cdf0e10cSrcweir // the disposing mechanics is required for java related scenarios
42cdf0e10cSrcweir class ODocumentCloser : public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XComponent,
43cdf0e10cSrcweir 														::com::sun::star::lang::XInitialization,
44cdf0e10cSrcweir 														::com::sun::star::lang::XServiceInfo >
45cdf0e10cSrcweir {
46cdf0e10cSrcweir 	::osl::Mutex m_aMutex;
47cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 	sal_Bool m_bDisposed;
54cdf0e10cSrcweir 	sal_Bool m_bInitialized;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir 	ODocumentCloser( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
58cdf0e10cSrcweir 	~ODocumentCloser();
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
61cdf0e10cSrcweir 			impl_staticGetSupportedServiceNames();
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
66cdf0e10cSrcweir 		impl_staticCreateSelfInstance(
67cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir // XComponent
70cdf0e10cSrcweir     virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
71cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
72cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
73cdf0e10cSrcweir 
74cdf0e10cSrcweir // XInitialization
75cdf0e10cSrcweir     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir // XServiceInfo
78cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
79cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
80cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir };
83cdf0e10cSrcweir 
84cdf0e10cSrcweir #endif
85cdf0e10cSrcweir 
86