bump product version to 5.0.4.1
[LibreOffice.git] / forms / source / component / ComboBox.hxx
blobb752c3240f21d741f4e50a8d01a19292130e697b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_COMBOBOX_HXX
21 #define INCLUDED_FORMS_SOURCE_COMPONENT_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>
41 namespace frm
44 class OComboBoxModel
45 :public OBoundControlModel
46 ,public OEntryListHelper
47 ,public OErrorBroadcaster
49 CachedRowSet m_aListRowSet; // the row set to fill the list
50 ::com::sun::star::uno::Any m_aBoundColumn; // obsolete
51 OUString m_aListSource;
52 OUString m_aDefaultText; // DefaultText
53 ::com::sun::star::uno::Any m_aLastKnownValue;
55 StringSequence m_aDesignModeStringItems;
56 // upon loading, in some cases we reset fill our string item list ourself. We don't want
57 // to lose the user's items then, so we remember them here.
58 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter> m_xFormatter;
60 ::com::sun::star::form::ListSourceType m_eListSourceType; // ListSource's type
61 bool m_bEmptyIsNull; // Empty string is interpreted as NULL
63 ::std::unique_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter;
67 protected:
68 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes() SAL_OVERRIDE;
70 public:
71 DECLARE_DEFAULT_LEAF_XTOR( OComboBoxModel );
73 virtual void SAL_CALL disposing() SAL_OVERRIDE;
75 // OPropertySetHelper
76 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const SAL_OVERRIDE;
77 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
78 throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
79 virtual sal_Bool SAL_CALL convertFastPropertyValue(
80 ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
81 throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
83 // XLoadListener
84 virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 // XServiceInfo
87 OUString SAL_CALL getImplementationName()
88 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
89 { return OUString("com.sun.star.form.OComboBoxModel"); }
91 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 // UNO
94 DECLARE_UNO3_AGG_DEFAULTS(OComboBoxModel, OBoundControlModel)
95 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 // XPersistObject
98 virtual OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 virtual void SAL_CALL
100 write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 virtual void SAL_CALL
102 read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 // OControlModel's property handling
105 virtual void describeFixedProperties(
106 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
107 ) const SAL_OVERRIDE;
108 virtual void describeAggregateProperties(
109 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
110 ) const SAL_OVERRIDE;
112 // XEventListener
113 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 // prevent method hiding
116 using OBoundControlModel::getFastPropertyValue;
118 protected:
119 // OBoundControlModel overridables
120 virtual ::com::sun::star::uno::Any
121 translateDbColumnToControlValue( ) SAL_OVERRIDE;
122 virtual bool commitControlValueToDbColumn( bool _bPostReset ) SAL_OVERRIDE;
124 virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ) SAL_OVERRIDE;
125 virtual void onDisconnectedDbColumn() SAL_OVERRIDE;
127 virtual ::com::sun::star::uno::Any
128 getDefaultForReset() const SAL_OVERRIDE;
130 virtual void resetNoBroadcast() SAL_OVERRIDE;
132 // OEntryListHelper overridables
133 virtual void stringItemListChanged( ControlModelLock& _rInstanceLock ) SAL_OVERRIDE;
134 virtual void connectedExternalListSource( ) SAL_OVERRIDE;
135 virtual void disconnectedExternalListSource( ) SAL_OVERRIDE;
136 virtual void refreshInternalEntryList() SAL_OVERRIDE;
138 protected:
139 void loadData( bool _bForce );
141 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 class OComboBoxControl : public OBoundControl
146 public:
147 OComboBoxControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
149 // XServiceInfo
150 OUString SAL_CALL getImplementationName()
151 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
152 { return OUString("com.sun.star.form.OComboBoxControl"); }
154 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 #endif // INCLUDED_FORMS_SOURCE_COMPONENT_COMBOBOX_HXX
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */