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 .
20 #ifndef INCLUDED_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
21 #define INCLUDED_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
23 #include "FormComponent.hxx"
24 #include "togglestate.hxx"
30 /** a OBoundControlModel which features the exchange of a reference value
32 class OReferenceValueComponent
: public OBoundControlModel
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
41 bool m_bSupportSecondRefValue
; // do we support the SecondaryRefValue property?
44 const OUString
& getReferenceValue() const { return m_sReferenceValue
; }
45 void setReferenceValue( const OUString
& _rRefValue
);
47 const OUString
& getNoCheckReferenceValue() const { return m_sNoCheckReferenceValue
; }
49 ToggleState
getDefaultChecked() const { return m_eDefaultChecked
; }
50 void setDefaultChecked( ToggleState _eChecked
) { m_eDefaultChecked
= _eChecked
; }
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
59 DECLARE_DEFAULT_CLONE_CTOR( OReferenceValueComponent
)
60 virtual ~OReferenceValueComponent();
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
72 using ::cppu::OPropertySetHelper::getFastPropertyValue
;
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
;
82 virtual ::com::sun::star::uno::Any
83 translateControlValueToValidatableValue( ) const SAL_OVERRIDE
;
85 virtual ::com::sun::star::uno::Any
86 getDefaultForReset() const SAL_OVERRIDE
;
93 #endif // INCLUDED_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */