1b0724fc6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3b0724fc6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4b0724fc6SAndrew Rist * or more contributor license agreements. See the NOTICE file
5b0724fc6SAndrew Rist * distributed with this work for additional information
6b0724fc6SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7b0724fc6SAndrew Rist * to you under the Apache License, Version 2.0 (the
8b0724fc6SAndrew Rist * "License"); you may not use this file except in compliance
9b0724fc6SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11b0724fc6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13b0724fc6SAndrew Rist * Unless required by applicable law or agreed to in writing,
14b0724fc6SAndrew Rist * software distributed under the License is distributed on an
15b0724fc6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b0724fc6SAndrew Rist * KIND, either express or implied. See the License for the
17b0724fc6SAndrew Rist * specific language governing permissions and limitations
18b0724fc6SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20b0724fc6SAndrew Rist *************************************************************/
21b0724fc6SAndrew Rist
22b0724fc6SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #include "wrapper.hxx"
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
27cdf0e10cSrcweir #include <com/sun/star/awt/XMetricField.hpp>
28cdf0e10cSrcweir #include <com/sun/star/awt/XNumericField.hpp>
29cdf0e10cSrcweir #include <com/sun/star/awt/XTextComponent.hpp>
30cdf0e10cSrcweir #include <com/sun/star/awt/XListBox.hpp>
31cdf0e10cSrcweir #include <com/sun/star/awt/XComboBox.hpp>
32cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
33cdf0e10cSrcweir #include <com/sun/star/awt/XActionListener.hpp>
34cdf0e10cSrcweir #include <com/sun/star/awt/XItemListener.hpp>
35cdf0e10cSrcweir #include <com/sun/star/awt/XMouseListener.hpp>
36cdf0e10cSrcweir #include <vcl/combobox.hxx>
37cdf0e10cSrcweir #include <vcl/lstbox.hxx>
38cdf0e10cSrcweir
39cdf0e10cSrcweir #include <toolkit/awt/vclxwindows.hxx>
40cdf0e10cSrcweir
41cdf0e10cSrcweir using namespace ::com::sun::star;
42cdf0e10cSrcweir using rtl::OUString;
43cdf0e10cSrcweir
44cdf0e10cSrcweir #define LAYOUT_API_CALLS_HANDLER 0
45cdf0e10cSrcweir
46cdf0e10cSrcweir namespace layout
47cdf0e10cSrcweir {
48cdf0e10cSrcweir
49cdf0e10cSrcweir class EditImpl : public ControlImpl
50cdf0e10cSrcweir , public ::cppu::WeakImplHelper1< awt::XTextListener >
51cdf0e10cSrcweir {
52cdf0e10cSrcweir public:
53cdf0e10cSrcweir Link maModifyHdl;
54cdf0e10cSrcweir
55cdf0e10cSrcweir uno::Reference< awt::XTextComponent > mxEdit;
EditImpl(Context * context,const PeerHandle & peer,Window * window)56cdf0e10cSrcweir EditImpl( Context *context, const PeerHandle &peer, Window *window )
57cdf0e10cSrcweir : ControlImpl( context, peer, window )
58cdf0e10cSrcweir , mxEdit( peer, uno::UNO_QUERY )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir }
61cdf0e10cSrcweir
62cdf0e10cSrcweir ~EditImpl ();
63cdf0e10cSrcweir
64cdf0e10cSrcweir virtual void SAL_CALL disposing( lang::EventObject const& e )
65cdf0e10cSrcweir throw (uno::RuntimeException);
66cdf0e10cSrcweir
67cdf0e10cSrcweir virtual void SetModifyHdl( Link const& link );
68cdf0e10cSrcweir
textChanged(const awt::TextEvent &)69cdf0e10cSrcweir void SAL_CALL textChanged( const awt::TextEvent& /* rEvent */ )
70cdf0e10cSrcweir throw (uno::RuntimeException)
71cdf0e10cSrcweir {
72cdf0e10cSrcweir maModifyHdl.Call( mpWindow );
73cdf0e10cSrcweir }
74cdf0e10cSrcweir };
75cdf0e10cSrcweir
~EditImpl()76cdf0e10cSrcweir EditImpl::~EditImpl ()
77cdf0e10cSrcweir {
78cdf0e10cSrcweir }
79cdf0e10cSrcweir
disposing(lang::EventObject const & e)80cdf0e10cSrcweir void SAL_CALL EditImpl::disposing( lang::EventObject const& e )
81cdf0e10cSrcweir throw (uno::RuntimeException)
82cdf0e10cSrcweir {
83cdf0e10cSrcweir ControlImpl::disposing (e);
84cdf0e10cSrcweir mxEdit.clear ();
85cdf0e10cSrcweir }
86cdf0e10cSrcweir
SetModifyHdl(Link const & link)87cdf0e10cSrcweir void EditImpl::SetModifyHdl( Link const& link )
88cdf0e10cSrcweir {
89cdf0e10cSrcweir if (!link && !!maModifyHdl)
90cdf0e10cSrcweir mxEdit->removeTextListener( this );
91cdf0e10cSrcweir else if (!!link && !maModifyHdl)
92cdf0e10cSrcweir mxEdit->addTextListener( this );
93cdf0e10cSrcweir maModifyHdl = link;
94cdf0e10cSrcweir }
95cdf0e10cSrcweir
~Edit()96cdf0e10cSrcweir Edit::~Edit ()
97cdf0e10cSrcweir {
98cdf0e10cSrcweir SetModifyHdl (Link ());
99cdf0e10cSrcweir }
100cdf0e10cSrcweir
SetSelection(Selection const & rSelection)101cdf0e10cSrcweir void Edit::SetSelection( Selection const& rSelection )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir #if LAYOUT_API_CALLS_HANDLER
104*5e0f18e3SDon Lewis if ( !getImpl()->mxEdit.is() )
105*5e0f18e3SDon Lewis getImpl()->mxEdit->setSelection( awt::Selection( rSelection.Min(), rSelection.Max() ) );
106cdf0e10cSrcweir #else /* !LAYOUT_API_CALLS_HANDLER */
107cdf0e10cSrcweir GetEdit ()->SetSelection (rSelection);
108cdf0e10cSrcweir #endif /* !LAYOUT_API_CALLS_HANDLER */
109cdf0e10cSrcweir }
110cdf0e10cSrcweir
SetText(OUString const & rStr)111cdf0e10cSrcweir void Edit::SetText( OUString const& rStr )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir #if LAYOUT_API_CALLS_HANDLER
114*5e0f18e3SDon Lewis if ( getImpl()->mxEdit.is() )
115cdf0e10cSrcweir /// this calls handlers; endless loop in numfmt.cxx
116*5e0f18e3SDon Lewis getImpl()->mxEdit->setText( rStr );
117cdf0e10cSrcweir #else /* !LAYOUT_API_CALLS_HANDLER */
118cdf0e10cSrcweir GetEdit ()->SetText (rStr);
119cdf0e10cSrcweir #endif /* !LAYOUT_API_CALLS_HANDLER */
120cdf0e10cSrcweir }
121cdf0e10cSrcweir
GetText() const122cdf0e10cSrcweir String Edit::GetText() const
123cdf0e10cSrcweir {
124*5e0f18e3SDon Lewis if ( !getImpl()->mxEdit.is() )
125*5e0f18e3SDon Lewis return getImpl()->mxEdit->getText();
126cdf0e10cSrcweir return OUString();
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
SetModifyHdl(const Link & link)129cdf0e10cSrcweir void Edit::SetModifyHdl( const Link& link )
130cdf0e10cSrcweir {
131*5e0f18e3SDon Lewis if (getImpl() && getImpl()->mxEdit.is ())
132*5e0f18e3SDon Lewis getImpl()->SetModifyHdl( link );
133cdf0e10cSrcweir }
134cdf0e10cSrcweir
135cdf0e10cSrcweir IMPL_CONSTRUCTORS( Edit, Control, "edit" );
136cdf0e10cSrcweir IMPL_GET_IMPL( Edit );
137cdf0e10cSrcweir IMPL_GET_WINDOW (Edit);
138cdf0e10cSrcweir
139cdf0e10cSrcweir class MultiLineEditImpl : public EditImpl
140cdf0e10cSrcweir {
141cdf0e10cSrcweir public:
MultiLineEditImpl(Context * context,const PeerHandle & peer,Window * window)142cdf0e10cSrcweir MultiLineEditImpl( Context *context, const PeerHandle &peer, Window *window )
143cdf0e10cSrcweir : EditImpl( context, peer, window )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir }
146cdf0e10cSrcweir };
147cdf0e10cSrcweir
148cdf0e10cSrcweir IMPL_CONSTRUCTORS( MultiLineEdit, Edit, "multilineedit" );
149cdf0e10cSrcweir IMPL_GET_IMPL( MultiLineEdit );
150cdf0e10cSrcweir
151cdf0e10cSrcweir class SpinFieldImpl : public EditImpl
152cdf0e10cSrcweir {
153cdf0e10cSrcweir public:
SpinFieldImpl(Context * context,const PeerHandle & peer,Window * window)154cdf0e10cSrcweir SpinFieldImpl( Context *context, const PeerHandle &peer, Window *window )
155cdf0e10cSrcweir : EditImpl( context, peer, window )
156cdf0e10cSrcweir {
157cdf0e10cSrcweir }
158cdf0e10cSrcweir };
159cdf0e10cSrcweir
160cdf0e10cSrcweir IMPL_CONSTRUCTORS( SpinField, Edit, "spinfield" );
161cdf0e10cSrcweir
162cdf0e10cSrcweir class NumericFieldImpl : public SpinFieldImpl
163cdf0e10cSrcweir {
164cdf0e10cSrcweir public:
NumericFieldImpl(Context * context,const PeerHandle & peer,Window * window)165cdf0e10cSrcweir NumericFieldImpl( Context *context, const PeerHandle &peer, Window *window )
166cdf0e10cSrcweir : SpinFieldImpl( context, peer, window )
167cdf0e10cSrcweir {
168cdf0e10cSrcweir }
169cdf0e10cSrcweir };
170cdf0e10cSrcweir
171cdf0e10cSrcweir class MetricFieldImpl : public SpinFieldImpl
172cdf0e10cSrcweir {
173cdf0e10cSrcweir public:
MetricFieldImpl(Context * context,const PeerHandle & peer,Window * window)174cdf0e10cSrcweir MetricFieldImpl( Context *context, const PeerHandle &peer, Window *window )
175cdf0e10cSrcweir : SpinFieldImpl( context, peer, window )
176cdf0e10cSrcweir {
177cdf0e10cSrcweir }
178cdf0e10cSrcweir };
179cdf0e10cSrcweir
180cdf0e10cSrcweir IMPL_GET_IMPL( SpinField );
181cdf0e10cSrcweir IMPL_GET_IMPL( NumericField );
182cdf0e10cSrcweir IMPL_GET_IMPL( MetricField );
183cdf0e10cSrcweir
184cdf0e10cSrcweir class FormatterBaseImpl
185cdf0e10cSrcweir {
186cdf0e10cSrcweir protected:
187cdf0e10cSrcweir PeerHandle mpeer;
188cdf0e10cSrcweir public:
FormatterBaseImpl(const PeerHandle & peer)189cdf0e10cSrcweir explicit FormatterBaseImpl( const PeerHandle &peer )
190cdf0e10cSrcweir : mpeer( peer )
191cdf0e10cSrcweir {
192cdf0e10cSrcweir };
193cdf0e10cSrcweir };
194cdf0e10cSrcweir
FormatterBase(FormatterBaseImpl * pFormatImpl)195cdf0e10cSrcweir FormatterBase::FormatterBase( FormatterBaseImpl *pFormatImpl )
196cdf0e10cSrcweir : mpFormatImpl( pFormatImpl )
197cdf0e10cSrcweir {
198cdf0e10cSrcweir }
199cdf0e10cSrcweir
200cdf0e10cSrcweir class NumericFormatterImpl : public FormatterBaseImpl
201cdf0e10cSrcweir {
202cdf0e10cSrcweir public:
203cdf0e10cSrcweir uno::Reference< awt::XNumericField > mxField;
NumericFormatterImpl(const PeerHandle & peer)204cdf0e10cSrcweir explicit NumericFormatterImpl( const PeerHandle &peer )
205cdf0e10cSrcweir : FormatterBaseImpl( peer )
206cdf0e10cSrcweir , mxField( peer, uno::UNO_QUERY )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir }
209cdf0e10cSrcweir
210cdf0e10cSrcweir // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
valueToDouble(sal_Int64 nValue)211cdf0e10cSrcweir double valueToDouble( sal_Int64 nValue )
212cdf0e10cSrcweir {
213cdf0e10cSrcweir sal_Int16 nDigits = mxField->getDecimalDigits();
214cdf0e10cSrcweir double n = (double)nValue;
215cdf0e10cSrcweir for ( sal_uInt16 d = 0; d < nDigits; d++ )
216cdf0e10cSrcweir n /= 10;
217cdf0e10cSrcweir return n;
218cdf0e10cSrcweir } // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
doubleToValue(double nValue)219cdf0e10cSrcweir sal_Int64 doubleToValue( double nValue )
220cdf0e10cSrcweir {
221cdf0e10cSrcweir sal_Int16 nDigits = mxField->getDecimalDigits();
222cdf0e10cSrcweir double n = nValue;
223cdf0e10cSrcweir for ( sal_uInt16 d = 0; d < nDigits; d++ )
224cdf0e10cSrcweir n *= 10;
225cdf0e10cSrcweir return (sal_Int64) n;
226cdf0e10cSrcweir }
227cdf0e10cSrcweir };
228cdf0e10cSrcweir
229cdf0e10cSrcweir class MetricFormatterImpl : public FormatterBaseImpl
230cdf0e10cSrcweir {
231cdf0e10cSrcweir public:
232cdf0e10cSrcweir uno::Reference< awt::XMetricField > mxField;
MetricFormatterImpl(const PeerHandle & peer)233cdf0e10cSrcweir explicit MetricFormatterImpl( const PeerHandle &peer )
234cdf0e10cSrcweir : FormatterBaseImpl( peer )
235cdf0e10cSrcweir , mxField( peer, uno::UNO_QUERY )
236cdf0e10cSrcweir {
237cdf0e10cSrcweir }
238cdf0e10cSrcweir };
239cdf0e10cSrcweir
NumericFormatter(FormatterBaseImpl * pImpl)240cdf0e10cSrcweir NumericFormatter::NumericFormatter( FormatterBaseImpl *pImpl )
241cdf0e10cSrcweir : FormatterBase( pImpl )
242cdf0e10cSrcweir {
243cdf0e10cSrcweir }
244cdf0e10cSrcweir
getFormatImpl() const245cdf0e10cSrcweir NumericFormatterImpl& NumericFormatter::getFormatImpl() const
246cdf0e10cSrcweir {
247cdf0e10cSrcweir return *( static_cast<NumericFormatterImpl *>( mpFormatImpl ) );
248cdf0e10cSrcweir }
249cdf0e10cSrcweir
250cdf0e10cSrcweir #define SET_IMPL(vclmethod, idlmethod) \
251cdf0e10cSrcweir void NumericFormatter::vclmethod( sal_Int64 nValue ) \
252cdf0e10cSrcweir { \
253cdf0e10cSrcweir if ( !getFormatImpl().mxField.is() ) \
254cdf0e10cSrcweir return; \
255cdf0e10cSrcweir getFormatImpl().mxField->idlmethod( getFormatImpl().valueToDouble( nValue ) ); \
256cdf0e10cSrcweir }
257cdf0e10cSrcweir
SET_IMPL(SetMin,setMin)258cdf0e10cSrcweir SET_IMPL( SetMin, setMin )
259cdf0e10cSrcweir SET_IMPL( SetMax, setMax )
260cdf0e10cSrcweir SET_IMPL( SetLast, setLast )
261cdf0e10cSrcweir SET_IMPL( SetFirst, setFirst )
262cdf0e10cSrcweir SET_IMPL( SetValue, setValue )
263cdf0e10cSrcweir SET_IMPL( SetSpinSize, setSpinSize )
264cdf0e10cSrcweir
265cdf0e10cSrcweir sal_Int64 NumericFormatter::GetValue() const
266cdf0e10cSrcweir {
267cdf0e10cSrcweir if ( !getFormatImpl().mxField.is() )
268cdf0e10cSrcweir return 0;
269cdf0e10cSrcweir return getFormatImpl().doubleToValue( getFormatImpl().mxField->getValue() );
270cdf0e10cSrcweir }
271cdf0e10cSrcweir
272cdf0e10cSrcweir #undef SET_IMPL
273cdf0e10cSrcweir
274cdf0e10cSrcweir IMPL_CONSTRUCTORS_2( NumericField, SpinField, NumericFormatter, "numericfield" );
275cdf0e10cSrcweir
MetricFormatter(FormatterBaseImpl * pImpl)276cdf0e10cSrcweir MetricFormatter::MetricFormatter( FormatterBaseImpl *pImpl )
277cdf0e10cSrcweir : FormatterBase( pImpl )
278cdf0e10cSrcweir {
279cdf0e10cSrcweir }
getFormatImpl() const280cdf0e10cSrcweir MetricFormatterImpl& MetricFormatter::getFormatImpl() const
281cdf0e10cSrcweir { return *( static_cast<MetricFormatterImpl *>( mpFormatImpl ) ); }
282cdf0e10cSrcweir
283cdf0e10cSrcweir #define MetricUnitVclToUno(a) ((sal_uInt16)(a))
284cdf0e10cSrcweir
285cdf0e10cSrcweir #define SET_IMPL(vclmethod, idlmethod) \
286cdf0e10cSrcweir void MetricFormatter::vclmethod( sal_Int64 nValue, FieldUnit nUnit ) \
287cdf0e10cSrcweir { \
288cdf0e10cSrcweir if ( !getFormatImpl().mxField.is() ) \
289cdf0e10cSrcweir return; \
290cdf0e10cSrcweir getFormatImpl().mxField->idlmethod( nValue, MetricUnitVclToUno( nUnit ) ); \
291cdf0e10cSrcweir }
292cdf0e10cSrcweir
SET_IMPL(SetMin,setMin)293cdf0e10cSrcweir SET_IMPL( SetMin, setMin )
294cdf0e10cSrcweir SET_IMPL( SetMax, setMax )
295cdf0e10cSrcweir SET_IMPL( SetLast, setLast )
296cdf0e10cSrcweir SET_IMPL( SetFirst, setFirst )
297cdf0e10cSrcweir SET_IMPL( SetValue, setValue )
298cdf0e10cSrcweir
299cdf0e10cSrcweir #undef SET_IMPL
300cdf0e10cSrcweir
301cdf0e10cSrcweir void MetricFormatter::SetSpinSize( sal_Int64 nValue )
302cdf0e10cSrcweir {
303cdf0e10cSrcweir if ( !getFormatImpl().mxField.is() )
304cdf0e10cSrcweir return;
305cdf0e10cSrcweir getFormatImpl().mxField->setSpinSize( nValue );
306cdf0e10cSrcweir }
307cdf0e10cSrcweir
GetValue(FieldUnit nUnit) const308cdf0e10cSrcweir sal_Int64 MetricFormatter::GetValue( FieldUnit nUnit ) const
309cdf0e10cSrcweir {
310cdf0e10cSrcweir if ( !getFormatImpl().mxField.is() )
311cdf0e10cSrcweir return 0;
312cdf0e10cSrcweir return getFormatImpl().mxField->getValue( MetricUnitVclToUno( nUnit ) );
313cdf0e10cSrcweir }
314cdf0e10cSrcweir
315cdf0e10cSrcweir IMPL_CONSTRUCTORS_2( MetricField, SpinField, MetricFormatter, "metricfield" );
316cdf0e10cSrcweir
317cdf0e10cSrcweir class ComboBoxImpl : public EditImpl
318cdf0e10cSrcweir , public ::cppu::WeakImplHelper1< awt::XActionListener >
319cdf0e10cSrcweir , public ::cppu::WeakImplHelper1< awt::XItemListener >
320cdf0e10cSrcweir {
321cdf0e10cSrcweir public:
322cdf0e10cSrcweir uno::Reference< awt::XComboBox > mxComboBox;
323cdf0e10cSrcweir
324cdf0e10cSrcweir Link maClickHdl;
325cdf0e10cSrcweir Link maSelectHdl;
326cdf0e10cSrcweir
327cdf0e10cSrcweir Window *parent;
328cdf0e10cSrcweir
ComboBoxImpl(Context * context,const PeerHandle & peer,Window * window)329cdf0e10cSrcweir ComboBoxImpl( Context *context, const PeerHandle &peer, Window *window )
330cdf0e10cSrcweir : EditImpl( context, peer, window )
331cdf0e10cSrcweir , mxComboBox( peer, uno::UNO_QUERY )
332cdf0e10cSrcweir {
333cdf0e10cSrcweir }
334cdf0e10cSrcweir
335cdf0e10cSrcweir ~ComboBoxImpl ();
336cdf0e10cSrcweir
InsertEntry(OUString const & rStr,sal_uInt16 nPos)337cdf0e10cSrcweir sal_uInt16 InsertEntry( OUString const& rStr, sal_uInt16 nPos )
338cdf0e10cSrcweir {
339cdf0e10cSrcweir if ( nPos == COMBOBOX_APPEND )
340cdf0e10cSrcweir nPos = GetEntryCount();
341cdf0e10cSrcweir mxComboBox->addItem( rtl::OUString( rStr ), nPos );
342cdf0e10cSrcweir return nPos;
343cdf0e10cSrcweir }
344cdf0e10cSrcweir
RemoveEntry(sal_uInt16 nPos)345cdf0e10cSrcweir void RemoveEntry( sal_uInt16 nPos )
346cdf0e10cSrcweir {
347cdf0e10cSrcweir mxComboBox->removeItems( nPos, 1 );
348cdf0e10cSrcweir }
349cdf0e10cSrcweir
GetEntryPos(String const & rStr) const350cdf0e10cSrcweir sal_uInt16 GetEntryPos( String const& rStr ) const
351cdf0e10cSrcweir {
352cdf0e10cSrcweir uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() );
353cdf0e10cSrcweir rtl::OUString rKey( rStr );
354cdf0e10cSrcweir sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength());
355cdf0e10cSrcweir for (sal_uInt16 i = 0; i < n; i++)
356cdf0e10cSrcweir {
357cdf0e10cSrcweir if ( aItems[ i ] == rKey )
358cdf0e10cSrcweir return i;
359cdf0e10cSrcweir }
360cdf0e10cSrcweir return COMBOBOX_ENTRY_NOTFOUND;
361cdf0e10cSrcweir }
362cdf0e10cSrcweir
GetEntry(sal_uInt16 nPos) const363cdf0e10cSrcweir OUString GetEntry( sal_uInt16 nPos ) const
364cdf0e10cSrcweir {
365cdf0e10cSrcweir return OUString( mxComboBox->getItem( nPos ) );
366cdf0e10cSrcweir }
367cdf0e10cSrcweir
GetEntryCount() const368cdf0e10cSrcweir sal_uInt16 GetEntryCount() const
369cdf0e10cSrcweir {
370cdf0e10cSrcweir return mxComboBox->getItemCount();
371cdf0e10cSrcweir }
372cdf0e10cSrcweir
SetClickHdl(Link const & link)373cdf0e10cSrcweir void SetClickHdl( Link const& link )
374cdf0e10cSrcweir {
375cdf0e10cSrcweir if (!link && !!maClickHdl)
376cdf0e10cSrcweir mxComboBox->removeActionListener( this );
377cdf0e10cSrcweir else if (!!link && !maClickHdl)
378cdf0e10cSrcweir mxComboBox->addActionListener( this );
379cdf0e10cSrcweir maClickHdl = link;
380cdf0e10cSrcweir }
381cdf0e10cSrcweir
SetSelectHdl(Link const & link)382cdf0e10cSrcweir void SetSelectHdl( Link const& link )
383cdf0e10cSrcweir {
384cdf0e10cSrcweir if (!link && !!maSelectHdl)
385cdf0e10cSrcweir mxComboBox->removeItemListener( this );
386cdf0e10cSrcweir else if (!!link && !maSelectHdl)
387cdf0e10cSrcweir mxComboBox->addItemListener( this );
388cdf0e10cSrcweir maSelectHdl = link;
389cdf0e10cSrcweir }
390cdf0e10cSrcweir
391cdf0e10cSrcweir void SAL_CALL disposing( lang::EventObject const& e )
392cdf0e10cSrcweir throw (uno::RuntimeException);
393cdf0e10cSrcweir
actionPerformed(const awt::ActionEvent &)394cdf0e10cSrcweir void SAL_CALL actionPerformed (const awt::ActionEvent&)
395cdf0e10cSrcweir throw (uno::RuntimeException)
396cdf0e10cSrcweir {
397cdf0e10cSrcweir ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
398cdf0e10cSrcweir if ( !pComboBox )
399cdf0e10cSrcweir return;
400cdf0e10cSrcweir maClickHdl.Call( pComboBox );
401cdf0e10cSrcweir }
402cdf0e10cSrcweir
itemStateChanged(awt::ItemEvent const &)403cdf0e10cSrcweir void SAL_CALL itemStateChanged( awt::ItemEvent const&)
404cdf0e10cSrcweir throw (uno::RuntimeException)
405cdf0e10cSrcweir {
406cdf0e10cSrcweir ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
407cdf0e10cSrcweir if ( !pComboBox )
408cdf0e10cSrcweir return;
409cdf0e10cSrcweir maSelectHdl.Call( pComboBox );
410cdf0e10cSrcweir }
411cdf0e10cSrcweir };
412cdf0e10cSrcweir
~ComboBox()413cdf0e10cSrcweir ComboBox::~ComboBox ()
414cdf0e10cSrcweir {
415cdf0e10cSrcweir #ifndef __SUNPRO_CC
416cdf0e10cSrcweir OSL_TRACE ("%s: deleting ComboBox for window: %p", __FUNCTION__, GetWindow ());
417cdf0e10cSrcweir #endif
418cdf0e10cSrcweir }
419cdf0e10cSrcweir
~ComboBoxImpl()420cdf0e10cSrcweir ComboBoxImpl::~ComboBoxImpl ()
421cdf0e10cSrcweir {
422cdf0e10cSrcweir #ifndef __SUNPRO_CC
423cdf0e10cSrcweir OSL_TRACE ("%s: deleting ComboBoxImpl for window: %p", __FUNCTION__, mpWindow ? mpWindow->GetWindow () : 0);
424cdf0e10cSrcweir OSL_TRACE ("%s: deleting ComboBoxImpl for listener: %p", __FUNCTION__, static_cast<XFocusListener*> (this));
425cdf0e10cSrcweir #endif
426cdf0e10cSrcweir }
427cdf0e10cSrcweir
disposing(lang::EventObject const & e)428cdf0e10cSrcweir void ComboBoxImpl::disposing( lang::EventObject const& e )
429cdf0e10cSrcweir throw (uno::RuntimeException)
430cdf0e10cSrcweir {
431cdf0e10cSrcweir EditImpl::disposing (e);
432cdf0e10cSrcweir mxComboBox.clear ();
433cdf0e10cSrcweir }
434cdf0e10cSrcweir
InsertEntry(String const & rStr,sal_uInt16 nPos)435cdf0e10cSrcweir sal_uInt16 ComboBox::InsertEntry( String const& rStr, sal_uInt16 nPos )
436cdf0e10cSrcweir {
437*5e0f18e3SDon Lewis return getImpl()->InsertEntry( rStr, nPos );
438cdf0e10cSrcweir }
439cdf0e10cSrcweir
RemoveEntry(String const & rStr)440cdf0e10cSrcweir void ComboBox::RemoveEntry( String const& rStr )
441cdf0e10cSrcweir {
442*5e0f18e3SDon Lewis getImpl()->RemoveEntry( GetEntryPos( rStr ) );
443cdf0e10cSrcweir }
444cdf0e10cSrcweir
RemoveEntry(sal_uInt16 nPos)445cdf0e10cSrcweir void ComboBox::RemoveEntry( sal_uInt16 nPos )
446cdf0e10cSrcweir {
447*5e0f18e3SDon Lewis getImpl()->RemoveEntry( nPos );
448cdf0e10cSrcweir }
449cdf0e10cSrcweir
Clear()450cdf0e10cSrcweir void ComboBox::Clear()
451cdf0e10cSrcweir {
452cdf0e10cSrcweir uno::Sequence< rtl::OUString> aNoItems;
453*5e0f18e3SDon Lewis if ( getImpl() )
454*5e0f18e3SDon Lewis getImpl()->setProperty( "StringItemList", uno::Any( aNoItems ) );
455cdf0e10cSrcweir }
456cdf0e10cSrcweir
GetEntryPos(String const & rStr) const457cdf0e10cSrcweir sal_uInt16 ComboBox::GetEntryPos( String const& rStr ) const
458cdf0e10cSrcweir {
459*5e0f18e3SDon Lewis return getImpl()->GetEntryPos( rStr );
460cdf0e10cSrcweir }
461cdf0e10cSrcweir
GetEntry(sal_uInt16 nPos) const462cdf0e10cSrcweir String ComboBox::GetEntry( sal_uInt16 nPos ) const
463cdf0e10cSrcweir {
464*5e0f18e3SDon Lewis rtl::OUString rItem = getImpl()->mxComboBox->getItem( nPos );
465cdf0e10cSrcweir return OUString( rItem );
466cdf0e10cSrcweir }
467cdf0e10cSrcweir
GetEntryCount() const468cdf0e10cSrcweir sal_uInt16 ComboBox::GetEntryCount() const
469cdf0e10cSrcweir {
470*5e0f18e3SDon Lewis return getImpl()->GetEntryCount();
471cdf0e10cSrcweir }
472cdf0e10cSrcweir
SetClickHdl(const Link & link)473cdf0e10cSrcweir void ComboBox::SetClickHdl( const Link& link )
474cdf0e10cSrcweir {
475*5e0f18e3SDon Lewis if (getImpl() && getImpl()->mxComboBox.is ())
476*5e0f18e3SDon Lewis getImpl()->SetClickHdl( link );
477cdf0e10cSrcweir }
478cdf0e10cSrcweir
SetSelectHdl(const Link & link)479cdf0e10cSrcweir void ComboBox::SetSelectHdl( const Link& link )
480cdf0e10cSrcweir {
481*5e0f18e3SDon Lewis if (getImpl() && getImpl()->mxComboBox.is ())
482*5e0f18e3SDon Lewis getImpl()->SetSelectHdl( link );
483cdf0e10cSrcweir }
484cdf0e10cSrcweir
EnableAutocomplete(bool enable,bool matchCase)485cdf0e10cSrcweir void ComboBox::EnableAutocomplete (bool enable, bool matchCase)
486cdf0e10cSrcweir {
487cdf0e10cSrcweir GetComboBox ()->EnableAutocomplete (enable, matchCase);
488cdf0e10cSrcweir }
489cdf0e10cSrcweir
490*5e0f18e3SDon Lewis IMPL_CONSTRUCTORS_BODY( ComboBox, Edit, "combobox", getImpl()->parent = parent; );
491cdf0e10cSrcweir IMPL_GET_WINDOW (ComboBox);
492*5e0f18e3SDon Lewis IMPL_GET_IMPL( ComboBox );
493cdf0e10cSrcweir
494cdf0e10cSrcweir class ListBoxImpl : public ControlImpl
495cdf0e10cSrcweir , public ::cppu::WeakImplHelper1< awt::XActionListener >
496cdf0e10cSrcweir , public ::cppu::WeakImplHelper1< awt::XItemListener >
497cdf0e10cSrcweir , public ::cppu::WeakImplHelper1< awt::XMouseListener >
498cdf0e10cSrcweir {
499cdf0e10cSrcweir Link maClickHdl;
500cdf0e10cSrcweir Link maSelectHdl;
501cdf0e10cSrcweir Link maDoubleClickHdl;
502cdf0e10cSrcweir
503cdf0e10cSrcweir public:
504cdf0e10cSrcweir uno::Reference< awt::XListBox > mxListBox;
ListBoxImpl(Context * context,const PeerHandle & peer,Window * window)505cdf0e10cSrcweir ListBoxImpl( Context *context, const PeerHandle &peer, Window *window )
506cdf0e10cSrcweir : ControlImpl( context, peer, window )
507cdf0e10cSrcweir , mxListBox( peer, uno::UNO_QUERY )
508cdf0e10cSrcweir {
509cdf0e10cSrcweir SelectEntryPos (0, true);
510cdf0e10cSrcweir }
511cdf0e10cSrcweir
InsertEntry(String const & rStr,sal_uInt16 nPos)512cdf0e10cSrcweir sal_uInt16 InsertEntry (String const& rStr, sal_uInt16 nPos)
513cdf0e10cSrcweir {
514cdf0e10cSrcweir if ( nPos == LISTBOX_APPEND )
515cdf0e10cSrcweir nPos = mxListBox->getItemCount();
516cdf0e10cSrcweir mxListBox->addItem( rtl::OUString( rStr ), nPos );
517cdf0e10cSrcweir return nPos;
518cdf0e10cSrcweir }
519cdf0e10cSrcweir
RemoveEntry(sal_uInt16 nPos)520cdf0e10cSrcweir void RemoveEntry( sal_uInt16 nPos )
521cdf0e10cSrcweir {
522cdf0e10cSrcweir mxListBox->removeItems( nPos, 1 );
523cdf0e10cSrcweir }
524cdf0e10cSrcweir
RemoveEntry(String const & rStr,sal_uInt16 nPos)525cdf0e10cSrcweir sal_uInt16 RemoveEntry( String const& rStr, sal_uInt16 nPos)
526cdf0e10cSrcweir {
527cdf0e10cSrcweir if ( nPos == LISTBOX_APPEND )
528cdf0e10cSrcweir nPos = mxListBox->getItemCount();
529cdf0e10cSrcweir mxListBox->addItem( rtl::OUString( rStr ), nPos );
530cdf0e10cSrcweir return nPos;
531cdf0e10cSrcweir }
532cdf0e10cSrcweir
GetEntryPos(String const & rStr) const533cdf0e10cSrcweir sal_uInt16 GetEntryPos( String const& rStr ) const
534cdf0e10cSrcweir {
535cdf0e10cSrcweir uno::Sequence< rtl::OUString> aItems( mxListBox->getItems() );
536cdf0e10cSrcweir rtl::OUString rKey( rStr );
537cdf0e10cSrcweir sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength());
538cdf0e10cSrcweir for (sal_uInt16 i = 0; i < n; i++)
539cdf0e10cSrcweir {
540cdf0e10cSrcweir if ( aItems[ i ] == rKey )
541cdf0e10cSrcweir return i;
542cdf0e10cSrcweir }
543cdf0e10cSrcweir return LISTBOX_ENTRY_NOTFOUND;
544cdf0e10cSrcweir }
545cdf0e10cSrcweir
GetEntry(sal_uInt16 nPos) const546cdf0e10cSrcweir OUString GetEntry( sal_uInt16 nPos ) const
547cdf0e10cSrcweir {
548cdf0e10cSrcweir return mxListBox->getItem( nPos );
549cdf0e10cSrcweir }
550cdf0e10cSrcweir
GetEntryCount() const551cdf0e10cSrcweir sal_uInt16 GetEntryCount() const
552cdf0e10cSrcweir {
553cdf0e10cSrcweir return mxListBox->getItemCount();
554cdf0e10cSrcweir }
555cdf0e10cSrcweir
SelectEntryPos(sal_uInt16 nPos,bool bSelect)556cdf0e10cSrcweir void SelectEntryPos( sal_uInt16 nPos, bool bSelect )
557cdf0e10cSrcweir {
558cdf0e10cSrcweir mxListBox->selectItemPos( nPos, bSelect );
559cdf0e10cSrcweir }
560cdf0e10cSrcweir
GetSelectEntryCount() const561cdf0e10cSrcweir sal_uInt16 GetSelectEntryCount() const
562cdf0e10cSrcweir {
563cdf0e10cSrcweir return sal::static_int_cast< sal_uInt16 >( mxListBox->getSelectedItems().getLength() );
564cdf0e10cSrcweir }
565cdf0e10cSrcweir
GetSelectEntryPos(sal_uInt16 nSelIndex) const566cdf0e10cSrcweir sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex ) const
567cdf0e10cSrcweir {
568cdf0e10cSrcweir sal_uInt16 nSelected = 0;
569cdf0e10cSrcweir if ( mxListBox->isMutipleMode() )
570cdf0e10cSrcweir {
571cdf0e10cSrcweir uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() );
572cdf0e10cSrcweir if ( nSelIndex < aItems.getLength() )
573cdf0e10cSrcweir nSelected = aItems[ nSelIndex ];
574cdf0e10cSrcweir }
575cdf0e10cSrcweir else
576cdf0e10cSrcweir nSelected = mxListBox->getSelectedItemPos();
577cdf0e10cSrcweir return nSelected;
578cdf0e10cSrcweir }
579cdf0e10cSrcweir
disposing(lang::EventObject const & e)580cdf0e10cSrcweir virtual void SAL_CALL disposing( lang::EventObject const& e )
581cdf0e10cSrcweir throw (uno::RuntimeException)
582cdf0e10cSrcweir {
583cdf0e10cSrcweir ControlImpl::disposing (e);
584cdf0e10cSrcweir mxListBox.clear ();
585cdf0e10cSrcweir }
586cdf0e10cSrcweir
GetClickHdl()587cdf0e10cSrcweir Link& GetClickHdl ()
588cdf0e10cSrcweir {
589cdf0e10cSrcweir return maClickHdl;
590cdf0e10cSrcweir }
591cdf0e10cSrcweir
SetClickHdl(Link const & link)592cdf0e10cSrcweir void SetClickHdl( Link const& link )
593cdf0e10cSrcweir {
594cdf0e10cSrcweir if (!link && !!maClickHdl)
595cdf0e10cSrcweir mxListBox->removeActionListener( this );
596cdf0e10cSrcweir else if (!!link && !maClickHdl)
597cdf0e10cSrcweir mxListBox->addActionListener( this );
598cdf0e10cSrcweir maClickHdl = link;
599cdf0e10cSrcweir }
600cdf0e10cSrcweir
actionPerformed(const awt::ActionEvent &)601cdf0e10cSrcweir void SAL_CALL actionPerformed( const awt::ActionEvent& /* rEvent */ )
602cdf0e10cSrcweir throw (uno::RuntimeException)
603cdf0e10cSrcweir {
604cdf0e10cSrcweir maClickHdl.Call( mpWindow );
605cdf0e10cSrcweir }
606cdf0e10cSrcweir
GetSelectHdl()607cdf0e10cSrcweir Link& GetSelectHdl ()
608cdf0e10cSrcweir {
609cdf0e10cSrcweir return maSelectHdl;
610cdf0e10cSrcweir }
611cdf0e10cSrcweir
SetSelectHdl(Link const & link)612cdf0e10cSrcweir void SetSelectHdl( Link const& link )
613cdf0e10cSrcweir {
614cdf0e10cSrcweir if (!link && !!maSelectHdl)
615cdf0e10cSrcweir mxListBox->removeItemListener( this );
616cdf0e10cSrcweir else if (!!link && !maSelectHdl)
617cdf0e10cSrcweir mxListBox->addItemListener( this );
618cdf0e10cSrcweir maSelectHdl = link;
619cdf0e10cSrcweir }
620cdf0e10cSrcweir
itemStateChanged(awt::ItemEvent const &)621cdf0e10cSrcweir void SAL_CALL itemStateChanged (awt::ItemEvent const&)
622cdf0e10cSrcweir throw (uno::RuntimeException)
623cdf0e10cSrcweir {
624cdf0e10cSrcweir maSelectHdl.Call (static_cast <ListBox*> (mpWindow));
625cdf0e10cSrcweir }
626cdf0e10cSrcweir
GetDoubleClickHdl()627cdf0e10cSrcweir Link& GetDoubleClickHdl ()
628cdf0e10cSrcweir {
629cdf0e10cSrcweir return maDoubleClickHdl;
630cdf0e10cSrcweir }
631cdf0e10cSrcweir
SetDoubleClickHdl(Link const & link)632cdf0e10cSrcweir void SetDoubleClickHdl (Link const& link)
633cdf0e10cSrcweir {
634cdf0e10cSrcweir if (!link && !!maDoubleClickHdl)
635cdf0e10cSrcweir mxWindow->removeMouseListener (this);
636cdf0e10cSrcweir else if (!!link && !maSelectHdl)
637cdf0e10cSrcweir mxWindow->addMouseListener (this);
638cdf0e10cSrcweir maDoubleClickHdl = link;
639cdf0e10cSrcweir }
640cdf0e10cSrcweir
mousePressed(awt::MouseEvent const &)641cdf0e10cSrcweir void SAL_CALL mousePressed (awt::MouseEvent const&) throw (uno::RuntimeException)
642cdf0e10cSrcweir {
643cdf0e10cSrcweir }
mouseReleased(awt::MouseEvent const & e)644cdf0e10cSrcweir void SAL_CALL mouseReleased (awt::MouseEvent const& e) throw (uno::RuntimeException)
645cdf0e10cSrcweir {
646cdf0e10cSrcweir if (e.ClickCount == 2)
647cdf0e10cSrcweir maDoubleClickHdl.Call (mpWindow);
648cdf0e10cSrcweir }
mouseEntered(awt::MouseEvent const &)649cdf0e10cSrcweir void SAL_CALL mouseEntered (awt::MouseEvent const&) throw (uno::RuntimeException)
650cdf0e10cSrcweir {
651cdf0e10cSrcweir }
mouseExited(awt::MouseEvent const &)652cdf0e10cSrcweir void SAL_CALL mouseExited (awt::MouseEvent const&) throw (uno::RuntimeException)
653cdf0e10cSrcweir {
654cdf0e10cSrcweir }
655cdf0e10cSrcweir };
656cdf0e10cSrcweir
~ListBox()657cdf0e10cSrcweir ListBox::~ListBox ()
658cdf0e10cSrcweir {
659cdf0e10cSrcweir }
660cdf0e10cSrcweir
InsertEntry(String const & rStr,sal_uInt16 nPos)661cdf0e10cSrcweir sal_uInt16 ListBox::InsertEntry (String const& rStr, sal_uInt16 nPos)
662cdf0e10cSrcweir {
663*5e0f18e3SDon Lewis return getImpl()->InsertEntry(rStr, nPos);
664cdf0e10cSrcweir }
665cdf0e10cSrcweir
RemoveEntry(sal_uInt16 nPos)666cdf0e10cSrcweir void ListBox::RemoveEntry( sal_uInt16 nPos )
667cdf0e10cSrcweir {
668*5e0f18e3SDon Lewis return getImpl()->RemoveEntry( nPos );
669cdf0e10cSrcweir }
670cdf0e10cSrcweir
RemoveEntry(String const & rStr)671cdf0e10cSrcweir void ListBox::RemoveEntry( String const& rStr )
672cdf0e10cSrcweir {
673*5e0f18e3SDon Lewis return getImpl()->RemoveEntry( GetEntryPos( rStr ) );
674cdf0e10cSrcweir }
675cdf0e10cSrcweir
Clear()676cdf0e10cSrcweir void ListBox::Clear()
677cdf0e10cSrcweir {
678cdf0e10cSrcweir uno::Sequence< rtl::OUString> aNoItems;
679*5e0f18e3SDon Lewis if ( getImpl() )
680*5e0f18e3SDon Lewis getImpl()->setProperty( "StringItemList", uno::Any( aNoItems ) );
681cdf0e10cSrcweir }
682cdf0e10cSrcweir
GetEntryPos(String const & rStr) const683cdf0e10cSrcweir sal_uInt16 ListBox::GetEntryPos( String const& rStr ) const
684cdf0e10cSrcweir {
685*5e0f18e3SDon Lewis return getImpl()->GetEntryPos( rStr );
686cdf0e10cSrcweir }
687cdf0e10cSrcweir
GetEntry(sal_uInt16 nPos) const688cdf0e10cSrcweir String ListBox::GetEntry( sal_uInt16 nPos ) const
689cdf0e10cSrcweir {
690*5e0f18e3SDon Lewis return getImpl()->GetEntry( nPos );
691cdf0e10cSrcweir }
692cdf0e10cSrcweir
GetEntryCount() const693cdf0e10cSrcweir sal_uInt16 ListBox::GetEntryCount() const
694cdf0e10cSrcweir {
695*5e0f18e3SDon Lewis return getImpl()->GetEntryCount();
696cdf0e10cSrcweir }
697cdf0e10cSrcweir
SelectEntryPos(sal_uInt16 nPos,bool bSelect)698cdf0e10cSrcweir void ListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect )
699cdf0e10cSrcweir {
700cdf0e10cSrcweir #if LAYOUT_API_CALLS_HANDLER
701*5e0f18e3SDon Lewis getImpl()->SelectEntryPos( nPos, bSelect );
702cdf0e10cSrcweir #else /* !LAYOUT_API_CALLS_HANDLER */
703cdf0e10cSrcweir GetListBox ()->SelectEntryPos (nPos, bSelect);
704cdf0e10cSrcweir #endif /* !LAYOUT_API_CALLS_HANDLER */
705cdf0e10cSrcweir }
706cdf0e10cSrcweir
SelectEntry(String const & rStr,bool bSelect)707cdf0e10cSrcweir void ListBox::SelectEntry( String const& rStr, bool bSelect )
708cdf0e10cSrcweir {
709cdf0e10cSrcweir SelectEntryPos( GetEntryPos( rStr ), bSelect );
710cdf0e10cSrcweir }
711cdf0e10cSrcweir
GetSelectEntryCount() const712cdf0e10cSrcweir sal_uInt16 ListBox::GetSelectEntryCount() const
713cdf0e10cSrcweir {
714*5e0f18e3SDon Lewis return getImpl()->GetSelectEntryCount();
715cdf0e10cSrcweir }
716cdf0e10cSrcweir
GetSelectEntryPos(sal_uInt16 nSelIndex) const717cdf0e10cSrcweir sal_uInt16 ListBox::GetSelectEntryPos( sal_uInt16 nSelIndex ) const
718cdf0e10cSrcweir {
719*5e0f18e3SDon Lewis return getImpl()->GetSelectEntryPos( nSelIndex );
720cdf0e10cSrcweir }
721cdf0e10cSrcweir
GetSelectEntry(sal_uInt16 nSelIndex) const722cdf0e10cSrcweir String ListBox::GetSelectEntry( sal_uInt16 nSelIndex ) const
723cdf0e10cSrcweir {
724cdf0e10cSrcweir return GetEntry( GetSelectEntryPos( nSelIndex ) );
725cdf0e10cSrcweir }
726cdf0e10cSrcweir
GetSelectHdl()727cdf0e10cSrcweir Link& ListBox::GetSelectHdl ()
728cdf0e10cSrcweir {
729*5e0f18e3SDon Lewis return getImpl()->GetSelectHdl ();
730cdf0e10cSrcweir }
731cdf0e10cSrcweir
SetSelectHdl(Link const & link)732cdf0e10cSrcweir void ListBox::SetSelectHdl( Link const& link )
733cdf0e10cSrcweir {
734*5e0f18e3SDon Lewis getImpl()->SetSelectHdl( link );
735cdf0e10cSrcweir }
736cdf0e10cSrcweir
GetClickHdl()737cdf0e10cSrcweir Link& ListBox::GetClickHdl ()
738cdf0e10cSrcweir {
739*5e0f18e3SDon Lewis return getImpl()->GetSelectHdl ();
740cdf0e10cSrcweir }
741cdf0e10cSrcweir
SetClickHdl(Link const & link)742cdf0e10cSrcweir void ListBox::SetClickHdl( Link const& link )
743cdf0e10cSrcweir {
744*5e0f18e3SDon Lewis if (getImpl() && getImpl()->mxListBox.is ())
745*5e0f18e3SDon Lewis getImpl()->SetClickHdl( link );
746cdf0e10cSrcweir }
747cdf0e10cSrcweir
GetDoubleClickHdl()748cdf0e10cSrcweir Link& ListBox::GetDoubleClickHdl ()
749cdf0e10cSrcweir {
750*5e0f18e3SDon Lewis return getImpl()->GetSelectHdl ();
751cdf0e10cSrcweir }
752cdf0e10cSrcweir
SetDoubleClickHdl(Link const & link)753cdf0e10cSrcweir void ListBox::SetDoubleClickHdl( Link const& link )
754cdf0e10cSrcweir {
755*5e0f18e3SDon Lewis getImpl()->SetDoubleClickHdl( link );
756cdf0e10cSrcweir }
757cdf0e10cSrcweir
SetEntryData(sal_uInt16 pos,void * data)758cdf0e10cSrcweir void ListBox::SetEntryData( sal_uInt16 pos, void* data)
759cdf0e10cSrcweir {
760cdf0e10cSrcweir GetListBox ()->SetEntryData (pos, data);
761cdf0e10cSrcweir }
762cdf0e10cSrcweir
GetEntryData(sal_uInt16 pos) const763cdf0e10cSrcweir void* ListBox::GetEntryData( sal_uInt16 pos) const
764cdf0e10cSrcweir {
765cdf0e10cSrcweir return GetListBox ()->GetEntryData (pos);
766cdf0e10cSrcweir }
767cdf0e10cSrcweir
SetNoSelection()768cdf0e10cSrcweir void ListBox::SetNoSelection ()
769cdf0e10cSrcweir {
770cdf0e10cSrcweir GetListBox ()->SetNoSelection ();
771cdf0e10cSrcweir }
772cdf0e10cSrcweir
773cdf0e10cSrcweir IMPL_CONSTRUCTORS (ListBox, Control, "listbox");
774cdf0e10cSrcweir IMPL_GET_IMPL (ListBox);
775cdf0e10cSrcweir IMPL_GET_WINDOW (ListBox);
776cdf0e10cSrcweir
777cdf0e10cSrcweir IMPL_IMPL (MultiListBox, ListBox)
778cdf0e10cSrcweir IMPL_CONSTRUCTORS_BODY( MultiListBox, ListBox, "multilistbox", GetMultiListBox()->EnableMultiSelection( true ); );
779cdf0e10cSrcweir IMPL_GET_IMPL( MultiListBox );
780cdf0e10cSrcweir IMPL_GET_WINDOW( MultiListBox );
781cdf0e10cSrcweir } // namespace layout
782