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 EXTENSIONS_DEFAULTHELPPROVIDER_HXX
25 #define EXTENSIONS_DEFAULTHELPPROVIDER_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/inspection/XPropertyControlObserver.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/inspection/XObjectInspectorUI.hpp>
31 /** === end UNO includes === **/
32 
33 #include <cppuhelper/implbase2.hxx>
34 #include <comphelper/componentcontext.hxx>
35 
36 class Window;
37 
38 //........................................................................
39 namespace pcr
40 {
41 //........................................................................
42 
43 	//====================================================================
44 	//= DefaultHelpProvider
45 	//====================================================================
46     typedef ::cppu::WeakImplHelper2 <   ::com::sun::star::inspection::XPropertyControlObserver
47                                     ,   ::com::sun::star::lang::XInitialization
48                                     >   DefaultHelpProvider_Base;
49     class DefaultHelpProvider : public DefaultHelpProvider_Base
50 	{
51     private:
52         ::comphelper::ComponentContext  m_aContext;
53         bool                            m_bConstructed;
54         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >
55                                         m_xInspectorUI;
56 
57     public:
58 		DefaultHelpProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext );
59 
60         // XServiceInfo - static versions
61 		static ::rtl::OUString getImplementationName_static(  ) throw(::com::sun::star::uno::RuntimeException);
62 		static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(  ) throw(::com::sun::star::uno::RuntimeException);
63 		static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
64 						Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
65 
66     protected:
67         ~DefaultHelpProvider();
68 
69         // XPropertyControlObserver
70         virtual void SAL_CALL focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException);
71         virtual void SAL_CALL valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException);
72 
73         // XInitialization
74         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);
75 
76     protected:
77         // Service constructors
78         void    create( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxUI );
79 
80     private:
81         Window* impl_getVclControlWindow_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl );
82         ::rtl::OUString impl_getHelpText_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl );
83 	};
84 
85 //........................................................................
86 } // namespace pcr
87 //........................................................................
88 
89 #endif // EXTENSIONS_DEFAULTHELPPROVIDER_HXX
90