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