Kaydet (Commit) 50f1b1ff authored tarafından Joseph Powers's avatar Joseph Powers

Replace List with std::vector< SvxIconChoiceCtrlEntry* >

üst 4dfecb62
...@@ -116,32 +116,47 @@ struct LocalFocus ...@@ -116,32 +116,47 @@ struct LocalFocus
// //
// Entry-List // Entry-List
// //
class EntryList_Impl : public List typedef ::std::vector< SvxIconChoiceCtrlEntry* > SvxIconChoiceCtrlEntryList_impl;
class EntryList_Impl
{ {
private: private:
SvxIconChoiceCtrlEntryList_impl maIconChoiceCtrlEntryList;
using List::Replace;
SvxIconChoiceCtrl_Impl* _pOwner; SvxIconChoiceCtrl_Impl* _pOwner;
void Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ); void Removed_Impl( SvxIconChoiceCtrlEntry* pEntry );
public: public:
EntryList_Impl( EntryList_Impl( SvxIconChoiceCtrl_Impl* );
SvxIconChoiceCtrl_Impl*,
sal_uInt16 _nInitSize = 1024,
sal_uInt16 _nReSize = 1024 );
EntryList_Impl(
SvxIconChoiceCtrl_Impl*,
sal_uInt16 _nBlockSize,
sal_uInt16 _nInitSize,
sal_uInt16 _nReSize );
~EntryList_Impl(); ~EntryList_Impl();
void Clear(); void clear();
void Insert( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos );
SvxIconChoiceCtrlEntry* Remove( sal_uLong nPos ); SvxIconChoiceCtrlEntry* remove( size_t nPos );
void Remove( SvxIconChoiceCtrlEntry* pEntry ); void remove( SvxIconChoiceCtrlEntry* pEntry );
size_t size()
{
return maIconChoiceCtrlEntryList.size();
}
size_t size() const
{
return maIconChoiceCtrlEntryList.size();
}
SvxIconChoiceCtrlEntry* operator[]( size_t nPos )
{
return ( nPos < maIconChoiceCtrlEntryList.size() )
? maIconChoiceCtrlEntryList[ nPos ]
: NULL;
}
SvxIconChoiceCtrlEntry* operator[]( size_t nPos ) const
{
return ( nPos < maIconChoiceCtrlEntryList.size() )
? maIconChoiceCtrlEntryList[ nPos ]
: NULL;
}
void insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry );
}; };
...@@ -234,10 +249,19 @@ class SvxIconChoiceCtrl_Impl ...@@ -234,10 +249,19 @@ class SvxIconChoiceCtrl_Impl
void AdjustScrollBars( sal_Bool bVirtSizeGrowedOnly = sal_False); void AdjustScrollBars( sal_Bool bVirtSizeGrowedOnly = sal_False);
void PositionScrollBars( long nRealWidth, long nRealHeight ); void PositionScrollBars( long nRealWidth, long nRealHeight );
long GetScrollBarPageSize( long nVisibleRange ) const { return ((nVisibleRange*75)/100); } long GetScrollBarPageSize( long nVisibleRange ) const
long GetScrollBarLineSize() const { return nMaxBoundHeight / 2; } {
return ((nVisibleRange*75)/100);
}
long GetScrollBarLineSize() const
{
return nMaxBoundHeight / 2;
}
sal_Bool HandleScrollCommand( const CommandEvent& rCmd ); sal_Bool HandleScrollCommand( const CommandEvent& rCmd );
void ToDocPos( Point& rPosPixel ) { rPosPixel -= pView->GetMapMode().GetOrigin(); } void ToDocPos( Point& rPosPixel )
{
rPosPixel -= pView->GetMapMode().GetOrigin();
}
void InitScrollBarBox(); void InitScrollBarBox();
SvxIconChoiceCtrlEntry* FindNewCursor(); SvxIconChoiceCtrlEntry* FindNewCursor();
void ToggleSelection( SvxIconChoiceCtrlEntry* ); void ToggleSelection( SvxIconChoiceCtrlEntry* );
...@@ -251,17 +275,20 @@ class SvxIconChoiceCtrl_Impl ...@@ -251,17 +275,20 @@ class SvxIconChoiceCtrl_Impl
SvxIconChoiceCtrlEntry* pEntry1, SvxIconChoiceCtrlEntry* pEntry1,
SvxIconChoiceCtrlEntry* pEntry2, SvxIconChoiceCtrlEntry* pEntry2,
sal_Bool bAdd = sal_True, sal_Bool bAdd = sal_True,
SvPtrarr* pOtherRects = 0 ); SvPtrarr* pOtherRects = 0
);
void SelectRange( void SelectRange(
SvxIconChoiceCtrlEntry* pStart, SvxIconChoiceCtrlEntry* pStart,
SvxIconChoiceCtrlEntry* pEnd, SvxIconChoiceCtrlEntry* pEnd,
sal_Bool bAdd = sal_True ); sal_Bool bAdd = sal_True
);
void AddSelectedRect( const Rectangle& ); void AddSelectedRect( const Rectangle& );
void AddSelectedRect( void AddSelectedRect(
SvxIconChoiceCtrlEntry* pEntry1, SvxIconChoiceCtrlEntry* pEntry1,
SvxIconChoiceCtrlEntry* pEntry2 ); SvxIconChoiceCtrlEntry* pEntry2
);
void ClearSelectedRectList(); void ClearSelectedRectList();
void ClearColumnList(); void ClearColumnList();
...@@ -271,7 +298,8 @@ class SvxIconChoiceCtrl_Impl ...@@ -271,7 +298,8 @@ class SvxIconChoiceCtrl_Impl
void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 ); void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 );
Point AdjustAtGrid( Point AdjustAtGrid(
const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect) const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect)
const Rectangle& rBoundRect ) const; const Rectangle& rBoundRect
) const;
sal_uLong GetPredecessorGrid( const Point& rDocPos) const; sal_uLong GetPredecessorGrid( const Point& rDocPos) const;
void InitPredecessors(); void InitPredecessors();
...@@ -280,16 +308,23 @@ class SvxIconChoiceCtrl_Impl ...@@ -280,16 +308,23 @@ class SvxIconChoiceCtrl_Impl
sal_Bool CheckVerScrollBar(); sal_Bool CheckVerScrollBar();
sal_Bool CheckHorScrollBar(); sal_Bool CheckHorScrollBar();
void CancelUserEvents(); void CancelUserEvents();
void EntrySelected( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bSelect, void EntrySelected(
sal_Bool bSyncPaint ); SvxIconChoiceCtrlEntry* pEntry,
sal_Bool bSelect,
sal_Bool bSyncPaint
);
void SaveSelection( List** ); void SaveSelection( List** );
void RepaintEntries( sal_uInt16 nEntryFlagsMask ); void RepaintEntries( sal_uInt16 nEntryFlagsMask );
void SetListPositions(); void SetListPositions();
void SetDefaultTextSize(); void SetDefaultTextSize();
sal_Bool IsAutoArrange() const { sal_Bool IsAutoArrange() const
return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoArrange); } {
sal_Bool IsAutoAdjust() const { return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoArrange);
return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoAdjust); } }
sal_Bool IsAutoAdjust() const
{
return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoAdjust);
}
void DocRectChanged() { aDocRectChangedTimer.Start(); } void DocRectChanged() { aDocRectChangedTimer.Start(); }
void VisRectChanged() { aVisRectChangedTimer.Start(); } void VisRectChanged() { aVisRectChangedTimer.Start(); }
void SetOrigin( const Point&, sal_Bool bDoNotUpdateWallpaper = sal_False ); void SetOrigin( const Point&, sal_Bool bDoNotUpdateWallpaper = sal_False );
...@@ -304,10 +339,10 @@ class SvxIconChoiceCtrl_Impl ...@@ -304,10 +339,10 @@ class SvxIconChoiceCtrl_Impl
public: public:
long nGridDX, long nGridDX;
nGridDY; long nGridDY;
long nHorSBarHeight, long nHorSBarHeight;
nVerSBarWidth; long nVerSBarWidth;
SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle ); SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle );
~SvxIconChoiceCtrl_Impl(); ~SvxIconChoiceCtrl_Impl();
...@@ -326,7 +361,8 @@ public: ...@@ -326,7 +361,8 @@ public:
sal_Bool bSelect, sal_Bool bSelect,
sal_Bool bCallHdl = sal_True, sal_Bool bCallHdl = sal_True,
sal_Bool bAddToSelection = sal_False, sal_Bool bAddToSelection = sal_False,
sal_Bool bSyncPaint = sal_False ); sal_Bool bSyncPaint = sal_False
);
void Paint( const Rectangle& rRect ); void Paint( const Rectangle& rRect );
sal_Bool MouseButtonDown( const MouseEvent& ); sal_Bool MouseButtonDown( const MouseEvent& );
sal_Bool MouseButtonUp( const MouseEvent& ); sal_Bool MouseButtonUp( const MouseEvent& );
...@@ -337,19 +373,24 @@ public: ...@@ -337,19 +373,24 @@ public:
SvxIconChoiceCtrlEntry* pNewCursor, SvxIconChoiceCtrlEntry* pNewCursor,
sal_Bool bMod1, sal_Bool bMod1,
sal_Bool bShift, sal_Bool bShift,
sal_Bool bPaintSync = sal_False); sal_Bool bPaintSync = sal_False
);
sal_Bool KeyInput( const KeyEvent& ); sal_Bool KeyInput( const KeyEvent& );
void Resize(); void Resize();
void GetFocus(); void GetFocus();
void LoseFocus(); void LoseFocus();
void SetUpdateMode( sal_Bool bUpdate ); void SetUpdateMode( sal_Bool bUpdate );
sal_Bool GetUpdateMode() const { return bUpdateMode; } sal_Bool GetUpdateMode() const { return bUpdateMode; }
void PaintEntry( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bIsBackgroundPainted=sal_False ); void PaintEntry(
SvxIconChoiceCtrlEntry* pEntry,
sal_Bool bIsBackgroundPainted=sal_False
);
void PaintEntry( void PaintEntry(
SvxIconChoiceCtrlEntry*, SvxIconChoiceCtrlEntry*,
const Point&, const Point&,
OutputDevice* pOut = 0, OutputDevice* pOut = 0,
sal_Bool bIsBackgroundPainted = sal_False); sal_Bool bIsBackgroundPainted = sal_False
);
void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* ); void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* );
void SetEntryPos( void SetEntryPos(
...@@ -357,7 +398,8 @@ public: ...@@ -357,7 +398,8 @@ public:
const Point& rPos, const Point& rPos,
sal_Bool bAdjustRow = sal_False, sal_Bool bAdjustRow = sal_False,
sal_Bool bCheckScrollBars = sal_False, sal_Bool bCheckScrollBars = sal_False,
sal_Bool bKeepGridMap = sal_False ); sal_Bool bKeepGridMap = sal_False
);
void InvalidateEntry( SvxIconChoiceCtrlEntry* ); void InvalidateEntry( SvxIconChoiceCtrlEntry* );
IcnViewFieldType GetItem( SvxIconChoiceCtrlEntry*, const Point& rAbsPos ); IcnViewFieldType GetItem( SvxIconChoiceCtrlEntry*, const Point& rAbsPos );
...@@ -369,7 +411,8 @@ public: ...@@ -369,7 +411,8 @@ public:
SvxIconChoiceCtrlEntry*, SvxIconChoiceCtrlEntry*,
// sal_True == bei Single-Selection die Sel. mitfuehren // sal_True == bei Single-Selection die Sel. mitfuehren
sal_Bool bSyncSingleSelection = sal_True, sal_Bool bSyncSingleSelection = sal_True,
sal_Bool bShowFocusAsync = sal_False ); sal_Bool bShowFocusAsync = sal_False
);
SvxIconChoiceCtrlEntry* GetEntry( const Point& rDocPos, sal_Bool bHit = sal_False ); SvxIconChoiceCtrlEntry* GetEntry( const Point& rDocPos, sal_Bool bHit = sal_False );
SvxIconChoiceCtrlEntry* GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry ); SvxIconChoiceCtrlEntry* GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry );
...@@ -378,7 +421,11 @@ public: ...@@ -378,7 +421,11 @@ public:
Point GetEntryPos( SvxIconChoiceCtrlEntry* ); Point GetEntryPos( SvxIconChoiceCtrlEntry* );
void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bBound = sal_True ); void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bBound = sal_True );
void Arrange(sal_Bool bKeepPredecessors = sal_False, long nSetMaxVirtWidth =0, long nSetMaxVirtHeight =0 ); void Arrange(
sal_Bool bKeepPredecessors = sal_False,
long nSetMaxVirtWidth =0,
long nSetMaxVirtHeight =0
);
Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* ); Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* );
Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 ); Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 );
...@@ -386,7 +433,8 @@ public: ...@@ -386,7 +433,8 @@ public:
SvxIconChoiceCtrlEntry*, SvxIconChoiceCtrlEntry*,
const Point* pPos = 0, const Point* pPos = 0,
sal_Bool bForInplaceEdit = sal_False, sal_Bool bForInplaceEdit = sal_False,
const String* pStr = 0 ); const String* pStr = 0
);
long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const; long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const;
long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const; long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const;
...@@ -395,7 +443,8 @@ public: ...@@ -395,7 +443,8 @@ public:
void SetBoundingRect_Impl( void SetBoundingRect_Impl(
SvxIconChoiceCtrlEntry* pEntry, SvxIconChoiceCtrlEntry* pEntry,
const Point& rPos, const Point& rPos,
const Size& rBoundingSize ); const Size& rBoundingSize
);
// berechnet alle BoundRects neu // berechnet alle BoundRects neu
void RecalcAllBoundingRects(); void RecalcAllBoundingRects();
// berechnet alle ungueltigen BoundRects neu // berechnet alle ungueltigen BoundRects neu
...@@ -412,7 +461,8 @@ public: ...@@ -412,7 +461,8 @@ public:
sal_Bool bDropTarget, sal_Bool bDropTarget,
sal_Bool bCursored, sal_Bool bCursored,
OutputDevice* pOut, OutputDevice* pOut,
sal_Bool bIsBackgroundPainted = sal_False); sal_Bool bIsBackgroundPainted = sal_False
);
void PaintItem( void PaintItem(
const Rectangle& rRect, const Rectangle& rRect,
...@@ -421,7 +471,8 @@ public: ...@@ -421,7 +471,8 @@ public:
sal_uInt16 nPaintFlags, sal_uInt16 nPaintFlags,
OutputDevice* pOut, OutputDevice* pOut,
const String* pStr = 0, const String* pStr = 0,
::vcl::ControlLayoutData* _pLayoutData = NULL ); ::vcl::ControlLayoutData* _pLayoutData = NULL
);
// berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == sal_True // berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == sal_True
void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); } void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); }
...@@ -446,32 +497,40 @@ public: ...@@ -446,32 +497,40 @@ public:
void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos ); void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos );
void HideShowDDIcon( void HideShowDDIcon(
SvxIconChoiceCtrlEntry* pRefEntry, SvxIconChoiceCtrlEntry* pRefEntry,
const Point& rPos ); const Point& rPos
);
sal_Bool IsOver( sal_Bool IsOver(
SvPtrarr* pSelectedRectList, SvPtrarr* pSelectedRectList,
const Rectangle& rEntryBoundRect ) const; const Rectangle& rEntryBoundRect
) const;
void SelectRect( void SelectRect(
const Rectangle&, const Rectangle&,
sal_Bool bAdd = sal_True, sal_Bool bAdd = sal_True,
SvPtrarr* pOtherRects = 0 ); SvPtrarr* pOtherRects = 0
);
void CalcScrollOffsets( void CalcScrollOffsets(
const Point& rRefPosPixel, const Point& rRefPosPixel,
long& rX, long& rX,
long& rY, long& rY,
sal_Bool bDragDrop = sal_False, sal_Bool bDragDrop = sal_False,
sal_uInt16 nBorderWidth = 10 ); sal_uInt16 nBorderWidth = 10
);
sal_Bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos ); sal_Bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos );
void MakeVisible( void MakeVisible(
const Rectangle& rDocPos, const Rectangle& rDocPos,
sal_Bool bInScrollBarEvent=sal_False, sal_Bool bInScrollBarEvent=sal_False,
sal_Bool bCallRectChangedHdl = sal_True ); sal_Bool bCallRectChangedHdl = sal_True
);
void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 ); void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 );
void SetEntryTextMode( SvxIconChoiceCtrlTextMode, SvxIconChoiceCtrlEntry* pEntry = 0 ); void SetEntryTextMode(
SvxIconChoiceCtrlTextMode,
SvxIconChoiceCtrlEntry* pEntry = 0
);
SvxIconChoiceCtrlTextMode GetTextMode( const SvxIconChoiceCtrlEntry* pEntry = 0 ) const; SvxIconChoiceCtrlTextMode GetTextMode( const SvxIconChoiceCtrlEntry* pEntry = 0 ) const;
void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry ); void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry );
void EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; } void EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; }
...@@ -480,8 +539,15 @@ public: ...@@ -480,8 +539,15 @@ public:
void EditEntry( SvxIconChoiceCtrlEntry* pEntry ); void EditEntry( SvxIconChoiceCtrlEntry* pEntry );
void StopEntryEditing( sal_Bool bCancel ); void StopEntryEditing( sal_Bool bCancel );
void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock ); void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock );
sal_uLong GetEntryCount() const { return aEntries.Count(); } size_t GetEntryCount() const { return aEntries.size(); }
SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return (SvxIconChoiceCtrlEntry*)aEntries.GetObject(nPos); } SvxIconChoiceCtrlEntry* GetEntry( size_t nPos )
{
return aEntries[ nPos ];
}
SvxIconChoiceCtrlEntry* GetEntry( size_t nPos ) const
{
return aEntries[ nPos ];
}
SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( sal_uLong& ) const; SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( sal_uLong& ) const;
SvxIconChoiceCtrlEntry* GetNextSelectedEntry( sal_uLong& ) const; SvxIconChoiceCtrlEntry* GetNextSelectedEntry( sal_uLong& ) const;
SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; } SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; }
...@@ -493,8 +559,10 @@ public: ...@@ -493,8 +559,10 @@ public:
sal_Bool AreEntriesMoved() const { return (sal_Bool)((nFlags & F_MOVED_ENTRIES)!=0); } sal_Bool AreEntriesMoved() const { return (sal_Bool)((nFlags & F_MOVED_ENTRIES)!=0); }
void SetEntriesMoved( sal_Bool bMoved ) void SetEntriesMoved( sal_Bool bMoved )
{ {
if( bMoved ) nFlags |= F_MOVED_ENTRIES; if( bMoved )
else nFlags &= ~(F_MOVED_ENTRIES); nFlags |= F_MOVED_ENTRIES;
else
nFlags &= ~(F_MOVED_ENTRIES);
} }
sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* ) const; sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* ) const;
void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nNewPos ); void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nNewPos );
...@@ -523,10 +591,16 @@ public: ...@@ -523,10 +591,16 @@ public:
Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); } Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); }
Rectangle GetVisibleRect() const { return GetOutputRect(); } Rectangle GetVisibleRect() const { return GetOutputRect(); }
void SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEntry,sal_Bool bKeepHighlightFlags=sal_False ); void SetEntryHighlightFrame(
SvxIconChoiceCtrlEntry* pEntry,
sal_Bool bKeepHighlightFlags=sal_False
);
void HideEntryHighlightFrame(); void HideEntryHighlightFrame();
void DrawHighlightFrame( OutputDevice* pOut, void DrawHighlightFrame(
const Rectangle& rBmpRect, sal_Bool bHide ); OutputDevice* pOut,
const Rectangle& rBmpRect,
sal_Bool bHide
);
void StopSelectTimer() { aCallSelectHdlTimer.Stop(); } void StopSelectTimer() { aCallSelectHdlTimer.Stop(); }
void Tracking( const TrackingEvent& rTEvt ); void Tracking( const TrackingEvent& rTEvt );
Point GetPopupMenuPosPixel() const; Point GetPopupMenuPosPixel() const;
...@@ -535,8 +609,10 @@ public: ...@@ -535,8 +609,10 @@ public:
void CallEventListeners( sal_uLong nEvent, void* pData = NULL ); void CallEventListeners( sal_uLong nEvent, void* pData = NULL );
inline ::svt::IAccessibleFactory& inline ::svt::IAccessibleFactory& GetAccessibleFactory()
GetAccessibleFactory() { return aAccFactory.getFactory(); } {
return aAccFactory.getFactory();
}
}; };
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
...@@ -556,11 +632,23 @@ class IcnCursor_Impl ...@@ -556,11 +632,23 @@ class IcnCursor_Impl
void Create() { if( !pColumns ) ImplCreate(); } void Create() { if( !pColumns ) ImplCreate(); }
sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical); sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical);
SvxIconChoiceCtrlEntry* SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom,sal_uInt16 nPref, SvxIconChoiceCtrlEntry* SearchCol(
sal_Bool bDown, sal_Bool bSimple ); sal_uInt16 nCol,
sal_uInt16 nTop,
SvxIconChoiceCtrlEntry* SearchRow(sal_uInt16 nRow,sal_uInt16 nRight,sal_uInt16 nLeft,sal_uInt16 nPref, sal_uInt16 nBottom,
sal_Bool bRight, sal_Bool bSimple ); sal_uInt16 nPref,
sal_Bool bDown,
sal_Bool bSimple
);
SvxIconChoiceCtrlEntry* SearchRow(
sal_uInt16 nRow,
sal_uInt16 nRight,
sal_uInt16 nLeft,
sal_uInt16 nPref,
sal_Bool bRight,
sal_Bool bSimple
);
public: public:
IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner ); IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner );
...@@ -619,16 +707,15 @@ public: ...@@ -619,16 +707,15 @@ public:
Rectangle GetGridRect( GridId ); Rectangle GetGridRect( GridId );
void GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY ); void GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY );
static sal_uLong GetGridCount( const Size& rSizePixel, sal_uInt16 nGridWidth, sal_uInt16 nGridHeight ); static sal_uLong GetGridCount(
const Size& rSizePixel,
sal_uInt16 nGridWidth,
sal_uInt16 nGridHeight
);
void OutputSizeChanged(); void OutputSizeChanged();
}; };
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -224,13 +224,13 @@ void SvxIconChoiceCtrl_Impl::Clear( sal_Bool bInCtor ) ...@@ -224,13 +224,13 @@ void SvxIconChoiceCtrl_Impl::Clear( sal_Bool bInCtor )
pView->Invalidate(INVALIDATE_NOCHILDREN); pView->Invalidate(INVALIDATE_NOCHILDREN);
} }
AdjustScrollBars(); AdjustScrollBars();
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ];
delete pCur; delete pCur;
} }
aEntries.Clear(); aEntries.clear();
DocRectChanged(); DocRectChanged();
VisRectChanged(); VisRectChanged();
} }
...@@ -292,19 +292,18 @@ void SvxIconChoiceCtrl_Impl::FontModified() ...@@ -292,19 +292,18 @@ void SvxIconChoiceCtrl_Impl::FontModified()
ShowCursor( sal_True ); ShowCursor( sal_True );
} }
void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos, void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, size_t nPos,
const Point* pPos ) const Point* pPos )
{ {
StopEditTimer(); StopEditTimer();
aEntries.Insert( pEntry, nPos ); aEntries.insert( nPos, pEntry );
if( (nFlags & F_ENTRYLISTPOS_VALID) && nPos >= aEntries.Count() - 1 ) if( (nFlags & F_ENTRYLISTPOS_VALID) && nPos >= aEntries.size() - 1 )
pEntry->nPos = aEntries.Count() - 1; pEntry->nPos = aEntries.size() - 1;
else else
nFlags &= ~F_ENTRYLISTPOS_VALID; nFlags &= ~F_ENTRYLISTPOS_VALID;
pZOrderList->Insert( (void*)pEntry, LIST_APPEND ); //pZOrderList->Count() ); pZOrderList->Insert( (void*)pEntry, LIST_APPEND ); //pZOrderList->Count() );
pImpCursor->Clear(); pImpCursor->Clear();
// pGridMap->Clear();
if( pPos ) if( pPos )
{ {
Size aSize( CalcBoundingSize( pEntry ) ); Size aSize( CalcBoundingSize( pEntry ) );
...@@ -376,10 +375,10 @@ void SvxIconChoiceCtrl_Impl::SetListPositions() ...@@ -376,10 +375,10 @@ void SvxIconChoiceCtrl_Impl::SetListPositions()
if( nFlags & F_ENTRYLISTPOS_VALID ) if( nFlags & F_ENTRYLISTPOS_VALID )
return; return;
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
pEntry->nPos = nCur; pEntry->nPos = nCur;
} }
nFlags |= F_ENTRYLISTPOS_VALID; nFlags |= F_ENTRYLISTPOS_VALID;
...@@ -408,7 +407,7 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ) ...@@ -408,7 +407,7 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry )
if( pEntry->IsSelected() ) if( pEntry->IsSelected() )
CallSelectHandler( 0 ); CallSelectHandler( 0 );
if( aEntries.Count() == 1 && aEntries.GetObject(0) == pEntry ) if( aEntries.size() == 1 && aEntries[ 0 ] == pEntry )
{ {
Clear(); Clear();
return; return;
...@@ -435,21 +434,21 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ) ...@@ -435,21 +434,21 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry )
} }
sal_Bool bCurEntryPosValid = (nFlags & F_ENTRYLISTPOS_VALID) ? sal_True : sal_False; sal_Bool bCurEntryPosValid = (nFlags & F_ENTRYLISTPOS_VALID) ? sal_True : sal_False;
if( bCurEntryPosValid && aEntries.GetObject(aEntries.Count()-1) != pEntry ) if( bCurEntryPosValid && aEntries[ aEntries.size()-1 ] != pEntry )
nFlags &= ~F_ENTRYLISTPOS_VALID; nFlags &= ~F_ENTRYLISTPOS_VALID;
sal_uLong nPos = pZOrderList->GetPos( (void*)pEntry ); sal_uLong nPos = pZOrderList->GetPos( (void*)pEntry );
pZOrderList->Remove( nPos ); pZOrderList->Remove( nPos );
if( bCurEntryPosValid ) if( bCurEntryPosValid )
{ {
DBG_ASSERT(aEntries.GetObject(pEntry->nPos)==pEntry,"RemoveEntry: Wrong nPos in entry"); DBG_ASSERT(aEntries.GetObject(pEntry->nPos)==pEntry,"RemoveEntry: Wrong nPos in entry");
aEntries.Remove( pEntry->nPos ); aEntries.remove( pEntry->nPos );
} }
else else
aEntries.Remove( pEntry ); aEntries.remove( pEntry );
pImpCursor->Clear(); pImpCursor->Clear();
pGridMap->Clear(); pGridMap->Clear();
delete pEntry; delete pEntry;
if( IsAutoArrange() && aEntries.Count() ) if( IsAutoArrange() && aEntries.size() )
aAutoArrangeTimer.Start(); aAutoArrangeTimer.Start();
if( bSetNewCursor ) if( bSetNewCursor )
{ {
...@@ -544,10 +543,10 @@ void SvxIconChoiceCtrl_Impl::ResetVirtSize() ...@@ -544,10 +543,10 @@ void SvxIconChoiceCtrl_Impl::ResetVirtSize()
StopEditTimer(); StopEditTimer();
aVirtOutputSize.Width() = 0; aVirtOutputSize.Width() = 0;
aVirtOutputSize.Height() = 0; aVirtOutputSize.Height() = 0;
const sal_uLong nCount = aEntries.Count(); const size_t nCount = aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ];
pCur->ClearFlags( ICNVIEW_FLAG_POS_MOVED ); pCur->ClearFlags( ICNVIEW_FLAG_POS_MOVED );
if( pCur->IsPosLocked() ) if( pCur->IsPosLocked() )
{ {
...@@ -616,25 +615,25 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const Rectangle& rRect ) ...@@ -616,25 +615,25 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const Rectangle& rRect )
void SvxIconChoiceCtrl_Impl::InitPredecessors() void SvxIconChoiceCtrl_Impl::InitPredecessors()
{ {
DBG_ASSERT(!pHead,"SvxIconChoiceCtrl_Impl::InitPredecessors() >> Already initialized"); DBG_ASSERT(!pHead,"SvxIconChoiceCtrl_Impl::InitPredecessors() >> Already initialized");
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
if( nCount ) if( nCount )
{ {
SvxIconChoiceCtrlEntry* pPrev = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); SvxIconChoiceCtrlEntry* pPrev = aEntries[ 0 ];
for( sal_uLong nCur = 1; nCur <= nCount; nCur++ ) for( size_t nCur = 1; nCur <= nCount; nCur++ )
{ {
pPrev->ClearFlags( ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED | pPrev->ClearFlags( ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED |
ICNVIEW_FLAG_PRED_SET); ICNVIEW_FLAG_PRED_SET);
SvxIconChoiceCtrlEntry* pNext; SvxIconChoiceCtrlEntry* pNext;
if( nCur == nCount ) if( nCur == nCount )
pNext = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); pNext = aEntries[ 0 ];
else else
pNext = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); pNext = aEntries[ nCur ];
pPrev->pflink = pNext; pPrev->pflink = pNext;
pNext->pblink = pPrev; pNext->pblink = pPrev;
pPrev = pNext; pPrev = pNext;
} }
pHead = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); pHead = aEntries[ 0 ];
} }
else else
pHead = 0; pHead = 0;
...@@ -645,10 +644,10 @@ void SvxIconChoiceCtrl_Impl::ClearPredecessors() ...@@ -645,10 +644,10 @@ void SvxIconChoiceCtrl_Impl::ClearPredecessors()
{ {
if( pHead ) if( pHead )
{ {
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ];
pCur->pflink = 0; pCur->pflink = 0;
pCur->pblink = 0; pCur->pblink = 0;
pCur->ClearFlags( ICNVIEW_FLAG_PRED_SET ); pCur->ClearFlags( ICNVIEW_FLAG_PRED_SET );
...@@ -750,7 +749,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) ...@@ -750,7 +749,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect )
#endif #endif
nFlags |= F_PAINTED; nFlags |= F_PAINTED;
if( !aEntries.Count() ) if( !aEntries.size() )
return; return;
if( !pCursor ) if( !pCursor )
{ {
...@@ -767,7 +766,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) ...@@ -767,7 +766,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect )
} }
if( !bfound ) if( !bfound )
pCursor = (SvxIconChoiceCtrlEntry*)aEntries.First(); pCursor = aEntries[ 0 ];
} }
// Show Focus at Init-Time // Show Focus at Init-Time
...@@ -786,8 +785,8 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) ...@@ -786,8 +785,8 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect )
pView->SetClipRegion( aOutputArea ); pView->SetClipRegion( aOutputArea );
} }
const sal_uInt16 nListInitSize = aEntries.Count() > USHRT_MAX ? const sal_uInt16 nListInitSize = aEntries.size() > USHRT_MAX ?
USHRT_MAX : (sal_uInt16)aEntries.Count(); USHRT_MAX : (sal_uInt16)aEntries.size();
List* pNewZOrderList = new List( nListInitSize ); List* pNewZOrderList = new List( nListInitSize );
List* pPaintedEntries = new List( nListInitSize ); List* pPaintedEntries = new List( nListInitSize );
...@@ -1379,7 +1378,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) ...@@ -1379,7 +1378,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt )
case KEY_END: case KEY_END:
if( pCursor ) if( pCursor )
{ {
pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( aEntries.Count() - 1 ); pNewCursor = aEntries[ aEntries.size() - 1 ];
SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True ); SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True );
} }
break; break;
...@@ -1387,7 +1386,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) ...@@ -1387,7 +1386,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt )
case KEY_HOME: case KEY_HOME:
if( pCursor ) if( pCursor )
{ {
pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); pNewCursor = aEntries[ 0 ];
SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True ); SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True );
} }
break; break;
...@@ -2345,15 +2344,15 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() ...@@ -2345,15 +2344,15 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects()
{ {
nMaxBoundHeight = 0; nMaxBoundHeight = 0;
pZOrderList->Clear(); pZOrderList->Clear();
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
sal_uLong nCur; size_t nCur;
SvxIconChoiceCtrlEntry* pEntry; SvxIconChoiceCtrlEntry* pEntry;
if( !IsAutoArrange() || !pHead ) if( !IsAutoArrange() || !pHead )
{ {
for( nCur = 0; nCur < nCount; nCur++ ) for( nCur = 0; nCur < nCount; nCur++ )
{ {
pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); pEntry = aEntries[ nCur ];
FindBoundingRect( pEntry ); FindBoundingRect( pEntry );
pZOrderList->Insert( pEntry, LIST_APPEND ); pZOrderList->Insert( pEntry, LIST_APPEND );
} }
...@@ -2379,15 +2378,15 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() ...@@ -2379,15 +2378,15 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart()
{ {
nMaxBoundHeight = 0; nMaxBoundHeight = 0;
pZOrderList->Clear(); pZOrderList->Clear();
sal_uLong nCur; size_t nCur;
SvxIconChoiceCtrlEntry* pEntry; SvxIconChoiceCtrlEntry* pEntry;
const sal_uLong nCount = aEntries.Count(); const size_t nCount = aEntries.size();
if( !IsAutoArrange() || !pHead ) if( !IsAutoArrange() || !pHead )
{ {
for( nCur = 0; nCur < nCount; nCur++ ) for( nCur = 0; nCur < nCount; nCur++ )
{ {
pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); pEntry = aEntries[ nCur ];
if( IsBoundingRectValid( pEntry->aRect )) if( IsBoundingRectValid( pEntry->aRect ))
{ {
Size aBoundSize( pEntry->aRect.GetSize() ); Size aBoundSize( pEntry->aRect.GetSize() );
...@@ -2424,10 +2423,10 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() ...@@ -2424,10 +2423,10 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart()
void SvxIconChoiceCtrl_Impl::UpdateBoundingRects() void SvxIconChoiceCtrl_Impl::UpdateBoundingRects()
{ {
const sal_uLong nCount = aEntries.Count(); const size_t nCount = aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
GetEntryBoundRect( pEntry ); GetEntryBoundRect( pEntry );
} }
} }
...@@ -2906,7 +2905,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindNewCursor() ...@@ -2906,7 +2905,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindNewCursor()
} }
} }
else else
pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.First(); pNewCursor = aEntries[ 0 ];
DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"FindNewCursor failed"); DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"FindNewCursor failed");
return pNewCursor; return pNewCursor;
} }
...@@ -2935,10 +2934,10 @@ void SvxIconChoiceCtrl_Impl::DeselectAllBut( SvxIconChoiceCtrlEntry* pThisEntryN ...@@ -2935,10 +2934,10 @@ void SvxIconChoiceCtrl_Impl::DeselectAllBut( SvxIconChoiceCtrlEntry* pThisEntryN
// //
// !!!!!!! Todo: Evtl. Z-Orderlist abarbeiten !!!!!!! // !!!!!!! Todo: Evtl. Z-Orderlist abarbeiten !!!!!!!
// //
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
if( pEntry != pThisEntryNot && pEntry->IsSelected() ) if( pEntry != pThisEntryNot && pEntry->IsSelected() )
SelectEntry( pEntry, sal_False, sal_True, sal_True, bPaintSync ); SelectEntry( pEntry, sal_False, sal_True, sal_True, bPaintSync );
} }
...@@ -3605,8 +3604,8 @@ sal_Bool SvxIconChoiceCtrl_Impl::IsMnemonicChar( sal_Unicode cChar, sal_uLong& r ...@@ -3605,8 +3604,8 @@ sal_Bool SvxIconChoiceCtrl_Impl::IsMnemonicChar( sal_Unicode cChar, sal_uLong& r
{ {
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
sal_uLong nEntryCount = GetEntryCount(); size_t nEntryCount = GetEntryCount();
for ( sal_uLong i = 0; i < nEntryCount; ++i ) for ( size_t i = 0; i < nEntryCount; ++i )
{ {
if ( rI18nHelper.MatchMnemonic( GetEntry( i )->GetText(), cChar ) ) if ( rI18nHelper.MatchMnemonic( GetEntry( i )->GetText(), cChar ) )
{ {
...@@ -3751,12 +3750,12 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong ...@@ -3751,12 +3750,12 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong
return pCurHighlightFrame; return pCurHighlightFrame;
} }
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
if( !pHead ) if( !pHead )
{ {
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
if( pEntry->IsSelected() ) if( pEntry->IsSelected() )
{ {
rPos = nCur; rPos = nCur;
...@@ -3788,14 +3787,14 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong ...@@ -3788,14 +3787,14 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong
// kein Round Robin! // kein Round Robin!
SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong& rStartPos ) const SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong& rStartPos ) const
{ {
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
if( rStartPos > nCount || !GetSelectionCount() ) if( rStartPos > nCount || !GetSelectionCount() )
return 0; return 0;
if( !pHead ) if( !pHead )
{ {
for( sal_uLong nCur = rStartPos+1; nCur < nCount; nCur++ ) for( size_t nCur = rStartPos+1; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
if( pEntry->IsSelected() ) if( pEntry->IsSelected() )
{ {
rStartPos = nCur; rStartPos = nCur;
...@@ -3805,7 +3804,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong& ...@@ -3805,7 +3804,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong&
} }
else else
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( rStartPos ); SvxIconChoiceCtrlEntry* pEntry = aEntries[ rStartPos ];
pEntry = pEntry->pflink; pEntry = pEntry->pflink;
while( pEntry != pHead ) while( pEntry != pHead )
{ {
...@@ -3826,10 +3825,10 @@ void SvxIconChoiceCtrl_Impl::SelectAll( sal_Bool bSelect, sal_Bool bPaint ) ...@@ -3826,10 +3825,10 @@ void SvxIconChoiceCtrl_Impl::SelectAll( sal_Bool bSelect, sal_Bool bPaint )
{ {
bPaint = sal_True; bPaint = sal_True;
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount && (bSelect || GetSelectionCount() ); nCur++ ) for( size_t nCur = 0; nCur < nCount && (bSelect || GetSelectionCount() ); nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
SelectEntry( pEntry, bSelect, sal_True, sal_True, bPaint ); SelectEntry( pEntry, bSelect, sal_True, sal_True, bPaint );
} }
nFlags &= (~F_ADD_MODE); nFlags &= (~F_ADD_MODE);
...@@ -3986,13 +3985,13 @@ sal_uLong SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntr ...@@ -3986,13 +3985,13 @@ sal_uLong SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntr
void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry, sal_uLong nNewPos ) void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry, sal_uLong nNewPos )
{ {
sal_uLong nCurPos = GetEntryListPos( pListEntry ); size_t nCurPos = GetEntryListPos( pListEntry );
if( nCurPos == nNewPos ) if( nCurPos == nNewPos )
return; return;
aEntries.List::Remove( nCurPos ); aEntries.remove( nCurPos );
aEntries.List::Insert( (void*)pListEntry, nNewPos ); aEntries.insert( nNewPos, pListEntry );
// Eintragspositionen anpassen // Eintragspositionen anpassen
sal_uLong nStart, nEnd; size_t nStart, nEnd;
if( nNewPos < nCurPos ) if( nNewPos < nCurPos )
{ {
nStart = nNewPos; nStart = nNewPos;
...@@ -4005,7 +4004,7 @@ void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry ...@@ -4005,7 +4004,7 @@ void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry
} }
for( ; nStart <= nEnd; nStart++ ) for( ; nStart <= nEnd; nStart++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nStart ); SvxIconChoiceCtrlEntry* pEntry = aEntries[ nStart ];
pEntry->nPos = nStart; pEntry->nPos = nStart;
} }
} }
...@@ -4073,15 +4072,7 @@ void SvxIconChoiceCtrl_Impl::InitSettings() ...@@ -4073,15 +4072,7 @@ void SvxIconChoiceCtrl_Impl::InitSettings()
} }
} }
EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner, sal_uInt16 _nInitSize , sal_uInt16 _nReSize ) : EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner ) :
List( _nInitSize, _nReSize ),
_pOwner( pOwner )
{
_pOwner->pHead = 0;
}
EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner, sal_uInt16 _nBlockSize, sal_uInt16 _nInitSize, sal_uInt16 _nReSize ) :
List( _nBlockSize, _nInitSize, _nReSize ),
_pOwner( pOwner ) _pOwner( pOwner )
{ {
_pOwner->pHead = 0; _pOwner->pHead = 0;
...@@ -4092,31 +4083,47 @@ EntryList_Impl::~EntryList_Impl() ...@@ -4092,31 +4083,47 @@ EntryList_Impl::~EntryList_Impl()
_pOwner->pHead = 0; _pOwner->pHead = 0;
} }
void EntryList_Impl::Clear() void EntryList_Impl::clear()
{ {
_pOwner->pHead = 0; _pOwner->pHead = 0;
List::Clear(); maIconChoiceCtrlEntryList.clear();
} }
void EntryList_Impl::Insert( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos ) void EntryList_Impl::insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry )
{ {
List::Insert( pEntry, nPos ); if ( nPos < maIconChoiceCtrlEntryList.size() ) {
maIconChoiceCtrlEntryList.insert( maIconChoiceCtrlEntryList.begin() + nPos, pEntry );
} else {
maIconChoiceCtrlEntryList.push_back( pEntry );
}
if( _pOwner->pHead ) if( _pOwner->pHead )
pEntry->SetBacklink( _pOwner->pHead->pblink ); pEntry->SetBacklink( _pOwner->pHead->pblink );
} }
SvxIconChoiceCtrlEntry* EntryList_Impl::Remove( sal_uLong nPos ) SvxIconChoiceCtrlEntry* EntryList_Impl::remove( size_t nPos )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)List::Remove( nPos ); SvxIconChoiceCtrlEntry* pEntry = NULL;
DBG_ASSERT(pEntry,"EntryList_Impl::Remove > Entry not found"); if ( nPos < maIconChoiceCtrlEntryList.size() ) {
pEntry = maIconChoiceCtrlEntryList[ nPos ];
maIconChoiceCtrlEntryList.erase( maIconChoiceCtrlEntryList.begin() + nPos );
Removed_Impl( pEntry ); Removed_Impl( pEntry );
}
return pEntry; return pEntry;
} }
void EntryList_Impl::Remove( SvxIconChoiceCtrlEntry* pEntry ) void EntryList_Impl::remove( SvxIconChoiceCtrlEntry* pEntry )
{ {
List::Remove( (void*)pEntry ); for (
SvxIconChoiceCtrlEntryList_impl::iterator it = maIconChoiceCtrlEntryList.begin();
it < maIconChoiceCtrlEntryList.end();
++it
) {
if ( *it == pEntry ) {
maIconChoiceCtrlEntryList.erase( it );
Removed_Impl( pEntry ); Removed_Impl( pEntry );
break;
}
}
} }
void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry )
...@@ -4139,14 +4146,14 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) ...@@ -4139,14 +4146,14 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry )
void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMode ) void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMode )
{ {
sal_uLong nCur; size_t nCur;
if( eMode == ePositionMode ) if( eMode == ePositionMode )
return; return;
SvxIconChoiceCtrlPositionMode eOldMode = ePositionMode; SvxIconChoiceCtrlPositionMode eOldMode = ePositionMode;
ePositionMode = eMode; ePositionMode = eMode;
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
if( eOldMode == IcnViewPositionModeAutoArrange ) if( eOldMode == IcnViewPositionModeAutoArrange )
{ {
...@@ -4154,7 +4161,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod ...@@ -4154,7 +4161,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod
// mit ungewollten Ueberlappungen, da diese Eintrage im Arrange // mit ungewollten Ueberlappungen, da diese Eintrage im Arrange
// nicht beruecksichtigt werden. // nicht beruecksichtigt werden.
#if 1 #if 1
if( aEntries.Count() ) if( aEntries.size() )
aAutoArrangeTimer.Start(); aAutoArrangeTimer.Start();
#else #else
if( pHead ) if( pHead )
...@@ -4181,7 +4188,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod ...@@ -4181,7 +4188,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod
List aMovedEntries; List aMovedEntries;
for( nCur = 0; nCur < nCount; nCur++ ) for( nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
if( pEntry->GetFlags() & (ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED)) if( pEntry->GetFlags() & (ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED))
{ {
SvxIconChoiceCtrlEntry_Impl* pE = new SvxIconChoiceCtrlEntry_Impl( SvxIconChoiceCtrlEntry_Impl* pE = new SvxIconChoiceCtrlEntry_Impl(
...@@ -4197,7 +4204,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod ...@@ -4197,7 +4204,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod
} }
for( nCur = 0; nCur < nCount; nCur++ ) for( nCur = 0; nCur < nCount; nCur++ )
delete (SvxIconChoiceCtrlEntry_Impl*)aMovedEntries.GetObject( nCur ); delete (SvxIconChoiceCtrlEntry_Impl*)aMovedEntries.GetObject( nCur );
if( aEntries.Count() ) if( aEntries.size() )
aAutoArrangeTimer.Start(); aAutoArrangeTimer.Start();
} }
else if( ePositionMode == IcnViewPositionModeAutoAdjust ) else if( ePositionMode == IcnViewPositionModeAutoAdjust )
...@@ -4267,7 +4274,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::GetEntryPredecessor( SvxIconChoiceCtrlEntry* pE ...@@ -4267,7 +4274,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::GetEntryPredecessor( SvxIconChoiceCtrlEntry* pE
if( pEntry == pHead ) if( pEntry == pHead )
{ {
SvxIconChoiceCtrlEntry* pFirst = (SvxIconChoiceCtrlEntry*)aEntries.GetObject(0); SvxIconChoiceCtrlEntry* pFirst = aEntries[ 0 ];
if( pFirst != pEntry ) if( pFirst != pEntry )
return sal_True; return sal_True;
return sal_False; return sal_False;
...@@ -4286,13 +4293,13 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindEntryPredecessor( SvxIconCho ...@@ -4286,13 +4293,13 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindEntryPredecessor( SvxIconCho
Rectangle aCenterRect( CalcBmpRect( pEntry, &aPos )); Rectangle aCenterRect( CalcBmpRect( pEntry, &aPos ));
Point aNewPos( aCenterRect.Center() ); Point aNewPos( aCenterRect.Center() );
sal_uLong nGrid = GetPredecessorGrid( aNewPos ); sal_uLong nGrid = GetPredecessorGrid( aNewPos );
sal_uLong nCount = aEntries.Count(); size_t nCount = aEntries.size();
if( nGrid == ULONG_MAX ) if( nGrid == ULONG_MAX )
return 0; return 0;
if( nGrid >= nCount ) if( nGrid >= nCount )
nGrid = nCount - 1; nGrid = nCount - 1;
if( !pHead ) if( !pHead )
return (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nGrid ); return aEntries[ nGrid ];
SvxIconChoiceCtrlEntry* pCur = pHead; // Grid 0 SvxIconChoiceCtrlEntry* pCur = pHead; // Grid 0
// todo: Liste von hinten aufrollen wenn nGrid > nCount/2 // todo: Liste von hinten aufrollen wenn nGrid > nCount/2
......
...@@ -85,10 +85,10 @@ void IcnCursor_Impl::ImplCreate() ...@@ -85,10 +85,10 @@ void IcnCursor_Impl::ImplCreate()
pColumns = new SvPtrarr[ nCols ]; pColumns = new SvPtrarr[ nCols ];
pRows = new SvPtrarr[ nRows ]; pRows = new SvPtrarr[ nRows ];
sal_uLong nCount = pView->aEntries.Count(); size_t nCount = pView->aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ];
// const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); // const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
Rectangle rRect( pView->CalcBmpRect( pEntry,0 ) ); Rectangle rRect( pView->CalcBmpRect( pEntry,0 ) );
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight ); short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight );
...@@ -357,8 +357,8 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS ...@@ -357,8 +357,8 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS
if( bDown ) if( bDown )
{ {
nNewPos += nEntriesInView; nNewPos += nEntriesInView;
if( nNewPos >= (long)pView->aEntries.Count() ) if( nNewPos >= (long)pView->aEntries.size() )
nNewPos = pView->aEntries.Count() - 1; nNewPos = pView->aEntries.size() - 1;
} }
else else
{ {
...@@ -367,7 +367,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS ...@@ -367,7 +367,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS
nNewPos = 0; nNewPos = 0;
} }
if( nPos != nNewPos ) if( nPos != nNewPos )
return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( (sal_uLong)nNewPos ); return pView->aEntries[ (size_t)nNewPos ];
return 0; return 0;
} }
long nOpt = pView->GetEntryBoundRect( pStart ).Top(); long nOpt = pView->GetEntryBoundRect( pStart ).Top();
...@@ -410,10 +410,10 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pCtrlE ...@@ -410,10 +410,10 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pCtrlE
if( pView->IsAutoArrange() && !(pView->nWinBits & WB_ALIGN_TOP) ) if( pView->IsAutoArrange() && !(pView->nWinBits & WB_ALIGN_TOP) )
{ {
sal_uLong nPos = pView->GetEntryListPos( pCtrlEntry ); sal_uLong nPos = pView->GetEntryListPos( pCtrlEntry );
if( bDown && nPos < (pView->aEntries.Count() - 1) ) if( bDown && nPos < (pView->aEntries.size() - 1) )
return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos + 1 ); return pView->aEntries[ nPos + 1 ];
else if( !bDown && nPos > 0 ) else if( !bDown && nPos > 0 )
return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos - 1 ); return pView->aEntries[ nPos - 1 ];
return 0; return 0;
} }
...@@ -504,10 +504,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt ...@@ -504,10 +504,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt
SvPtrarr* pRow = new SvPtrarr; SvPtrarr* pRow = new SvPtrarr;
rLists.Insert( (void*)pRow, nCurList ); rLists.Insert( (void*)pRow, nCurList );
} }
const sal_uLong nCount = pView->aEntries.Count(); const size_t nCount = pView->aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ];
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
sal_uInt16 nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),sal_False); sal_uInt16 nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),sal_False);
...@@ -523,10 +523,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt ...@@ -523,10 +523,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt
short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY ); short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY );
SvPtrarr* pRow = new SvPtrarr; SvPtrarr* pRow = new SvPtrarr;
rLists.Insert( (void*)pRow, 0 ); rLists.Insert( (void*)pRow, 0 );
sal_uLong nCount = pView->aEntries.Count(); size_t nCount = pView->aEntries.size();
for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) for( size_t nCur = 0; nCur < nCount; nCur++ )
{ {
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur ); SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ];
Rectangle rRect( pView->CalcBmpRect(pEntry) ); Rectangle rRect( pView->CalcBmpRect(pEntry) );
//const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); //const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
...@@ -601,9 +601,9 @@ void IcnGridMap_Impl::Create_Impl() ...@@ -601,9 +601,9 @@ void IcnGridMap_Impl::Create_Impl()
_pGridMap = new sal_Bool[ _nGridRows * _nGridCols]; _pGridMap = new sal_Bool[ _nGridRows * _nGridCols];
memset( (void*)_pGridMap, 0, _nGridRows * _nGridCols ); memset( (void*)_pGridMap, 0, _nGridRows * _nGridCols );
const sal_uLong nCount = _pView->aEntries.Count(); const size_t nCount = _pView->aEntries.size();
for( sal_uLong nCur=0; nCur < nCount; nCur++ ) for( size_t nCur=0; nCur < nCount; nCur++ )
OccupyGrids( (SvxIconChoiceCtrlEntry*)_pView->aEntries.GetObject( nCur )); OccupyGrids( _pView->aEntries[ nCur ] );
} }
void IcnGridMap_Impl::GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const void IcnGridMap_Impl::GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment