1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <FormComponent.hxx>
23 #include <togglestate.hxx>
29 /** an OBoundControlModel which features the exchange of a reference value
31 class OReferenceValueComponent
: public OBoundControlModel
35 OUString m_sReferenceValue
; // the reference value to use for data exchange
36 OUString m_sNoCheckReferenceValue
; // the reference value to be exchanged when the control is not checked
37 ToggleState m_eDefaultChecked
; // the default check state
41 const OUString
& getReferenceValue() const { return m_sReferenceValue
; }
42 void setReferenceValue( const OUString
& _rRefValue
);
44 const OUString
& getNoCheckReferenceValue() const { return m_sNoCheckReferenceValue
; }
46 ToggleState
getDefaultChecked() const { return m_eDefaultChecked
; }
47 void setDefaultChecked( ToggleState _eChecked
) { m_eDefaultChecked
= _eChecked
; }
50 OReferenceValueComponent(
51 const css::uno::Reference
< css::uno::XComponentContext
>& _rxFactory
,
52 const OUString
& _rUnoControlModelTypeName
,
53 const OUString
& _rDefault
55 OReferenceValueComponent(
56 const OReferenceValueComponent
* _pOriginal
,
57 const css::uno::Reference
< css::uno::XComponentContext
>& _rxFactory
60 virtual ~OReferenceValueComponent() override
;
62 // OPropertySet and friends
63 virtual void SAL_CALL
getFastPropertyValue(css::uno::Any
& rValue
, sal_Int32 nHandle
) const override
;
64 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const css::uno::Any
& rValue
) override
;
65 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
66 css::uno::Any
& _rConvertedValue
, css::uno::Any
& _rOldValue
, sal_Int32 _nHandle
, const css::uno::Any
& _rValue
) override
;
67 virtual void describeFixedProperties(
68 css::uno::Sequence
< css::beans::Property
>& /* [out] */ _rProps
70 using ::cppu::OPropertySetHelper::getFastPropertyValue
;
72 // OBoundControlModel overridables
73 virtual css::uno::Sequence
< css::uno::Type
>
74 getSupportedBindingTypes() override
;
75 virtual css::uno::Any
translateExternalValueToControlValue( const css::uno::Any
& _rExternalValue
) const override
;
76 virtual css::uno::Any
translateControlValueToExternalValue( ) const override
;
78 virtual css::uno::Any
translateControlValueToValidatableValue( ) const override
;
80 virtual css::uno::Any
getDefaultForReset() const override
;
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */