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 FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
29 #define FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
30 
31 #include "FormComponent.hxx"
32 #include "togglestate.hxx"
33 
34 /** === begin UNO includes === **/
35 /** === end UNO includes === **/
36 
37 //........................................................................
38 namespace frm
39 {
40 //........................................................................
41 
42 	//====================================================================
43 	//= OReferenceValueComponent
44 	//====================================================================
45     /** a OBoundControlModel which features the exchange of a reference value
46     */
47     class OReferenceValueComponent : public OBoundControlModel
48 	{
49     private:
50         // <properties>
51         ::rtl::OUString     m_sReferenceValue;          // the reference value to use for data exchange
52         ::rtl::OUString     m_sNoCheckReferenceValue;   // the reference value to be exchanged when the control is not checked
53     	ToggleState			m_eDefaultChecked;          // the default check state
54         // </properties>
55 
56         sal_Bool            m_bSupportSecondRefValue;       // do we support the SecondaryRefValue property?
57 
58     protected:
59         const ::rtl::OUString& getReferenceValue() const { return m_sReferenceValue; }
60         void                   setReferenceValue( const ::rtl::OUString& _rRefValue );
61 
62         const ::rtl::OUString& getNoCheckReferenceValue() const { return m_sNoCheckReferenceValue; }
63 
64         ToggleState            getDefaultChecked() const { return m_eDefaultChecked; }
65         void                   setDefaultChecked( ToggleState _eChecked ) { m_eDefaultChecked = _eChecked; }
66 
67     protected:
68 	    OReferenceValueComponent(
69 		    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory,
70 		    const ::rtl::OUString& _rUnoControlModelTypeName,
71 		    const ::rtl::OUString& _rDefault,
72             sal_Bool _bSupportNoCheckRefValue = sal_False
73 	    );
74         DECLARE_DEFAULT_CLONE_CTOR( OReferenceValueComponent )
75         DECLARE_DEFAULT_DTOR( OReferenceValueComponent );
76 
77         // OPropertySet and friends
78         virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const;
79         virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
80                     throw (::com::sun::star::uno::Exception);
81         virtual sal_Bool SAL_CALL convertFastPropertyValue(
82                     ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
83                     throw (::com::sun::star::lang::IllegalArgumentException);
84 	    virtual void describeFixedProperties(
85             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
86         ) const;
87         using ::cppu::OPropertySetHelper::getFastPropertyValue;
88 
89         // OBoundControlModel overridables
90         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
91                                 getSupportedBindingTypes();
92         virtual ::com::sun::star::uno::Any
93                                 translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const;
94         virtual ::com::sun::star::uno::Any
95                                 translateControlValueToExternalValue( ) const;
96 
97         virtual ::com::sun::star::uno::Any
98                                 translateControlValueToValidatableValue( ) const;
99 
100         virtual ::com::sun::star::uno::Any
101                                 getDefaultForReset() const;
102 	};
103 
104 //........................................................................
105 } // namespace frm
106 //........................................................................
107 
108 #endif // FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
109 
110