LibreOffice Module forms (master) 1
entrylisthelper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <com/sun/star/form/binding/XListEntrySink.hpp>
23#include <com/sun/star/util/XRefreshable.hpp>
24#include <com/sun/star/form/binding/XListEntryListener.hpp>
25
28
29
30namespace frm
31{
32
33
34 class OControlModel;
35 class ControlModelLock;
36
37
38 //= OEntryListHelper
39
40 typedef ::cppu::ImplHelper3 < css::form::binding::XListEntrySink
41 , css::form::binding::XListEntryListener
42 , css::util::XRefreshable
44
46 {
47 private:
49
50 css::uno::Reference< css::form::binding::XListEntrySource >
52 std::vector< OUString >
54 css::uno::Sequence< css::uno::Any >
58
59
60 protected:
61 explicit OEntryListHelper( OControlModel& _rControlModel );
62 OEntryListHelper( const OEntryListHelper& _rSource, OControlModel& _rControlModel );
63 virtual ~OEntryListHelper( );
64
66 const std::vector< OUString >&
68
70 const css::uno::Sequence< css::uno::Any >&
71 getTypedItemList() const { return m_aTypedItems; }
72
74 bool hasExternalListSource( ) const { return m_xListSource.is(); }
75
82 bool handleDisposing( const css::lang::EventObject& _rEvent );
83
86 void disposing( );
87
88 // prevent method hiding
89 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override = 0;
90
97 css::uno::Any& _rConvertedValue,
98 css::uno::Any& _rOldValue,
99 const css::uno::Any& _rValue
100 );
101
111 void setNewStringItemList( const css::uno::Any& _rValue, ControlModelLock& _rInstanceLock );
112
122 void setNewTypedItemList( const css::uno::Any& _rValue, ControlModelLock& _rInstanceLock );
123
132 virtual void stringItemListChanged( ControlModelLock& _rInstanceLock ) = 0;
133
137 virtual void refreshInternalEntryList() = 0;
138
139 private:
140 // XListEntrySink
141 virtual void SAL_CALL setListEntrySource( const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource ) override;
142 virtual css::uno::Reference< css::form::binding::XListEntrySource > SAL_CALL getListEntrySource( ) override;
143
144 // XListEntryListener
145 virtual void SAL_CALL entryChanged( const css::form::binding::ListEntryEvent& _rSource ) override;
146 virtual void SAL_CALL entryRangeInserted( const css::form::binding::ListEntryEvent& _rSource ) override;
147 virtual void SAL_CALL entryRangeRemoved( const css::form::binding::ListEntryEvent& _rSource ) override;
148 virtual void SAL_CALL allEntriesChanged( const css::lang::EventObject& _rSource ) override;
149
150 // XRefreshable
151 virtual void SAL_CALL refresh() override;
152 virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener>& _rxListener) override;
153 virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener>& _rxListener) override;
154
155 private:
160
167 const css::uno::Reference< css::form::binding::XListEntrySource >& _rxSource,
168 ControlModelLock& _rInstanceLock
169 );
170
176 void obtainListSourceEntries( ControlModelLock& _rInstanceLock );
177
186 void impl_lock_refreshList( ControlModelLock& _rInstanceLock );
187
188 private:
191 };
192
193
194} // namespace frm
195
196/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
class whose instances lock an OControlModel
void obtainListSourceEntries(ControlModelLock &_rInstanceLock)
obtains list entries and possibly data values from list source
::comphelper::OInterfaceContainerHelper3< css::util::XRefreshListener > m_aRefreshListeners
"overridden" TypedItemList property value
OEntryListHelper(OControlModel &_rControlModel)
bool convertNewListSourceProperty(css::uno::Any &_rConvertedValue, css::uno::Any &_rOldValue, const css::uno::Any &_rValue)
helper for implementing convertFastPropertyValue( StringItemList )
void setNewStringItemList(const css::uno::Any &_rValue, ControlModelLock &_rInstanceLock)
helper for implementing setFastPropertyValueNoBroadcast
virtual void refreshInternalEntryList()=0
called when XRefreshable::refresh has been called, and we do not have an external list source
virtual void stringItemListChanged(ControlModelLock &_rInstanceLock)=0
announces that the list of entries has changed.
OEntryListHelper(const OEntryListHelper &)=delete
std::vector< OUString > m_aStringItems
our external list source
css::uno::Sequence< css::uno::Any > m_aTypedItems
"overridden" StringItemList property value
virtual css::uno::Reference< css::form::binding::XListEntrySource > SAL_CALL getListEntrySource() override
void connectExternalListSource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource, ControlModelLock &_rInstanceLock)
connects to a new external list source
virtual void SAL_CALL entryRangeInserted(const css::form::binding::ListEntryEvent &_rSource) override
void disconnectExternalListSource()
disconnects from the active external list source, if present
void impl_lock_refreshList(ControlModelLock &_rInstanceLock)
refreshes our list entries
virtual void SAL_CALL refresh() override
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &_rxListener) override
void disposing()
to be called by derived classes' instances when they're being disposed
void setNewTypedItemList(const css::uno::Any &_rValue, ControlModelLock &_rInstanceLock)
helper for implementing setFastPropertyValueNoBroadcast
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override=0
css::uno::Reference< css::form::binding::XListEntrySource > m_xListSource
const css::uno::Sequence< css::uno::Any > & getTypedItemList() const
returns the current typed item list
OControlModel & m_rControlModel
virtual void SAL_CALL allEntriesChanged(const css::lang::EventObject &_rSource) override
bool handleDisposing(const css::lang::EventObject &_rEvent)
handling the XEventListener::disposing call for the case where our list source is being disposed
OEntryListHelper & operator=(const OEntryListHelper &)=delete
virtual void SAL_CALL setListEntrySource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource) override
virtual void SAL_CALL entryChanged(const css::form::binding::ListEntryEvent &_rSource) override
bool hasExternalListSource() const
determines whether we actually have an external list source
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &_rxListener) override
const std::vector< OUString > & getStringItemList() const
returns the current string item list
virtual void SAL_CALL entryRangeRemoved(const css::form::binding::ListEntryEvent &_rSource) override
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
::cppu::ImplHelper3< css::form::binding::XListEntrySink, css::form::binding::XListEntryListener, css::util::XRefreshable > OEntryListHelper_BASE