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 INSPECTORMODELBASE_HXX
25 #define INSPECTORMODELBASE_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/inspection/XObjectInspectorModel.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 /** === end UNO includes === **/
32 
33 #include <cppuhelper/implbase3.hxx>
34 #include <cppuhelper/propshlp.hxx>
35 
36 #include <comphelper/broadcasthelper.hxx>
37 #include <comphelper/componentcontext.hxx>
38 #include <comphelper/uno3.hxx>
39 
40 #include <memory>
41 
42 //........................................................................
43 namespace pcr
44 {
45 //........................................................................
46 
47     class InspectorModelProperties;
48     //====================================================================
49 	//= ImplInspectorModel
50 	//====================================================================
51     typedef ::cppu::WeakImplHelper3 <   ::com::sun::star::inspection::XObjectInspectorModel
52                                     ,   ::com::sun::star::lang::XInitialization
53                                     ,   ::com::sun::star::lang::XServiceInfo
54                                     >   ImplInspectorModel_Base;
55     typedef ::cppu::OPropertySetHelper  ImplInspectorModel_PBase;
56 
57     class ImplInspectorModel
58             :public ::comphelper::OMutexAndBroadcastHelper
59             ,public ImplInspectorModel_Base
60             ,public ImplInspectorModel_PBase
61 	{
62     protected:
63         ::comphelper::ComponentContext                                  m_aContext;
64         ::std::auto_ptr< InspectorModelProperties >                     m_pProperties;
65 
66     protected:
67         ~ImplInspectorModel();
68 
69     public:
70         ImplInspectorModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext );
71 
72         DECLARE_XINTERFACE()
73         DECLARE_XTYPEPROVIDER()
74 
75         // ::com::sun::star::beans::XPropertySet and friends
76         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw (::com::sun::star::uno::RuntimeException);
77         virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
78         virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException);
79         virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
80         virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
81 
82         // ::com::sun::star::inspection::XObjectInspectorModel
83         virtual ::sal_Bool SAL_CALL getHasHelpSection() throw (::com::sun::star::uno::RuntimeException);
84         virtual ::sal_Int32 SAL_CALL getMinHelpTextLines() throw (::com::sun::star::uno::RuntimeException);
85         virtual ::sal_Int32 SAL_CALL getMaxHelpTextLines() throw (::com::sun::star::uno::RuntimeException);
86         virtual ::sal_Bool SAL_CALL getIsReadOnly() throw (::com::sun::star::uno::RuntimeException);
87         virtual void SAL_CALL setIsReadOnly( ::sal_Bool _IsReadOnly ) throw (::com::sun::star::uno::RuntimeException);
88 
89         // ::com::sun::star::lang::XServiceInfo
90         virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
91 
92     protected:
93         void enableHelpSectionProperties( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines );
94 
95     private:
96         using ImplInspectorModel_PBase::getFastPropertyValue;
97 	};
98 
99 //........................................................................
100 } // namespace pcr
101 //........................................................................
102 
103 #endif // INSPECTORMODELBASE_HXX
104 
105