xref: /aoo41x/main/svtools/source/contnr/ivctrl.cxx (revision 2bfcd321)
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 #include <svtools/ivctrl.hxx>
28 #include "imivctl.hxx"
29 #include <vcl/bitmapex.hxx>
30 #include <vcl/controllayout.hxx>
31 #include <vcl/mnemonic.hxx>
32 using namespace ::com::sun::star::accessibility;
33 
34 /*****************************************************************************
35 |
36 | class : SvxIconChoiceCtrlEntry
37 |
38 \*****************************************************************************/
39 
SvxIconChoiceCtrlEntry(const String & rText,const Image & rImage,sal_uInt16 _nFlags)40 SvxIconChoiceCtrlEntry::SvxIconChoiceCtrlEntry( const String& rText, const Image& rImage, sal_uInt16 _nFlags )
41 {
42 	aText = rText;
43 	aImage = rImage;
44 	aImageHC = rImage;
45 	pUserData = NULL;
46 
47 	nFlags = _nFlags;
48 	eTextMode = IcnShowTextShort;
49 	pblink = 0;
50 	pflink = 0;
51 }
52 
SvxIconChoiceCtrlEntry(const String & rText,const Image & rImage,const Image & rImageHC,sal_uInt16 _nFlags)53 SvxIconChoiceCtrlEntry::SvxIconChoiceCtrlEntry( const String& rText, const Image& rImage, const Image& rImageHC, sal_uInt16 _nFlags )
54 {
55 	aText = rText;
56 	aImage = rImage;
57 	aImageHC = rImageHC;
58 	pUserData = NULL;
59 
60 	nFlags = _nFlags;
61 	eTextMode = IcnShowTextShort;
62 	pblink = 0;
63 	pflink = 0;
64 }
65 
SvxIconChoiceCtrlEntry(sal_uInt16 _nFlags)66 SvxIconChoiceCtrlEntry::SvxIconChoiceCtrlEntry( sal_uInt16 _nFlags )
67 {
68 	pUserData = NULL;
69 
70 	nFlags = _nFlags;
71 	eTextMode = IcnShowTextShort;
72 	pblink = 0;
73 	pflink = 0;
74 }
75 
SetMoved(sal_Bool bMoved)76 void SvxIconChoiceCtrlEntry::SetMoved( sal_Bool bMoved )
77 {
78 	if( bMoved )
79 		nFlags |= ICNVIEW_FLAG_POS_MOVED;
80 	else
81 		nFlags &= ~ICNVIEW_FLAG_POS_MOVED;
82 }
83 
LockPos(sal_Bool bLock)84 void SvxIconChoiceCtrlEntry::LockPos( sal_Bool bLock )
85 {
86 	if( bLock )
87 		nFlags |= ICNVIEW_FLAG_POS_LOCKED;
88 	else
89 		nFlags &= ~ICNVIEW_FLAG_POS_LOCKED;
90 }
91 
92 /*sal_Unicode SvxIconChoiceCtrlEntry::GetMnemonicChar() const
93 {
94 	sal_Unicode cChar = 0;
95 	xub_StrLen nPos = aText.Search( '~' );
96 	if ( nPos != STRING_NOTFOUND && nPos < ( aText.Len() ) - 1 )
97 		cChar = aText.GetChar( nPos + 1 );
98 	return cChar;
99 }*/
100 
GetDisplayText() const101 String SvxIconChoiceCtrlEntry::GetDisplayText() const
102 {
103 	return MnemonicGenerator::EraseAllMnemonicChars( aText );
104 }
105 
106 // ----------------------------------------------------------------------------
107 
SvxIconChoiceCtrlColumnInfo(const SvxIconChoiceCtrlColumnInfo & rInfo)108 SvxIconChoiceCtrlColumnInfo::SvxIconChoiceCtrlColumnInfo( const SvxIconChoiceCtrlColumnInfo& rInfo )
109 	: aColText( rInfo.aColText ), aColImage( rInfo.aColImage )
110 {
111 	nWidth = rInfo.nWidth;
112 	eAlignment = rInfo.eAlignment;
113 	nSubItem = rInfo.nSubItem;
114 }
115 
116 /*****************************************************************************
117 |
118 | class : SvtIconChoiceCtrl
119 |
120 \*****************************************************************************/
121 
SvtIconChoiceCtrl(Window * pParent,WinBits nWinStyle)122 SvtIconChoiceCtrl::SvtIconChoiceCtrl( Window* pParent, WinBits nWinStyle ) :
123 
124 	 // WB_CLIPCHILDREN an, da ScrollBars auf dem Fenster liegen!
125 	Control( pParent, nWinStyle | WB_CLIPCHILDREN ),
126 
127 	_pCurKeyEvent	( NULL ),
128 	_pImp			( new SvxIconChoiceCtrl_Impl( this, nWinStyle ) ),
129 	_bAutoFontColor	( sal_False )
130 
131 {
132 	SetLineColor();
133 	_pImp->SetGrid( Size( 100, 70 ) );
134 	_pImp->InitSettings();
135 	_pImp->SetPositionMode( IcnViewPositionModeAutoArrange );
136 }
137 
SvtIconChoiceCtrl(Window * pParent,const ResId & rResId)138 SvtIconChoiceCtrl::SvtIconChoiceCtrl( Window* pParent, const ResId& rResId ) :
139 
140 	Control( pParent, rResId ),
141 
142 	_pCurKeyEvent	( NULL ),
143 	_pImp			( new SvxIconChoiceCtrl_Impl( this, WB_BORDER ) ),
144 	_bAutoFontColor	( sal_False )
145 
146 {
147 	SetLineColor();
148 	_pImp->SetGrid( Size( 100, 70 ) );
149 	_pImp->InitSettings();
150 	_pImp->SetPositionMode( IcnViewPositionModeAutoArrange );
151 }
152 
~SvtIconChoiceCtrl()153 SvtIconChoiceCtrl::~SvtIconChoiceCtrl()
154 {
155 	_pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
156 	delete _pImp;
157 }
158 
InsertEntry(sal_uLong nPos,const Point * pPos,sal_uInt16 nFlags)159 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( sal_uLong nPos, const Point* pPos, sal_uInt16 nFlags  )
160 {
161 	SvxIconChoiceCtrlEntry* pEntry = new SvxIconChoiceCtrlEntry( nFlags );
162 	_pImp->InsertEntry( pEntry, nPos, pPos );
163 	return pEntry;
164 }
165 
InsertEntry(const String & rText,const Image & rImage,sal_uLong nPos,const Point * pPos,sal_uInt16 nFlags)166 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const String& rText, const Image& rImage, sal_uLong nPos, const Point* pPos, sal_uInt16 nFlags  )
167 {
168 	SvxIconChoiceCtrlEntry* pEntry = new SvxIconChoiceCtrlEntry( rText, rImage, nFlags);
169 
170 	_pImp->InsertEntry( pEntry, nPos, pPos );
171 
172 	return pEntry;
173 }
174 
InsertEntry(const String & rText,const Image & rImage,const Image & rImageHC,sal_uLong nPos,const Point * pPos,sal_uInt16 nFlags)175 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const String& rText, const Image& rImage, const Image& rImageHC, sal_uLong nPos, const Point* pPos, sal_uInt16 nFlags  )
176 {
177 	SvxIconChoiceCtrlEntry* pEntry = new SvxIconChoiceCtrlEntry( rText, rImage, rImageHC, nFlags);
178 
179 	_pImp->InsertEntry( pEntry, nPos, pPos );
180 
181 	return pEntry;
182 }
183 
EditedEntry(SvxIconChoiceCtrlEntry *,const XubString &,sal_Bool)184 sal_Bool SvtIconChoiceCtrl::EditedEntry( SvxIconChoiceCtrlEntry*, const XubString&, sal_Bool )
185 {
186 	return sal_True;
187 }
EditingEntry(SvxIconChoiceCtrlEntry *)188 sal_Bool SvtIconChoiceCtrl::EditingEntry( SvxIconChoiceCtrlEntry* )
189 {
190 	return sal_True;
191 }
DrawEntryImage(SvxIconChoiceCtrlEntry * pEntry,const Point & rPos,OutputDevice & rDev)192 void SvtIconChoiceCtrl::DrawEntryImage( SvxIconChoiceCtrlEntry* pEntry, const Point& rPos, OutputDevice& rDev )
193 {
194 	rDev.DrawImage( rPos, GetSettings().GetStyleSettings().GetHighContrastMode() ? pEntry->GetImageHC() : pEntry->GetImage() );
195 }
GetEntryText(SvxIconChoiceCtrlEntry * pEntry,sal_Bool)196 String SvtIconChoiceCtrl::GetEntryText( SvxIconChoiceCtrlEntry* pEntry, sal_Bool )
197 {
198 	return pEntry->GetText();
199 }
HasBackground() const200 sal_Bool SvtIconChoiceCtrl::HasBackground() const
201 {
202 	return sal_False;
203 }
HasFont() const204 sal_Bool SvtIconChoiceCtrl::HasFont() const
205 {
206 	return sal_False;
207 }
HasFontTextColor() const208 sal_Bool SvtIconChoiceCtrl::HasFontTextColor() const
209 {
210 	return sal_True;
211 }
HasFontFillColor() const212 sal_Bool SvtIconChoiceCtrl::HasFontFillColor() const
213 {
214 	return sal_True;
215 }
216 
Paint(const Rectangle & rRect)217 void SvtIconChoiceCtrl::Paint( const Rectangle& rRect )
218 {
219 	_pImp->Paint( rRect );
220 }
221 
MouseButtonDown(const MouseEvent & rMEvt)222 void SvtIconChoiceCtrl::MouseButtonDown( const MouseEvent& rMEvt )
223 {
224 	if( !_pImp->MouseButtonDown( rMEvt ) )
225 		Control::MouseButtonDown( rMEvt );
226 }
227 
MouseButtonUp(const MouseEvent & rMEvt)228 void SvtIconChoiceCtrl::MouseButtonUp( const MouseEvent& rMEvt )
229 {
230 	if( !_pImp->MouseButtonUp( rMEvt ) )
231 		Control::MouseButtonUp( rMEvt );
232 }
233 
MouseMove(const MouseEvent & rMEvt)234 void SvtIconChoiceCtrl::MouseMove( const MouseEvent& rMEvt )
235 {
236 	if( !_pImp->MouseMove( rMEvt ) )
237 		Control::MouseMove( rMEvt );
238 }
ArrangeIcons()239 void SvtIconChoiceCtrl::ArrangeIcons()
240 {
241 	if ( GetStyle() & WB_ALIGN_TOP )
242 	{
243 		Size aFullSize;
244 		Rectangle aEntryRect;
245 
246 		for ( sal_uLong i = 0; i < GetEntryCount(); i++ )
247 		{
248 			SvxIconChoiceCtrlEntry* pEntry = GetEntry ( i );
249 			aEntryRect = _pImp->GetEntryBoundRect ( pEntry );
250 
251 			aFullSize.setWidth ( aFullSize.getWidth()+aEntryRect.GetWidth() );
252 		}
253 
254 		_pImp->Arrange ( sal_False, aFullSize.getWidth() );
255 	}
256 	else if ( GetStyle() & WB_ALIGN_LEFT )
257 	{
258 		Size aFullSize;
259 		Rectangle aEntryRect;
260 
261 		for ( sal_uLong i = 0; i < GetEntryCount(); i++ )
262 		{
263 			SvxIconChoiceCtrlEntry* pEntry = GetEntry ( i );
264 			aEntryRect = _pImp->GetEntryBoundRect ( pEntry );
265 
266 			aFullSize.setHeight ( aFullSize.getHeight()+aEntryRect.GetHeight() );
267 		}
268 
269 		_pImp->Arrange ( sal_False, 0, aFullSize.getHeight() );
270 	}
271 	else
272 	{
273 		_pImp->Arrange();
274 	}
275 	_pImp->Arrange( sal_False, 0, 1000 );
276 }
Resize()277 void SvtIconChoiceCtrl::Resize()
278 {
279 	_pImp->Resize();
280 	Control::Resize();
281 }
282 
GetLogicPos(const Point & rPosPixel) const283 Point SvtIconChoiceCtrl::GetLogicPos( const Point& rPosPixel ) const
284 {
285 	Point aPos( rPosPixel );
286 	aPos -= GetMapMode().GetOrigin();
287 	return aPos;
288 }
289 
GetPixelPos(const Point & rPosLogic) const290 Point SvtIconChoiceCtrl::GetPixelPos( const Point& rPosLogic ) const
291 {
292 	Point aPos( rPosLogic );
293 	aPos += GetMapMode().GetOrigin();
294 	return aPos;
295 }
296 
DocumentRectChanged()297 void SvtIconChoiceCtrl::DocumentRectChanged()
298 {
299 	_aDocRectChangedHdl.Call( this );
300 }
301 
VisibleRectChanged()302 void SvtIconChoiceCtrl::VisibleRectChanged()
303 {
304 	_aVisRectChangedHdl.Call( this );
305 }
306 
GetFocus()307 void SvtIconChoiceCtrl::GetFocus()
308 {
309 	_pImp->GetFocus();
310 	Control::GetFocus();
311 	sal_uLong nPos;
312 	SvxIconChoiceCtrlEntry* pSelectedEntry = GetSelectedEntry ( nPos );
313 	if ( pSelectedEntry )
314 		_pImp->CallEventListeners( VCLEVENT_LISTBOX_SELECT, pSelectedEntry );
315 }
316 
LoseFocus()317 void SvtIconChoiceCtrl::LoseFocus()
318 {
319 	_pImp->LoseFocus();
320 	Control::LoseFocus();
321 }
322 
SetUpdateMode(sal_Bool bUpdate)323 void SvtIconChoiceCtrl::SetUpdateMode( sal_Bool bUpdate )
324 {
325 	Control::SetUpdateMode( bUpdate );
326 	_pImp->SetUpdateMode( bUpdate );
327 }
SetFont(const Font & rFont)328 void SvtIconChoiceCtrl::SetFont( const Font& rFont )
329 {
330 	if( rFont != GetFont() )
331 	{
332 		Control::SetFont( rFont );
333 		_pImp->FontModified();
334 	}
335 }
336 
SetPointFont(const Font & rFont)337 void SvtIconChoiceCtrl::SetPointFont( const Font& rFont )
338 {
339 	if( rFont != GetPointFont() )
340 	{
341 		Control::SetPointFont( rFont );
342 		_pImp->FontModified();
343 	}
344 }
GetEntry(const Point & rPixPos,sal_Bool bHit) const345 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( const Point& rPixPos, sal_Bool bHit ) const
346 {
347 	Point aPos( rPixPos );
348 	aPos -= GetMapMode().GetOrigin();
349 	return ((SvtIconChoiceCtrl*)this)->_pImp->GetEntry( aPos, bHit );
350 }
351 
SetStyle(WinBits nWinStyle)352 void SvtIconChoiceCtrl::SetStyle( WinBits nWinStyle )
353 {
354 	_pImp->SetStyle( nWinStyle );
355 }
356 
GetStyle() const357 WinBits SvtIconChoiceCtrl::GetStyle() const
358 {
359 	return _pImp->GetStyle();
360 }
Command(const CommandEvent & rCEvt)361 void SvtIconChoiceCtrl::Command( const CommandEvent& rCEvt )
362 {
363 	_pImp->Command( rCEvt );
364 }
365 
SetEntryTextMode(SvxIconChoiceCtrlTextMode eMode,SvxIconChoiceCtrlEntry * pEntry)366 void SvtIconChoiceCtrl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry )
367 {
368 	_pImp->SetEntryTextMode( eMode, pEntry );
369 }
370 
GetEntryTextMode(const SvxIconChoiceCtrlEntry * pEntry) const371 SvxIconChoiceCtrlTextMode SvtIconChoiceCtrl::GetEntryTextMode( const SvxIconChoiceCtrlEntry* pEntry ) const
372 {
373 	return _pImp->GetEntryTextModeSmart( pEntry );
374 }
375 
GetNextEntry(const Point & rPixPos,SvxIconChoiceCtrlEntry * pCurEntry,sal_Bool) const376 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetNextEntry( const Point& rPixPos, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool  ) const
377 {
378 	Point aPos( rPixPos );
379 	aPos -= GetMapMode().GetOrigin();
380 	return ((SvtIconChoiceCtrl*)this)->_pImp->GetNextEntry( aPos, pCurEntry );
381 }
382 
GetPrevEntry(const Point & rPixPos,SvxIconChoiceCtrlEntry * pCurEntry,sal_Bool) const383 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetPrevEntry( const Point& rPixPos, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool  ) const
384 {
385 	Point aPos( rPixPos );
386 	aPos -= GetMapMode().GetOrigin();
387 	return ((SvtIconChoiceCtrl*)this)->_pImp->GetPrevEntry( aPos, pCurEntry );
388 }
GetEntryCount() const389 sal_uLong SvtIconChoiceCtrl::GetEntryCount() const
390 {
391 	return _pImp->GetEntryCount();
392 }
393 
GetEntry(sal_uLong nPos) const394 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( sal_uLong nPos ) const
395 {
396 	return _pImp->GetEntry( nPos );
397 }
398 
CreateAutoMnemonics(MnemonicGenerator & _rUsedMnemonics)399 void SvtIconChoiceCtrl::CreateAutoMnemonics( MnemonicGenerator& _rUsedMnemonics )
400 {
401 	_pImp->CreateAutoMnemonics( &_rUsedMnemonics );
402 }
403 
CreateAutoMnemonics(void)404 void SvtIconChoiceCtrl::CreateAutoMnemonics( void )
405 {
406 	_pImp->CreateAutoMnemonics();
407 }
408 
RemoveEntry(SvxIconChoiceCtrlEntry * pEntry)409 void SvtIconChoiceCtrl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry )
410 {
411 	_pImp->RemoveEntry( pEntry );
412 }
413 
GetSelectedEntry(sal_uLong & rPos) const414 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetSelectedEntry( sal_uLong& rPos ) const
415 {
416 	return _pImp->GetFirstSelectedEntry( rPos );
417 }
418 
ClickIcon()419 void SvtIconChoiceCtrl::ClickIcon()
420 {
421 	sal_uLong nPos;
422 	GetSelectedEntry ( nPos );
423 	_aClickIconHdl.Call( this );
424 }
IsEntryEditing() const425 sal_Bool SvtIconChoiceCtrl::IsEntryEditing() const
426 {
427 	return _pImp->IsEntryEditing();
428 }
429 
SetChoiceWithCursor(sal_Bool bDo)430 sal_Bool SvtIconChoiceCtrl::SetChoiceWithCursor ( sal_Bool bDo )
431 {
432 	return _pImp->SetChoiceWithCursor (bDo);
433 }
434 
KeyInput(const KeyEvent & rKEvt)435 void SvtIconChoiceCtrl::KeyInput( const KeyEvent& rKEvt )
436 {
437 	sal_Bool bKeyUsed = DoKeyInput( rKEvt );
438 	if ( !bKeyUsed )
439 	{
440 		_pCurKeyEvent = (KeyEvent*)&rKEvt;
441 		Control::KeyInput( rKEvt );
442 		_pCurKeyEvent = NULL;
443 	}
444 }
DoKeyInput(const KeyEvent & rKEvt)445 sal_Bool SvtIconChoiceCtrl::DoKeyInput( const KeyEvent& rKEvt )
446 {
447 	// unter OS/2 bekommen wir auch beim Editieren Key-Up/Down
448 	if( IsEntryEditing() )
449 		return sal_True;
450 	_pCurKeyEvent = (KeyEvent*)&rKEvt;
451 	sal_Bool bHandled = _pImp->KeyInput( rKEvt );
452 	_pCurKeyEvent = NULL;
453 	return bHandled;
454 }
GetEntryListPos(SvxIconChoiceCtrlEntry * pEntry) const455 sal_uLong SvtIconChoiceCtrl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const
456 {
457 	return _pImp->GetEntryListPos( pEntry );
458 }
GetCursor() const459 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetCursor( ) const
460 {
461 	return _pImp->GetCurEntry( );
462 }
SetCursor(SvxIconChoiceCtrlEntry * pEntry)463 void SvtIconChoiceCtrl::SetCursor( SvxIconChoiceCtrlEntry* pEntry )
464 {
465 	_pImp->SetCursor( pEntry );
466 }
InvalidateEntry(SvxIconChoiceCtrlEntry * pEntry)467 void SvtIconChoiceCtrl::InvalidateEntry( SvxIconChoiceCtrlEntry* pEntry )
468 {
469 	_pImp->InvalidateEntry( pEntry );
470 }
Clear()471 void SvtIconChoiceCtrl::Clear()
472 {
473 	_pImp->Clear();
474 }
StateChanged(StateChangedType nType)475 void SvtIconChoiceCtrl::StateChanged( StateChangedType nType )
476 {
477 	Control::StateChanged( nType );
478 }
479 
480 
DataChanged(const DataChangedEvent & rDCEvt)481 void SvtIconChoiceCtrl::DataChanged( const DataChangedEvent& rDCEvt )
482 {
483 	if ( ((rDCEvt.GetType() == DATACHANGED_SETTINGS) ||
484 		 (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
485 		 (rDCEvt.GetType() == DATACHANGED_FONTS) ) &&
486 		 (rDCEvt.GetFlags() & SETTINGS_STYLE) )
487 	{
488 		_pImp->InitSettings();
489 		Invalidate(INVALIDATE_NOCHILDREN);
490 	}
491 	else
492 		Control::DataChanged( rDCEvt );
493 }
494 
SetBackground(const Wallpaper & rPaper)495 void SvtIconChoiceCtrl::SetBackground( const Wallpaper& rPaper )
496 {
497 	if( rPaper != GetBackground() )
498 	{
499 		const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
500 		Wallpaper aEmpty;
501 		if( rPaper == aEmpty )
502 			Control::SetBackground( rStyleSettings.GetFieldColor() );
503 		else
504 		{
505 			Wallpaper aBackground( rPaper );
506 			// HACK, da Hintergrund sonst transparent sein koennte
507 			if( !aBackground.IsBitmap() )
508 				aBackground.SetStyle( WALLPAPER_TILE );
509 
510 			WallpaperStyle eStyle = aBackground.GetStyle();
511 			Color aBack( aBackground.GetColor());
512 			Color aTrans( COL_TRANSPARENT );
513 			if( aBack == aTrans  && (
514 				(!aBackground.IsBitmap() ||
515 					aBackground.GetBitmap().IsTransparent() ||
516 					(eStyle != WALLPAPER_TILE && eStyle != WALLPAPER_SCALE))))
517 			{
518 				aBackground.SetColor( rStyleSettings.GetFieldColor() );
519 			}
520 			if( aBackground.IsScrollable() )
521 			{
522 				Rectangle aRect;
523 				aRect.SetSize( Size(32765, 32765) );
524 				aBackground.SetRect( aRect );
525 			}
526 			else
527 			{
528 				Rectangle aRect( _pImp->GetOutputRect() );
529 				aBackground.SetRect( aRect );
530 			}
531 			Control::SetBackground( aBackground );
532 		}
533 
534 		// bei hart attributierter Textfarbe keine 'Automatik', die eine
535 		// lesbare Textfarbe einstellt.
536 		Font aFont( GetFont() );
537 		aFont.SetColor( rStyleSettings.GetFieldTextColor() );
538 		SetFont( aFont );
539 
540 		Invalidate(INVALIDATE_NOCHILDREN);
541 	}
542 }
543 
Flush()544 void SvtIconChoiceCtrl::Flush()
545 {
546 	_pImp->Flush();
547 }
548 
RequestHelp(const HelpEvent & rHEvt)549 void SvtIconChoiceCtrl::RequestHelp( const HelpEvent& rHEvt )
550 {
551 	if ( !_pImp->RequestHelp( rHEvt ) )
552 		Control::RequestHelp( rHEvt );
553 }
554 
SetSelectionMode(SelectionMode eMode)555 void SvtIconChoiceCtrl::SetSelectionMode( SelectionMode eMode )
556 {
557 	_pImp->SetSelectionMode( eMode );
558 }
559 
HandleShortCutKey(const KeyEvent & r)560 sal_Bool SvtIconChoiceCtrl::HandleShortCutKey( const KeyEvent& r )
561 {
562 	return _pImp->HandleShortCutKey( r );
563 }
564 
GetBoundingBox(SvxIconChoiceCtrlEntry * pEntry) const565 Rectangle SvtIconChoiceCtrl::GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const
566 {
567 	return _pImp->GetEntryBoundRect( pEntry );
568 }
569 
FillLayoutData() const570 void SvtIconChoiceCtrl::FillLayoutData() const
571 {
572     CreateLayoutData();
573 
574 	SvtIconChoiceCtrl* pNonConstMe = const_cast< SvtIconChoiceCtrl* >( this );
575 
576 	// loop through all entries
577 	sal_uInt16 nCount = (sal_uInt16)GetEntryCount();
578 	sal_uInt16 nPos = 0;
579 	while ( nPos < nCount )
580 	{
581 		SvxIconChoiceCtrlEntry* pEntry = GetEntry( nPos );
582 
583 		Point aPos = _pImp->GetEntryBoundRect( pEntry ).TopLeft();
584 		String sEntryText = pEntry->GetDisplayText( );
585 		Rectangle aTextRect = _pImp->CalcTextRect( pEntry, &aPos, sal_False, &sEntryText );
586 
587 		sal_Bool bLargeIconMode = WB_ICON == ( _pImp->GetStyle() & ( VIEWMODE_MASK ) );
588 		sal_uInt16 nTextPaintFlags = bLargeIconMode ? PAINTFLAG_HOR_CENTERED : PAINTFLAG_VER_CENTERED;
589 
590 		_pImp->PaintItem( aTextRect, IcnViewFieldTypeText, pEntry, nTextPaintFlags, pNonConstMe, &sEntryText, GetLayoutData() );
591 
592 		++nPos;
593 	}
594 }
595 
GetEntryCharacterBounds(const sal_Int32 _nEntryPos,const sal_Int32 _nCharacterIndex) const596 Rectangle SvtIconChoiceCtrl::GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const
597 {
598 	Rectangle aRect;
599 
600 	Pair aEntryCharacterRange = GetLineStartEnd( _nEntryPos );
601 	if ( aEntryCharacterRange.A() + _nCharacterIndex < aEntryCharacterRange.B() )
602 	{
603 		aRect = GetCharacterBounds( aEntryCharacterRange.A() + _nCharacterIndex );
604 	}
605 
606 	return aRect;
607 }
608 
SetNoSelection()609 void SvtIconChoiceCtrl::SetNoSelection()
610 {
611 	_pImp->SetNoSelection();
612 }
613 
CallImplEventListeners(sal_uLong nEvent,void * pData)614 void SvtIconChoiceCtrl::CallImplEventListeners(sal_uLong nEvent, void* pData)
615 {
616 	CallEventListeners(nEvent, pData);
617 }
CreateAccessible()618 ::com::sun::star::uno::Reference< XAccessible > SvtIconChoiceCtrl::CreateAccessible()
619 {
620     Window* pParent = GetAccessibleParentWindow();
621     DBG_ASSERT( pParent, "SvTreeListBox::CreateAccessible - accessible parent not found" );
622 
623     ::com::sun::star::uno::Reference< XAccessible > xAccessible;
624     if ( pParent )
625     {
626         ::com::sun::star::uno::Reference< XAccessible > xAccParent = pParent->GetAccessible();
627         if ( xAccParent.is() )
628 		{
629 			::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xTemp(GetComponentInterface());
630             xAccessible = _pImp->GetAccessibleFactory().createAccessibleIconChoiceCtrl( *this, xAccParent );
631 		}
632 	}
633     return xAccessible;
634 }
635 
636