Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
21 : #define INCLUDED_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
22 :
23 : #include "FormComponent.hxx"
24 : #include "togglestate.hxx"
25 :
26 :
27 : namespace frm
28 : {
29 :
30 :
31 :
32 : //= OReferenceValueComponent
33 :
34 : /** a OBoundControlModel which features the exchange of a reference value
35 : */
36 : class OReferenceValueComponent : public OBoundControlModel
37 : {
38 : private:
39 : // <properties>
40 : OUString m_sReferenceValue; // the reference value to use for data exchange
41 : OUString m_sNoCheckReferenceValue; // the reference value to be exchanged when the control is not checked
42 : ToggleState m_eDefaultChecked; // the default check state
43 : // </properties>
44 :
45 : sal_Bool m_bSupportSecondRefValue; // do we support the SecondaryRefValue property?
46 :
47 : protected:
48 0 : const OUString& getReferenceValue() const { return m_sReferenceValue; }
49 : void setReferenceValue( const OUString& _rRefValue );
50 :
51 0 : const OUString& getNoCheckReferenceValue() const { return m_sNoCheckReferenceValue; }
52 :
53 0 : ToggleState getDefaultChecked() const { return m_eDefaultChecked; }
54 0 : void setDefaultChecked( ToggleState _eChecked ) { m_eDefaultChecked = _eChecked; }
55 :
56 : protected:
57 : OReferenceValueComponent(
58 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxFactory,
59 : const OUString& _rUnoControlModelTypeName,
60 : const OUString& _rDefault,
61 : sal_Bool _bSupportNoCheckRefValue = sal_False
62 : );
63 : DECLARE_DEFAULT_CLONE_CTOR( OReferenceValueComponent )
64 : DECLARE_DEFAULT_DTOR( OReferenceValueComponent );
65 :
66 : // OPropertySet and friends
67 : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const SAL_OVERRIDE;
68 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
69 : throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
70 : virtual sal_Bool SAL_CALL convertFastPropertyValue(
71 : ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
72 : throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
73 : virtual void describeFixedProperties(
74 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
75 : ) const SAL_OVERRIDE;
76 : using ::cppu::OPropertySetHelper::getFastPropertyValue;
77 :
78 : // OBoundControlModel overridables
79 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
80 : getSupportedBindingTypes() SAL_OVERRIDE;
81 : virtual ::com::sun::star::uno::Any
82 : translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const SAL_OVERRIDE;
83 : virtual ::com::sun::star::uno::Any
84 : translateControlValueToExternalValue( ) const SAL_OVERRIDE;
85 :
86 : virtual ::com::sun::star::uno::Any
87 : translateControlValueToValidatableValue( ) const SAL_OVERRIDE;
88 :
89 : virtual ::com::sun::star::uno::Any
90 : getDefaultForReset() const SAL_OVERRIDE;
91 : };
92 :
93 :
94 : } // namespace frm
95 :
96 :
97 : #endif // INCLUDED_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|