1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVTOOLS_JAVAINTERACTION_HXX_
25 #define _SVTOOLS_JAVAINTERACTION_HXX_
26 
27 #include "svtools/svtdllapi.h"
28 #include <osl/mutex.hxx>
29 #include <tools/gen.hxx>
30 
31 #include <com/sun/star/task/XInteractionRequest.hpp>
32 #include <svtools/javacontext.hxx>
33 
34 #define JAVA_INTERACTION_HANDLER_NAME "java-vm.interaction-handler"
35 
36 namespace svt
37 {
38 // We cannot derive from  cppu::WeakImplHelper because we would export the inline
39 //generated class. This conflicts with other libraries if they use the same inline
40 //class.
41 
42 class SVT_DLLPUBLIC JavaInteractionHandler:
43         public com::sun::star::task::XInteractionHandler
44 {
45 public:
46     JavaInteractionHandler();
47     JavaInteractionHandler(bool bReportErrorOnce);
48 
49     // XInterface
50     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
51         const ::com::sun::star::uno::Type& aType )
52         throw (::com::sun::star::uno::RuntimeException);
53 
54     virtual void SAL_CALL acquire() throw();
55 
56     virtual void SAL_CALL release() throw();
57 
58     // XCurrentContext
59     virtual void SAL_CALL handle( const com::sun::star::uno::Reference<
60                                   com::sun::star::task::XInteractionRequest >& Request )
61         throw (com::sun::star::uno::RuntimeException);
62 
63 private:
64     oslInterlockedCount	m_aRefCount;
65     SVT_DLLPRIVATE JavaInteractionHandler(JavaInteractionHandler const&); //not implemented
66     SVT_DLLPRIVATE JavaInteractionHandler& operator = (JavaInteractionHandler const &); //not implemented
67     SVT_DLLPRIVATE virtual ~JavaInteractionHandler();
68     bool m_bShowErrorsOnce;
69     bool m_bJavaDisabled_Handled;
70     bool m_bInvalidSettings_Handled;
71     bool m_bJavaNotFound_Handled;
72     bool m_bVMCreationFailure_Handled;
73     bool m_bRestartRequired_Handled;
74     sal_uInt16 m_nResult_JavaDisabled;
75 };
76 }
77 
78 #endif // _DESKTOP_JAVAINTERACTION_HXX_
79