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     /** an 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     protected:
getReferenceValue() const42         const OUString& getReferenceValue() const { return m_sReferenceValue; }
43         void                   setReferenceValue( const OUString& _rRefValue );
44 
getNoCheckReferenceValue() const45         const OUString& getNoCheckReferenceValue() const { return m_sNoCheckReferenceValue; }
46 
getDefaultChecked() const47         ToggleState            getDefaultChecked() const { return m_eDefaultChecked; }
setDefaultChecked(ToggleState _eChecked)48         void                   setDefaultChecked( ToggleState _eChecked ) { m_eDefaultChecked = _eChecked; }
49 
50     protected:
51         OReferenceValueComponent(
52             const css::uno::Reference< css::uno::XComponentContext>& _rxFactory,
53             const OUString& _rUnoControlModelTypeName,
54             const OUString& _rDefault
55         );
56         DECLARE_DEFAULT_CLONE_CTOR( OReferenceValueComponent )
57         virtual ~OReferenceValueComponent() override;
58 
59         // OPropertySet and friends
60         virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue, sal_Int32 nHandle) const override;
61         virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
62         virtual sal_Bool SAL_CALL convertFastPropertyValue(
63                     css::uno::Any& _rConvertedValue, css::uno::Any& _rOldValue, sal_Int32 _nHandle, const css::uno::Any& _rValue ) override;
64         virtual void describeFixedProperties(
65             css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps
66         ) const override;
67         using ::cppu::OPropertySetHelper::getFastPropertyValue;
68 
69         // OBoundControlModel overridables
70         virtual css::uno::Sequence< css::uno::Type >
71                                 getSupportedBindingTypes() override;
72         virtual css::uno::Any   translateExternalValueToControlValue( const css::uno::Any& _rExternalValue ) const override;
73         virtual css::uno::Any   translateControlValueToExternalValue( ) const override;
74 
75         virtual css::uno::Any   translateControlValueToValidatableValue( ) const override;
76 
77         virtual css::uno::Any   getDefaultForReset() const override;
78     };
79 
80 
81 } // namespace frm
82 
83 
84 #endif // INCLUDED_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
85 
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
87