1*b0724fc6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*b0724fc6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*b0724fc6SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*b0724fc6SAndrew Rist * distributed with this work for additional information
6*b0724fc6SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*b0724fc6SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*b0724fc6SAndrew Rist * "License"); you may not use this file except in compliance
9*b0724fc6SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*b0724fc6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*b0724fc6SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*b0724fc6SAndrew Rist * software distributed under the License is distributed on an
15*b0724fc6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b0724fc6SAndrew Rist * KIND, either express or implied. See the License for the
17*b0724fc6SAndrew Rist * specific language governing permissions and limitations
18*b0724fc6SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*b0724fc6SAndrew Rist *************************************************************/
21*b0724fc6SAndrew Rist
22*b0724fc6SAndrew 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
104cdf0e10cSrcweir if ( !getImpl().mxEdit.is() )
105cdf0e10cSrcweir 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
114cdf0e10cSrcweir if ( getImpl().mxEdit.is() )
115cdf0e10cSrcweir /// this calls handlers; endless loop in numfmt.cxx
116cdf0e10cSrcweir 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 {
124cdf0e10cSrcweir if ( !getImpl().mxEdit.is() )
125cdf0e10cSrcweir return getImpl().mxEdit->getText();
126cdf0e10cSrcweir return OUString();
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
SetModifyHdl(const Link & link)129cdf0e10cSrcweir void Edit::SetModifyHdl( const Link& link )
130cdf0e10cSrcweir {
131cdf0e10cSrcweir if (&getImpl () && getImpl().mxEdit.is ())
132cdf0e10cSrcweir 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 {
437cdf0e10cSrcweir return getImpl().InsertEntry( rStr, nPos );
438cdf0e10cSrcweir }
439cdf0e10cSrcweir
RemoveEntry(String const & rStr)440cdf0e10cSrcweir void ComboBox::RemoveEntry( String const& rStr )
441cdf0e10cSrcweir {
442cdf0e10cSrcweir getImpl().RemoveEntry( GetEntryPos( rStr ) );
443cdf0e10cSrcweir }
444cdf0e10cSrcweir
RemoveEntry(sal_uInt16 nPos)445cdf0e10cSrcweir void ComboBox::RemoveEntry( sal_uInt16 nPos )
446cdf0e10cSrcweir {
447cdf0e10cSrcweir getImpl().RemoveEntry( nPos );
448cdf0e10cSrcweir }
449cdf0e10cSrcweir
Clear()450cdf0e10cSrcweir void ComboBox::Clear()
451cdf0e10cSrcweir {
452cdf0e10cSrcweir uno::Sequence< rtl::OUString> aNoItems;
453cdf0e10cSrcweir getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
454cdf0e10cSrcweir }
455cdf0e10cSrcweir
GetEntryPos(String const & rStr) const456cdf0e10cSrcweir sal_uInt16 ComboBox::GetEntryPos( String const& rStr ) const
457cdf0e10cSrcweir {
458cdf0e10cSrcweir return getImpl().GetEntryPos( rStr );
459cdf0e10cSrcweir }
460cdf0e10cSrcweir
GetEntry(sal_uInt16 nPos) const461cdf0e10cSrcweir String ComboBox::GetEntry( sal_uInt16 nPos ) const
462cdf0e10cSrcweir {
463cdf0e10cSrcweir rtl::OUString rItem = getImpl().mxComboBox->getItem( nPos );
464cdf0e10cSrcweir return OUString( rItem );
465cdf0e10cSrcweir }
466cdf0e10cSrcweir
GetEntryCount() const467cdf0e10cSrcweir sal_uInt16 ComboBox::GetEntryCount() const
468cdf0e10cSrcweir {
469cdf0e10cSrcweir return getImpl().GetEntryCount();
470cdf0e10cSrcweir }
471cdf0e10cSrcweir
SetClickHdl(const Link & link)472cdf0e10cSrcweir void ComboBox::SetClickHdl( const Link& link )
473cdf0e10cSrcweir {
474cdf0e10cSrcweir if (&getImpl () && getImpl().mxComboBox.is ())
475cdf0e10cSrcweir getImpl().SetClickHdl( link );
476cdf0e10cSrcweir }
477cdf0e10cSrcweir
SetSelectHdl(const Link & link)478cdf0e10cSrcweir void ComboBox::SetSelectHdl( const Link& link )
479cdf0e10cSrcweir {
480cdf0e10cSrcweir if (&getImpl () && getImpl().mxComboBox.is ())
481cdf0e10cSrcweir getImpl().SetSelectHdl( link );
482cdf0e10cSrcweir }
483cdf0e10cSrcweir
EnableAutocomplete(bool enable,bool matchCase)484cdf0e10cSrcweir void ComboBox::EnableAutocomplete (bool enable, bool matchCase)
485cdf0e10cSrcweir {
486cdf0e10cSrcweir GetComboBox ()->EnableAutocomplete (enable, matchCase);
487cdf0e10cSrcweir }
488cdf0e10cSrcweir
489cdf0e10cSrcweir IMPL_CONSTRUCTORS_BODY( ComboBox, Edit, "combobox", getImpl().parent = parent; );
490cdf0e10cSrcweir IMPL_GET_WINDOW (ComboBox);
491cdf0e10cSrcweir /// IMPL_GET_IMPL( ComboBox );
492cdf0e10cSrcweir
493cdf0e10cSrcweir static ComboBoxImpl* null_combobox_impl = 0;
494cdf0e10cSrcweir
getImpl() const495cdf0e10cSrcweir ComboBoxImpl &ComboBox::getImpl () const
496cdf0e10cSrcweir {
497cdf0e10cSrcweir if (ComboBoxImpl* c = static_cast<ComboBoxImpl *>(mpImpl))
498cdf0e10cSrcweir return *c;
499cdf0e10cSrcweir return *null_combobox_impl;
500cdf0e10cSrcweir }
501cdf0e10cSrcweir
502cdf0e10cSrcweir class ListBoxImpl : public ControlImpl
503cdf0e10cSrcweir , public ::cppu::WeakImplHelper1< awt::XActionListener >
504cdf0e10cSrcweir , public ::cppu::WeakImplHelper1< awt::XItemListener >
505cdf0e10cSrcweir , public ::cppu::WeakImplHelper1< awt::XMouseListener >
506cdf0e10cSrcweir {
507cdf0e10cSrcweir Link maClickHdl;
508cdf0e10cSrcweir Link maSelectHdl;
509cdf0e10cSrcweir Link maDoubleClickHdl;
510cdf0e10cSrcweir
511cdf0e10cSrcweir public:
512cdf0e10cSrcweir uno::Reference< awt::XListBox > mxListBox;
ListBoxImpl(Context * context,const PeerHandle & peer,Window * window)513cdf0e10cSrcweir ListBoxImpl( Context *context, const PeerHandle &peer, Window *window )
514cdf0e10cSrcweir : ControlImpl( context, peer, window )
515cdf0e10cSrcweir , mxListBox( peer, uno::UNO_QUERY )
516cdf0e10cSrcweir {
517cdf0e10cSrcweir SelectEntryPos (0, true);
518cdf0e10cSrcweir }
519cdf0e10cSrcweir
InsertEntry(String const & rStr,sal_uInt16 nPos)520cdf0e10cSrcweir sal_uInt16 InsertEntry (String const& rStr, sal_uInt16 nPos)
521cdf0e10cSrcweir {
522cdf0e10cSrcweir if ( nPos == LISTBOX_APPEND )
523cdf0e10cSrcweir nPos = mxListBox->getItemCount();
524cdf0e10cSrcweir mxListBox->addItem( rtl::OUString( rStr ), nPos );
525cdf0e10cSrcweir return nPos;
526cdf0e10cSrcweir }
527cdf0e10cSrcweir
RemoveEntry(sal_uInt16 nPos)528cdf0e10cSrcweir void RemoveEntry( sal_uInt16 nPos )
529cdf0e10cSrcweir {
530cdf0e10cSrcweir mxListBox->removeItems( nPos, 1 );
531cdf0e10cSrcweir }
532cdf0e10cSrcweir
RemoveEntry(String const & rStr,sal_uInt16 nPos)533cdf0e10cSrcweir sal_uInt16 RemoveEntry( String const& rStr, sal_uInt16 nPos)
534cdf0e10cSrcweir {
535cdf0e10cSrcweir if ( nPos == LISTBOX_APPEND )
536cdf0e10cSrcweir nPos = mxListBox->getItemCount();
537cdf0e10cSrcweir mxListBox->addItem( rtl::OUString( rStr ), nPos );
538cdf0e10cSrcweir return nPos;
539cdf0e10cSrcweir }
540cdf0e10cSrcweir
GetEntryPos(String const & rStr) const541cdf0e10cSrcweir sal_uInt16 GetEntryPos( String const& rStr ) const
542cdf0e10cSrcweir {
543cdf0e10cSrcweir uno::Sequence< rtl::OUString> aItems( mxListBox->getItems() );
544cdf0e10cSrcweir rtl::OUString rKey( rStr );
545cdf0e10cSrcweir sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength());
546cdf0e10cSrcweir for (sal_uInt16 i = 0; i < n; i++)
547cdf0e10cSrcweir {
548cdf0e10cSrcweir if ( aItems[ i ] == rKey )
549cdf0e10cSrcweir return i;
550cdf0e10cSrcweir }
551cdf0e10cSrcweir return LISTBOX_ENTRY_NOTFOUND;
552cdf0e10cSrcweir }
553cdf0e10cSrcweir
GetEntry(sal_uInt16 nPos) const554cdf0e10cSrcweir OUString GetEntry( sal_uInt16 nPos ) const
555cdf0e10cSrcweir {
556cdf0e10cSrcweir return mxListBox->getItem( nPos );
557cdf0e10cSrcweir }
558cdf0e10cSrcweir
GetEntryCount() const559cdf0e10cSrcweir sal_uInt16 GetEntryCount() const
560cdf0e10cSrcweir {
561cdf0e10cSrcweir return mxListBox->getItemCount();
562cdf0e10cSrcweir }
563cdf0e10cSrcweir
SelectEntryPos(sal_uInt16 nPos,bool bSelect)564cdf0e10cSrcweir void SelectEntryPos( sal_uInt16 nPos, bool bSelect )
565cdf0e10cSrcweir {
566cdf0e10cSrcweir mxListBox->selectItemPos( nPos, bSelect );
567cdf0e10cSrcweir }
568cdf0e10cSrcweir
GetSelectEntryCount() const569cdf0e10cSrcweir sal_uInt16 GetSelectEntryCount() const
570cdf0e10cSrcweir {
571cdf0e10cSrcweir return sal::static_int_cast< sal_uInt16 >( mxListBox->getSelectedItems().getLength() );
572cdf0e10cSrcweir }
573cdf0e10cSrcweir
GetSelectEntryPos(sal_uInt16 nSelIndex) const574cdf0e10cSrcweir sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex ) const
575cdf0e10cSrcweir {
576cdf0e10cSrcweir sal_uInt16 nSelected = 0;
577cdf0e10cSrcweir if ( mxListBox->isMutipleMode() )
578cdf0e10cSrcweir {
579cdf0e10cSrcweir uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() );
580cdf0e10cSrcweir if ( nSelIndex < aItems.getLength() )
581cdf0e10cSrcweir nSelected = aItems[ nSelIndex ];
582cdf0e10cSrcweir }
583cdf0e10cSrcweir else
584cdf0e10cSrcweir nSelected = mxListBox->getSelectedItemPos();
585cdf0e10cSrcweir return nSelected;
586cdf0e10cSrcweir }
587cdf0e10cSrcweir
disposing(lang::EventObject const & e)588cdf0e10cSrcweir virtual void SAL_CALL disposing( lang::EventObject const& e )
589cdf0e10cSrcweir throw (uno::RuntimeException)
590cdf0e10cSrcweir {
591cdf0e10cSrcweir ControlImpl::disposing (e);
592cdf0e10cSrcweir mxListBox.clear ();
593cdf0e10cSrcweir }
594cdf0e10cSrcweir
GetClickHdl()595cdf0e10cSrcweir Link& GetClickHdl ()
596cdf0e10cSrcweir {
597cdf0e10cSrcweir return maClickHdl;
598cdf0e10cSrcweir }
599cdf0e10cSrcweir
SetClickHdl(Link const & link)600cdf0e10cSrcweir void SetClickHdl( Link const& link )
601cdf0e10cSrcweir {
602cdf0e10cSrcweir if (!link && !!maClickHdl)
603cdf0e10cSrcweir mxListBox->removeActionListener( this );
604cdf0e10cSrcweir else if (!!link && !maClickHdl)
605cdf0e10cSrcweir mxListBox->addActionListener( this );
606cdf0e10cSrcweir maClickHdl = link;
607cdf0e10cSrcweir }
608cdf0e10cSrcweir
actionPerformed(const awt::ActionEvent &)609cdf0e10cSrcweir void SAL_CALL actionPerformed( const awt::ActionEvent& /* rEvent */ )
610cdf0e10cSrcweir throw (uno::RuntimeException)
611cdf0e10cSrcweir {
612cdf0e10cSrcweir maClickHdl.Call( mpWindow );
613cdf0e10cSrcweir }
614cdf0e10cSrcweir
GetSelectHdl()615cdf0e10cSrcweir Link& GetSelectHdl ()
616cdf0e10cSrcweir {
617cdf0e10cSrcweir return maSelectHdl;
618cdf0e10cSrcweir }
619cdf0e10cSrcweir
SetSelectHdl(Link const & link)620cdf0e10cSrcweir void SetSelectHdl( Link const& link )
621cdf0e10cSrcweir {
622cdf0e10cSrcweir if (!link && !!maSelectHdl)
623cdf0e10cSrcweir mxListBox->removeItemListener( this );
624cdf0e10cSrcweir else if (!!link && !maSelectHdl)
625cdf0e10cSrcweir mxListBox->addItemListener( this );
626cdf0e10cSrcweir maSelectHdl = link;
627cdf0e10cSrcweir }
628cdf0e10cSrcweir
itemStateChanged(awt::ItemEvent const &)629cdf0e10cSrcweir void SAL_CALL itemStateChanged (awt::ItemEvent const&)
630cdf0e10cSrcweir throw (uno::RuntimeException)
631cdf0e10cSrcweir {
632cdf0e10cSrcweir maSelectHdl.Call (static_cast <ListBox*> (mpWindow));
633cdf0e10cSrcweir }
634cdf0e10cSrcweir
GetDoubleClickHdl()635cdf0e10cSrcweir Link& GetDoubleClickHdl ()
636cdf0e10cSrcweir {
637cdf0e10cSrcweir return maDoubleClickHdl;
638cdf0e10cSrcweir }
639cdf0e10cSrcweir
SetDoubleClickHdl(Link const & link)640cdf0e10cSrcweir void SetDoubleClickHdl (Link const& link)
641cdf0e10cSrcweir {
642cdf0e10cSrcweir if (!link && !!maDoubleClickHdl)
643cdf0e10cSrcweir mxWindow->removeMouseListener (this);
644cdf0e10cSrcweir else if (!!link && !maSelectHdl)
645cdf0e10cSrcweir mxWindow->addMouseListener (this);
646cdf0e10cSrcweir maDoubleClickHdl = link;
647cdf0e10cSrcweir }
648cdf0e10cSrcweir
mousePressed(awt::MouseEvent const &)649cdf0e10cSrcweir void SAL_CALL mousePressed (awt::MouseEvent const&) throw (uno::RuntimeException)
650cdf0e10cSrcweir {
651cdf0e10cSrcweir }
mouseReleased(awt::MouseEvent const & e)652cdf0e10cSrcweir void SAL_CALL mouseReleased (awt::MouseEvent const& e) throw (uno::RuntimeException)
653cdf0e10cSrcweir {
654cdf0e10cSrcweir if (e.ClickCount == 2)
655cdf0e10cSrcweir maDoubleClickHdl.Call (mpWindow);
656cdf0e10cSrcweir }
mouseEntered(awt::MouseEvent const &)657cdf0e10cSrcweir void SAL_CALL mouseEntered (awt::MouseEvent const&) throw (uno::RuntimeException)
658cdf0e10cSrcweir {
659cdf0e10cSrcweir }
mouseExited(awt::MouseEvent const &)660cdf0e10cSrcweir void SAL_CALL mouseExited (awt::MouseEvent const&) throw (uno::RuntimeException)
661cdf0e10cSrcweir {
662cdf0e10cSrcweir }
663cdf0e10cSrcweir };
664cdf0e10cSrcweir
~ListBox()665cdf0e10cSrcweir ListBox::~ListBox ()
666cdf0e10cSrcweir {
667cdf0e10cSrcweir }
668cdf0e10cSrcweir
InsertEntry(String const & rStr,sal_uInt16 nPos)669cdf0e10cSrcweir sal_uInt16 ListBox::InsertEntry (String const& rStr, sal_uInt16 nPos)
670cdf0e10cSrcweir {
671cdf0e10cSrcweir return getImpl().InsertEntry(rStr, nPos);
672cdf0e10cSrcweir }
673cdf0e10cSrcweir
RemoveEntry(sal_uInt16 nPos)674cdf0e10cSrcweir void ListBox::RemoveEntry( sal_uInt16 nPos )
675cdf0e10cSrcweir {
676cdf0e10cSrcweir return getImpl().RemoveEntry( nPos );
677cdf0e10cSrcweir }
678cdf0e10cSrcweir
RemoveEntry(String const & rStr)679cdf0e10cSrcweir void ListBox::RemoveEntry( String const& rStr )
680cdf0e10cSrcweir {
681cdf0e10cSrcweir return getImpl().RemoveEntry( GetEntryPos( rStr ) );
682cdf0e10cSrcweir }
683cdf0e10cSrcweir
Clear()684cdf0e10cSrcweir void ListBox::Clear()
685cdf0e10cSrcweir {
686cdf0e10cSrcweir uno::Sequence< rtl::OUString> aNoItems;
687cdf0e10cSrcweir getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
688cdf0e10cSrcweir }
689cdf0e10cSrcweir
GetEntryPos(String const & rStr) const690cdf0e10cSrcweir sal_uInt16 ListBox::GetEntryPos( String const& rStr ) const
691cdf0e10cSrcweir {
692cdf0e10cSrcweir return getImpl().GetEntryPos( rStr );
693cdf0e10cSrcweir }
694cdf0e10cSrcweir
GetEntry(sal_uInt16 nPos) const695cdf0e10cSrcweir String ListBox::GetEntry( sal_uInt16 nPos ) const
696cdf0e10cSrcweir {
697cdf0e10cSrcweir return getImpl().GetEntry( nPos );
698cdf0e10cSrcweir }
699cdf0e10cSrcweir
GetEntryCount() const700cdf0e10cSrcweir sal_uInt16 ListBox::GetEntryCount() const
701cdf0e10cSrcweir {
702cdf0e10cSrcweir return getImpl().GetEntryCount();
703cdf0e10cSrcweir }
704cdf0e10cSrcweir
SelectEntryPos(sal_uInt16 nPos,bool bSelect)705cdf0e10cSrcweir void ListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect )
706cdf0e10cSrcweir {
707cdf0e10cSrcweir #if LAYOUT_API_CALLS_HANDLER
708cdf0e10cSrcweir getImpl().SelectEntryPos( nPos, bSelect );
709cdf0e10cSrcweir #else /* !LAYOUT_API_CALLS_HANDLER */
710cdf0e10cSrcweir GetListBox ()->SelectEntryPos (nPos, bSelect);
711cdf0e10cSrcweir #endif /* !LAYOUT_API_CALLS_HANDLER */
712cdf0e10cSrcweir }
713cdf0e10cSrcweir
SelectEntry(String const & rStr,bool bSelect)714cdf0e10cSrcweir void ListBox::SelectEntry( String const& rStr, bool bSelect )
715cdf0e10cSrcweir {
716cdf0e10cSrcweir SelectEntryPos( GetEntryPos( rStr ), bSelect );
717cdf0e10cSrcweir }
718cdf0e10cSrcweir
GetSelectEntryCount() const719cdf0e10cSrcweir sal_uInt16 ListBox::GetSelectEntryCount() const
720cdf0e10cSrcweir {
721cdf0e10cSrcweir return getImpl().GetSelectEntryCount();
722cdf0e10cSrcweir }
723cdf0e10cSrcweir
GetSelectEntryPos(sal_uInt16 nSelIndex) const724cdf0e10cSrcweir sal_uInt16 ListBox::GetSelectEntryPos( sal_uInt16 nSelIndex ) const
725cdf0e10cSrcweir {
726cdf0e10cSrcweir return getImpl().GetSelectEntryPos( nSelIndex );
727cdf0e10cSrcweir }
728cdf0e10cSrcweir
GetSelectEntry(sal_uInt16 nSelIndex) const729cdf0e10cSrcweir String ListBox::GetSelectEntry( sal_uInt16 nSelIndex ) const
730cdf0e10cSrcweir {
731cdf0e10cSrcweir return GetEntry( GetSelectEntryPos( nSelIndex ) );
732cdf0e10cSrcweir }
733cdf0e10cSrcweir
GetSelectHdl()734cdf0e10cSrcweir Link& ListBox::GetSelectHdl ()
735cdf0e10cSrcweir {
736cdf0e10cSrcweir return getImpl ().GetSelectHdl ();
737cdf0e10cSrcweir }
738cdf0e10cSrcweir
SetSelectHdl(Link const & link)739cdf0e10cSrcweir void ListBox::SetSelectHdl( Link const& link )
740cdf0e10cSrcweir {
741cdf0e10cSrcweir getImpl().SetSelectHdl( link );
742cdf0e10cSrcweir }
743cdf0e10cSrcweir
GetClickHdl()744cdf0e10cSrcweir Link& ListBox::GetClickHdl ()
745cdf0e10cSrcweir {
746cdf0e10cSrcweir return getImpl ().GetSelectHdl ();
747cdf0e10cSrcweir }
748cdf0e10cSrcweir
SetClickHdl(Link const & link)749cdf0e10cSrcweir void ListBox::SetClickHdl( Link const& link )
750cdf0e10cSrcweir {
751cdf0e10cSrcweir if (&getImpl () && getImpl().mxListBox.is ())
752cdf0e10cSrcweir getImpl().SetClickHdl( link );
753cdf0e10cSrcweir }
754cdf0e10cSrcweir
GetDoubleClickHdl()755cdf0e10cSrcweir Link& ListBox::GetDoubleClickHdl ()
756cdf0e10cSrcweir {
757cdf0e10cSrcweir return getImpl ().GetSelectHdl ();
758cdf0e10cSrcweir }
759cdf0e10cSrcweir
SetDoubleClickHdl(Link const & link)760cdf0e10cSrcweir void ListBox::SetDoubleClickHdl( Link const& link )
761cdf0e10cSrcweir {
762cdf0e10cSrcweir getImpl().SetDoubleClickHdl( link );
763cdf0e10cSrcweir }
764cdf0e10cSrcweir
SetEntryData(sal_uInt16 pos,void * data)765cdf0e10cSrcweir void ListBox::SetEntryData( sal_uInt16 pos, void* data)
766cdf0e10cSrcweir {
767cdf0e10cSrcweir GetListBox ()->SetEntryData (pos, data);
768cdf0e10cSrcweir }
769cdf0e10cSrcweir
GetEntryData(sal_uInt16 pos) const770cdf0e10cSrcweir void* ListBox::GetEntryData( sal_uInt16 pos) const
771cdf0e10cSrcweir {
772cdf0e10cSrcweir return GetListBox ()->GetEntryData (pos);
773cdf0e10cSrcweir }
774cdf0e10cSrcweir
SetNoSelection()775cdf0e10cSrcweir void ListBox::SetNoSelection ()
776cdf0e10cSrcweir {
777cdf0e10cSrcweir GetListBox ()->SetNoSelection ();
778cdf0e10cSrcweir }
779cdf0e10cSrcweir
780cdf0e10cSrcweir IMPL_CONSTRUCTORS (ListBox, Control, "listbox");
781cdf0e10cSrcweir IMPL_GET_IMPL (ListBox);
782cdf0e10cSrcweir IMPL_GET_WINDOW (ListBox);
783cdf0e10cSrcweir
784cdf0e10cSrcweir IMPL_IMPL (MultiListBox, ListBox)
785cdf0e10cSrcweir IMPL_CONSTRUCTORS_BODY( MultiListBox, ListBox, "multilistbox", GetMultiListBox()->EnableMultiSelection( true ); );
786cdf0e10cSrcweir IMPL_GET_IMPL( MultiListBox );
787cdf0e10cSrcweir IMPL_GET_WINDOW( MultiListBox );
788cdf0e10cSrcweir } // namespace layout
789