Bump version to 5.0-14
[LibreOffice.git] / svtools / source / contnr / imivctl.hxx
blob0980f0c0f6c632049b5a86bfddd09256cde228e3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVTOOLS_SOURCE_CONTNR_IMIVCTL_HXX
21 #define INCLUDED_SVTOOLS_SOURCE_CONTNR_IMIVCTL_HXX
23 #include <vcl/virdev.hxx>
24 #include <vcl/scrbar.hxx>
25 #include <vcl/timer.hxx>
26 #include <vcl/idle.hxx>
27 #include <vcl/vclptr.hxx>
28 #include <vcl/seleng.hxx>
29 #include <tools/debug.hxx>
30 #include "svtaccessiblefactory.hxx"
32 #include <limits.h>
34 #include <svtools/ivctrl.hxx>
35 #include <boost/ptr_container/ptr_map.hpp>
37 class IcnCursor_Impl;
38 class SvtIconChoiceCtrl;
39 class SvxIconChoiceCtrlEntry;
40 class IcnViewEdit_Impl;
41 class IcnGridMap_Impl;
45 // some defines
47 #define PAINTFLAG_HOR_CENTERED 0x0001
48 #define PAINTFLAG_VER_CENTERED 0x0002
50 #define F_VER_SBARSIZE_WITH_HBAR 0x0001
51 #define F_HOR_SBARSIZE_WITH_VBAR 0x0002
52 #define F_PAINTED 0x0004 // true after first paint
53 #define F_ADD_MODE 0x0008
54 #define F_SELECTING_RECT 0x0020
55 #define F_DOWN_CTRL 0x0080
56 #define F_DOWN_DESELECT 0x0100
57 #define F_START_EDITTIMER_IN_MOUSEUP 0x0400
58 #define F_MOVED_ENTRIES 0x0800
59 #define F_ENTRYLISTPOS_VALID 0x1000
60 #define F_CLEARING_SELECTION 0x2000
61 #define F_ARRANGING 0x4000
63 // unit = pixels
64 // distances from window borders
65 #define LROFFS_WINBORDER 4
66 #define TBOFFS_WINBORDER 4
67 // for the bounding rectangle
68 #define LROFFS_BOUND 2
69 #define TBOFFS_BOUND 2
70 // distance icon to text
71 #define HOR_DIST_BMP_STRING 3
72 #define VER_DIST_BMP_STRING 3
73 // width offset of highlight rectangle for Text
74 #define LROFFS_TEXT 2
76 #define DEFAULT_MAX_VIRT_WIDTH 200
77 #define DEFAULT_MAX_VIRT_HEIGHT 200
79 #define VIEWMODE_MASK (WB_ICON | WB_SMALLICON | WB_DETAILS)
85 enum IcnViewFieldType
87 IcnViewFieldTypeDontknow = 0,
88 IcnViewFieldTypeImage = 1,
89 IcnViewFieldTypeText = 2
94 // Data about the focus of entries
96 struct LocalFocus
98 bool bOn;
99 Rectangle aRect;
100 Color aPenColor;
102 LocalFocus() { bOn = false; }
107 // Entry-List
109 typedef ::std::vector< SvxIconChoiceCtrlEntry* > SvxIconChoiceCtrlEntryList_impl;
111 class EntryList_Impl
113 private:
114 SvxIconChoiceCtrlEntryList_impl maIconChoiceCtrlEntryList;
115 SvxIconChoiceCtrl_Impl* _pOwner;
117 public:
118 EntryList_Impl( SvxIconChoiceCtrl_Impl* );
119 ~EntryList_Impl();
121 void clear();
123 size_t size()
125 return maIconChoiceCtrlEntryList.size();
127 size_t size() const
129 return maIconChoiceCtrlEntryList.size();
132 SvxIconChoiceCtrlEntry* operator[]( size_t nPos )
134 return ( nPos < maIconChoiceCtrlEntryList.size() )
135 ? maIconChoiceCtrlEntryList[ nPos ]
136 : NULL;
138 SvxIconChoiceCtrlEntry* operator[]( size_t nPos ) const
140 return ( nPos < maIconChoiceCtrlEntryList.size() )
141 ? maIconChoiceCtrlEntryList[ nPos ]
142 : NULL;
144 void insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry );
150 // Implementation-class of IconChoiceCtrl
153 typedef boost::ptr_map<sal_uInt16, SvxIconChoiceCtrlColumnInfo> SvxIconChoiceCtrlColumnInfoMap;
154 typedef std::vector<SvxIconChoiceCtrlEntry*> SvxIconChoiceCtrlEntryPtrVec;
156 class SvxIconChoiceCtrl_Impl
158 friend class IcnCursor_Impl;
159 friend class EntryList_Impl;
160 friend class IcnGridMap_Impl;
162 bool bChooseWithCursor;
163 EntryList_Impl aEntries;
164 VclPtr<ScrollBar> aVerSBar;
165 VclPtr<ScrollBar> aHorSBar;
166 VclPtr<ScrollBarBox> aScrBarBox;
167 Rectangle aCurSelectionRect;
168 std::vector<Rectangle*> aSelectedRectList;
169 Idle aEditIdle; // for editing in place
170 Idle aAutoArrangeIdle;
171 Idle aDocRectChangedIdle;
172 Idle aVisRectChangedIdle;
173 Idle aCallSelectHdlIdle;
174 Size aVirtOutputSize;
175 Size aImageSize;
176 Size aDefaultTextSize;
177 Size aOutputSize; // Pixel
178 Point aDDLastEntryPos;
179 Point aDDLastRectPos;
180 Point aDDPaintOffs;
181 Point aDDStartPos;
182 VclPtr<SvtIconChoiceCtrl> pView;
183 IcnCursor_Impl* pImpCursor;
184 IcnGridMap_Impl* pGridMap;
185 long nMaxVirtWidth; // max. width aVirtOutputSize for ALIGN_TOP
186 long nMaxVirtHeight; // max. height aVirtOutputSize for ALIGN_LEFT
187 SvxIconChoiceCtrlEntryList_impl* pZOrderList;
188 SvxIconChoiceCtrlColumnInfoMap* pColumns;
189 VclPtr<IcnViewEdit_Impl> pEdit;
190 WinBits nWinBits;
191 long nMaxBoundHeight; // height of highest BoundRects
192 sal_uInt16 nFlags;
193 DrawTextFlags nCurTextDrawFlags;
194 ImplSVEvent * nUserEventAdjustScrBars;
195 ImplSVEvent * nUserEventShowCursor;
196 SvxIconChoiceCtrlEntry* pCurHighlightFrame;
197 bool bHighlightFramePressed;
198 SvxIconChoiceCtrlEntry* pHead; // top left entry
199 SvxIconChoiceCtrlEntry* pCursor;
200 SvxIconChoiceCtrlEntry* pPrevDropTarget;
201 SvxIconChoiceCtrlEntry* pHdlEntry;
202 SvxIconChoiceCtrlEntry* pDDRefEntry;
203 VclPtr<VirtualDevice> pDDDev;
204 VclPtr<VirtualDevice> pDDBufDev;
205 VclPtr<VirtualDevice> pDDTempDev;
206 VclPtr<VirtualDevice> pEntryPaintDev;
207 SvxIconChoiceCtrlEntry* pAnchor; // for selection
208 LocalFocus aFocus; // Data for focusrect
209 ::svt::AccessibleFactoryAccess aAccFactory;
211 SvxIconChoiceCtrlEntry* pCurEditedEntry;
212 SvxIconChoiceCtrlTextMode eTextMode;
213 SelectionMode eSelectionMode;
214 sal_uLong nSelectionCount;
215 SvxIconChoiceCtrlPositionMode ePositionMode;
216 bool bBoundRectsDirty;
217 bool bUpdateMode;
218 bool bEntryEditingEnabled;
220 void ShowCursor( bool bShow );
222 void ImpArrange( bool bKeepPredecessors = false );
223 void AdjustVirtSize( const Rectangle& );
224 void ResetVirtSize();
225 void CheckScrollBars();
227 DECL_LINK( ScrollUpDownHdl, ScrollBar * );
228 DECL_LINK( ScrollLeftRightHdl, ScrollBar * );
229 DECL_LINK_TYPED(EditTimeoutHdl, Idle *, void);
230 DECL_LINK( UserEventHdl, void* );
231 DECL_STATIC_LINK( SvxIconChoiceCtrl_Impl, EndScrollHdl, void* );
232 DECL_LINK_TYPED( AutoArrangeHdl, Idle*, void );
233 DECL_LINK_TYPED( DocRectChangedHdl, Idle*, void );
234 DECL_LINK_TYPED( VisRectChangedHdl, Idle*, void );
235 DECL_LINK_TYPED( CallSelectHdlHdl, Idle*, void );
237 void AdjustScrollBars( bool bVirtSizeGrowedOnly = false);
238 void PositionScrollBars( long nRealWidth, long nRealHeight );
239 static long GetScrollBarPageSize( long nVisibleRange )
241 return ((nVisibleRange*75)/100);
243 long GetScrollBarLineSize() const
245 return nMaxBoundHeight / 2;
247 bool HandleScrollCommand( const CommandEvent& rCmd );
248 void ToDocPos( Point& rPosPixel )
250 rPosPixel -= pView->GetMapMode().GetOrigin();
252 void InitScrollBarBox();
253 void ToggleSelection( SvxIconChoiceCtrlEntry* );
254 void DeselectAllBut( SvxIconChoiceCtrlEntry*, bool bPaintSync = false );
255 void Center( SvxIconChoiceCtrlEntry* pEntry ) const;
256 void StopEditTimer() { aEditIdle.Stop(); }
257 void StartEditTimer() { aEditIdle.Start(); }
258 void ImpHideDDIcon();
259 void CallSelectHandler( SvxIconChoiceCtrlEntry* );
260 void SelectRect(
261 SvxIconChoiceCtrlEntry* pEntry1,
262 SvxIconChoiceCtrlEntry* pEntry2,
263 bool bAdd = true,
264 std::vector<Rectangle*>* pOtherRects = 0
267 void SelectRange(
268 SvxIconChoiceCtrlEntry* pStart,
269 SvxIconChoiceCtrlEntry* pEnd,
270 bool bAdd = true
273 void AddSelectedRect( const Rectangle& );
274 void AddSelectedRect(
275 SvxIconChoiceCtrlEntry* pEntry1,
276 SvxIconChoiceCtrlEntry* pEntry2
279 void ClearSelectedRectList();
280 void ClearColumnList();
281 Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const;
283 void ClipAtVirtOutRect( Rectangle& rRect ) const;
284 void AdjustAtGrid( const SvxIconChoiceCtrlEntryPtrVec& rRow, SvxIconChoiceCtrlEntry* pStart=0 );
285 Point AdjustAtGrid(
286 const Rectangle& rCenterRect, // balance point of object (typically Bmp-Rect)
287 const Rectangle& rBoundRect
288 ) const;
289 sal_uLong GetPredecessorGrid( const Point& rDocPos) const;
291 void InitPredecessors();
292 void ClearPredecessors();
294 bool CheckVerScrollBar();
295 bool CheckHorScrollBar();
296 void CancelUserEvents();
297 void EntrySelected(
298 SvxIconChoiceCtrlEntry* pEntry,
299 bool bSelect,
300 bool bSyncPaint
302 void RepaintEntries( SvxIconViewFlags nEntryFlagsMask );
303 void SetListPositions();
304 void SetDefaultTextSize();
305 bool IsAutoArrange() const
307 return (ePositionMode == IcnViewPositionModeAutoArrange);
309 bool IsAutoAdjust() const
311 return (ePositionMode == IcnViewPositionModeAutoAdjust);
313 void DocRectChanged() { aDocRectChangedIdle.Start(); }
314 void VisRectChanged() { aVisRectChangedIdle.Start(); }
315 void SetOrigin( const Point& );
317 DECL_LINK(TextEditEndedHdl, void *);
319 void ShowFocus ( Rectangle& rRect );
320 void DrawFocusRect(vcl::RenderContext& rRenderContext);
322 bool IsMnemonicChar( sal_Unicode cChar, sal_uLong& rPos ) const;
324 public:
326 long nGridDX;
327 long nGridDY;
328 long nHorSBarHeight;
329 long nVerSBarWidth;
331 SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle );
332 ~SvxIconChoiceCtrl_Impl();
334 bool SetChoiceWithCursor ( bool bDo = true ) { bool bOld = bChooseWithCursor; bChooseWithCursor = bDo; return bOld; }
335 void Clear( bool bInCtor = false );
336 void SetStyle( WinBits nWinStyle );
337 WinBits GetStyle() const { return nWinBits; }
338 void InsertEntry( SvxIconChoiceCtrlEntry*, size_t nPos, const Point* pPos=0 );
339 void CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL );
340 void FontModified();
341 void SelectAll( bool bSelect = true, bool bPaint = true );
342 void SelectEntry(
343 SvxIconChoiceCtrlEntry*,
344 bool bSelect,
345 bool bCallHdl = true,
346 bool bAddToSelection = false,
347 bool bSyncPaint = false
349 void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
350 bool MouseButtonDown( const MouseEvent& );
351 bool MouseButtonUp( const MouseEvent& );
352 bool MouseMove( const MouseEvent&);
353 bool RequestHelp( const HelpEvent& rHEvt );
354 void SetCursor_Impl(
355 SvxIconChoiceCtrlEntry* pOldCursor,
356 SvxIconChoiceCtrlEntry* pNewCursor,
357 bool bMod1,
358 bool bShift,
359 bool bPaintSync = false
361 bool KeyInput( const KeyEvent& );
362 void Resize();
363 void GetFocus();
364 void LoseFocus();
365 void SetUpdateMode( bool bUpdate );
366 bool GetUpdateMode() const { return bUpdateMode; }
367 void PaintEntry(SvxIconChoiceCtrlEntry*, const Point&, vcl::RenderContext& rRenderContext, bool bIsBackgroundPainted = false);
369 void SetEntryPos(
370 SvxIconChoiceCtrlEntry* pEntry,
371 const Point& rPos,
372 bool bAdjustRow = false,
373 bool bCheckScrollBars = false,
374 bool bKeepGridMap = false
377 void InvalidateEntry( SvxIconChoiceCtrlEntry* );
379 void SetNoSelection();
381 SvxIconChoiceCtrlEntry* GetCurEntry() const { return pCursor; }
382 void SetCursor(
383 SvxIconChoiceCtrlEntry*,
384 // true == carry selection when single-selecting
385 bool bSyncSingleSelection = true,
386 bool bShowFocusAsync = false
389 SvxIconChoiceCtrlEntry* GetEntry( const Point& rDocPos, bool bHit = false );
391 void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, bool bBound = true );
393 void Arrange(
394 bool bKeepPredecessors = false,
395 long nSetMaxVirtWidth =0,
396 long nSetMaxVirtHeight =0
399 Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* );
400 Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 );
401 Rectangle CalcTextRect(
402 SvxIconChoiceCtrlEntry*,
403 const Point* pPos = 0,
404 bool bForInplaceEdit = false,
405 const OUString* pStr = 0
408 long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const;
409 long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const;
410 Size CalcBoundingSize( SvxIconChoiceCtrlEntry* ) const;
411 void FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry );
412 void SetBoundingRect_Impl(
413 SvxIconChoiceCtrlEntry* pEntry,
414 const Point& rPos,
415 const Size& rBoundingSize
417 // recalculates all invalid BoundRects
418 void RecalcAllBoundingRectsSmart();
419 const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* );
420 void InvalidateBoundingRect( Rectangle& rRect )
422 rRect.Right() = LONG_MAX;
423 bBoundRectsDirty = true;
425 static bool IsBoundingRectValid( const Rectangle& rRect ) { return ( rRect.Right() != LONG_MAX ); }
427 void PaintEmphasis(const Rectangle& rRect1, const Rectangle& rRect2, bool bSelected,
428 bool bDropTarget, bool bCursored, vcl::RenderContext& rRenderContext,
429 bool bIsBackgroundPainted = false);
431 void PaintItem(const Rectangle& rRect, IcnViewFieldType eItem, SvxIconChoiceCtrlEntry* pEntry,
432 sal_uInt16 nPaintFlags, vcl::RenderContext& rRenderContext, const OUString* pStr = 0,
433 vcl::ControlLayoutData* _pLayoutData = NULL);
435 // recalculates all BoundingRects if bMustRecalcBoundingRects == true
436 void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); }
437 // recalculates all invalidated BoundingRects
438 void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, bool bShow );
439 void Command( const CommandEvent& rCEvt );
440 void ToTop( SvxIconChoiceCtrlEntry* );
442 sal_uLong GetSelectionCount() const;
443 void SetGrid( const Size& );
444 Size GetMinGrid() const;
445 void Scroll( long nDeltaX, long nDeltaY, bool bScrollBar = false );
446 const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const;
448 void HideDDIcon();
450 static bool IsOver(
451 std::vector<Rectangle*>* pSelectedRectList,
452 const Rectangle& rEntryBoundRect
455 void SelectRect(
456 const Rectangle&,
457 bool bAdd = true,
458 std::vector<Rectangle*>* pOtherRects = 0
461 bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos );
462 void MakeVisible(
463 const Rectangle& rDocPos,
464 bool bInScrollBarEvent=false,
465 bool bCallRectChangedHdl = true
468 void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 );
469 #ifdef DBG_UTIL
470 void SetEntryTextMode(
471 SvxIconChoiceCtrlTextMode,
472 SvxIconChoiceCtrlEntry* pEntry = 0
474 #endif
475 void EnableEntryEditing( bool bEnable ) { bEntryEditingEnabled = bEnable; }
476 bool IsEntryEditingEnabled() const { return bEntryEditingEnabled; }
477 bool IsEntryEditing() const { return (pCurEditedEntry!=0); }
478 void EditEntry( SvxIconChoiceCtrlEntry* pEntry );
479 void StopEntryEditing( bool bCancel );
480 size_t GetEntryCount() const { return aEntries.size(); }
481 SvxIconChoiceCtrlEntry* GetEntry( size_t nPos )
483 return aEntries[ nPos ];
485 SvxIconChoiceCtrlEntry* GetEntry( size_t nPos ) const
487 return aEntries[ nPos ];
489 SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( sal_uLong& ) const;
490 SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; }
491 void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; }
493 SvxIconChoiceCtrlTextMode GetEntryTextModeSmart( const SvxIconChoiceCtrlEntry* pEntry ) const;
494 void SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; }
495 SelectionMode GetSelectionMode() const { return eSelectionMode; }
496 bool AreEntriesMoved() const { return ((nFlags & F_MOVED_ENTRIES) != 0); }
497 void SetEntriesMoved( bool bMoved )
499 if( bMoved )
500 nFlags |= F_MOVED_ENTRIES;
501 else
502 nFlags &= ~(F_MOVED_ENTRIES);
504 sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* ) const;
505 void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; }
506 void InitSettings();
507 Rectangle GetOutputRect() const;
509 bool ArePredecessorsSet() const { return (pHead != 0); }
510 SvxIconChoiceCtrlEntry* GetPredecessorHead() const { return pHead; }
511 void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor);
512 // only delivers valid results when in AutoArrange mode!
513 SvxIconChoiceCtrlEntry* FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& );
515 void SetPositionMode( SvxIconChoiceCtrlPositionMode );
516 SvxIconChoiceCtrlPositionMode GetPositionMode() const { return ePositionMode;}
518 void SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& );
519 const SvxIconChoiceCtrlColumnInfo* GetColumn( sal_uInt16 nIndex ) const;
521 Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); }
522 Rectangle GetVisibleRect() const { return GetOutputRect(); }
524 void SetEntryHighlightFrame(
525 SvxIconChoiceCtrlEntry* pEntry,
526 bool bKeepHighlightFlags = false
528 void HideEntryHighlightFrame();
529 void DrawHighlightFrame(vcl::RenderContext& rRenderContext, const Rectangle& rBmpRect, bool bHide);
530 void StopSelectTimer() { aCallSelectHdlIdle.Stop(); }
532 void CallEventListeners( sal_uLong nEvent, void* pData = NULL );
534 inline ::svt::IAccessibleFactory& GetAccessibleFactory()
536 return aAccFactory.getFactory();
542 typedef std::map<sal_uInt16, SvxIconChoiceCtrlEntryPtrVec> IconChoiceMap;
544 class IcnCursor_Impl
546 SvxIconChoiceCtrl_Impl* pView;
547 std::unique_ptr<IconChoiceMap> xColumns;
548 std::unique_ptr<IconChoiceMap> xRows;
549 long nCols;
550 long nRows;
551 short nDeltaWidth;
552 short nDeltaHeight;
553 SvxIconChoiceCtrlEntry* pCurEntry;
554 void SetDeltas();
555 void ImplCreate();
556 void Create() { if( !xColumns ) ImplCreate(); }
558 sal_uInt16 GetSortListPos(
559 SvxIconChoiceCtrlEntryPtrVec& rList,
560 long nValue,
561 bool bVertical);
562 SvxIconChoiceCtrlEntry* SearchCol(
563 sal_uInt16 nCol,
564 sal_uInt16 nTop,
565 sal_uInt16 nBottom,
566 sal_uInt16 nPref,
567 bool bDown,
568 bool bSimple
571 SvxIconChoiceCtrlEntry* SearchRow(
572 sal_uInt16 nRow,
573 sal_uInt16 nRight,
574 sal_uInt16 nLeft,
575 sal_uInt16 nPref,
576 bool bRight,
577 bool bSimple
580 public:
581 IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner );
582 ~IcnCursor_Impl();
583 void Clear();
585 // for Cursortravelling etc.
586 SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, bool bRight );
587 SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, bool bDown );
588 SvxIconChoiceCtrlEntry* GoPageUpDown( SvxIconChoiceCtrlEntry*, bool bDown );
590 // Creates a list of entries for every row (height = nGridDY) sorted by
591 // BoundRect.Left(). A list may be empty. The lists become the property of
592 // the caller and have to be deleted with DestroyGridAdjustData.
593 void CreateGridAjustData( IconChoiceMap& pLists, SvxIconChoiceCtrlEntry* pRow=0);
594 static void DestroyGridAdjustData( IconChoiceMap& rLists );
599 typedef sal_uLong GridId;
601 #define GRID_NOT_FOUND ((GridId)ULONG_MAX)
603 class IcnGridMap_Impl
605 Rectangle _aLastOccupiedGrid;
606 SvxIconChoiceCtrl_Impl* _pView;
607 bool * _pGridMap;
608 sal_uInt16 _nGridCols, _nGridRows;
610 void Expand();
611 void Create_Impl();
612 void Create() { if(!_pGridMap) Create_Impl(); }
614 void GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const;
616 public:
617 IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView);
618 ~IcnGridMap_Impl();
620 void Clear();
622 GridId GetGrid( const Point& rDocPos, bool* pbClipped = 0 );
623 GridId GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY );
624 GridId GetUnoccupiedGrid( bool bOccupyFound=true );
626 void OccupyGrids( const SvxIconChoiceCtrlEntry*, bool bOccupy = true );
627 void OccupyGrid( GridId nId, bool bOccupy = true )
629 DBG_ASSERT(!_pGridMap || nId<(sal_uLong)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId");
630 if(_pGridMap && nId < (sal_uLong)(_nGridCols *_nGridRows) )
631 _pGridMap[ nId ] = bOccupy;
634 Rectangle GetGridRect( GridId );
635 void GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY );
636 static sal_uLong GetGridCount(
637 const Size& rSizePixel,
638 sal_uInt16 nGridWidth,
639 sal_uInt16 nGridHeight
642 void OutputSizeChanged();
645 #endif
647 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */