tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / forms / source / component / ComboBox.hxx
blobdd2a7b6ea4c3d1a823f6bc6425d79daf70f3b79f
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 #pragma once
22 #include <memory>
23 #include <FormComponent.hxx>
24 #include "errorbroadcaster.hxx"
25 #include "entrylisthelper.hxx"
26 #include "cachedrowset.hxx"
28 #include <com/sun/star/form/ListSourceType.hpp>
30 #include <connectivity/formattedcolumnvalue.hxx>
33 namespace frm
36 class OComboBoxModel final
37 :public OBoundControlModel
38 ,public OEntryListHelper
39 ,public OErrorBroadcaster
41 CachedRowSet m_aListRowSet; // the row set to fill the list
42 css::uno::Any m_aBoundColumn; // obsolete
43 OUString m_aListSource;
44 OUString m_aDefaultText; // DefaultText
45 css::uno::Any m_aLastKnownValue;
47 css::uno::Sequence<OUString> m_aDesignModeStringItems;
49 css::form::ListSourceType m_eListSourceType; // ListSource's type
50 bool m_bEmptyIsNull; // Empty string is interpreted as NULL
52 ::std::unique_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter;
54 virtual css::uno::Sequence< css::uno::Type> _getTypes() override;
56 public:
57 OComboBoxModel(
58 const css::uno::Reference< css::uno::XComponentContext>& _rxFactory
60 OComboBoxModel(
61 const OComboBoxModel* _pOriginal,
62 const css::uno::Reference< css::uno::XComponentContext>& _rxFactory
64 virtual ~OComboBoxModel() override;
66 virtual void SAL_CALL disposing() override;
68 // OPropertySetHelper
69 virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue, sal_Int32 nHandle) const override;
70 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
71 virtual sal_Bool SAL_CALL convertFastPropertyValue(
72 css::uno::Any& _rConvertedValue, css::uno::Any& _rOldValue, sal_Int32 _nHandle, const css::uno::Any& _rValue ) override;
74 // XLoadListener
75 virtual void SAL_CALL reloaded( const css::lang::EventObject& aEvent ) override;
77 // XServiceInfo
78 OUString SAL_CALL getImplementationName() override
79 { return u"com.sun.star.form.OComboBoxModel"_ustr; }
81 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
83 // UNO
84 DECLARE_UNO3_AGG_DEFAULTS(OComboBoxModel, OBoundControlModel)
85 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
87 // XPersistObject
88 virtual OUString SAL_CALL getServiceName() override;
89 virtual void SAL_CALL
90 write(const css::uno::Reference< css::io::XObjectOutputStream>& _rxOutStream) override;
91 virtual void SAL_CALL
92 read(const css::uno::Reference< css::io::XObjectInputStream>& _rxInStream) override;
94 // OControlModel's property handling
95 virtual void describeFixedProperties(
96 css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps
97 ) const override;
98 virtual void describeAggregateProperties(
99 css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps
100 ) const override;
102 // XEventListener
103 virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
105 // prevent method hiding
106 using OBoundControlModel::getFastPropertyValue;
108 private:
109 // OBoundControlModel overridables
110 virtual css::uno::Any translateDbColumnToControlValue( ) override;
111 virtual bool commitControlValueToDbColumn( bool _bPostReset ) override;
113 virtual void onConnectedDbColumn( const css::uno::Reference< css::uno::XInterface >& _rxForm ) override;
114 virtual void onDisconnectedDbColumn() override;
116 virtual css::uno::Any getDefaultForReset() const override;
118 virtual void resetNoBroadcast() override;
120 // OEntryListHelper overridables
121 virtual void stringItemListChanged( ControlModelLock& _rInstanceLock ) override;
122 virtual void refreshInternalEntryList() override;
124 void loadData( bool _bForce );
126 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
129 class OComboBoxControl : public OBoundControl
131 public:
132 explicit OComboBoxControl(const css::uno::Reference< css::uno::XComponentContext>& _rxContext);
134 // XServiceInfo
135 OUString SAL_CALL getImplementationName() override
136 { return u"com.sun.star.form.OComboBoxControl"_ustr; }
138 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */