1*6d739b60SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*6d739b60SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*6d739b60SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*6d739b60SAndrew Rist * distributed with this work for additional information
6*6d739b60SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*6d739b60SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*6d739b60SAndrew Rist * "License"); you may not use this file except in compliance
9*6d739b60SAndrew Rist * with the License. You may obtain a copy of the License at
10*6d739b60SAndrew Rist *
11*6d739b60SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*6d739b60SAndrew Rist *
13*6d739b60SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*6d739b60SAndrew Rist * software distributed under the License is distributed on an
15*6d739b60SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6d739b60SAndrew Rist * KIND, either express or implied. See the License for the
17*6d739b60SAndrew Rist * specific language governing permissions and limitations
18*6d739b60SAndrew Rist * under the License.
19*6d739b60SAndrew Rist *
20*6d739b60SAndrew Rist *************************************************************/
21*6d739b60SAndrew Rist
22*6d739b60SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_framework.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #ifndef __FRAMEWORK_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX
28cdf0e10cSrcweir #include "uielement/comboboxtoolbarcontroller.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir //_________________________________________________________________________________________________________________
32cdf0e10cSrcweir // my own includes
33cdf0e10cSrcweir //_________________________________________________________________________________________________________________
34cdf0e10cSrcweir
35cdf0e10cSrcweir #ifndef __FRAMEWORK_TOOLBAR_HXX_
36cdf0e10cSrcweir #include "uielement/toolbar.hxx"
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir
39cdf0e10cSrcweir //_________________________________________________________________________________________________________________
40cdf0e10cSrcweir // interface includes
41cdf0e10cSrcweir //_________________________________________________________________________________________________________________
42cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp>
43cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
44cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
45cdf0e10cSrcweir #include <com/sun/star/frame/status/ItemStatus.hpp>
46cdf0e10cSrcweir #include <com/sun/star/frame/status/ItemState.hpp>
47cdf0e10cSrcweir #include <com/sun/star/frame/status/Visibility.hpp>
48cdf0e10cSrcweir #include <com/sun/star/frame/XControlNotificationListener.hpp>
49cdf0e10cSrcweir #include <com/sun/star/util/Color.hpp>
50cdf0e10cSrcweir
51cdf0e10cSrcweir //_________________________________________________________________________________________________________________
52cdf0e10cSrcweir // other includes
53cdf0e10cSrcweir //_________________________________________________________________________________________________________________
54cdf0e10cSrcweir #include <svtools/toolboxcontroller.hxx>
55cdf0e10cSrcweir #include <vos/mutex.hxx>
56cdf0e10cSrcweir #include <vcl/svapp.hxx>
57cdf0e10cSrcweir #ifndef _VCL_MNEMONIC_HXX_
58cdf0e10cSrcweir #include <vcl/mnemonic.hxx>
59cdf0e10cSrcweir #endif
60cdf0e10cSrcweir #include <vcl/toolbox.hxx>
61cdf0e10cSrcweir #include <vcl/combobox.hxx>
62cdf0e10cSrcweir #include <tools/urlobj.hxx>
63cdf0e10cSrcweir
64cdf0e10cSrcweir using namespace ::com::sun::star;
65cdf0e10cSrcweir using namespace ::com::sun::star::uno;
66cdf0e10cSrcweir using namespace ::com::sun::star::beans;
67cdf0e10cSrcweir using namespace ::com::sun::star::lang;
68cdf0e10cSrcweir using namespace ::com::sun::star::frame;
69cdf0e10cSrcweir using namespace ::com::sun::star::frame::status;
70cdf0e10cSrcweir using namespace ::com::sun::star::util;
71cdf0e10cSrcweir
72cdf0e10cSrcweir namespace framework
73cdf0e10cSrcweir {
74cdf0e10cSrcweir
75cdf0e10cSrcweir // ------------------------------------------------------------------
76cdf0e10cSrcweir
77cdf0e10cSrcweir // Wrapper class to notify controller about events from combobox.
78cdf0e10cSrcweir // Unfortunaltly the events are notifed through virtual methods instead
79cdf0e10cSrcweir // of Listeners.
80cdf0e10cSrcweir
81cdf0e10cSrcweir class ComboBoxControl : public ComboBox
82cdf0e10cSrcweir {
83cdf0e10cSrcweir public:
84cdf0e10cSrcweir ComboBoxControl( Window* pParent, WinBits nStyle, IComboBoxListener* pComboBoxListener );
85cdf0e10cSrcweir virtual ~ComboBoxControl();
86cdf0e10cSrcweir
87cdf0e10cSrcweir virtual void Select();
88cdf0e10cSrcweir virtual void DoubleClick();
89cdf0e10cSrcweir virtual void Modify();
90cdf0e10cSrcweir virtual void KeyInput( const ::KeyEvent& rKEvt );
91cdf0e10cSrcweir virtual void GetFocus();
92cdf0e10cSrcweir virtual void LoseFocus();
93cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt );
94cdf0e10cSrcweir
95cdf0e10cSrcweir private:
96cdf0e10cSrcweir IComboBoxListener* m_pComboBoxListener;
97cdf0e10cSrcweir };
98cdf0e10cSrcweir
ComboBoxControl(Window * pParent,WinBits nStyle,IComboBoxListener * pComboBoxListener)99cdf0e10cSrcweir ComboBoxControl::ComboBoxControl( Window* pParent, WinBits nStyle, IComboBoxListener* pComboBoxListener ) :
100cdf0e10cSrcweir ComboBox( pParent, nStyle )
101cdf0e10cSrcweir , m_pComboBoxListener( pComboBoxListener )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir }
104cdf0e10cSrcweir
~ComboBoxControl()105cdf0e10cSrcweir ComboBoxControl::~ComboBoxControl()
106cdf0e10cSrcweir {
107cdf0e10cSrcweir m_pComboBoxListener = 0;
108cdf0e10cSrcweir }
109cdf0e10cSrcweir
Select()110cdf0e10cSrcweir void ComboBoxControl::Select()
111cdf0e10cSrcweir {
112cdf0e10cSrcweir ComboBox::Select();
113cdf0e10cSrcweir if ( m_pComboBoxListener )
114cdf0e10cSrcweir m_pComboBoxListener->Select();
115cdf0e10cSrcweir }
116cdf0e10cSrcweir
DoubleClick()117cdf0e10cSrcweir void ComboBoxControl::DoubleClick()
118cdf0e10cSrcweir {
119cdf0e10cSrcweir ComboBox::DoubleClick();
120cdf0e10cSrcweir if ( m_pComboBoxListener )
121cdf0e10cSrcweir m_pComboBoxListener->DoubleClick();
122cdf0e10cSrcweir }
123cdf0e10cSrcweir
Modify()124cdf0e10cSrcweir void ComboBoxControl::Modify()
125cdf0e10cSrcweir {
126cdf0e10cSrcweir ComboBox::Modify();
127cdf0e10cSrcweir if ( m_pComboBoxListener )
128cdf0e10cSrcweir m_pComboBoxListener->Modify();
129cdf0e10cSrcweir }
130cdf0e10cSrcweir
KeyInput(const::KeyEvent & rKEvt)131cdf0e10cSrcweir void ComboBoxControl::KeyInput( const ::KeyEvent& rKEvt )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir ComboBox::KeyInput( rKEvt );
134cdf0e10cSrcweir if ( m_pComboBoxListener )
135cdf0e10cSrcweir m_pComboBoxListener->KeyInput( rKEvt );
136cdf0e10cSrcweir }
137cdf0e10cSrcweir
GetFocus()138cdf0e10cSrcweir void ComboBoxControl::GetFocus()
139cdf0e10cSrcweir {
140cdf0e10cSrcweir ComboBox::GetFocus();
141cdf0e10cSrcweir if ( m_pComboBoxListener )
142cdf0e10cSrcweir m_pComboBoxListener->GetFocus();
143cdf0e10cSrcweir }
144cdf0e10cSrcweir
LoseFocus()145cdf0e10cSrcweir void ComboBoxControl::LoseFocus()
146cdf0e10cSrcweir {
147cdf0e10cSrcweir ComboBox::LoseFocus();
148cdf0e10cSrcweir if ( m_pComboBoxListener )
149cdf0e10cSrcweir m_pComboBoxListener->LoseFocus();
150cdf0e10cSrcweir }
151cdf0e10cSrcweir
PreNotify(NotifyEvent & rNEvt)152cdf0e10cSrcweir long ComboBoxControl::PreNotify( NotifyEvent& rNEvt )
153cdf0e10cSrcweir {
154cdf0e10cSrcweir long nRet( 0 );
155cdf0e10cSrcweir if ( m_pComboBoxListener )
156cdf0e10cSrcweir nRet = m_pComboBoxListener->PreNotify( rNEvt );
157cdf0e10cSrcweir if ( nRet == 0 )
158cdf0e10cSrcweir nRet = ComboBox::PreNotify( rNEvt );
159cdf0e10cSrcweir
160cdf0e10cSrcweir return nRet;
161cdf0e10cSrcweir }
162cdf0e10cSrcweir
163cdf0e10cSrcweir // ------------------------------------------------------------------
164cdf0e10cSrcweir
ComboboxToolbarController(const Reference<XMultiServiceFactory> & rServiceManager,const Reference<XFrame> & rFrame,ToolBox * pToolbar,sal_uInt16 nID,sal_Int32 nWidth,const::rtl::OUString & aCommand)165cdf0e10cSrcweir ComboboxToolbarController::ComboboxToolbarController(
166cdf0e10cSrcweir const Reference< XMultiServiceFactory >& rServiceManager,
167cdf0e10cSrcweir const Reference< XFrame >& rFrame,
168cdf0e10cSrcweir ToolBox* pToolbar,
169cdf0e10cSrcweir sal_uInt16 nID,
170cdf0e10cSrcweir sal_Int32 nWidth,
171cdf0e10cSrcweir const ::rtl::OUString& aCommand ) :
172cdf0e10cSrcweir ComplexToolbarController( rServiceManager, rFrame, pToolbar, nID, aCommand )
173cdf0e10cSrcweir , m_pComboBox( 0 )
174cdf0e10cSrcweir {
175cdf0e10cSrcweir m_pComboBox = new ComboBoxControl( m_pToolbar, WB_DROPDOWN, this );
176cdf0e10cSrcweir if ( nWidth == 0 )
177cdf0e10cSrcweir nWidth = 100;
178cdf0e10cSrcweir
179cdf0e10cSrcweir // default dropdown size
180cdf0e10cSrcweir ::Size aLogicalSize( 8, 160 );
181cdf0e10cSrcweir ::Size aPixelSize = m_pComboBox->LogicToPixel( aLogicalSize, MAP_APPFONT );
182cdf0e10cSrcweir
183cdf0e10cSrcweir m_pComboBox->SetSizePixel( ::Size( nWidth, aPixelSize.Height() ));
184cdf0e10cSrcweir m_pToolbar->SetItemWindow( m_nID, m_pComboBox );
185cdf0e10cSrcweir }
186cdf0e10cSrcweir
187cdf0e10cSrcweir // ------------------------------------------------------------------
188cdf0e10cSrcweir
~ComboboxToolbarController()189cdf0e10cSrcweir ComboboxToolbarController::~ComboboxToolbarController()
190cdf0e10cSrcweir {
191cdf0e10cSrcweir }
192cdf0e10cSrcweir
193cdf0e10cSrcweir // ------------------------------------------------------------------
194cdf0e10cSrcweir
dispose()195cdf0e10cSrcweir void SAL_CALL ComboboxToolbarController::dispose()
196cdf0e10cSrcweir throw ( RuntimeException )
197cdf0e10cSrcweir {
198cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
199cdf0e10cSrcweir
200cdf0e10cSrcweir m_pToolbar->SetItemWindow( m_nID, 0 );
201cdf0e10cSrcweir delete m_pComboBox;
202cdf0e10cSrcweir
203cdf0e10cSrcweir ComplexToolbarController::dispose();
204cdf0e10cSrcweir
205cdf0e10cSrcweir m_pComboBox = 0;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir
208cdf0e10cSrcweir // ------------------------------------------------------------------
getExecuteArgs(sal_Int16 KeyModifier) const209cdf0e10cSrcweir Sequence<PropertyValue> ComboboxToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
210cdf0e10cSrcweir {
211cdf0e10cSrcweir Sequence<PropertyValue> aArgs( 2 );
212cdf0e10cSrcweir ::rtl::OUString aSelectedText = m_pComboBox->GetText();
213cdf0e10cSrcweir
214cdf0e10cSrcweir // Add key modifier to argument list
215cdf0e10cSrcweir aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
216cdf0e10cSrcweir aArgs[0].Value <<= KeyModifier;
217cdf0e10cSrcweir aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
218cdf0e10cSrcweir aArgs[1].Value <<= aSelectedText;
219cdf0e10cSrcweir return aArgs;
220cdf0e10cSrcweir }
221cdf0e10cSrcweir
222cdf0e10cSrcweir // ------------------------------------------------------------------
223cdf0e10cSrcweir
Select()224cdf0e10cSrcweir void ComboboxToolbarController::Select()
225cdf0e10cSrcweir {
226cdf0e10cSrcweir if ( m_pComboBox->GetEntryCount() > 0 )
227cdf0e10cSrcweir {
228cdf0e10cSrcweir Window::PointerState aState = m_pComboBox->GetPointerState();
229cdf0e10cSrcweir
230cdf0e10cSrcweir sal_uInt16 nKeyModifier = sal_uInt16( aState.mnState & KEY_MODTYPE );
231cdf0e10cSrcweir execute( nKeyModifier );
232cdf0e10cSrcweir }
233cdf0e10cSrcweir }
234cdf0e10cSrcweir
DoubleClick()235cdf0e10cSrcweir void ComboboxToolbarController::DoubleClick()
236cdf0e10cSrcweir {
237cdf0e10cSrcweir }
238cdf0e10cSrcweir
Modify()239cdf0e10cSrcweir void ComboboxToolbarController::Modify()
240cdf0e10cSrcweir {
241cdf0e10cSrcweir notifyTextChanged( m_pComboBox->GetText() );
242cdf0e10cSrcweir }
243cdf0e10cSrcweir
KeyInput(const::KeyEvent &)244cdf0e10cSrcweir void ComboboxToolbarController::KeyInput( const ::KeyEvent& )
245cdf0e10cSrcweir {
246cdf0e10cSrcweir }
247cdf0e10cSrcweir
GetFocus()248cdf0e10cSrcweir void ComboboxToolbarController::GetFocus()
249cdf0e10cSrcweir {
250cdf0e10cSrcweir notifyFocusGet();
251cdf0e10cSrcweir }
252cdf0e10cSrcweir
LoseFocus()253cdf0e10cSrcweir void ComboboxToolbarController::LoseFocus()
254cdf0e10cSrcweir {
255cdf0e10cSrcweir notifyFocusLost();
256cdf0e10cSrcweir }
257cdf0e10cSrcweir
PreNotify(NotifyEvent & rNEvt)258cdf0e10cSrcweir long ComboboxToolbarController::PreNotify( NotifyEvent& rNEvt )
259cdf0e10cSrcweir {
260cdf0e10cSrcweir switch ( rNEvt.GetType() )
261cdf0e10cSrcweir {
262cdf0e10cSrcweir case EVENT_KEYINPUT :
263cdf0e10cSrcweir {
264cdf0e10cSrcweir const ::KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
265cdf0e10cSrcweir const KeyCode& rKeyCode = pKeyEvent->GetKeyCode();
266cdf0e10cSrcweir if(( rKeyCode.GetModifier() | rKeyCode.GetCode()) == KEY_RETURN )
267cdf0e10cSrcweir {
268cdf0e10cSrcweir // Call execute only with non-empty text
269cdf0e10cSrcweir if ( m_pComboBox->GetText().Len() > 0 )
270cdf0e10cSrcweir execute( rKeyCode.GetModifier() );
271cdf0e10cSrcweir return 1;
272cdf0e10cSrcweir }
273cdf0e10cSrcweir }
274cdf0e10cSrcweir break;
275cdf0e10cSrcweir case EVENT_GETFOCUS :
276cdf0e10cSrcweir notifyFocusGet();
277cdf0e10cSrcweir break;
278cdf0e10cSrcweir case EVENT_LOSEFOCUS :
279cdf0e10cSrcweir notifyFocusLost();
280cdf0e10cSrcweir break;
281cdf0e10cSrcweir default :
282cdf0e10cSrcweir break;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir return 0;
285cdf0e10cSrcweir }
286cdf0e10cSrcweir
287cdf0e10cSrcweir // --------------------------------------------------------
288cdf0e10cSrcweir
executeControlCommand(const::com::sun::star::frame::ControlCommand & rControlCommand)289cdf0e10cSrcweir void ComboboxToolbarController::executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand )
290cdf0e10cSrcweir {
291cdf0e10cSrcweir if ( rControlCommand.Command.equalsAsciiL( "SetText", 7 ))
292cdf0e10cSrcweir {
293cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
294cdf0e10cSrcweir {
295cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "Text", 4 ))
296cdf0e10cSrcweir {
297cdf0e10cSrcweir rtl::OUString aText;
298cdf0e10cSrcweir rControlCommand.Arguments[i].Value >>= aText;
299cdf0e10cSrcweir m_pComboBox->SetText( aText );
300cdf0e10cSrcweir
301cdf0e10cSrcweir // send notification
302cdf0e10cSrcweir notifyTextChanged( aText );
303cdf0e10cSrcweir break;
304cdf0e10cSrcweir }
305cdf0e10cSrcweir }
306cdf0e10cSrcweir }
307cdf0e10cSrcweir else if ( rControlCommand.Command.equalsAsciiL( "SetList", 7 ))
308cdf0e10cSrcweir {
309cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
310cdf0e10cSrcweir {
311cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "List", 4 ))
312cdf0e10cSrcweir {
313cdf0e10cSrcweir Sequence< ::rtl::OUString > aList;
314cdf0e10cSrcweir m_pComboBox->Clear();
315cdf0e10cSrcweir
316cdf0e10cSrcweir rControlCommand.Arguments[i].Value >>= aList;
317cdf0e10cSrcweir for ( sal_Int32 j = 0; j < aList.getLength(); j++ )
318cdf0e10cSrcweir m_pComboBox->InsertEntry( aList[j] );
319cdf0e10cSrcweir
320cdf0e10cSrcweir // send notification
321cdf0e10cSrcweir uno::Sequence< beans::NamedValue > aInfo( 1 );
322cdf0e10cSrcweir aInfo[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ));
323cdf0e10cSrcweir aInfo[0].Value <<= aList;
324cdf0e10cSrcweir addNotifyInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListChanged" )),
325cdf0e10cSrcweir getDispatchFromCommand( m_aCommandURL ),
326cdf0e10cSrcweir aInfo );
327cdf0e10cSrcweir
328cdf0e10cSrcweir break;
329cdf0e10cSrcweir }
330cdf0e10cSrcweir }
331cdf0e10cSrcweir }
332cdf0e10cSrcweir else if ( rControlCommand.Command.equalsAsciiL( "AddEntry", 8 ))
333cdf0e10cSrcweir {
334cdf0e10cSrcweir sal_uInt16 nPos( COMBOBOX_APPEND );
335cdf0e10cSrcweir rtl::OUString aText;
336cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
337cdf0e10cSrcweir {
338cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "Text", 4 ))
339cdf0e10cSrcweir {
340cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Value >>= aText )
341cdf0e10cSrcweir m_pComboBox->InsertEntry( aText, nPos );
342cdf0e10cSrcweir break;
343cdf0e10cSrcweir }
344cdf0e10cSrcweir }
345cdf0e10cSrcweir }
346cdf0e10cSrcweir else if ( rControlCommand.Command.equalsAsciiL( "InsertEntry", 11 ))
347cdf0e10cSrcweir {
348cdf0e10cSrcweir sal_uInt16 nPos( COMBOBOX_APPEND );
349cdf0e10cSrcweir rtl::OUString aText;
350cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
351cdf0e10cSrcweir {
352cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "Pos", 3 ))
353cdf0e10cSrcweir {
354cdf0e10cSrcweir sal_Int32 nTmpPos = 0;
355cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Value >>= nTmpPos )
356cdf0e10cSrcweir {
357cdf0e10cSrcweir if (( nTmpPos >= 0 ) &&
358cdf0e10cSrcweir ( nTmpPos < sal_Int32( m_pComboBox->GetEntryCount() )))
359cdf0e10cSrcweir nPos = sal_uInt16( nTmpPos );
360cdf0e10cSrcweir }
361cdf0e10cSrcweir }
362cdf0e10cSrcweir else if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "Text", 4 ))
363cdf0e10cSrcweir rControlCommand.Arguments[i].Value >>= aText;
364cdf0e10cSrcweir }
365cdf0e10cSrcweir
366cdf0e10cSrcweir m_pComboBox->InsertEntry( aText, nPos );
367cdf0e10cSrcweir }
368cdf0e10cSrcweir else if ( rControlCommand.Command.equalsAsciiL( "RemoveEntryPos", 14 ))
369cdf0e10cSrcweir {
370cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
371cdf0e10cSrcweir {
372cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "Pos", 3 ))
373cdf0e10cSrcweir {
374cdf0e10cSrcweir sal_Int32 nPos( -1 );
375cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Value >>= nPos )
376cdf0e10cSrcweir {
377cdf0e10cSrcweir if ( nPos < sal_Int32( m_pComboBox->GetEntryCount() ))
378cdf0e10cSrcweir m_pComboBox->RemoveEntry( sal_uInt16( nPos ));
379cdf0e10cSrcweir }
380cdf0e10cSrcweir break;
381cdf0e10cSrcweir }
382cdf0e10cSrcweir }
383cdf0e10cSrcweir }
384cdf0e10cSrcweir else if ( rControlCommand.Command.equalsAsciiL( "RemoveEntryText", 15 ))
385cdf0e10cSrcweir {
386cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
387cdf0e10cSrcweir {
388cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "Text", 4 ))
389cdf0e10cSrcweir {
390cdf0e10cSrcweir rtl::OUString aText;
391cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Value >>= aText )
392cdf0e10cSrcweir m_pComboBox->RemoveEntry( aText );
393cdf0e10cSrcweir break;
394cdf0e10cSrcweir }
395cdf0e10cSrcweir }
396cdf0e10cSrcweir }
397cdf0e10cSrcweir else if ( rControlCommand.Command.equalsAsciiL( "SetDropDownLines", 16 ))
398cdf0e10cSrcweir {
399cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
400cdf0e10cSrcweir {
401cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "Lines", 5 ))
402cdf0e10cSrcweir {
403cdf0e10cSrcweir sal_Int32 nValue( 5 );
404cdf0e10cSrcweir rControlCommand.Arguments[i].Value >>= nValue;
405cdf0e10cSrcweir m_pComboBox->SetDropDownLineCount( sal_uInt16( nValue ));
406cdf0e10cSrcweir break;
407cdf0e10cSrcweir }
408cdf0e10cSrcweir }
409cdf0e10cSrcweir }
410cdf0e10cSrcweir else if ( rControlCommand.Command.equalsAsciiL( "SetBackgroundColor", 18 ))
411cdf0e10cSrcweir {
412cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
413cdf0e10cSrcweir {
414cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "Color", 5 ))
415cdf0e10cSrcweir {
416cdf0e10cSrcweir com::sun::star::util::Color aColor(0);
417cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Value >>= aColor )
418cdf0e10cSrcweir {
419cdf0e10cSrcweir ::Color aBackColor( static_cast< sal_uInt32 >( aColor ));
420cdf0e10cSrcweir m_pComboBox->SetControlBackground( aBackColor );
421cdf0e10cSrcweir }
422cdf0e10cSrcweir break;
423cdf0e10cSrcweir }
424cdf0e10cSrcweir }
425cdf0e10cSrcweir }
426cdf0e10cSrcweir else if ( rControlCommand.Command.equalsAsciiL( "SetTextColor", 12 ))
427cdf0e10cSrcweir {
428cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
429cdf0e10cSrcweir {
430cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Name.equalsAsciiL( "Color", 5 ))
431cdf0e10cSrcweir {
432cdf0e10cSrcweir com::sun::star::util::Color aColor(0);
433cdf0e10cSrcweir if ( rControlCommand.Arguments[i].Value >>= aColor )
434cdf0e10cSrcweir {
435cdf0e10cSrcweir ::Color aForeColor( static_cast< sal_uInt32 >( aColor ));
436cdf0e10cSrcweir m_pComboBox->SetControlForeground( aForeColor );
437cdf0e10cSrcweir }
438cdf0e10cSrcweir break;
439cdf0e10cSrcweir }
440cdf0e10cSrcweir }
441cdf0e10cSrcweir }
442cdf0e10cSrcweir }
443cdf0e10cSrcweir
444cdf0e10cSrcweir } // namespace
445cdf0e10cSrcweir
446