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 : /** a OBoundControlModel which features the exchange of a reference value
31 : */
32 : class OReferenceValueComponent : public OBoundControlModel
33 : {
34 : private:
35 : // <properties>
36 : OUString m_sReferenceValue; // the reference value to use for data exchange
37 : OUString m_sNoCheckReferenceValue; // the reference value to be exchanged when the control is not checked
38 : ToggleState m_eDefaultChecked; // the default check state
39 : // </properties>
40 :
41 : bool m_bSupportSecondRefValue; // do we support the SecondaryRefValue property?
42 :
43 : protected:
44 2 : const OUString& getReferenceValue() const { return m_sReferenceValue; }
45 : void setReferenceValue( const OUString& _rRefValue );
46 :
47 0 : const OUString& getNoCheckReferenceValue() const { return m_sNoCheckReferenceValue; }
48 :
49 2 : ToggleState getDefaultChecked() const { return m_eDefaultChecked; }
50 2 : void setDefaultChecked( ToggleState _eChecked ) { m_eDefaultChecked = _eChecked; }
51 :
52 : protected:
53 : OReferenceValueComponent(
54 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxFactory,
55 : const OUString& _rUnoControlModelTypeName,
56 : const OUString& _rDefault,
57 : bool _bSupportNoCheckRefValue = false
58 : );
59 : DECLARE_DEFAULT_CLONE_CTOR( OReferenceValueComponent )
60 : virtual ~OReferenceValueComponent();
61 :
62 : // OPropertySet and friends
63 : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const SAL_OVERRIDE;
64 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
65 : throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
66 : virtual sal_Bool SAL_CALL convertFastPropertyValue(
67 : ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
68 : throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
69 : virtual void describeFixedProperties(
70 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
71 : ) const SAL_OVERRIDE;
72 : using ::cppu::OPropertySetHelper::getFastPropertyValue;
73 :
74 : // OBoundControlModel overridables
75 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
76 : getSupportedBindingTypes() SAL_OVERRIDE;
77 : virtual ::com::sun::star::uno::Any
78 : translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const SAL_OVERRIDE;
79 : virtual ::com::sun::star::uno::Any
80 : translateControlValueToExternalValue( ) const SAL_OVERRIDE;
81 :
82 : virtual ::com::sun::star::uno::Any
83 : translateControlValueToValidatableValue( ) const SAL_OVERRIDE;
84 :
85 : virtual ::com::sun::star::uno::Any
86 : getDefaultForReset() const SAL_OVERRIDE;
87 : };
88 :
89 :
90 : } // namespace frm
91 :
92 :
93 : #endif // INCLUDED_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|