1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INSPECTORMODELBASE_HXX
29 #define INSPECTORMODELBASE_HXX
30 
31 /** === begin UNO includes === **/
32 #include <com/sun/star/inspection/XObjectInspectorModel.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 /** === end UNO includes === **/
36 
37 #include <cppuhelper/implbase3.hxx>
38 #include <cppuhelper/propshlp.hxx>
39 
40 #include <comphelper/broadcasthelper.hxx>
41 #include <comphelper/componentcontext.hxx>
42 #include <comphelper/uno3.hxx>
43 
44 #include <memory>
45 
46 //........................................................................
47 namespace pcr
48 {
49 //........................................................................
50 
51     class InspectorModelProperties;
52     //====================================================================
53 	//= ImplInspectorModel
54 	//====================================================================
55     typedef ::cppu::WeakImplHelper3 <   ::com::sun::star::inspection::XObjectInspectorModel
56                                     ,   ::com::sun::star::lang::XInitialization
57                                     ,   ::com::sun::star::lang::XServiceInfo
58                                     >   ImplInspectorModel_Base;
59     typedef ::cppu::OPropertySetHelper  ImplInspectorModel_PBase;
60 
61     class ImplInspectorModel
62             :public ::comphelper::OMutexAndBroadcastHelper
63             ,public ImplInspectorModel_Base
64             ,public ImplInspectorModel_PBase
65 	{
66     protected:
67         ::comphelper::ComponentContext                                  m_aContext;
68         ::std::auto_ptr< InspectorModelProperties >                     m_pProperties;
69 
70     protected:
71         ~ImplInspectorModel();
72 
73     public:
74         ImplInspectorModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext );
75 
76         DECLARE_XINTERFACE()
77         DECLARE_XTYPEPROVIDER()
78 
79         // ::com::sun::star::beans::XPropertySet and friends
80         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw (::com::sun::star::uno::RuntimeException);
81         virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
82         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);
83         virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
84         virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
85 
86         // ::com::sun::star::inspection::XObjectInspectorModel
87         virtual ::sal_Bool SAL_CALL getHasHelpSection() throw (::com::sun::star::uno::RuntimeException);
88         virtual ::sal_Int32 SAL_CALL getMinHelpTextLines() throw (::com::sun::star::uno::RuntimeException);
89         virtual ::sal_Int32 SAL_CALL getMaxHelpTextLines() throw (::com::sun::star::uno::RuntimeException);
90         virtual ::sal_Bool SAL_CALL getIsReadOnly() throw (::com::sun::star::uno::RuntimeException);
91         virtual void SAL_CALL setIsReadOnly( ::sal_Bool _IsReadOnly ) throw (::com::sun::star::uno::RuntimeException);
92 
93         // ::com::sun::star::lang::XServiceInfo
94         virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
95 
96     protected:
97         void enableHelpSectionProperties( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines );
98 
99     private:
100         using ImplInspectorModel_PBase::getFastPropertyValue;
101 	};
102 
103 //........................................................................
104 } // namespace pcr
105 //........................................................................
106 
107 #endif // INSPECTORMODELBASE_HXX
108 
109