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 #ifndef RPT_DEFAULTINSPECTION_HXX
24 #define RPT_DEFAULTINSPECTION_HXX
25 
26 /** === begin UNO includes === **/
27 #include <com/sun/star/inspection/XObjectInspectorModel.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/lang/XInitialization.hpp>
31 /** === end UNO includes === **/
32 #include <cppuhelper/implbase3.hxx>
33 
34 #include <memory>
35 
36 //........................................................................
37 namespace rptui
38 {
39 //........................................................................
40     class OPropertyInfoService;
41 	//====================================================================
42 	//= DefaultComponentInspectorModel
43 	//====================================================================
44     typedef ::cppu::WeakAggImplHelper3  <   ::com::sun::star::inspection::XObjectInspectorModel
45                                         ,   ::com::sun::star::lang::XServiceInfo
46                                         ,   ::com::sun::star::lang::XInitialization
47                                         >   DefaultComponentInspectorModel_Base;
48     class DefaultComponentInspectorModel : public DefaultComponentInspectorModel_Base
49 	{
50     private:
51         ::osl::Mutex                                                                            m_aMutex;
52         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >            m_xContext;
53         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel > m_xComponent; /// delegatee
54         bool                                                                                    m_bConstructed;
55         bool                                                                                    m_bHasHelpSection;
56         sal_Bool                                                                                m_bIsReadOnly;
57         sal_Int32                                                                               m_nMinHelpTextLines;
58         sal_Int32                                                                               m_nMaxHelpTextLines;
59         /// access to property meta data
60         ::std::auto_ptr< OPropertyInfoService >                                                 m_pInfoService;
61 
62 		DefaultComponentInspectorModel(const DefaultComponentInspectorModel&);
63 		DefaultComponentInspectorModel& operator=(const DefaultComponentInspectorModel&);
64     protected:
65         virtual ~DefaultComponentInspectorModel();
66 
67 		// XServiceInfo
68 		virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
69 		virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
70 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
71 
72         // XObjectInspectorModel
73         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getHandlerFactories() throw (::com::sun::star::uno::RuntimeException);
74         virtual ::sal_Bool SAL_CALL getHasHelpSection() throw (::com::sun::star::uno::RuntimeException);
75         virtual ::sal_Int32 SAL_CALL getMinHelpTextLines() throw (::com::sun::star::uno::RuntimeException);
76         virtual ::sal_Int32 SAL_CALL getMaxHelpTextLines() throw (::com::sun::star::uno::RuntimeException);
77         virtual ::sal_Bool SAL_CALL getIsReadOnly() throw (::com::sun::star::uno::RuntimeException);
78         virtual void SAL_CALL setIsReadOnly( ::sal_Bool _isreadonly ) throw (::com::sun::star::uno::RuntimeException);
79 
80         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::inspection::PropertyCategoryDescriptor > SAL_CALL describeCategories(  ) throw (::com::sun::star::uno::RuntimeException);
81         virtual ::sal_Int32 SAL_CALL getPropertyOrderIndex( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::uno::RuntimeException);
82 
83         // XInitialization
84         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);
85 
86     public:
87         // XServiceInfo - static versions
88 		static ::rtl::OUString getImplementationName_Static(  ) throw(::com::sun::star::uno::RuntimeException);
89 		static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(  ) throw(::com::sun::star::uno::RuntimeException);
90 		static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
91 						create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
92 
93     public:
94 		DefaultComponentInspectorModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
95 
96     protected:
97         // Service constructors
98         void    createDefault();
99         void    createWithHelpSection( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines );
100 	};
101 
102 //........................................................................
103 } // namespace rptui
104 //........................................................................
105 
106 #endif // RPT_DEFAULTINSPECTION_HXX
107 
108