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 _FORMS_COMBOBOX_HXX_
21 #define _FORMS_COMBOBOX_HXX_
23 #include "FormComponent.hxx"
24 #include "errorbroadcaster.hxx"
25 #include "entrylisthelper.hxx"
26 #include "cachedrowset.hxx"
28 #include <com/sun/star/util/XNumberFormatter.hpp>
29 #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
30 #include <com/sun/star/form/ListSourceType.hpp>
31 #include <com/sun/star/awt/XItemListener.hpp>
32 #include <com/sun/star/awt/XFocusListener.hpp>
34 #include <connectivity/formattedcolumnvalue.hxx>
36 #include <cppuhelper/interfacecontainer.hxx>
38 #include <vcl/timer.hxx>
40 //.........................................................................
44 //==================================================================
46 //==================================================================
48 :public OBoundControlModel
49 ,public OEntryListHelper
50 ,public OErrorBroadcaster
52 CachedRowSet m_aListRowSet
; // the row set to fill the list
53 ::com::sun::star::uno::Any m_aBoundColumn
; // obsolet
54 OUString m_aListSource
; //
55 OUString m_aDefaultText
; // DefaultText
56 ::com::sun::star::uno::Any m_aLastKnownValue
;
58 StringSequence m_aDesignModeStringItems
;
59 // upon loading, in some cases we reset fill our string item list ourself. We don't want
60 // to lose the user's items then, so we remember them here.
63 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
> m_xFormatter
;
65 ::com::sun::star::form::ListSourceType m_eListSourceType
; // ListSource's type
66 sal_Bool m_bEmptyIsNull
; // Empty string is interpreted as NULL
68 ::std::auto_ptr
< ::dbtools::FormattedColumnValue
>
74 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> _getTypes();
77 DECLARE_DEFAULT_LEAF_XTOR( OComboBoxModel
);
79 virtual void SAL_CALL
disposing();
82 virtual void SAL_CALL
getFastPropertyValue(::com::sun::star::uno::Any
& rValue
, sal_Int32 nHandle
) const;
83 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
)
84 throw (::com::sun::star::uno::Exception
);
85 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
86 ::com::sun::star::uno::Any
& _rConvertedValue
, ::com::sun::star::uno::Any
& _rOldValue
, sal_Int32 _nHandle
, const ::com::sun::star::uno::Any
& _rValue
)
87 throw (::com::sun::star::lang::IllegalArgumentException
);
90 virtual void SAL_CALL
reloaded( const ::com::sun::star::lang::EventObject
& aEvent
) throw(::com::sun::star::uno::RuntimeException
);
93 IMPLEMENTATION_NAME(OComboBoxModel
);
94 virtual StringSequence SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
97 DECLARE_UNO3_AGG_DEFAULTS(OComboBoxModel
, OBoundControlModel
);
98 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& _rType
) throw (::com::sun::star::uno::RuntimeException
);
101 virtual OUString SAL_CALL
getServiceName() throw(::com::sun::star::uno::RuntimeException
);
102 virtual void SAL_CALL
103 write(const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XObjectOutputStream
>& _rxOutStream
) throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
104 virtual void SAL_CALL
105 read(const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XObjectInputStream
>& _rxInStream
) throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
107 // OControlModel's property handling
108 virtual void describeFixedProperties(
109 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
>& /* [out] */ _rProps
111 virtual void describeAggregateProperties(
112 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
>& /* [out] */ _rAggregateProps
116 virtual void SAL_CALL
disposing(const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
118 // prevent method hiding
119 using OBoundControlModel::getFastPropertyValue
;
122 // OBoundControlModel overridables
123 virtual ::com::sun::star::uno::Any
124 translateDbColumnToControlValue( );
125 virtual sal_Bool
commitControlValueToDbColumn( bool _bPostReset
);
127 virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& _rxForm
);
128 virtual void onDisconnectedDbColumn();
130 virtual ::com::sun::star::uno::Any
131 getDefaultForReset() const;
133 virtual void resetNoBroadcast();
135 // OEntryListHelper overriables
136 virtual void stringItemListChanged( ControlModelLock
& _rInstanceLock
);
137 virtual void connectedExternalListSource( );
138 virtual void disconnectedExternalListSource( );
139 virtual void refreshInternalEntryList();
142 void loadData( bool _bForce
);
144 DECLARE_XCLONEABLE();
147 //==================================================================
149 //==================================================================
151 class OComboBoxControl
: public OBoundControl
154 OComboBoxControl(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
);
157 IMPLEMENTATION_NAME(OComboBoxControl
);
158 virtual StringSequence SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
161 //.........................................................................
163 //.........................................................................
165 #endif // _FORMS_COMBOBOX_HXX_
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */