1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svtools.hxx"
26
27 #define _SVT_UNOIFACE_CXX
28 #include <tools/debug.hxx>
29 #include <vcl/svapp.hxx>
30 #include <svtools/svmedit.hxx>
31 #include <unoiface.hxx>
32 #include <svtools/filedlg.hxx>
33 #include <svtools/filectrl.hxx>
34 #include <svtools/roadmap.hxx>
35 #include <svtools/fixedhyper.hxx>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
38 #include <com/sun/star/awt/LineEndFormat.hpp>
39 #include <comphelper/processfactory.hxx>
40 #include <toolkit/helper/convert.hxx>
41 #include <toolkit/helper/property.hxx>
42 #include <svtools/fmtfield.hxx>
43 #include <svl/numuno.hxx>
44 #include <svtools/calendar.hxx>
45 #include <svtools/prgsbar.hxx>
46 #include <svtools/svtreebx.hxx>
47 #include "treecontrolpeer.hxx"
48 #include "svtxgridcontrol.hxx"
49 #include <svtools/table/tablecontrol.hxx>
50
51 namespace
52 {
lcl_setWinBits(Window * _pWindow,WinBits _nBits,sal_Bool _bSet)53 static void lcl_setWinBits( Window* _pWindow, WinBits _nBits, sal_Bool _bSet )
54 {
55 WinBits nStyle = _pWindow->GetStyle();
56 if ( _bSet )
57 nStyle |= _nBits;
58 else
59 nStyle &= ~_nBits;
60 _pWindow->SetStyle( nStyle );
61 }
62 }
63
64 // ----------------------------------------------------
65 // help function for the toolkit...
66 // ----------------------------------------------------
67
68 extern "C" {
69
CreateWindow(VCLXWindow ** ppNewComp,const::com::sun::star::awt::WindowDescriptor * pDescriptor,Window * pParent,WinBits nWinBits)70 SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com::sun::star::awt::WindowDescriptor* pDescriptor, Window* pParent, WinBits nWinBits )
71 {
72 Window* pWindow = NULL;
73 String aServiceName( pDescriptor->WindowServiceName );
74 if ( aServiceName.EqualsIgnoreCaseAscii( "MultiLineEdit" ) )
75 {
76 if ( pParent )
77 {
78 pWindow = new MultiLineEdit( pParent, nWinBits|WB_IGNORETAB);
79 static_cast< MultiLineEdit* >( pWindow )->DisableSelectionOnFocus();
80 *ppNewComp = new VCLXMultiLineEdit;
81 }
82 else
83 {
84 *ppNewComp = NULL;
85 return NULL;
86 }
87 }
88 else if ( aServiceName.EqualsIgnoreCaseAscii( "FileControl" ) )
89 {
90 if ( pParent )
91 {
92 pWindow = new FileControl( pParent, nWinBits );
93 *ppNewComp = new VCLXFileControl;
94 }
95 else
96 {
97 *ppNewComp = NULL;
98 return NULL;
99 }
100 }
101 else if (aServiceName.EqualsIgnoreCaseAscii("FormattedField") )
102 {
103 pWindow = new FormattedField( pParent, nWinBits );
104 *ppNewComp = new SVTXFormattedField;
105 }
106 else if (aServiceName.EqualsIgnoreCaseAscii("NumericField") )
107 {
108 pWindow = new DoubleNumericField( pParent, nWinBits );
109 *ppNewComp = new SVTXNumericField;
110 }
111 else if (aServiceName.EqualsIgnoreCaseAscii("LongCurrencyField") )
112 {
113 pWindow = new DoubleCurrencyField( pParent, nWinBits );
114 *ppNewComp = new SVTXCurrencyField;
115 }
116 else if (aServiceName.EqualsIgnoreCaseAscii("datefield") )
117 {
118 pWindow = new CalendarField( pParent, nWinBits);
119 static_cast<CalendarField*>(pWindow)->EnableToday();
120 static_cast<CalendarField*>(pWindow)->EnableNone();
121 static_cast<CalendarField*>(pWindow)->EnableEmptyFieldValue( sal_True );
122 *ppNewComp = new SVTXDateField;
123 ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(DateField*)pWindow );
124 }
125 else if (aServiceName.EqualsIgnoreCaseAscii("roadmap") )
126 {
127 pWindow = new ::svt::ORoadmap( pParent, WB_TABSTOP );
128 *ppNewComp = new SVTXRoadmap;
129 }
130 else if ( aServiceName.EqualsIgnoreCaseAscii( "ProgressBar" ) )
131 {
132 if ( pParent )
133 {
134 pWindow = new ProgressBar( pParent, nWinBits );
135 *ppNewComp = new VCLXProgressBar;
136 }
137 else
138 {
139 *ppNewComp = NULL;
140 return NULL;
141 }
142 }
143 else if ( aServiceName.EqualsIgnoreCaseAscii( "Tree" ) )
144 {
145 TreeControlPeer* pPeer = new TreeControlPeer;
146 *ppNewComp = pPeer;
147 pWindow = pPeer->createVclControl( pParent, nWinBits );
148 }
149 else if ( aServiceName.EqualsIgnoreCaseAscii( "FixedHyperlink" ) )
150 {
151 if ( pParent )
152 {
153 pWindow = new ::svt::FixedHyperlink( pParent, nWinBits );
154 *ppNewComp = new VCLXFixedHyperlink;
155 }
156 else
157 {
158 *ppNewComp = NULL;
159 return NULL;
160 }
161 }
162 else if ( aServiceName.EqualsIgnoreCaseAscii( "Grid" ) )
163 {
164 if ( pParent )
165 {
166 pWindow = new ::svt::table::TableControl(pParent, nWinBits);
167 *ppNewComp = new SVTXGridControl;
168 }
169 else
170 {
171 *ppNewComp = NULL;
172 return NULL;
173 }
174 }
175 return pWindow;
176 }
177
178 } // extern "C"
179
180 // ----------------------------------------------------
181 // class VCLXMultiLineEdit
182 // ----------------------------------------------------
VCLXMultiLineEdit()183 VCLXMultiLineEdit::VCLXMultiLineEdit()
184 :maTextListeners( *this )
185 ,meLineEndType( LINEEND_LF ) // default behavior before introducing this property: LF (unix-like)
186 {
187 }
188
~VCLXMultiLineEdit()189 VCLXMultiLineEdit::~VCLXMultiLineEdit()
190 {
191 }
192
queryInterface(const::com::sun::star::uno::Type & rType)193 ::com::sun::star::uno::Any VCLXMultiLineEdit::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
194 {
195 ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
196 SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent*, this ),
197 SAL_STATIC_CAST( ::com::sun::star::awt::XTextArea*, this ),
198 SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ),
199 SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
200 return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
201 }
202
203 // ::com::sun::star::lang::XTypeProvider
204 IMPL_XTYPEPROVIDER_START( VCLXMultiLineEdit )
205 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
206 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextArea>* ) NULL ),
207 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
208 VCLXWindow::getTypes()
209 IMPL_XTYPEPROVIDER_END
210
211 void VCLXMultiLineEdit::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
212 {
213 maTextListeners.addInterface( l );
214 }
215
removeTextListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XTextListener> & l)216 void VCLXMultiLineEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
217 {
218 maTextListeners.removeInterface( l );
219 }
220
setText(const::rtl::OUString & aText)221 void VCLXMultiLineEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
222 {
223 ::vos::OGuard aGuard( GetMutex() );
224
225 MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
226 if ( pEdit )
227 {
228 pEdit->SetText( aText );
229
230 // #107218# Call same listeners like VCL would do after user interaction
231 SetSynthesizingVCLEvent( sal_True );
232 pEdit->SetModifyFlag();
233 pEdit->Modify();
234 SetSynthesizingVCLEvent( sal_False );
235 }
236 }
237
insertText(const::com::sun::star::awt::Selection & rSel,const::rtl::OUString & aText)238 void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
239 {
240 ::vos::OGuard aGuard( GetMutex() );
241
242 MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
243 if ( pEdit )
244 {
245 setSelection( rSel );
246 pEdit->ReplaceSelected( aText );
247 }
248 }
249
getText()250 ::rtl::OUString VCLXMultiLineEdit::getText() throw(::com::sun::star::uno::RuntimeException)
251 {
252 ::vos::OGuard aGuard( GetMutex() );
253
254 ::rtl::OUString aText;
255 MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
256 if ( pEdit )
257 aText = pEdit->GetText( meLineEndType );
258 return aText;
259 }
260
getSelectedText()261 ::rtl::OUString VCLXMultiLineEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
262 {
263 ::vos::OGuard aGuard( GetMutex() );
264
265 ::rtl::OUString aText;
266 MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
267 if ( pMultiLineEdit)
268 aText = pMultiLineEdit->GetSelected( meLineEndType );
269 return aText;
270
271 }
272
setSelection(const::com::sun::star::awt::Selection & aSelection)273 void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
274 {
275 ::vos::OGuard aGuard( GetMutex() );
276
277 MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
278 if ( pMultiLineEdit )
279 {
280 pMultiLineEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
281 }
282 }
283
getSelection()284 ::com::sun::star::awt::Selection VCLXMultiLineEdit::getSelection() throw(::com::sun::star::uno::RuntimeException)
285 {
286 ::vos::OGuard aGuard( GetMutex() );
287
288 ::com::sun::star::awt::Selection aSel;
289 MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
290 if ( pMultiLineEdit )
291 {
292 aSel.Min = pMultiLineEdit->GetSelection().Min();
293 aSel.Max = pMultiLineEdit->GetSelection().Max();
294 }
295 return aSel;
296 }
297
isEditable()298 sal_Bool VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeException)
299 {
300 ::vos::OGuard aGuard( GetMutex() );
301
302 MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
303 return ( pMultiLineEdit && !pMultiLineEdit->IsReadOnly() && pMultiLineEdit->IsEnabled() ) ? sal_True : sal_False;
304 }
305
setEditable(sal_Bool bEditable)306 void VCLXMultiLineEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
307 {
308 ::vos::OGuard aGuard( GetMutex() );
309
310 MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
311 if ( pMultiLineEdit )
312 pMultiLineEdit->SetReadOnly( !bEditable );
313 }
314
setMaxTextLen(sal_Int16 nLen)315 void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
316 {
317 ::vos::OGuard aGuard( GetMutex() );
318
319 MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
320 if ( pMultiLineEdit )
321 pMultiLineEdit->SetMaxTextLen( nLen );
322 }
323
getMaxTextLen()324 sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
325 {
326 ::vos::OGuard aGuard( GetMutex() );
327
328 MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
329 return pMultiLineEdit ? (sal_Int16)pMultiLineEdit->GetMaxTextLen() : (sal_Int16)0;
330 }
331
getTextLines()332 ::rtl::OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeException)
333 {
334 ::vos::OGuard aGuard( GetMutex() );
335
336 ::rtl::OUString aText;
337 MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
338 if ( pEdit )
339 aText = pEdit->GetTextLines( meLineEndType );
340 return aText;
341 }
342
getMinimumSize()343 ::com::sun::star::awt::Size VCLXMultiLineEdit::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
344 {
345 ::vos::OGuard aGuard( GetMutex() );
346
347 ::com::sun::star::awt::Size aSz;
348 MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
349 if ( pEdit )
350 aSz = AWTSize(pEdit->CalcMinimumSize());
351 return aSz;
352 }
353
getPreferredSize()354 ::com::sun::star::awt::Size VCLXMultiLineEdit::getPreferredSize() throw(::com::sun::star::uno::RuntimeException)
355 {
356 return getMinimumSize();
357 }
358
calcAdjustedSize(const::com::sun::star::awt::Size & rNewSize)359 ::com::sun::star::awt::Size VCLXMultiLineEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
360 {
361 ::vos::OGuard aGuard( GetMutex() );
362
363 ::com::sun::star::awt::Size aSz = rNewSize;
364 MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
365 if ( pEdit )
366 aSz = AWTSize(pEdit->CalcAdjustedSize( VCLSize(rNewSize )));
367 return aSz;
368 }
369
getMinimumSize(sal_Int16 nCols,sal_Int16 nLines)370 ::com::sun::star::awt::Size VCLXMultiLineEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
371 {
372 ::vos::OGuard aGuard( GetMutex() );
373
374 ::com::sun::star::awt::Size aSz;
375 MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
376 if ( pEdit )
377 aSz = AWTSize(pEdit->CalcSize( nCols, nLines ));
378 return aSz;
379 }
380
getColumnsAndLines(sal_Int16 & nCols,sal_Int16 & nLines)381 void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
382 {
383 ::vos::OGuard aGuard( GetMutex() );
384
385 nCols = nLines = 0;
386 MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
387 if ( pEdit )
388 {
389 sal_uInt16 nC, nL;
390 pEdit->GetMaxVisColumnsAndLines( nC, nL );
391 nCols = nC;
392 nLines = nL;
393 }
394 }
395
ProcessWindowEvent(const VclWindowEvent & rVclWindowEvent)396 void VCLXMultiLineEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
397 {
398 switch ( rVclWindowEvent.GetId() )
399 {
400 case VCLEVENT_EDIT_MODIFY:
401 {
402 if ( maTextListeners.getLength() )
403 {
404 ::com::sun::star::awt::TextEvent aEvent;
405 aEvent.Source = (::cppu::OWeakObject*)this;
406 maTextListeners.textChanged( aEvent );
407 }
408 }
409 break;
410 default:
411 {
412 VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
413 }
414 break;
415 }
416 }
417
setProperty(const::rtl::OUString & PropertyName,const::com::sun::star::uno::Any & Value)418 void VCLXMultiLineEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
419 {
420 ::vos::OGuard aGuard( GetMutex() );
421
422 MultiLineEdit* pMultiLineEdit = (MultiLineEdit*)GetWindow();
423 if ( pMultiLineEdit )
424 {
425 sal_uInt16 nPropType = GetPropertyId( PropertyName );
426 switch ( nPropType )
427 {
428 case BASEPROPERTY_LINE_END_FORMAT:
429 {
430 sal_Int16 nLineEndType = ::com::sun::star::awt::LineEndFormat::LINE_FEED;
431 OSL_VERIFY( Value >>= nLineEndType );
432 switch ( nLineEndType )
433 {
434 case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN: meLineEndType = LINEEND_CR; break;
435 case ::com::sun::star::awt::LineEndFormat::LINE_FEED: meLineEndType = LINEEND_LF; break;
436 case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED: meLineEndType = LINEEND_CRLF; break;
437 default: DBG_ERROR( "VCLXMultiLineEdit::setProperty: invalid line end value!" ); break;
438 }
439 }
440 break;
441
442 case BASEPROPERTY_READONLY:
443 {
444 sal_Bool b = sal_Bool();
445 if ( Value >>= b )
446 pMultiLineEdit->SetReadOnly( b );
447 }
448 break;
449 case BASEPROPERTY_MAXTEXTLEN:
450 {
451 sal_Int16 n = sal_Int16();
452 if ( Value >>= n )
453 pMultiLineEdit->SetMaxTextLen( n );
454 }
455 break;
456 case BASEPROPERTY_HIDEINACTIVESELECTION:
457 {
458 sal_Bool b = sal_Bool();
459 if ( Value >>= b )
460 {
461 pMultiLineEdit->EnableFocusSelectionHide( b );
462 lcl_setWinBits( pMultiLineEdit, WB_NOHIDESELECTION, !b );
463 }
464 }
465 break;
466 default:
467 {
468 VCLXWindow::setProperty( PropertyName, Value );
469 }
470 }
471 }
472 }
473
getProperty(const::rtl::OUString & PropertyName)474 ::com::sun::star::uno::Any VCLXMultiLineEdit::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
475 {
476 ::vos::OGuard aGuard( GetMutex() );
477
478 ::com::sun::star::uno::Any aProp;
479 MultiLineEdit* pMultiLineEdit = (MultiLineEdit*)GetWindow();
480 if ( pMultiLineEdit )
481 {
482 sal_uInt16 nPropType = GetPropertyId( PropertyName );
483 switch ( nPropType )
484 {
485 case BASEPROPERTY_LINE_END_FORMAT:
486 {
487 sal_Int16 nLineEndType = ::com::sun::star::awt::LineEndFormat::LINE_FEED;
488 switch ( meLineEndType )
489 {
490 case LINEEND_CR: nLineEndType = ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN; break;
491 case LINEEND_LF: nLineEndType = ::com::sun::star::awt::LineEndFormat::LINE_FEED; break;
492 case LINEEND_CRLF: nLineEndType = ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED; break;
493 default: DBG_ERROR( "VCLXMultiLineEdit::getProperty: invalid line end value!" ); break;
494 }
495 aProp <<= nLineEndType;
496 }
497 break;
498
499 case BASEPROPERTY_READONLY:
500 {
501 aProp <<= pMultiLineEdit->IsReadOnly();
502 }
503 break;
504 case BASEPROPERTY_MAXTEXTLEN:
505 {
506 aProp <<= (sal_Int16) pMultiLineEdit->GetMaxTextLen();
507 }
508 break;
509 default:
510 {
511 aProp <<= VCLXWindow::getProperty( PropertyName );
512 }
513 }
514 }
515 return aProp;
516 }
517
setFocus()518 void SAL_CALL VCLXMultiLineEdit::setFocus( ) throw(::com::sun::star::uno::RuntimeException)
519 {
520 ::vos::OGuard aGuard( GetMutex() );
521
522 // don't grab the focus if we already have it. Reason is that the only thing which the edit
523 // does is forwarding the focus to it's text window. This text window then does a "select all".
524 // So if the text window already has the focus, and we give the focus to the multi line
525 // edit, then all which happens is that everything is selected.
526 // #i27072# - 2004-04-25 - fs@openoffice.org
527 if ( GetWindow() && !GetWindow()->HasChildPathFocus() )
528 GetWindow()->GrabFocus();
529 }
530
ImplGetPropertyIds(std::list<sal_uInt16> & rIds)531 void VCLXMultiLineEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
532 {
533 PushPropertyIds( rIds,
534 // FIXME: elide duplication ?
535 BASEPROPERTY_LINE_END_FORMAT,
536 BASEPROPERTY_READONLY,
537 BASEPROPERTY_MAXTEXTLEN,
538 BASEPROPERTY_HIDEINACTIVESELECTION,
539 0);
540 VCLXWindow::ImplGetPropertyIds( rIds, true );
541
542 }
543 // ----------------------------------------------------
544 // class VCLXFileControl
545 // ----------------------------------------------------
VCLXFileControl()546 VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
547 {
548 }
549
~VCLXFileControl()550 VCLXFileControl::~VCLXFileControl()
551 {
552 FileControl* pControl = (FileControl*) GetWindow();
553 if ( pControl )
554 pControl->GetEdit().SetModifyHdl( Link() );
555 }
556
queryInterface(const::com::sun::star::uno::Type & rType)557 ::com::sun::star::uno::Any VCLXFileControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
558 {
559 ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
560 SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent*, this ),
561 SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ),
562 SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
563 return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
564 }
565
566 // ::com::sun::star::lang::XTypeProvider
567 IMPL_XTYPEPROVIDER_START( VCLXFileControl )
568 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
569 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
570 VCLXWindow::getTypes()
571 IMPL_XTYPEPROVIDER_END
572
573 void SAL_CALL VCLXFileControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
574 {
575 ::vos::OGuard aGuard( GetMutex() );
576
577 FileControl* pControl = (FileControl*)GetWindow();
578 if ( pControl )
579 {
580 sal_uInt16 nPropType = GetPropertyId( PropertyName );
581 switch ( nPropType )
582 {
583 case BASEPROPERTY_HIDEINACTIVESELECTION:
584 {
585 sal_Bool bValue( sal_False );
586 OSL_VERIFY( Value >>= bValue );
587
588 lcl_setWinBits( pControl, WB_NOHIDESELECTION, !bValue );
589 lcl_setWinBits( &pControl->GetEdit(), WB_NOHIDESELECTION, !bValue );
590 }
591 break;
592
593 default:
594 VCLXWindow::setProperty( PropertyName, Value );
595 break;
596 }
597 }
598 }
599
SetWindow(Window * pWindow)600 void VCLXFileControl::SetWindow( Window* pWindow )
601 {
602 FileControl* pPrevFileControl = dynamic_cast<FileControl*>( GetWindow() );
603 if ( pPrevFileControl )
604 pPrevFileControl->GetEdit().SetModifyHdl( Link() );
605
606 FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow );
607 if ( pNewFileControl )
608 pNewFileControl->GetEdit().SetModifyHdl( LINK( this, VCLXFileControl, ModifyHdl ) );
609
610 VCLXWindow::SetWindow( pWindow );
611 }
612
addTextListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XTextListener> & l)613 void VCLXFileControl::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
614 {
615 maTextListeners.addInterface( l );
616 }
617
removeTextListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XTextListener> & l)618 void VCLXFileControl::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
619 {
620 maTextListeners.removeInterface( l );
621 }
622
setText(const::rtl::OUString & aText)623 void VCLXFileControl::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
624 {
625 ::vos::OGuard aGuard( GetMutex() );
626
627 Window* pWindow = GetWindow();
628 if ( pWindow )
629 {
630 pWindow->SetText( aText );
631
632 // In JAVA wird auch ein textChanged ausgeloest, in VCL nicht.
633 // ::com::sun::star::awt::Toolkit soll JAVA-komform sein...
634 ModifyHdl( NULL );
635 }
636 }
637
insertText(const::com::sun::star::awt::Selection & rSel,const::rtl::OUString & aText)638 void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
639 {
640 ::vos::OGuard aGuard( GetMutex() );
641
642 FileControl* pFileControl = (FileControl*) GetWindow();
643 if ( pFileControl )
644 {
645 pFileControl->GetEdit().SetSelection( Selection( rSel.Min, rSel.Max ) );
646 pFileControl->GetEdit().ReplaceSelected( aText );
647 }
648 }
649
getText()650 ::rtl::OUString VCLXFileControl::getText() throw(::com::sun::star::uno::RuntimeException)
651 {
652 ::vos::OGuard aGuard( GetMutex() );
653
654 ::rtl::OUString aText;
655 Window* pWindow = GetWindow();
656 if ( pWindow )
657 aText = pWindow->GetText();
658 return aText;
659 }
660
getSelectedText()661 ::rtl::OUString VCLXFileControl::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
662 {
663 ::vos::OGuard aGuard( GetMutex() );
664
665 ::rtl::OUString aText;
666 FileControl* pFileControl = (FileControl*) GetWindow();
667 if ( pFileControl)
668 aText = pFileControl->GetEdit().GetSelected();
669 return aText;
670
671 }
672
setSelection(const::com::sun::star::awt::Selection & aSelection)673 void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
674 {
675 ::vos::OGuard aGuard( GetMutex() );
676
677 FileControl* pFileControl = (FileControl*) GetWindow();
678 if ( pFileControl )
679 pFileControl->GetEdit().SetSelection( Selection( aSelection.Min, aSelection.Max ) );
680 }
681
getSelection()682 ::com::sun::star::awt::Selection VCLXFileControl::getSelection() throw(::com::sun::star::uno::RuntimeException)
683 {
684 ::vos::OGuard aGuard( GetMutex() );
685
686 ::com::sun::star::awt::Selection aSel;
687 FileControl* pFileControl = (FileControl*) GetWindow();
688 if ( pFileControl )
689 {
690 aSel.Min = pFileControl->GetEdit().GetSelection().Min();
691 aSel.Max = pFileControl->GetEdit().GetSelection().Max();
692 }
693 return aSel;
694 }
695
isEditable()696 sal_Bool VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeException)
697 {
698 ::vos::OGuard aGuard( GetMutex() );
699
700 FileControl* pFileControl = (FileControl*) GetWindow();
701 return ( pFileControl && !pFileControl->GetEdit().IsReadOnly() && pFileControl->GetEdit().IsEnabled() ) ? sal_True : sal_False;
702 }
703
setEditable(sal_Bool bEditable)704 void VCLXFileControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
705 {
706 ::vos::OGuard aGuard( GetMutex() );
707
708 FileControl* pFileControl = (FileControl*) GetWindow();
709 if ( pFileControl )
710 pFileControl->GetEdit().SetReadOnly( !bEditable );
711 }
712
setMaxTextLen(sal_Int16 nLen)713 void VCLXFileControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
714 {
715 ::vos::OGuard aGuard( GetMutex() );
716
717 FileControl* pFileControl = (FileControl*) GetWindow();
718 if ( pFileControl )
719 pFileControl->GetEdit().SetMaxTextLen( nLen );
720 }
721
getMaxTextLen()722 sal_Int16 VCLXFileControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
723 {
724 ::vos::OGuard aGuard( GetMutex() );
725
726 FileControl* pFileControl = (FileControl*) GetWindow();
727 return pFileControl ? pFileControl->GetEdit().GetMaxTextLen() : 0;
728 }
729
730
IMPL_LINK(VCLXFileControl,ModifyHdl,Edit *,EMPTYARG)731 IMPL_LINK( VCLXFileControl, ModifyHdl, Edit*, EMPTYARG )
732 {
733 ::com::sun::star::awt::TextEvent aEvent;
734 aEvent.Source = (::cppu::OWeakObject*)this;
735 maTextListeners.textChanged( aEvent );
736
737 return 1;
738 }
739
getMinimumSize()740 ::com::sun::star::awt::Size VCLXFileControl::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
741 {
742 ::vos::OGuard aGuard( GetMutex() );
743
744 ::com::sun::star::awt::Size aSz;
745 FileControl* pControl = (FileControl*) GetWindow();
746 if ( pControl )
747 {
748 Size aTmpSize = pControl->GetEdit().CalcMinimumSize();
749 aTmpSize.Width() += pControl->GetButton().CalcMinimumSize().Width();
750 aSz = AWTSize(pControl->CalcWindowSize( aTmpSize ));
751 }
752 return aSz;
753 }
754
getPreferredSize()755 ::com::sun::star::awt::Size VCLXFileControl::getPreferredSize() throw(::com::sun::star::uno::RuntimeException)
756 {
757 ::com::sun::star::awt::Size aSz = getMinimumSize();
758 aSz.Height += 4;
759 return aSz;
760 }
761
calcAdjustedSize(const::com::sun::star::awt::Size & rNewSize)762 ::com::sun::star::awt::Size VCLXFileControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
763 {
764 ::vos::OGuard aGuard( GetMutex() );
765
766 ::com::sun::star::awt::Size aSz =rNewSize;
767 FileControl* pControl = (FileControl*) GetWindow();
768 if ( pControl )
769 {
770 ::com::sun::star::awt::Size aMinSz = getMinimumSize();
771 if ( aSz.Height != aMinSz.Height )
772 aSz.Height = aMinSz.Height;
773 }
774 return aSz;
775 }
776
getMinimumSize(sal_Int16 nCols,sal_Int16)777 ::com::sun::star::awt::Size VCLXFileControl::getMinimumSize( sal_Int16 nCols, sal_Int16 ) throw(::com::sun::star::uno::RuntimeException)
778 {
779 ::vos::OGuard aGuard( GetMutex() );
780
781 ::com::sun::star::awt::Size aSz;
782 FileControl* pControl = (FileControl*) GetWindow();
783 if ( pControl )
784 {
785 aSz = AWTSize(pControl->GetEdit().CalcSize( nCols ));
786 aSz.Width += pControl->GetButton().CalcMinimumSize().Width();
787 }
788 return aSz;
789 }
790
getColumnsAndLines(sal_Int16 & nCols,sal_Int16 & nLines)791 void VCLXFileControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
792 {
793 ::vos::OGuard aGuard( GetMutex() );
794
795 nCols = 0;
796 nLines = 1;
797 FileControl* pControl = (FileControl*) GetWindow();
798 if ( pControl )
799 nCols = (sal_Int16) pControl->GetEdit().GetMaxVisChars();
800 }
801
ImplGetPropertyIds(std::list<sal_uInt16> & rIds)802 void VCLXFileControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
803 {
804 PushPropertyIds( rIds,
805 // FIXME: elide duplication ?
806 BASEPROPERTY_HIDEINACTIVESELECTION,
807 0);
808 VCLXWindow::ImplGetPropertyIds( rIds, true );
809 }
810
811
812 // ----------------------------------------------------
813 // class SVTXFormattedField
814 // ----------------------------------------------------
815 // --------------------------------------------------------------------------------------
SVTXFormattedField()816 SVTXFormattedField::SVTXFormattedField()
817 :m_pCurrentSupplier(NULL)
818 ,bIsStandardSupplier(sal_True)
819 ,nKeyToSetDelayed(-1)
820 {
821 }
822
823 // --------------------------------------------------------------------------------------
~SVTXFormattedField()824 SVTXFormattedField::~SVTXFormattedField()
825 {
826 if (m_pCurrentSupplier)
827 {
828 m_pCurrentSupplier->release();
829 m_pCurrentSupplier = NULL;
830 }
831 }
832
833 // --------------------------------------------------------------------------------------
SetWindow(Window * _pWindow)834 void SVTXFormattedField::SetWindow( Window* _pWindow )
835 {
836 VCLXSpinField::SetWindow(_pWindow);
837 if (GetFormattedField())
838 GetFormattedField()->SetAutoColor(sal_True);
839 }
840
841 // --------------------------------------------------------------------------------------
setProperty(const::rtl::OUString & PropertyName,const::com::sun::star::uno::Any & Value)842 void SVTXFormattedField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
843 {
844 ::vos::OGuard aGuard( GetMutex() );
845
846 FormattedField* pField = GetFormattedField();
847 if ( pField )
848 {
849 sal_uInt16 nPropType = GetPropertyId( PropertyName );
850 switch (nPropType)
851 {
852 case BASEPROPERTY_ENFORCE_FORMAT:
853 {
854 sal_Bool bEnable( sal_True );
855 if ( Value >>= bEnable )
856 pField->EnableNotANumber( !bEnable );
857 }
858 break;
859
860 case BASEPROPERTY_EFFECTIVE_MIN:
861 case BASEPROPERTY_VALUEMIN_DOUBLE:
862 SetMinValue(Value);
863 break;
864
865 case BASEPROPERTY_EFFECTIVE_MAX:
866 case BASEPROPERTY_VALUEMAX_DOUBLE:
867 SetMaxValue(Value);
868 break;
869
870 case BASEPROPERTY_EFFECTIVE_DEFAULT:
871 SetDefaultValue(Value);
872 break;
873
874 case BASEPROPERTY_TREATASNUMBER:
875 {
876 sal_Bool b = sal_Bool();
877 if ( Value >>= b )
878 SetTreatAsNumber(b);
879 }
880 break;
881
882 case BASEPROPERTY_FORMATSSUPPLIER:
883 if (!Value.hasValue())
884 setFormatsSupplier(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > (NULL));
885 else
886 {
887 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > xNFS;
888 if ( Value >>= xNFS )
889 setFormatsSupplier(xNFS);
890 }
891 break;
892 case BASEPROPERTY_FORMATKEY:
893 if (!Value.hasValue())
894 setFormatKey(0);
895 else
896 {
897 sal_Int32 n = 0;
898 if ( Value >>= n )
899 setFormatKey(n);
900 }
901 break;
902
903 case BASEPROPERTY_EFFECTIVE_VALUE:
904 case BASEPROPERTY_VALUE_DOUBLE:
905 {
906 const ::com::sun::star::uno::TypeClass rTC = Value.getValueType().getTypeClass();
907 if (rTC != ::com::sun::star::uno::TypeClass_STRING)
908 // no string
909 if (rTC != ::com::sun::star::uno::TypeClass_DOUBLE)
910 // no double
911 if (Value.hasValue())
912 { // but a value
913 // try if it is something converitble
914 sal_Int32 nValue = 0;
915 if (!(Value >>= nValue))
916 throw ::com::sun::star::lang::IllegalArgumentException();
917 SetValue(::com::sun::star::uno::makeAny((double)nValue));
918 break;
919 }
920
921 SetValue(Value);
922 }
923 break;
924 case BASEPROPERTY_VALUESTEP_DOUBLE:
925 {
926 double d = 0.0;
927 if ( Value >>= d )
928 pField->SetSpinSize( d );
929 else
930 {
931 sal_Int32 n = 0;
932 if ( Value >>= n )
933 pField->SetSpinSize( n );
934 }
935 }
936 break;
937 case BASEPROPERTY_DECIMALACCURACY:
938 {
939 sal_Int32 n = 0;
940 if ( Value >>= n )
941 pField->SetDecimalDigits( (sal_uInt16)n );
942 }
943 break;
944 case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
945 {
946 sal_Bool b = sal_Bool();
947 if ( Value >>= b )
948 pField->SetThousandsSep( b );
949 }
950 break;
951
952 default:
953 VCLXSpinField::setProperty( PropertyName, Value );
954 }
955
956 if (BASEPROPERTY_TEXTCOLOR == nPropType)
957 { // after setting a new text color, think again about the AutoColor flag of the control
958 // 17.05.2001 - 86859 - frank.schoenheit@germany.sun.com
959 pField->SetAutoColor(!Value.hasValue());
960 }
961 }
962 else
963 VCLXSpinField::setProperty( PropertyName, Value );
964 }
965
966 // --------------------------------------------------------------------------------------
getProperty(const::rtl::OUString & PropertyName)967 ::com::sun::star::uno::Any SVTXFormattedField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
968 {
969 ::vos::OGuard aGuard( GetMutex() );
970
971 ::com::sun::star::uno::Any aReturn;
972
973 FormattedField* pField = GetFormattedField();
974 if ( pField )
975 {
976 sal_uInt16 nPropType = GetPropertyId( PropertyName );
977 switch (nPropType)
978 {
979 case BASEPROPERTY_EFFECTIVE_MIN:
980 case BASEPROPERTY_VALUEMIN_DOUBLE:
981 aReturn <<= GetMinValue();
982 break;
983
984 case BASEPROPERTY_EFFECTIVE_MAX:
985 case BASEPROPERTY_VALUEMAX_DOUBLE:
986 aReturn <<= GetMaxValue();
987 break;
988
989 case BASEPROPERTY_EFFECTIVE_DEFAULT:
990 aReturn <<= GetDefaultValue();
991 break;
992
993 case BASEPROPERTY_TREATASNUMBER:
994 aReturn <<= GetTreatAsNumber();
995 break;
996
997 case BASEPROPERTY_EFFECTIVE_VALUE:
998 case BASEPROPERTY_VALUE_DOUBLE:
999 aReturn <<= GetValue();
1000 break;
1001
1002 case BASEPROPERTY_VALUESTEP_DOUBLE:
1003 aReturn <<= pField->GetSpinSize();
1004 break;
1005
1006 case BASEPROPERTY_DECIMALACCURACY:
1007 aReturn <<= pField->GetDecimalDigits();
1008 break;
1009
1010 case BASEPROPERTY_FORMATSSUPPLIER:
1011 {
1012 if (!bIsStandardSupplier)
1013 { // ansonsten void
1014 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier = getFormatsSupplier();
1015 aReturn <<= xSupplier;
1016 }
1017 }
1018 break;
1019
1020 case BASEPROPERTY_FORMATKEY:
1021 {
1022 if (!bIsStandardSupplier)
1023 aReturn <<= getFormatKey();
1024 }
1025 break;
1026
1027 default:
1028 aReturn <<= VCLXSpinField::getProperty(PropertyName);
1029 }
1030 }
1031 return aReturn;
1032 }
1033
1034 // --------------------------------------------------------------------------------------
convertEffectiveValue(const::com::sun::star::uno::Any & rValue)1035 ::com::sun::star::uno::Any SVTXFormattedField::convertEffectiveValue(const ::com::sun::star::uno::Any& rValue)
1036 {
1037 ::com::sun::star::uno::Any aReturn;
1038
1039 FormattedField* pField = GetFormattedField();
1040 if (!pField)
1041 return aReturn;
1042
1043 switch (rValue.getValueType().getTypeClass())
1044 {
1045 case ::com::sun::star::uno::TypeClass_DOUBLE:
1046 if (pField->TreatingAsNumber())
1047 {
1048 double d = 0.0;
1049 rValue >>= d;
1050 aReturn <<= d;
1051 }
1052 else
1053 {
1054 SvNumberFormatter* pFormatter = pField->GetFormatter();
1055 if (!pFormatter)
1056 pFormatter = pField->StandardFormatter();
1057 // should never fail
1058
1059 Color* pDum;
1060 double d = 0.0;
1061 rValue >>= d;
1062 String sConverted;
1063 pFormatter->GetOutputString(d, 0, sConverted, &pDum);
1064 aReturn <<= ::rtl::OUString( sConverted );
1065 }
1066 break;
1067 case ::com::sun::star::uno::TypeClass_STRING:
1068 {
1069 ::rtl::OUString aStr;
1070 rValue >>= aStr;
1071 String sValue = aStr;
1072 if (pField->TreatingAsNumber())
1073 {
1074 SvNumberFormatter* pFormatter = pField->GetFormatter();
1075 if (!pFormatter)
1076 pFormatter = pField->StandardFormatter();
1077
1078 double dVal;
1079 sal_uInt32 nTestFormat(0);
1080 if (!pFormatter->IsNumberFormat(sValue, nTestFormat, dVal))
1081 aReturn.clear();
1082 aReturn <<=dVal;
1083 }
1084 else
1085 aReturn <<= aStr;
1086 }
1087 break;
1088 default:
1089 aReturn.clear();
1090 break;
1091 }
1092 return aReturn;
1093 }
1094
1095 // --------------------------------------------------------------------------------------
SetMinValue(const::com::sun::star::uno::Any & rValue)1096 void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
1097 {
1098 FormattedField* pField = GetFormattedField();
1099 if (!pField)
1100 return;
1101
1102 switch (rValue.getValueType().getTypeClass())
1103
1104 {
1105 case ::com::sun::star::uno::TypeClass_DOUBLE:
1106 {
1107 double d = 0.0;
1108 rValue >>= d;
1109 pField->SetMinValue(d);
1110 }
1111 break;
1112 default:
1113 DBG_ASSERT(rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID, "SVTXFormattedField::SetMinValue : invalid argument (an exception will be thrown) !");
1114 if ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID )
1115
1116 {
1117 throw ::com::sun::star::lang::IllegalArgumentException();
1118 }
1119 pField->ClearMinValue();
1120 break;
1121 }
1122 }
1123
1124 // --------------------------------------------------------------------------------------
GetMinValue()1125 ::com::sun::star::uno::Any SVTXFormattedField::GetMinValue()
1126 {
1127 FormattedField* pField = GetFormattedField();
1128 if (!pField || !pField->HasMinValue())
1129 return ::com::sun::star::uno::Any();
1130
1131 ::com::sun::star::uno::Any aReturn;
1132 aReturn <<= pField->GetMinValue();
1133 return aReturn;
1134 }
1135
1136 // --------------------------------------------------------------------------------------
SetMaxValue(const::com::sun::star::uno::Any & rValue)1137 void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
1138 {
1139 FormattedField* pField = GetFormattedField();
1140 if (!pField)
1141 return;
1142
1143 switch (rValue.getValueType().getTypeClass())
1144
1145 {
1146 case ::com::sun::star::uno::TypeClass_DOUBLE:
1147 {
1148 double d = 0.0;
1149 rValue >>= d;
1150 pField->SetMaxValue(d);
1151 }
1152 break;
1153 default:
1154 if (rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID)
1155
1156 {
1157 throw ::com::sun::star::lang::IllegalArgumentException();
1158 }
1159 pField->ClearMaxValue();
1160 break;
1161 }
1162 }
1163
1164 // --------------------------------------------------------------------------------------
GetMaxValue()1165 ::com::sun::star::uno::Any SVTXFormattedField::GetMaxValue()
1166 {
1167 FormattedField* pField = GetFormattedField();
1168 if (!pField || !pField->HasMaxValue())
1169 return ::com::sun::star::uno::Any();
1170
1171 ::com::sun::star::uno::Any aReturn;
1172 aReturn <<= pField->GetMaxValue();
1173 return aReturn;
1174 }
1175
1176 // --------------------------------------------------------------------------------------
SetDefaultValue(const::com::sun::star::uno::Any & rValue)1177 void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValue)
1178 {
1179 FormattedField* pField = GetFormattedField();
1180 if (!pField)
1181 return;
1182
1183 ::com::sun::star::uno::Any aConverted = convertEffectiveValue(rValue);
1184
1185 switch (aConverted.getValueType().getTypeClass())
1186
1187 {
1188 case ::com::sun::star::uno::TypeClass_DOUBLE:
1189 {
1190 double d = 0.0;
1191 aConverted >>= d;
1192 pField->SetDefaultValue(d);
1193 }
1194 break;
1195 case ::com::sun::star::uno::TypeClass_STRING:
1196 {
1197 ::rtl::OUString aStr;
1198 aConverted >>= aStr;
1199 pField->SetDefaultText( aStr );
1200 }
1201 break;
1202 default:
1203 pField->EnableEmptyField(sal_True);
1204 // nur noch void erlaubt
1205 break;
1206 }
1207 }
1208
1209 // --------------------------------------------------------------------------------------
GetDefaultValue()1210 ::com::sun::star::uno::Any SVTXFormattedField::GetDefaultValue()
1211 {
1212 FormattedField* pField = GetFormattedField();
1213 if (!pField || pField->IsEmptyFieldEnabled())
1214 return ::com::sun::star::uno::Any();
1215
1216 ::com::sun::star::uno::Any aReturn;
1217 if (pField->TreatingAsNumber())
1218 aReturn <<= pField->GetDefaultValue();
1219 else
1220 aReturn <<= ::rtl::OUString( pField->GetDefaultText() );
1221 return aReturn;
1222 }
1223
1224 // --------------------------------------------------------------------------------------
GetTreatAsNumber()1225 sal_Bool SVTXFormattedField::GetTreatAsNumber()
1226 {
1227 FormattedField* pField = GetFormattedField();
1228 if (pField)
1229 return pField->TreatingAsNumber();
1230
1231 return sal_True;
1232 }
1233
1234 // --------------------------------------------------------------------------------------
SetTreatAsNumber(sal_Bool bSet)1235 void SVTXFormattedField::SetTreatAsNumber(sal_Bool bSet)
1236 {
1237 FormattedField* pField = GetFormattedField();
1238 if (pField)
1239 pField->TreatAsNumber(bSet);
1240 }
1241
1242 // --------------------------------------------------------------------------------------
GetValue()1243 ::com::sun::star::uno::Any SVTXFormattedField::GetValue()
1244 {
1245 FormattedField* pField = GetFormattedField();
1246 if (!pField)
1247 return ::com::sun::star::uno::Any();
1248
1249 ::com::sun::star::uno::Any aReturn;
1250 if (!pField->TreatingAsNumber())
1251 {
1252 ::rtl::OUString sText = pField->GetTextValue();
1253 aReturn <<= sText;
1254 }
1255 else
1256 {
1257 if (pField->GetText().Len()) // empty wird erst mal standardmaessig als void nach draussen gereicht
1258 aReturn <<= pField->GetValue();
1259 }
1260
1261 return aReturn;
1262 }
1263
1264 // --------------------------------------------------------------------------------------
SetValue(const::com::sun::star::uno::Any & rValue)1265 void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any& rValue)
1266 {
1267 FormattedField* pField = GetFormattedField();
1268 if (!pField)
1269 return;
1270
1271 if (!rValue.hasValue())
1272 {
1273 pField->SetText(String());
1274 }
1275 else
1276 {
1277 if (rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE )
1278 {
1279 double d = 0.0;
1280 rValue >>= d;
1281 pField->SetValue(d);
1282 }
1283 else
1284 {
1285 DBG_ASSERT(rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING, "SVTXFormattedField::SetValue : invalid argument !");
1286
1287 ::rtl::OUString sText;
1288 rValue >>= sText;
1289 String aStr( sText );
1290 if (!pField->TreatingAsNumber())
1291 pField->SetTextFormatted(aStr);
1292 else
1293 pField->SetTextValue(aStr);
1294 }
1295 }
1296 // NotifyTextListeners();
1297 }
1298
1299 // --------------------------------------------------------------------------------------
getFormatsSupplier(void) const1300 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > SVTXFormattedField::getFormatsSupplier(void) const
1301 {
1302 return ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > ((::com::sun::star::util::XNumberFormatsSupplier*)m_pCurrentSupplier);
1303 }
1304
1305 // --------------------------------------------------------------------------------------
setFormatsSupplier(const::com::sun::star::uno::Reference<::com::sun::star::util::XNumberFormatsSupplier> & xSupplier)1306 void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier)
1307 {
1308 FormattedField* pField = GetFormattedField();
1309
1310 SvNumberFormatsSupplierObj* pNew = NULL;
1311 if (!xSupplier.is())
1312 {
1313 if (pField)
1314 {
1315 pNew = new SvNumberFormatsSupplierObj(pField->StandardFormatter());
1316 bIsStandardSupplier = sal_True;
1317 }
1318 }
1319 else
1320 {
1321 pNew = SvNumberFormatsSupplierObj::getImplementation(xSupplier);
1322 bIsStandardSupplier = sal_False;
1323 }
1324
1325 if (!pNew)
1326 return; // TODO : wie das behandeln ?
1327
1328 if (m_pCurrentSupplier)
1329 m_pCurrentSupplier->release();
1330 m_pCurrentSupplier = pNew;
1331 m_pCurrentSupplier->acquire();
1332 if (pField)
1333 {
1334 // den aktuellen Value mit hinueberretten
1335 ::com::sun::star::uno::Any aCurrent = GetValue();
1336 pField->SetFormatter(m_pCurrentSupplier->GetNumberFormatter(), sal_False);
1337 if (nKeyToSetDelayed != -1)
1338 {
1339 pField->SetFormatKey(nKeyToSetDelayed);
1340 nKeyToSetDelayed = -1;
1341 }
1342 SetValue(aCurrent);
1343 NotifyTextListeners();
1344 }
1345 }
1346
1347 // --------------------------------------------------------------------------------------
getFormatKey(void) const1348 sal_Int32 SVTXFormattedField::getFormatKey(void) const
1349 {
1350 FormattedField* pField = GetFormattedField();
1351 return pField ? pField->GetFormatKey() : 0;
1352 }
1353
1354 // --------------------------------------------------------------------------------------
setFormatKey(sal_Int32 nKey)1355 void SVTXFormattedField::setFormatKey(sal_Int32 nKey)
1356 {
1357 FormattedField* pField = GetFormattedField();
1358 if (pField)
1359 {
1360 if (pField->GetFormatter())
1361 pField->SetFormatKey(nKey);
1362 else
1363 { // Wahrscheinlich bin ich gerade in einem Block, in dem erst der Key und dann der Formatter gesetzt
1364 // wird, das passiert initial mit ziemlicher Sicherheit, da die Properties in alphabetischer Reihenfolge
1365 // gesetzt werden, und der FormatsSupplier nun mal vor dem FormatKey kommt
1366 nKeyToSetDelayed = nKey;
1367 }
1368 NotifyTextListeners();
1369 }
1370 }
1371
1372 // --------------------------------------------------------------------------------------
NotifyTextListeners()1373 void SVTXFormattedField::NotifyTextListeners()
1374 {
1375 if ( GetTextListeners().getLength() )
1376 {
1377 ::com::sun::star::awt::TextEvent aEvent;
1378 aEvent.Source = (::cppu::OWeakObject*)this;
1379 GetTextListeners().textChanged( aEvent );
1380 }
1381 }
1382
ImplGetPropertyIds(std::list<sal_uInt16> & rIds)1383 void SVTXFormattedField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1384 {
1385 PushPropertyIds( rIds,
1386 // FIXME: elide duplication ?
1387 BASEPROPERTY_EFFECTIVE_MIN,
1388 BASEPROPERTY_VALUEMIN_DOUBLE,
1389 BASEPROPERTY_EFFECTIVE_MAX,
1390 BASEPROPERTY_VALUEMAX_DOUBLE,
1391 BASEPROPERTY_EFFECTIVE_DEFAULT,
1392 BASEPROPERTY_TREATASNUMBER,
1393 BASEPROPERTY_EFFECTIVE_VALUE,
1394 BASEPROPERTY_VALUE_DOUBLE,
1395 BASEPROPERTY_VALUESTEP_DOUBLE,
1396 BASEPROPERTY_DECIMALACCURACY,
1397 BASEPROPERTY_FORMATSSUPPLIER,
1398 BASEPROPERTY_NUMSHOWTHOUSANDSEP,
1399 BASEPROPERTY_FORMATKEY,
1400 BASEPROPERTY_TREATASNUMBER,
1401 BASEPROPERTY_ENFORCE_FORMAT,
1402 0);
1403 VCLXWindow::ImplGetPropertyIds( rIds, true );
1404 VCLXSpinField::ImplGetPropertyIds( rIds );
1405 }
1406
1407
1408 // ----------------------------------------------------
1409 // class SVTXRoadmap
1410 // ----------------------------------------------------
1411
1412 using namespace svt;
1413
1414 // --------------------------------------------------------------------------------------
SVTXRoadmap()1415 SVTXRoadmap::SVTXRoadmap() : maItemListeners( *this )
1416 {
1417 }
1418
1419 // --------------------------------------------------------------------------------------
~SVTXRoadmap()1420 SVTXRoadmap::~SVTXRoadmap()
1421 {
1422 }
1423
ProcessWindowEvent(const VclWindowEvent & rVclWindowEvent)1424 void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1425 {
1426 switch ( rVclWindowEvent.GetId() )
1427 {
1428 case VCLEVENT_ROADMAP_ITEMSELECTED:
1429 {
1430 ::vos::OGuard aGuard( GetMutex() );
1431 ::svt::ORoadmap* pField = GetRoadmap();
1432 if ( pField )
1433 {
1434 sal_Int16 CurItemID = pField->GetCurrentRoadmapItemID();
1435 ::com::sun::star::awt::ItemEvent aEvent;
1436 aEvent.Selected = CurItemID;
1437 aEvent.Highlighted = CurItemID;
1438 aEvent.ItemId = CurItemID;
1439 maItemListeners.itemStateChanged( aEvent );
1440 }
1441 }
1442 break;
1443 default:
1444 SVTXRoadmap_Base::ProcessWindowEvent( rVclWindowEvent );
1445 break;
1446 }
1447 }
1448
1449
propertyChange(const::com::sun::star::beans::PropertyChangeEvent & evt)1450 void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException)
1451 {
1452 ::vos::OGuard aGuard( GetMutex() );
1453 ::svt::ORoadmap* pField = GetRoadmap();
1454 if ( pField )
1455 {
1456 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRoadmapItem;
1457 xRoadmapItem = evt.Source;
1458 sal_Int32 nID = 0;
1459 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropertySet( xRoadmapItem, ::com::sun::star::uno::UNO_QUERY );
1460 ::com::sun::star::uno::Any aValue = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii( "ID" ));
1461 aValue >>= nID;
1462
1463 ::com::sun::star::uno::Any rVal = evt.NewValue;
1464 evt.NewValue >>= rVal;
1465 ::rtl::OUString sPropertyName = evt.PropertyName;
1466 if ( sPropertyName.equals(::rtl::OUString::createFromAscii( "Enabled" ) ) )
1467 {
1468 sal_Bool bEnable = false;
1469 evt.NewValue >>= bEnable;
1470 pField->EnableRoadmapItem( (RoadmapTypes::ItemId)nID , bEnable );
1471 }
1472 else if ( sPropertyName.equals(::rtl::OUString::createFromAscii( "Label" ) ) )
1473 {
1474 ::rtl::OUString sLabel;
1475 evt.NewValue >>= sLabel;
1476 pField->ChangeRoadmapItemLabel( (RoadmapTypes::ItemId)nID , sLabel );
1477 }
1478 else if ( sPropertyName.equals(::rtl::OUString::createFromAscii( "ID" ) ) )
1479 {
1480 sal_Int32 nNewID = 0;
1481 evt.NewValue >>= nNewID;
1482 evt.OldValue >>= nID;
1483 pField->ChangeRoadmapItemID( (RoadmapTypes::ItemId)nID, (RoadmapTypes::ItemId)nNewID );
1484 }
1485 // else
1486 // Todo: handle Interactive appropriately
1487 }
1488 }
1489
1490
addItemListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XItemListener> & l)1491 void SVTXRoadmap::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw (::com::sun::star::uno::RuntimeException)
1492 {
1493 maItemListeners.addInterface( l );
1494 }
1495
removeItemListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XItemListener> & l)1496 void SVTXRoadmap::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw (::com::sun::star::uno::RuntimeException)
1497 {
1498 maItemListeners.removeInterface( l );
1499 }
1500
GetRMItemData(const::com::sun::star::container::ContainerEvent & _rEvent)1501 RMItemData SVTXRoadmap::GetRMItemData( const ::com::sun::star::container::ContainerEvent& _rEvent )
1502 {
1503 RMItemData aCurRMItemData;
1504 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRoadmapItem;
1505 _rEvent.Element >>= xRoadmapItem;
1506 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropertySet( xRoadmapItem, ::com::sun::star::uno::UNO_QUERY );
1507 if ( xPropertySet.is() )
1508 {
1509 ::com::sun::star::uno::Any aValue = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii( "Label" ));
1510 aValue >>= aCurRMItemData.Label;
1511 aValue = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii( "ID" ));
1512 aValue >>= aCurRMItemData.n_ID;
1513 aValue = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii( "Enabled" ));
1514 aValue >>= aCurRMItemData.b_Enabled;
1515 }
1516 return aCurRMItemData;;
1517 }
1518
elementInserted(const::com::sun::star::container::ContainerEvent & _rEvent)1519 void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException)
1520 {
1521 ::vos::OGuard aGuard( GetMutex() );
1522 ::svt::ORoadmap* pField = GetRoadmap();
1523 if ( pField )
1524 {
1525 RMItemData CurItemData = GetRMItemData( _rEvent );
1526 sal_Int32 InsertIndex = 0;
1527 _rEvent.Accessor >>= InsertIndex;
1528 pField->InsertRoadmapItem( InsertIndex, CurItemData.Label, (RoadmapTypes::ItemId)CurItemData.n_ID, CurItemData.b_Enabled );
1529 }
1530 }
1531
elementRemoved(const::com::sun::star::container::ContainerEvent & _rEvent)1532 void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException)
1533 {
1534 ::vos::OGuard aGuard( GetMutex() );
1535 ::svt::ORoadmap* pField = GetRoadmap();
1536 if ( pField )
1537 {
1538 sal_Int32 DelIndex = 0;
1539 _rEvent.Accessor >>= DelIndex;
1540 pField->DeleteRoadmapItem(DelIndex);
1541 // pField->GetCurrentRoadmapItem()
1542 // setProperty(::rtl::OUString.createFromAscii( "CurrentItem" )aAny,
1543 }
1544 }
1545
elementReplaced(const::com::sun::star::container::ContainerEvent & _rEvent)1546 void SVTXRoadmap::elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException)
1547 {
1548 ::vos::OGuard aGuard( GetMutex() );
1549 ::svt::ORoadmap* pField = GetRoadmap();
1550 if ( pField )
1551 {
1552 RMItemData CurItemData = GetRMItemData( _rEvent );
1553 sal_Int32 ReplaceIndex = 0;
1554 _rEvent.Accessor >>= ReplaceIndex;
1555 pField->ReplaceRoadmapItem( ReplaceIndex, CurItemData.Label, (RoadmapTypes::ItemId)CurItemData.n_ID, CurItemData.b_Enabled );
1556 }
1557 }
1558
1559
1560
1561 // --------------------------------------------------------------------------------------
setProperty(const::rtl::OUString & PropertyName,const::com::sun::star::uno::Any & Value)1562 void SVTXRoadmap::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
1563 {
1564 ::vos::OGuard aGuard( GetMutex() );
1565
1566 ::svt::ORoadmap* pField = GetRoadmap();
1567 if ( pField )
1568 {
1569 sal_uInt16 nPropType = GetPropertyId( PropertyName );
1570 switch (nPropType)
1571 {
1572 case BASEPROPERTY_COMPLETE:
1573 {
1574 sal_Bool b = false;
1575 Value >>= b;
1576 pField->SetRoadmapComplete( b);
1577 }
1578 break;
1579
1580 case BASEPROPERTY_ACTIVATED:
1581 {
1582 sal_Bool b = false;
1583 Value >>= b;
1584 pField->SetRoadmapInteractive( b);
1585 }
1586 break;
1587
1588 case BASEPROPERTY_CURRENTITEMID:
1589 {
1590 sal_Int32 nId = 0;
1591 Value >>= nId;
1592 pField->SelectRoadmapItemByID( (RoadmapTypes::ItemId)nId );
1593 }
1594 break;
1595
1596 case BASEPROPERTY_TEXT:
1597 {
1598 ::rtl::OUString aStr;
1599 Value >>= aStr;
1600 pField->SetText( aStr );
1601 pField->Invalidate();
1602 }
1603 break;
1604
1605 default:
1606 SVTXRoadmap_Base::setProperty( PropertyName, Value );
1607 break;
1608 }
1609
1610 }
1611 else
1612 SVTXRoadmap_Base::setProperty( PropertyName, Value );
1613 }
1614
1615
1616 // --------------------------------------------------------------------------------------
getProperty(const::rtl::OUString & PropertyName)1617 ::com::sun::star::uno::Any SVTXRoadmap::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
1618 {
1619 ::vos::OGuard aGuard( GetMutex() );
1620
1621 ::com::sun::star::uno::Any aReturn;
1622
1623 ::svt::ORoadmap* pField = GetRoadmap();
1624 if ( pField )
1625 {
1626 sal_uInt16 nPropType = GetPropertyId( PropertyName );
1627 switch (nPropType)
1628 {
1629 case BASEPROPERTY_COMPLETE:
1630 aReturn <<= pField->IsRoadmapComplete();
1631 break;
1632 case BASEPROPERTY_ACTIVATED:
1633 aReturn <<= pField->IsRoadmapInteractive();
1634 break;
1635 case BASEPROPERTY_CURRENTITEMID:
1636 aReturn <<= pField->GetCurrentRoadmapItemID();
1637 break;
1638 default:
1639 aReturn = SVTXRoadmap_Base::getProperty(PropertyName);
1640 break;
1641 }
1642 }
1643 return aReturn;
1644 }
1645
ImplSetNewImage()1646 void SVTXRoadmap::ImplSetNewImage()
1647 {
1648 OSL_PRECOND( GetWindow(), "SVTXRoadmap::ImplSetNewImage: window is required to be not-NULL!" );
1649 ::svt::ORoadmap* pButton = static_cast< ::svt::ORoadmap* >( GetWindow() );
1650 pButton->SetRoadmapBitmap( GetImage().GetBitmapEx() );
1651 }
1652
ImplGetPropertyIds(std::list<sal_uInt16> & rIds)1653 void SVTXRoadmap::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1654 {
1655 PushPropertyIds( rIds,
1656 BASEPROPERTY_COMPLETE,
1657 BASEPROPERTY_ACTIVATED,
1658 BASEPROPERTY_CURRENTITEMID,
1659 BASEPROPERTY_TEXT,
1660 0);
1661 VCLXWindow::ImplGetPropertyIds( rIds, true );
1662 VCLXGraphicControl::ImplGetPropertyIds( rIds );
1663 }
1664
1665 // ----------------------------------------------------
1666 // class SVTXNumericField
1667 // ----------------------------------------------------
SVTXNumericField()1668 SVTXNumericField::SVTXNumericField()
1669 {
1670 }
1671
~SVTXNumericField()1672 SVTXNumericField::~SVTXNumericField()
1673 {
1674 }
1675
queryInterface(const::com::sun::star::uno::Type & rType)1676 ::com::sun::star::uno::Any SVTXNumericField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
1677 {
1678 ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
1679 SAL_STATIC_CAST( ::com::sun::star::awt::XNumericField*, this ),
1680 SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
1681 return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
1682 }
1683
1684 // ::com::sun::star::lang::XTypeProvider
1685 IMPL_XTYPEPROVIDER_START( SVTXNumericField )
1686 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ),
1687 SVTXFormattedField::getTypes()
1688 IMPL_XTYPEPROVIDER_END
1689
1690
1691 void SVTXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
1692 {
1693 ::vos::OGuard aGuard( GetMutex() );
1694
1695 FormattedField* pField = GetFormattedField();
1696 if ( pField )
1697 pField->SetValue( Value );
1698 }
1699
getValue()1700 double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException)
1701 {
1702 ::vos::OGuard aGuard( GetMutex() );
1703
1704 FormattedField* pField = GetFormattedField();
1705 return pField ? pField->GetValue() : 0;
1706 }
1707
setMin(double Value)1708 void SVTXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
1709 {
1710 ::vos::OGuard aGuard( GetMutex() );
1711
1712 FormattedField* pField = GetFormattedField();
1713 if ( pField )
1714 pField->SetMinValue( Value );
1715 }
1716
getMin()1717 double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException)
1718 {
1719 ::vos::OGuard aGuard( GetMutex() );
1720
1721 FormattedField* pField = GetFormattedField();
1722 return pField ? pField->GetMinValue() : 0;
1723 }
1724
setMax(double Value)1725 void SVTXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
1726 {
1727 ::vos::OGuard aGuard( GetMutex() );
1728
1729 FormattedField* pField = GetFormattedField();
1730 if ( pField )
1731 pField->SetMaxValue( Value );
1732 }
1733
getMax()1734 double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException)
1735 {
1736 ::vos::OGuard aGuard( GetMutex() );
1737
1738 FormattedField* pField = GetFormattedField();
1739 return pField ? pField->GetMaxValue() : 0;
1740 }
1741
setFirst(double Value)1742 void SVTXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
1743 {
1744 ::vos::OGuard aGuard( GetMutex() );
1745
1746 FormattedField* pField = GetFormattedField();
1747 if ( pField )
1748 pField->SetSpinFirst( Value );
1749 }
1750
getFirst()1751 double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException)
1752 {
1753 ::vos::OGuard aGuard( GetMutex() );
1754
1755 FormattedField* pField = GetFormattedField();
1756 return pField ? pField->GetSpinFirst() : 0;
1757 }
1758
setLast(double Value)1759 void SVTXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
1760 {
1761 ::vos::OGuard aGuard( GetMutex() );
1762
1763 FormattedField* pField = GetFormattedField();
1764 if ( pField )
1765 pField->SetSpinLast( Value );
1766 }
1767
getLast()1768 double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException)
1769 {
1770 ::vos::OGuard aGuard( GetMutex() );
1771
1772 FormattedField* pField = GetFormattedField();
1773 return pField ? pField->GetSpinLast() : 0;
1774 }
1775
setSpinSize(double Value)1776 void SVTXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
1777 {
1778 ::vos::OGuard aGuard( GetMutex() );
1779
1780 FormattedField* pField = GetFormattedField();
1781 if ( pField )
1782 pField->SetSpinSize( Value );
1783 }
1784
getSpinSize()1785 double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
1786 {
1787 ::vos::OGuard aGuard( GetMutex() );
1788
1789 FormattedField* pField = GetFormattedField();
1790 return pField ? pField->GetSpinSize() : 0;
1791 }
1792
setDecimalDigits(sal_Int16 Value)1793 void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
1794 {
1795 ::vos::OGuard aGuard( GetMutex() );
1796
1797 FormattedField* pField = GetFormattedField();
1798 if ( pField )
1799 pField->SetDecimalDigits( Value );
1800 }
1801
getDecimalDigits()1802 sal_Int16 SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
1803 {
1804 ::vos::OGuard aGuard( GetMutex() );
1805
1806 FormattedField* pField = GetFormattedField();
1807 return pField ? pField->GetDecimalDigits() : 0;
1808 }
1809
setStrictFormat(sal_Bool bStrict)1810 void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
1811 {
1812 ::vos::OGuard aGuard( GetMutex() );
1813
1814 FormattedField* pField = GetFormattedField();
1815 if ( pField )
1816 pField->SetStrictFormat( bStrict );
1817 }
1818
isStrictFormat()1819 sal_Bool SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
1820 {
1821 ::vos::OGuard aGuard( GetMutex() );
1822
1823 FormattedField* pField = GetFormattedField();
1824 return pField ? pField->IsStrictFormat() : sal_False;
1825 }
1826
ImplGetPropertyIds(std::list<sal_uInt16> & rIds)1827 void SVTXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1828 {
1829 SVTXFormattedField::ImplGetPropertyIds( rIds );
1830 }
1831
1832 // ----------------------------------------------------
1833 // class SVTXCurrencyField
1834 // ----------------------------------------------------
SVTXCurrencyField()1835 SVTXCurrencyField::SVTXCurrencyField()
1836 {
1837 }
1838
~SVTXCurrencyField()1839 SVTXCurrencyField::~SVTXCurrencyField()
1840 {
1841 }
1842
queryInterface(const::com::sun::star::uno::Type & rType)1843 ::com::sun::star::uno::Any SVTXCurrencyField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
1844 {
1845 ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
1846 SAL_STATIC_CAST( ::com::sun::star::awt::XCurrencyField*, this ),
1847 SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
1848 return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
1849 }
1850
1851 // ::com::sun::star::lang::XTypeProvider
1852 IMPL_XTYPEPROVIDER_START( SVTXCurrencyField )
1853 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ),
1854 SVTXFormattedField::getTypes()
1855 IMPL_XTYPEPROVIDER_END
1856
1857 void SVTXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
1858 {
1859 ::vos::OGuard aGuard( GetMutex() );
1860
1861 FormattedField* pField = GetFormattedField();
1862 if ( pField )
1863 pField->SetValue( Value );
1864 }
1865
getValue()1866 double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException)
1867 {
1868 ::vos::OGuard aGuard( GetMutex() );
1869
1870 FormattedField* pField = GetFormattedField();
1871 return pField ? pField->GetValue() : 0;
1872 }
1873
setMin(double Value)1874 void SVTXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
1875 {
1876 ::vos::OGuard aGuard( GetMutex() );
1877
1878 FormattedField* pField = GetFormattedField();
1879 if ( pField )
1880 pField->SetMinValue( Value );
1881 }
1882
getMin()1883 double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException)
1884 {
1885 ::vos::OGuard aGuard( GetMutex() );
1886
1887 FormattedField* pField = GetFormattedField();
1888 return pField ? pField->GetMinValue() : 0;
1889 }
1890
setMax(double Value)1891 void SVTXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
1892 {
1893 ::vos::OGuard aGuard( GetMutex() );
1894
1895 FormattedField* pField = GetFormattedField();
1896 if ( pField )
1897 pField->SetMaxValue( Value );
1898 }
1899
getMax()1900 double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException)
1901 {
1902 ::vos::OGuard aGuard( GetMutex() );
1903
1904 FormattedField* pField = GetFormattedField();
1905 return pField ? pField->GetMaxValue() : 0;
1906 }
1907
setFirst(double Value)1908 void SVTXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
1909 {
1910 ::vos::OGuard aGuard( GetMutex() );
1911
1912 FormattedField* pField = GetFormattedField();
1913 if ( pField )
1914 pField->SetSpinFirst( Value );
1915 }
1916
getFirst()1917 double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException)
1918 {
1919 ::vos::OGuard aGuard( GetMutex() );
1920
1921 FormattedField* pField = GetFormattedField();
1922 return pField ? pField->GetSpinFirst() : 0;
1923 }
1924
setLast(double Value)1925 void SVTXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
1926 {
1927 ::vos::OGuard aGuard( GetMutex() );
1928
1929 FormattedField* pField = GetFormattedField();
1930 if ( pField )
1931 pField->SetSpinLast( Value );
1932 }
1933
getLast()1934 double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException)
1935 {
1936 ::vos::OGuard aGuard( GetMutex() );
1937
1938 FormattedField* pField = GetFormattedField();
1939 return pField ? pField->GetSpinLast() : 0;
1940 }
1941
setSpinSize(double Value)1942 void SVTXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
1943 {
1944 ::vos::OGuard aGuard( GetMutex() );
1945
1946 FormattedField* pField = GetFormattedField();
1947 if ( pField )
1948 pField->SetSpinSize( Value );
1949 }
1950
getSpinSize()1951 double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
1952 {
1953 ::vos::OGuard aGuard( GetMutex() );
1954
1955 FormattedField* pField = GetFormattedField();
1956 return pField ? pField->GetSpinSize() : 0;
1957 }
1958
setDecimalDigits(sal_Int16 Value)1959 void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
1960 {
1961 ::vos::OGuard aGuard( GetMutex() );
1962
1963 FormattedField* pField = GetFormattedField();
1964 if ( pField )
1965 pField->SetDecimalDigits( Value );
1966 }
1967
getDecimalDigits()1968 sal_Int16 SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
1969 {
1970 ::vos::OGuard aGuard( GetMutex() );
1971
1972 FormattedField* pField = GetFormattedField();
1973 return pField ? pField->GetDecimalDigits() : 0;
1974 }
1975
setStrictFormat(sal_Bool bStrict)1976 void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
1977 {
1978 ::vos::OGuard aGuard( GetMutex() );
1979
1980 FormattedField* pField = GetFormattedField();
1981 if ( pField )
1982 pField->SetStrictFormat( bStrict );
1983 }
1984
isStrictFormat()1985 sal_Bool SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
1986 {
1987 ::vos::OGuard aGuard( GetMutex() );
1988
1989 FormattedField* pField = GetFormattedField();
1990 return pField ? pField->IsStrictFormat() : sal_False;
1991 }
1992
setProperty(const::rtl::OUString & PropertyName,const::com::sun::star::uno::Any & Value)1993 void SVTXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
1994 {
1995 ::vos::OGuard aGuard( GetMutex() );
1996
1997 ::com::sun::star::uno::Any aReturn;
1998
1999 DoubleCurrencyField* pField = (DoubleCurrencyField*)GetFormattedField();
2000 if ( pField )
2001 {
2002 #ifdef DBG_UTIL
2003 String sAssertion( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "SVTXCurrencyField::setProperty(" ) ) );
2004 sAssertion += String( PropertyName );
2005 sAssertion.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ") : invalid value !" ) );
2006 #endif
2007 sal_uInt16 nPropType = GetPropertyId( PropertyName );
2008 switch (nPropType)
2009 {
2010 case BASEPROPERTY_CURRENCYSYMBOL:
2011 {
2012 ::rtl::OUString aStr;
2013 Value >>= aStr;
2014 pField->setCurrencySymbol( aStr );
2015 }
2016 break;
2017 case BASEPROPERTY_CURSYM_POSITION:
2018 {
2019 sal_Bool b = false;
2020 Value >>= b;
2021 pField->setPrependCurrSym(b);
2022 }
2023 break;
2024
2025 default:
2026 SVTXFormattedField::setProperty(PropertyName, Value);
2027 }
2028 }
2029 else
2030 SVTXFormattedField::setProperty(PropertyName, Value);
2031 }
2032
getProperty(const::rtl::OUString & PropertyName)2033 ::com::sun::star::uno::Any SVTXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
2034 {
2035 ::vos::OGuard aGuard( GetMutex() );
2036
2037 ::com::sun::star::uno::Any aReturn;
2038
2039 DoubleCurrencyField* pField = (DoubleCurrencyField*)GetFormattedField();
2040 if ( pField )
2041 {
2042 sal_uInt16 nPropType = GetPropertyId( PropertyName );
2043 switch (nPropType)
2044 {
2045 case BASEPROPERTY_CURRENCYSYMBOL:
2046 {
2047 aReturn <<= ::rtl::OUString( pField->getCurrencySymbol() );
2048 }
2049 break;
2050 case BASEPROPERTY_CURSYM_POSITION:
2051 {
2052 aReturn <<= pField->getPrependCurrSym();
2053 }
2054 break;
2055 default:
2056 return SVTXFormattedField::getProperty(PropertyName);
2057 }
2058 }
2059 return SVTXFormattedField::getProperty(PropertyName);
2060 }
2061
ImplGetPropertyIds(std::list<sal_uInt16> & rIds)2062 void SVTXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2063 {
2064 PushPropertyIds( rIds,
2065 BASEPROPERTY_CURRENCYSYMBOL,
2066 BASEPROPERTY_CURSYM_POSITION,
2067 0);
2068 SVTXFormattedField::ImplGetPropertyIds( rIds );
2069 }
2070
2071
2072 // ----------------------------------------------------
2073 // class VCLXProgressBar
2074 // ----------------------------------------------------
2075
VCLXProgressBar()2076 VCLXProgressBar::VCLXProgressBar()
2077 :m_nValue(0)
2078 ,m_nValueMin(0)
2079 ,m_nValueMax(100)
2080 {
2081 }
2082
~VCLXProgressBar()2083 VCLXProgressBar::~VCLXProgressBar()
2084 {
2085 }
2086
ImplUpdateValue()2087 void VCLXProgressBar::ImplUpdateValue()
2088 {
2089 ProgressBar* pProgressBar = (ProgressBar*) GetWindow();
2090 if ( pProgressBar )
2091 {
2092 sal_Int32 nVal;
2093 sal_Int32 nValMin;
2094 sal_Int32 nValMax;
2095
2096 // check min and max
2097 if (m_nValueMin < m_nValueMax)
2098 {
2099 nValMin = m_nValueMin;
2100 nValMax = m_nValueMax;
2101 }
2102 else
2103 {
2104 nValMin = m_nValueMax;
2105 nValMax = m_nValueMin;
2106 }
2107
2108 // check value
2109 if (m_nValue < nValMin)
2110 {
2111 nVal = nValMin;
2112 }
2113 else if (m_nValue > nValMax)
2114 {
2115 nVal = nValMax;
2116 }
2117 else
2118 {
2119 nVal = m_nValue;
2120 }
2121
2122 // calculate percent
2123 sal_Int32 nPercent;
2124 if (nValMin != nValMax)
2125 {
2126 nPercent = 100 * (nVal - nValMin) / (nValMax - nValMin);
2127 }
2128 else
2129 {
2130 nPercent = 0;
2131 }
2132
2133 // set progressbar value
2134 pProgressBar->SetValue( (sal_uInt16) nPercent );
2135 }
2136 }
2137
2138 // ::com::sun::star::uno::XInterface
queryInterface(const::com::sun::star::uno::Type & rType)2139 ::com::sun::star::uno::Any VCLXProgressBar::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2140 {
2141 ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2142 SAL_STATIC_CAST( ::com::sun::star::awt::XProgressBar*, this ),
2143 SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
2144 return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
2145 }
2146
2147 // ::com::sun::star::lang::XTypeProvider
2148 IMPL_XTYPEPROVIDER_START( VCLXProgressBar )
2149 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XProgressBar>* ) NULL ),
2150 VCLXWindow::getTypes()
2151 IMPL_XTYPEPROVIDER_END
2152
2153 // ::com::sun::star::awt::XProgressBar
2154 void VCLXProgressBar::setForegroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
2155 {
2156 ::vos::OGuard aGuard( GetMutex() );
2157
2158 Window* pWindow = GetWindow();
2159 if ( pWindow )
2160 {
2161 Color aColor( nColor );
2162 pWindow->SetControlForeground( aColor );
2163 }
2164 }
2165
setBackgroundColor(sal_Int32 nColor)2166 void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
2167 {
2168 ::vos::OGuard aGuard( GetMutex() );
2169
2170 Window* pWindow = GetWindow();
2171 if ( pWindow )
2172 {
2173 Color aColor( nColor );
2174 pWindow->SetBackground( aColor );
2175 pWindow->SetControlBackground( aColor );
2176 pWindow->Invalidate();
2177 }
2178 }
2179
setValue(sal_Int32 nValue)2180 void VCLXProgressBar::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException)
2181 {
2182 ::vos::OGuard aGuard( GetMutex() );
2183
2184 m_nValue = nValue;
2185 ImplUpdateValue();
2186 }
2187
setRange(sal_Int32 nMin,sal_Int32 nMax)2188 void VCLXProgressBar::setRange( sal_Int32 nMin, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException )
2189 {
2190 ::vos::OGuard aGuard( GetMutex() );
2191
2192 if ( nMin < nMax )
2193 {
2194 // take correct min and max
2195 m_nValueMin = nMin;
2196 m_nValueMax = nMax;
2197 }
2198 else
2199 {
2200 // change min and max
2201 m_nValueMin = nMax;
2202 m_nValueMax = nMin;
2203 }
2204
2205 ImplUpdateValue();
2206 }
2207
getValue()2208 sal_Int32 VCLXProgressBar::getValue() throw(::com::sun::star::uno::RuntimeException)
2209 {
2210 ::vos::OGuard aGuard( GetMutex() );
2211
2212 return m_nValue;
2213 }
2214
2215 // ::com::sun::star::awt::VclWindowPeer
setProperty(const::rtl::OUString & PropertyName,const::com::sun::star::uno::Any & Value)2216 void VCLXProgressBar::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
2217 {
2218 ::vos::OGuard aGuard( GetMutex() );
2219
2220 ProgressBar* pProgressBar = (ProgressBar*)GetWindow();
2221 if ( pProgressBar )
2222 {
2223 sal_uInt16 nPropType = GetPropertyId( PropertyName );
2224 switch ( nPropType )
2225 {
2226 case BASEPROPERTY_PROGRESSVALUE:
2227 {
2228 if ( Value >>= m_nValue )
2229 ImplUpdateValue();
2230 }
2231 break;
2232 case BASEPROPERTY_PROGRESSVALUE_MIN:
2233 {
2234 if ( Value >>= m_nValueMin )
2235 ImplUpdateValue();
2236 }
2237 break;
2238 case BASEPROPERTY_PROGRESSVALUE_MAX:
2239 {
2240 if ( Value >>= m_nValueMax )
2241 ImplUpdateValue();
2242 }
2243 break;
2244 case BASEPROPERTY_FILLCOLOR:
2245 {
2246 Window* pWindow = GetWindow();
2247 if ( pWindow )
2248 {
2249 sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
2250
2251 if ( bVoid )
2252 {
2253 pWindow->SetControlForeground();
2254 }
2255 else
2256 {
2257 sal_Int32 nColor = 0;
2258 if ( Value >>= nColor )
2259 {
2260 Color aColor( nColor );
2261 pWindow->SetControlForeground( aColor );
2262 }
2263 }
2264 }
2265 }
2266 break;
2267 default:
2268 VCLXWindow::setProperty( PropertyName, Value );
2269 break;
2270 }
2271 }
2272 }
2273
getProperty(const::rtl::OUString & PropertyName)2274 ::com::sun::star::uno::Any VCLXProgressBar::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
2275 {
2276 ::vos::OGuard aGuard( GetMutex() );
2277
2278 ::com::sun::star::uno::Any aProp;
2279 ProgressBar* pProgressBar = (ProgressBar*)GetWindow();
2280 if ( pProgressBar )
2281 {
2282 sal_uInt16 nPropType = GetPropertyId( PropertyName );
2283 switch ( nPropType )
2284 {
2285 case BASEPROPERTY_PROGRESSVALUE:
2286 {
2287 aProp <<= m_nValue;
2288 }
2289 break;
2290 case BASEPROPERTY_PROGRESSVALUE_MIN:
2291 {
2292 aProp <<= m_nValueMin;
2293 }
2294 break;
2295 case BASEPROPERTY_PROGRESSVALUE_MAX:
2296 {
2297 aProp <<= m_nValueMax;
2298 }
2299 break;
2300 default:
2301 aProp <<= VCLXWindow::getProperty( PropertyName );
2302 break;
2303 }
2304 }
2305 return aProp;
2306 }
2307
ImplGetPropertyIds(std::list<sal_uInt16> & rIds)2308 void VCLXProgressBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2309 {
2310 PushPropertyIds( rIds,
2311 BASEPROPERTY_PROGRESSVALUE,
2312 BASEPROPERTY_PROGRESSVALUE_MIN,
2313 BASEPROPERTY_PROGRESSVALUE_MAX,
2314 BASEPROPERTY_FILLCOLOR,
2315 0);
2316 VCLXWindow::ImplGetPropertyIds( rIds, true );
2317 }
2318
2319
2320 // ----------------------------------------------------
2321 // class SVTXDateField
2322 // ----------------------------------------------------
SVTXDateField()2323 SVTXDateField::SVTXDateField()
2324 :VCLXDateField()
2325 {
2326 }
2327
~SVTXDateField()2328 SVTXDateField::~SVTXDateField()
2329 {
2330 }
2331
setProperty(const::rtl::OUString & PropertyName,const::com::sun::star::uno::Any & Value)2332 void SAL_CALL SVTXDateField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException)
2333 {
2334 VCLXDateField::setProperty( PropertyName, Value );
2335
2336 // some properties need to be forwarded to the sub edit, too
2337 Edit* pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow() )->GetSubEdit() : NULL;
2338 if ( !pSubEdit )
2339 return;
2340
2341 switch ( GetPropertyId( PropertyName ) )
2342 {
2343 case BASEPROPERTY_TEXTLINECOLOR:
2344 if ( !Value.hasValue() )
2345 pSubEdit->SetTextLineColor();
2346 else
2347 {
2348 sal_Int32 nColor = 0;
2349 if ( Value >>= nColor )
2350 pSubEdit->SetTextLineColor( Color( nColor ) );
2351 }
2352 break;
2353 }
2354 }
2355
ImplGetPropertyIds(std::list<sal_uInt16> & rIds)2356 void SVTXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2357 {
2358 PushPropertyIds( rIds,
2359 BASEPROPERTY_TEXTLINECOLOR,
2360 0);
2361 VCLXDateField::ImplGetPropertyIds( rIds );
2362 }
2363