merge the formfield patch from ooo-build
[ooovba.git] / svtools / source / contnr / imivctl.hxx
blob3266a18c3b426f691d82ab3135e286d3231a05db
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: imivctl.hxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _IMPICNVW_HXX
32 #define _IMPICNVW_HXX
34 #ifndef _VIRDEV_HXX
35 #include <vcl/virdev.hxx>
36 #endif
37 #ifndef _SCRBAR_HXX
38 #include <vcl/scrbar.hxx>
39 #endif
40 #include <vcl/timer.hxx>
41 #include <vcl/seleng.hxx>
42 #include <tools/debug.hxx>
43 #include "svtaccessiblefactory.hxx"
45 #include <limits.h>
47 #include "ivctrl.hxx"
48 #include <svtools/svarray.hxx>
50 class IcnCursor_Impl;
51 class SvtIconChoiceCtrl;
52 class SvxIconChoiceCtrlEntry;
53 class IcnViewEdit_Impl;
54 class IcnGridMap_Impl;
56 ///////////////////////////////////////////////////////////////////////////////
58 // some defines
60 #define PAINTFLAG_HOR_CENTERED 0x0001
61 #define PAINTFLAG_VER_CENTERED 0x0002
63 #define F_VER_SBARSIZE_WITH_HBAR 0x0001
64 #define F_HOR_SBARSIZE_WITH_VBAR 0x0002
65 #define F_PAINTED 0x0004 // TRUE nach erstem Paint
66 #define F_ADD_MODE 0x0008
67 #define F_SELECTING_RECT 0x0020
68 #define F_DOWN_CTRL 0x0080
69 #define F_DOWN_DESELECT 0x0100
70 #define F_START_EDITTIMER_IN_MOUSEUP 0x0400
71 #define F_MOVED_ENTRIES 0x0800
72 #define F_ENTRYLISTPOS_VALID 0x1000
73 #define F_CLEARING_SELECTION 0x2000
74 #define F_ARRANGING 0x4000
76 // alle Angaben in Pixel
77 // Abstaende von Fensterraendern
78 #define LROFFS_WINBORDER 4
79 #define TBOFFS_WINBORDER 4
80 // fuer das Bounding-Rectangle
81 #define LROFFS_BOUND 2
82 #define TBOFFS_BOUND 2
83 // Abstand Fokusrechteck - Icon
84 #define LROFFS_ICON 2
85 #define TBOFFS_ICON 2
86 // Abstaende Icon - Text
87 #define HOR_DIST_BMP_STRING 3
88 #define VER_DIST_BMP_STRING 3
89 // Breitenoffset Highlight-Rect bei Text
90 #define LROFFS_TEXT 2
92 #define DEFAULT_MAX_VIRT_WIDTH 200
93 #define DEFAULT_MAX_VIRT_HEIGHT 200
95 #define VIEWMODE_MASK (WB_ICON | WB_SMALLICON | WB_DETAILS)
97 ///////////////////////////////////////////////////////////////////////////////
101 enum IcnViewFieldType
103 IcnViewFieldTypeDontknow = 0,
104 IcnViewFieldTypeImage = 1,
105 IcnViewFieldTypeText = 2
108 ///////////////////////////////////////////////////////////////////////////////
110 // Data about the focus of entries
112 struct LocalFocus
114 BOOL bOn;
115 Rectangle aRect;
116 Color aPenColor;
118 LocalFocus() { bOn = FALSE; }
121 ///////////////////////////////////////////////////////////////////////////////
123 // Entry-List
125 class EntryList_Impl : public List
127 private:
129 using List::Replace;
131 SvxIconChoiceCtrl_Impl* _pOwner;
133 void Removed_Impl( SvxIconChoiceCtrlEntry* pEntry );
135 public:
136 EntryList_Impl(
137 SvxIconChoiceCtrl_Impl*,
138 USHORT _nInitSize = 1024,
139 USHORT _nReSize = 1024 );
140 EntryList_Impl(
141 SvxIconChoiceCtrl_Impl*,
142 USHORT _nBlockSize,
143 USHORT _nInitSize,
144 USHORT _nReSize );
145 ~EntryList_Impl();
147 void Clear();
148 void Insert( SvxIconChoiceCtrlEntry* pEntry, ULONG nPos );
149 SvxIconChoiceCtrlEntry* Remove( ULONG nPos );
150 void Remove( SvxIconChoiceCtrlEntry* pEntry );
154 ///////////////////////////////////////////////////////////////////////////////
156 // Implementation-class of IconChoiceCtrl
158 class SvxIconChoiceCtrl_Impl
160 friend class IcnCursor_Impl;
161 friend class EntryList_Impl;
162 friend class IcnGridMap_Impl;
164 BOOL bChooseWithCursor;
165 EntryList_Impl aEntries;
166 ScrollBar aVerSBar;
167 ScrollBar aHorSBar;
168 ScrollBarBox aScrBarBox;
169 Rectangle aCurSelectionRect;
170 SvPtrarr aSelectedRectList;
171 Timer aEditTimer; // fuer Inplace-Editieren
172 Timer aAutoArrangeTimer;
173 Timer aDocRectChangedTimer;
174 Timer aVisRectChangedTimer;
175 Timer aCallSelectHdlTimer;
176 Size aVirtOutputSize;
177 Size aImageSize;
178 Size aDefaultTextSize;
179 Size aOutputSize; // Pixel
180 Point aDDLastEntryPos;
181 Point aDDLastRectPos;
182 Point aDDPaintOffs;
183 Point aDDStartPos;
184 SvtIconChoiceCtrl* pView;
185 IcnCursor_Impl* pImpCursor;
186 IcnGridMap_Impl* pGridMap;
187 long nMaxVirtWidth; // max. Breite aVirtOutputSize bei ALIGN_TOP
188 long nMaxVirtHeight; // max. Hoehe aVirtOutputSize bei ALIGN_LEFT
189 List* pZOrderList;
190 SvPtrarr* pColumns;
191 IcnViewEdit_Impl* pEdit;
192 WinBits nWinBits;
193 long nMaxBoundHeight; // Hoehe des hoechsten BoundRects
194 USHORT nFlags;
195 USHORT nCurTextDrawFlags;
196 ULONG nUserEventAdjustScrBars;
197 ULONG nUserEventShowCursor;
198 SvxIconChoiceCtrlEntry* pCurHighlightFrame;
199 BOOL bHighlightFramePressed;
200 SvxIconChoiceCtrlEntry* pHead; // Eintrag oben links
201 SvxIconChoiceCtrlEntry* pCursor;
202 SvxIconChoiceCtrlEntry* pPrevDropTarget;
203 SvxIconChoiceCtrlEntry* pHdlEntry;
204 SvxIconChoiceCtrlEntry* pDDRefEntry;
205 VirtualDevice* pDDDev;
206 VirtualDevice* pDDBufDev;
207 VirtualDevice* pDDTempDev;
208 VirtualDevice* pEntryPaintDev;
209 SvxIconChoiceCtrlEntry* pAnchor; // fuer Selektion
210 LocalFocus aFocus; // Data for focusrect
211 ::svt::AccessibleFactoryAccess aAccFactory;
213 List* pDraggedSelection;
214 SvxIconChoiceCtrlEntry* pCurEditedEntry;
215 SvxIconChoiceCtrlTextMode eTextMode;
216 SelectionMode eSelectionMode;
217 ULONG nSelectionCount;
218 SvxIconChoiceCtrlPositionMode ePositionMode;
219 BOOL bBoundRectsDirty;
220 BOOL bUpdateMode;
221 BOOL bEntryEditingEnabled;
222 BOOL bInDragDrop;
224 void ShowCursor( BOOL bShow );
226 void ImpArrange( BOOL bKeepPredecessors = FALSE );
227 void AdjustVirtSize( const Rectangle& );
228 void ResetVirtSize();
229 void CheckScrollBars();
231 DECL_LINK( ScrollUpDownHdl, ScrollBar * );
232 DECL_LINK( ScrollLeftRightHdl, ScrollBar * );
233 DECL_LINK( EditTimeoutHdl, Timer* );
234 DECL_LINK( UserEventHdl, void* );
235 DECL_LINK( EndScrollHdl, void* );
236 DECL_LINK( AutoArrangeHdl, void* );
237 DECL_LINK( DocRectChangedHdl, void* );
238 DECL_LINK( VisRectChangedHdl, void* );
239 DECL_LINK( CallSelectHdlHdl, void* );
241 void AdjustScrollBars( BOOL bVirtSizeGrowedOnly = FALSE);
242 void PositionScrollBars( long nRealWidth, long nRealHeight );
243 long GetScrollBarPageSize( long nVisibleRange ) const { return ((nVisibleRange*75)/100); }
244 long GetScrollBarLineSize() const { return nMaxBoundHeight / 2; }
245 BOOL HandleScrollCommand( const CommandEvent& rCmd );
246 void ToDocPos( Point& rPosPixel ) { rPosPixel -= pView->GetMapMode().GetOrigin(); }
247 void InitScrollBarBox();
248 SvxIconChoiceCtrlEntry* FindNewCursor();
249 void ToggleSelection( SvxIconChoiceCtrlEntry* );
250 void DeselectAllBut( SvxIconChoiceCtrlEntry*, BOOL bPaintSync=FALSE );
251 void Center( SvxIconChoiceCtrlEntry* pEntry ) const;
252 void StopEditTimer() { aEditTimer.Stop(); }
253 void StartEditTimer() { aEditTimer.Start(); }
254 void ImpHideDDIcon();
255 void CallSelectHandler( SvxIconChoiceCtrlEntry* );
256 void SelectRect(
257 SvxIconChoiceCtrlEntry* pEntry1,
258 SvxIconChoiceCtrlEntry* pEntry2,
259 BOOL bAdd = TRUE,
260 SvPtrarr* pOtherRects = 0 );
262 void SelectRange(
263 SvxIconChoiceCtrlEntry* pStart,
264 SvxIconChoiceCtrlEntry* pEnd,
265 BOOL bAdd = TRUE );
267 void AddSelectedRect( const Rectangle& );
268 void AddSelectedRect(
269 SvxIconChoiceCtrlEntry* pEntry1,
270 SvxIconChoiceCtrlEntry* pEntry2 );
272 void ClearSelectedRectList();
273 void ClearColumnList();
274 Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const;
276 void ClipAtVirtOutRect( Rectangle& rRect ) const;
277 void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 );
278 Point AdjustAtGrid(
279 const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect)
280 const Rectangle& rBoundRect ) const;
281 ULONG GetPredecessorGrid( const Point& rDocPos) const;
283 void InitPredecessors();
284 void ClearPredecessors();
286 BOOL CheckVerScrollBar();
287 BOOL CheckHorScrollBar();
288 void CancelUserEvents();
289 void EntrySelected( SvxIconChoiceCtrlEntry* pEntry, BOOL bSelect,
290 BOOL bSyncPaint );
291 void SaveSelection( List** );
292 void RepaintEntries( USHORT nEntryFlagsMask );
293 void SetListPositions();
294 void SetDefaultTextSize();
295 BOOL IsAutoArrange() const {
296 return (BOOL)(ePositionMode == IcnViewPositionModeAutoArrange); }
297 BOOL IsAutoAdjust() const {
298 return (BOOL)(ePositionMode == IcnViewPositionModeAutoAdjust); }
299 void DocRectChanged() { aDocRectChangedTimer.Start(); }
300 void VisRectChanged() { aVisRectChangedTimer.Start(); }
301 void SetOrigin( const Point&, BOOL bDoNotUpdateWallpaper = FALSE );
303 DECL_LINK( TextEditEndedHdl, IcnViewEdit_Impl* );
305 void ShowFocus ( Rectangle& rRect );
306 void HideFocus ();
307 void DrawFocusRect ( OutputDevice* pOut );
309 BOOL IsMnemonicChar( sal_Unicode cChar, ULONG& rPos ) const;
311 public:
313 long nGridDX,
314 nGridDY;
315 long nHorSBarHeight,
316 nVerSBarWidth;
318 SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle );
319 ~SvxIconChoiceCtrl_Impl();
321 BOOL SetChoiceWithCursor ( BOOL bDo = TRUE ) { BOOL bOld=bChooseWithCursor; bChooseWithCursor = bDo; return bOld; }
322 void Clear( BOOL bInCtor = FALSE );
323 void SetStyle( WinBits nWinStyle );
324 WinBits GetStyle() const { return nWinBits; }
325 void InsertEntry( SvxIconChoiceCtrlEntry*, ULONG nPos, const Point* pPos=0 );
326 void CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL );
327 void RemoveEntry( SvxIconChoiceCtrlEntry* pEntry );
328 void FontModified();
329 void SelectAll( BOOL bSelect = TRUE, BOOL bPaint = TRUE );
330 void SelectEntry(
331 SvxIconChoiceCtrlEntry*,
332 BOOL bSelect,
333 BOOL bCallHdl = TRUE,
334 BOOL bAddToSelection = FALSE,
335 BOOL bSyncPaint = FALSE );
336 void Paint( const Rectangle& rRect );
337 BOOL MouseButtonDown( const MouseEvent& );
338 BOOL MouseButtonUp( const MouseEvent& );
339 BOOL MouseMove( const MouseEvent&);
340 BOOL RequestHelp( const HelpEvent& rHEvt );
341 void SetCursor_Impl(
342 SvxIconChoiceCtrlEntry* pOldCursor,
343 SvxIconChoiceCtrlEntry* pNewCursor,
344 BOOL bMod1,
345 BOOL bShift,
346 BOOL bPaintSync = FALSE);
347 BOOL KeyInput( const KeyEvent& );
348 void Resize();
349 void GetFocus();
350 void LoseFocus();
351 void SetUpdateMode( BOOL bUpdate );
352 BOOL GetUpdateMode() const { return bUpdateMode; }
353 void PaintEntry( SvxIconChoiceCtrlEntry* pEntry, BOOL bIsBackgroundPainted=FALSE );
354 void PaintEntry(
355 SvxIconChoiceCtrlEntry*,
356 const Point&,
357 OutputDevice* pOut = 0,
358 BOOL bIsBackgroundPainted = FALSE);
359 void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* );
361 void SetEntryPos(
362 SvxIconChoiceCtrlEntry* pEntry,
363 const Point& rPos,
364 BOOL bAdjustRow = FALSE,
365 BOOL bCheckScrollBars = FALSE,
366 BOOL bKeepGridMap = FALSE );
368 void InvalidateEntry( SvxIconChoiceCtrlEntry* );
369 IcnViewFieldType GetItem( SvxIconChoiceCtrlEntry*, const Point& rAbsPos );
371 void SetNoSelection();
373 SvxIconChoiceCtrlEntry* GetCurEntry() const { return pCursor; }
374 void SetCursor(
375 SvxIconChoiceCtrlEntry*,
376 // TRUE == bei Single-Selection die Sel. mitfuehren
377 BOOL bSyncSingleSelection = TRUE,
378 BOOL bShowFocusAsync = FALSE );
380 SvxIconChoiceCtrlEntry* GetEntry( const Point& rDocPos, BOOL bHit = FALSE );
381 SvxIconChoiceCtrlEntry* GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry );
382 SvxIconChoiceCtrlEntry* GetPrevEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry );
384 Point GetEntryPos( SvxIconChoiceCtrlEntry* );
385 void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, BOOL bBound = TRUE );
387 void Arrange(BOOL bKeepPredecessors = FALSE, long nSetMaxVirtWidth =0, long nSetMaxVirtHeight =0 );
389 Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* );
390 Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 );
391 Rectangle CalcTextRect(
392 SvxIconChoiceCtrlEntry*,
393 const Point* pPos = 0,
394 BOOL bForInplaceEdit = FALSE,
395 const String* pStr = 0 );
397 long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const;
398 long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const;
399 Size CalcBoundingSize( SvxIconChoiceCtrlEntry* ) const;
400 void FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry );
401 void SetBoundingRect_Impl(
402 SvxIconChoiceCtrlEntry* pEntry,
403 const Point& rPos,
404 const Size& rBoundingSize );
405 // berechnet alle BoundRects neu
406 void RecalcAllBoundingRects();
407 // berechnet alle ungueltigen BoundRects neu
408 void RecalcAllBoundingRectsSmart();
409 const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* );
410 void InvalidateBoundingRect( SvxIconChoiceCtrlEntry* );
411 void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; bBoundRectsDirty = TRUE; }
412 BOOL IsBoundingRectValid( const Rectangle& rRect ) const { return (BOOL)( rRect.Right() != LONG_MAX ); }
414 void PaintEmphasis(
415 const Rectangle& rRect1,
416 const Rectangle& rRect2,
417 BOOL bSelected,
418 BOOL bDropTarget,
419 BOOL bCursored,
420 OutputDevice* pOut,
421 BOOL bIsBackgroundPainted = FALSE);
423 void PaintItem(
424 const Rectangle& rRect,
425 IcnViewFieldType eItem,
426 SvxIconChoiceCtrlEntry* pEntry,
427 USHORT nPaintFlags,
428 OutputDevice* pOut,
429 const String* pStr = 0,
430 ::vcl::ControlLayoutData* _pLayoutData = NULL );
432 // berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == TRUE
433 void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); }
434 // berechnet alle invalidierten BoundingRects neu
435 void UpdateBoundingRects();
436 void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, BOOL bShow );
437 void PrepareCommandEvent( const CommandEvent& );
438 void Command( const CommandEvent& rCEvt );
439 void ToTop( SvxIconChoiceCtrlEntry* );
441 ULONG GetSelectionCount() const;
442 void SetGrid( const Size& );
443 Size GetMinGrid() const;
444 ULONG GetGridCount(
445 const Size& rSize,
446 BOOL bCheckScrBars,
447 BOOL bSmartScrBar ) const;
448 void Scroll( long nDeltaX, long nDeltaY, BOOL bScrollBar = FALSE );
449 const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const;
451 void HideDDIcon();
452 void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos );
453 void HideShowDDIcon(
454 SvxIconChoiceCtrlEntry* pRefEntry,
455 const Point& rPos );
457 BOOL IsOver(
458 SvPtrarr* pSelectedRectList,
459 const Rectangle& rEntryBoundRect ) const;
461 void SelectRect(
462 const Rectangle&,
463 BOOL bAdd = TRUE,
464 SvPtrarr* pOtherRects = 0 );
466 void CalcScrollOffsets(
467 const Point& rRefPosPixel,
468 long& rX,
469 long& rY,
470 BOOL bDragDrop = FALSE,
471 USHORT nBorderWidth = 10 );
473 BOOL IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos );
474 void MakeVisible(
475 const Rectangle& rDocPos,
476 BOOL bInScrollBarEvent=FALSE,
477 BOOL bCallRectChangedHdl = TRUE );
479 void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 );
480 void SetEntryTextMode( SvxIconChoiceCtrlTextMode, SvxIconChoiceCtrlEntry* pEntry = 0 );
481 SvxIconChoiceCtrlTextMode GetTextMode( const SvxIconChoiceCtrlEntry* pEntry = 0 ) const;
482 void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry );
483 void EnableEntryEditing( BOOL bEnable ) { bEntryEditingEnabled = bEnable; }
484 BOOL IsEntryEditingEnabled() const { return bEntryEditingEnabled; }
485 BOOL IsEntryEditing() const { return (BOOL)(pCurEditedEntry!=0); }
486 void EditEntry( SvxIconChoiceCtrlEntry* pEntry );
487 void StopEntryEditing( BOOL bCancel );
488 void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, BOOL bLock );
489 ULONG GetEntryCount() const { return aEntries.Count(); }
490 SvxIconChoiceCtrlEntry* GetEntry( ULONG nPos ) const { return (SvxIconChoiceCtrlEntry*)aEntries.GetObject(nPos); }
491 SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( ULONG& ) const;
492 SvxIconChoiceCtrlEntry* GetNextSelectedEntry( ULONG& ) const;
493 SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; }
494 void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; }
496 SvxIconChoiceCtrlTextMode GetEntryTextModeSmart( const SvxIconChoiceCtrlEntry* pEntry ) const;
497 void SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; }
498 SelectionMode GetSelectionMode() const { return eSelectionMode; }
499 BOOL AreEntriesMoved() const { return (BOOL)((nFlags & F_MOVED_ENTRIES)!=0); }
500 void SetEntriesMoved( BOOL bMoved )
502 if( bMoved ) nFlags |= F_MOVED_ENTRIES;
503 else nFlags &= ~(F_MOVED_ENTRIES);
505 ULONG GetEntryListPos( SvxIconChoiceCtrlEntry* ) const;
506 void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, ULONG nNewPos );
507 void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; }
508 void SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, USHORT nFlags );
509 SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, BOOL bRight );
510 SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, BOOL bDown );
511 void InitSettings();
512 Rectangle GetOutputRect() const;
514 BOOL ArePredecessorsSet() const { return (BOOL)(pHead != 0); }
515 SvxIconChoiceCtrlEntry* GetPredecessorHead() const { return pHead; }
516 void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor);
517 BOOL GetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry** ppPredecessor);
518 // liefert gueltige Ergebnisse nur im AutoArrange-Modus!
519 SvxIconChoiceCtrlEntry* FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& );
521 void SetPositionMode( SvxIconChoiceCtrlPositionMode );
522 SvxIconChoiceCtrlPositionMode GetPositionMode() const { return ePositionMode;}
524 void Flush();
525 void SetColumn( USHORT nIndex, const SvxIconChoiceCtrlColumnInfo& );
526 const SvxIconChoiceCtrlColumnInfo* GetColumn( USHORT nIndex ) const;
527 const SvxIconChoiceCtrlColumnInfo* GetItemColumn( USHORT nSubItem, long& rLeft ) const;
529 Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); }
530 Rectangle GetVisibleRect() const { return GetOutputRect(); }
532 void SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEntry,BOOL bKeepHighlightFlags=FALSE );
533 void HideEntryHighlightFrame();
534 void DrawHighlightFrame( OutputDevice* pOut,
535 const Rectangle& rBmpRect, BOOL bHide );
536 void StopSelectTimer() { aCallSelectHdlTimer.Stop(); }
537 void Tracking( const TrackingEvent& rTEvt );
538 Point GetPopupMenuPosPixel() const;
540 BOOL HandleShortCutKey( const KeyEvent& rKeyEvent );
542 void CallEventListeners( ULONG nEvent, void* pData = NULL );
544 inline ::svt::IAccessibleFactory&
545 GetAccessibleFactory() { return aAccFactory.getFactory(); }
548 // ----------------------------------------------------------------------------------------------
550 class IcnCursor_Impl
552 SvxIconChoiceCtrl_Impl* pView;
553 SvPtrarr* pColumns;
554 SvPtrarr* pRows;
555 long nCols;
556 long nRows;
557 short nDeltaWidth;
558 short nDeltaHeight;
559 SvxIconChoiceCtrlEntry* pCurEntry;
560 void SetDeltas();
561 void ImplCreate();
562 void Create() { if( !pColumns ) ImplCreate(); }
564 USHORT GetSortListPos( SvPtrarr* pList, long nValue, int bVertical);
565 SvxIconChoiceCtrlEntry* SearchCol(USHORT nCol,USHORT nTop,USHORT nBottom,USHORT nPref,
566 BOOL bDown, BOOL bSimple );
568 SvxIconChoiceCtrlEntry* SearchRow(USHORT nRow,USHORT nRight,USHORT nLeft,USHORT nPref,
569 BOOL bRight, BOOL bSimple );
571 public:
572 IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner );
573 ~IcnCursor_Impl();
574 void Clear();
576 // fuer Cursortravelling usw.
577 SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, BOOL bRight );
578 SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, BOOL bDown );
579 SvxIconChoiceCtrlEntry* GoPageUpDown( SvxIconChoiceCtrlEntry*, BOOL bDown );
581 // Erzeugt fuer jede Zeile (Hoehe=nGridDY) eine nach BoundRect.Left()
582 // sortierte Liste der Eintraege, die in ihr stehen. Eine Liste kann
583 // leer sein. Die Listen gehen in das Eigentum des Rufenden ueber und
584 // muessen mit DestroyGridAdjustData geloescht werden
585 void CreateGridAjustData( SvPtrarr& pLists, SvxIconChoiceCtrlEntry* pRow=0);
586 static void DestroyGridAdjustData( SvPtrarr& rLists );
589 // ----------------------------------------------------------------------------------------------
591 typedef ULONG GridId;
593 #define GRID_NOT_FOUND ((GridId)ULONG_MAX)
595 class IcnGridMap_Impl
597 Rectangle _aLastOccupiedGrid;
598 SvxIconChoiceCtrl_Impl* _pView;
599 BOOL* _pGridMap;
600 USHORT _nGridCols, _nGridRows;
602 void Expand();
603 void Create_Impl();
604 void Create() { if(!_pGridMap) Create_Impl(); }
606 void GetMinMapSize( USHORT& rDX, USHORT& rDY ) const;
608 public:
609 IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView);
610 ~IcnGridMap_Impl();
612 void Clear();
614 GridId GetGrid( const Point& rDocPos, BOOL* pbClipped = 0 );
615 GridId GetGrid( USHORT nGridX, USHORT nGridY );
616 GridId GetUnoccupiedGrid( BOOL bOccupyFound=TRUE );
618 void OccupyGrids( const Rectangle&, BOOL bOccupy = TRUE );
619 void OccupyGrids( const SvxIconChoiceCtrlEntry*, BOOL bOccupy = TRUE );
620 void OccupyGrid( GridId nId, BOOL bOccupy = TRUE )
622 DBG_ASSERT(!_pGridMap || nId<(ULONG)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId");
623 if(_pGridMap && nId < (ULONG)(_nGridCols *_nGridRows) )
624 _pGridMap[ nId ] = bOccupy;
627 Rectangle GetGridRect( GridId );
628 void GetGridCoord( GridId, USHORT& rGridX, USHORT& rGridY );
629 static ULONG GetGridCount( const Size& rSizePixel, USHORT nGridWidth, USHORT nGridHeight );
631 void OutputSizeChanged();
638 #endif