1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: imivctl2.cxx,v $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
33 #include "imivctl.hxx"
35 IcnCursor_Impl::IcnCursor_Impl( SvxIconChoiceCtrl_Impl
* pOwner
)
47 IcnCursor_Impl::~IcnCursor_Impl()
53 USHORT
IcnCursor_Impl::GetSortListPos( SvPtrarr
* pList
, long nValue
,
56 USHORT nCount
= (USHORT
)pList
->Count();
61 long nPrevValue
= LONG_MIN
;
64 const Rectangle
& rRect
=
65 pView
->GetEntryBoundRect((SvxIconChoiceCtrlEntry
*)(pList
->GetObject(nCurPos
)));
68 nCurValue
= rRect
.Top();
70 nCurValue
= rRect
.Left();
71 if( nValue
>= nPrevValue
&& nValue
<= nCurValue
)
72 return (USHORT
)nCurPos
;
73 nPrevValue
= nCurValue
;
77 return pList
->Count();
80 void IcnCursor_Impl::ImplCreate()
82 pView
->CheckBoundingRects();
83 DBG_ASSERT(pColumns
==0&&pRows
==0,"ImplCreate: Not cleared");
87 pColumns
= new SvPtrarr
[ nCols
];
88 pRows
= new SvPtrarr
[ nRows
];
90 ULONG nCount
= pView
->aEntries
.Count();
91 for( ULONG nCur
= 0; nCur
< nCount
; nCur
++ )
93 SvxIconChoiceCtrlEntry
* pEntry
= (SvxIconChoiceCtrlEntry
*)pView
->aEntries
.GetObject( nCur
);
94 // const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
95 Rectangle
rRect( pView
->CalcBmpRect( pEntry
,0 ) );
96 short nY
= (short)( ((rRect
.Top()+rRect
.Bottom())/2) / nDeltaHeight
);
97 short nX
= (short)( ((rRect
.Left()+rRect
.Right())/2) / nDeltaWidth
);
99 // Rundungsfehler abfangen
101 nY
= sal::static_int_cast
< short >(nRows
- 1);
103 nX
= sal::static_int_cast
< short >(nCols
- 1);
105 USHORT nIns
= GetSortListPos( &pColumns
[nX
], rRect
.Top(), TRUE
);
106 pColumns
[ nX
].Insert( pEntry
, nIns
);
108 nIns
= GetSortListPos( &pRows
[nY
], rRect
.Left(), FALSE
);
109 pRows
[ nY
].Insert( pEntry
, nIns
);
119 void IcnCursor_Impl::Clear()
133 SvxIconChoiceCtrlEntry
* IcnCursor_Impl::SearchCol(USHORT nCol
,USHORT nTop
,USHORT nBottom
,
134 USHORT
, BOOL bDown
, BOOL bSimple
)
136 DBG_ASSERT(pCurEntry
,"SearchCol: No reference entry");
137 SvPtrarr
* pList
= &(pColumns
[ nCol
]);
138 const USHORT nCount
= pList
->Count();
142 const Rectangle
& rRefRect
= pView
->GetEntryBoundRect(pCurEntry
);
146 USHORT nListPos
= pList
->GetPos( pCurEntry
);
147 DBG_ASSERT(nListPos
!=0xffff,"Entry not in Col-List");
150 while( nListPos
< nCount
-1 )
153 SvxIconChoiceCtrlEntry
* pEntry
= (SvxIconChoiceCtrlEntry
*)pList
->GetObject( nListPos
);
154 const Rectangle
& rRect
= pView
->GetEntryBoundRect( pEntry
);
155 if( rRect
.Top() > rRefRect
.Top() )
165 if( nListPos
< nCount
)
167 SvxIconChoiceCtrlEntry
* pEntry
= (SvxIconChoiceCtrlEntry
*)pList
->GetObject( nListPos
);
168 const Rectangle
& rRect
= pView
->GetEntryBoundRect( pEntry
);
169 if( rRect
.Top() < rRefRect
.Top() )
183 long nMinDistance
= LONG_MAX
;
184 SvxIconChoiceCtrlEntry
* pResult
= 0;
185 for( USHORT nCur
= 0; nCur
< nCount
; nCur
++ )
187 SvxIconChoiceCtrlEntry
* pEntry
= (SvxIconChoiceCtrlEntry
*)(pList
->GetObject( nCur
));
188 if( pEntry
!= pCurEntry
)
190 USHORT nY
= pEntry
->nY
;
191 if( nY
>= nTop
&& nY
<= nBottom
)
193 const Rectangle
& rRect
= pView
->GetEntryBoundRect( pEntry
);
194 long nDistance
= rRect
.Top() - rRefRect
.Top();
197 if( nDistance
&& nDistance
< nMinDistance
)
199 nMinDistance
= nDistance
;
208 SvxIconChoiceCtrlEntry
* IcnCursor_Impl::SearchRow(USHORT nRow
,USHORT nLeft
,USHORT nRight
,
209 USHORT
, BOOL bRight
, BOOL bSimple
)
211 DBG_ASSERT(pCurEntry
,"SearchRow: No reference entry");
212 SvPtrarr
* pList
= &(pRows
[ nRow
]);
213 const USHORT nCount
= pList
->Count();
217 const Rectangle
& rRefRect
= pView
->GetEntryBoundRect(pCurEntry
);
221 USHORT nListPos
= pList
->GetPos( pCurEntry
);
222 DBG_ASSERT(nListPos
!=0xffff,"Entry not in Row-List");
225 while( nListPos
< nCount
-1 )
228 SvxIconChoiceCtrlEntry
* pEntry
= (SvxIconChoiceCtrlEntry
*)pList
->GetObject( nListPos
);
229 const Rectangle
& rRect
= pView
->GetEntryBoundRect( pEntry
);
230 if( rRect
.Left() > rRefRect
.Left() )
240 if( nListPos
< nCount
)
242 SvxIconChoiceCtrlEntry
* pEntry
= (SvxIconChoiceCtrlEntry
*)pList
->GetObject( nListPos
);
243 const Rectangle
& rRect
= pView
->GetEntryBoundRect( pEntry
);
244 if( rRect
.Left() < rRefRect
.Left() )
254 USHORT nTemp
= nRight
;
258 long nMinDistance
= LONG_MAX
;
259 SvxIconChoiceCtrlEntry
* pResult
= 0;
260 for( USHORT nCur
= 0; nCur
< nCount
; nCur
++ )
262 SvxIconChoiceCtrlEntry
* pEntry
= (SvxIconChoiceCtrlEntry
*)(pList
->GetObject( nCur
));
263 if( pEntry
!= pCurEntry
)
265 USHORT nX
= pEntry
->nX
;
266 if( nX
>= nLeft
&& nX
<= nRight
)
268 const Rectangle
& rRect
= pView
->GetEntryBoundRect( pEntry
);
269 long nDistance
= rRect
.Left() - rRefRect
.Left();
272 if( nDistance
&& nDistance
< nMinDistance
)
274 nMinDistance
= nDistance
;
286 Sucht ab dem uebergebenen Eintrag den naechsten rechts- bzw.
287 linksstehenden. Suchverfahren am Beispiel bRight = TRUE:
292 S 1 1 1 ====> Suchrichtung
298 1 : erstes Suchrechteck
299 a,b,c : 2., 3., 4. Suchrechteck
302 SvxIconChoiceCtrlEntry
* IcnCursor_Impl::GoLeftRight( SvxIconChoiceCtrlEntry
* pCtrlEntry
, BOOL bRight
)
304 SvxIconChoiceCtrlEntry
* pResult
;
305 pCurEntry
= pCtrlEntry
;
307 USHORT nY
= pCtrlEntry
->nY
;
308 USHORT nX
= pCtrlEntry
->nX
;
309 DBG_ASSERT(nY
< nRows
,"GoLeftRight:Bad column");
310 DBG_ASSERT(nX
< nCols
,"GoLeftRight:Bad row");
311 // Nachbar auf gleicher Zeile ?
314 nY
, nX
, sal::static_int_cast
< USHORT
>(nCols
-1), nX
, TRUE
, TRUE
);
316 pResult
= SearchRow( nY
, nX
,0, nX
, FALSE
, TRUE
);
322 long nColOffs
, nLastCol
;
331 nLastCol
= -1; // 0-1
338 SvxIconChoiceCtrlEntry
* pEntry
= SearchCol((USHORT
)nCurCol
,nRowMin
,nRowMax
,nY
,TRUE
, FALSE
);
343 if( nRowMax
< (nRows
-1))
346 } while( nCurCol
!= nLastCol
);
350 SvxIconChoiceCtrlEntry
* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry
* pStart
, BOOL bDown
)
352 if( pView
->IsAutoArrange() && !(pView
->nWinBits
& WB_ALIGN_TOP
) )
354 const long nPos
= (long)pView
->GetEntryListPos( pStart
);
355 long nEntriesInView
= (pView
->aOutputSize
.Height() / pView
->nGridDY
);
357 ((pView
->aOutputSize
.Width()+(pView
->nGridDX
/2)) / pView
->nGridDX
);
361 nNewPos
+= nEntriesInView
;
362 if( nNewPos
>= (long)pView
->aEntries
.Count() )
363 nNewPos
= pView
->aEntries
.Count() - 1;
367 nNewPos
-= nEntriesInView
;
371 if( nPos
!= nNewPos
)
372 return (SvxIconChoiceCtrlEntry
*)pView
->aEntries
.GetObject( (ULONG
)nNewPos
);
375 long nOpt
= pView
->GetEntryBoundRect( pStart
).Top();
378 nOpt
+= pView
->aOutputSize
.Height();
379 nOpt
-= pView
->nGridDY
;
383 nOpt
-= pView
->aOutputSize
.Height();
384 nOpt
+= pView
->nGridDY
;
389 long nPrevErr
= LONG_MAX
;
391 SvxIconChoiceCtrlEntry
* pPrev
= pStart
;
392 SvxIconChoiceCtrlEntry
* pNext
= GoUpDown( pStart
, bDown
);
395 long nCur
= pView
->GetEntryBoundRect( pNext
).Top();
396 long nErr
= nOpt
- nCur
;
399 if( nErr
> nPrevErr
)
403 pNext
= GoUpDown( pNext
, bDown
);
405 if( pPrev
!= pStart
)
410 SvxIconChoiceCtrlEntry
* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry
* pCtrlEntry
, BOOL bDown
)
412 if( pView
->IsAutoArrange() && !(pView
->nWinBits
& WB_ALIGN_TOP
) )
414 ULONG nPos
= pView
->GetEntryListPos( pCtrlEntry
);
415 if( bDown
&& nPos
< (pView
->aEntries
.Count() - 1) )
416 return (SvxIconChoiceCtrlEntry
*)pView
->aEntries
.GetObject( nPos
+ 1 );
417 else if( !bDown
&& nPos
> 0 )
418 return (SvxIconChoiceCtrlEntry
*)pView
->aEntries
.GetObject( nPos
- 1 );
422 SvxIconChoiceCtrlEntry
* pResult
;
423 pCurEntry
= pCtrlEntry
;
425 USHORT nY
= pCtrlEntry
->nY
;
426 USHORT nX
= pCtrlEntry
->nX
;
427 DBG_ASSERT(nY
<nRows
,"GoUpDown:Bad column");
428 DBG_ASSERT(nX
<nCols
,"GoUpDown:Bad row");
430 // Nachbar in gleicher Spalte ?
433 nX
, nY
, sal::static_int_cast
< USHORT
>(nRows
-1), nY
, TRUE
, TRUE
);
435 pResult
= SearchCol( nX
, nY
,0, nY
, FALSE
, TRUE
);
441 long nRowOffs
, nLastRow
;
450 nLastRow
= -1; // 0-1
457 SvxIconChoiceCtrlEntry
* pEntry
= SearchRow((USHORT
)nCurRow
,nColMin
,nColMax
,nX
,TRUE
, FALSE
);
462 if( nColMax
< (nCols
-1))
465 } while( nCurRow
!= nLastRow
);
469 void IcnCursor_Impl::SetDeltas()
471 const Size
& rSize
= pView
->aVirtOutputSize
;
472 nCols
= rSize
.Width() / pView
->nGridDX
;
475 nRows
= rSize
.Height() / pView
->nGridDY
;
476 if( (nRows
* pView
->nGridDY
) < rSize
.Height() )
481 nDeltaWidth
= (short)(rSize
.Width() / nCols
);
482 nDeltaHeight
= (short)(rSize
.Height() / nRows
);
486 DBG_WARNING("SetDeltas:Bad height");
491 DBG_WARNING("SetDeltas:Bad width");
495 void IcnCursor_Impl::CreateGridAjustData( SvPtrarr
& rLists
, SvxIconChoiceCtrlEntry
* pRefEntry
)
499 USHORT nGridRows
= (USHORT
)(pView
->aVirtOutputSize
.Height() / pView
->nGridDY
);
500 nGridRows
++; // wg. Abrundung!
504 for( USHORT nCurList
= 0; nCurList
< nGridRows
; nCurList
++ )
506 SvPtrarr
* pRow
= new SvPtrarr
;
507 rLists
.Insert( (void*)pRow
, nCurList
);
509 const ULONG nCount
= pView
->aEntries
.Count();
510 for( ULONG nCur
= 0; nCur
< nCount
; nCur
++ )
512 SvxIconChoiceCtrlEntry
* pEntry
= (SvxIconChoiceCtrlEntry
*)pView
->aEntries
.GetObject( nCur
);
513 const Rectangle
& rRect
= pView
->GetEntryBoundRect( pEntry
);
514 short nY
= (short)( ((rRect
.Top()+rRect
.Bottom())/2) / pView
->nGridDY
);
515 USHORT nIns
= GetSortListPos((SvPtrarr
*)rLists
[nY
],rRect
.Left(),FALSE
);
516 ((SvPtrarr
*)rLists
[ nY
])->Insert( pEntry
, nIns
);
521 // Aufbau eines hor. "Schlauchs" auf der RefEntry-Zeile
522 // UEBERLEGEN: BoundingRect nehmen wg. Ueberlappungen???
523 Rectangle
rRefRect( pView
->CalcBmpRect( pRefEntry
) );
524 //const Rectangle& rRefRect = pView->GetEntryBoundRect( pRefEntry );
525 short nRefRow
= (short)( ((rRefRect
.Top()+rRefRect
.Bottom())/2) / pView
->nGridDY
);
526 SvPtrarr
* pRow
= new SvPtrarr
;
527 rLists
.Insert( (void*)pRow
, 0 );
528 ULONG nCount
= pView
->aEntries
.Count();
529 for( ULONG nCur
= 0; nCur
< nCount
; nCur
++ )
531 SvxIconChoiceCtrlEntry
* pEntry
= (SvxIconChoiceCtrlEntry
*)pView
->aEntries
.GetObject( nCur
);
532 Rectangle
rRect( pView
->CalcBmpRect(pEntry
) );
533 //const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
534 short nY
= (short)( ((rRect
.Top()+rRect
.Bottom())/2) / pView
->nGridDY
);
537 USHORT nIns
= GetSortListPos( pRow
, rRect
.Left(), FALSE
);
538 pRow
->Insert( pEntry
, nIns
);
545 void IcnCursor_Impl::DestroyGridAdjustData( SvPtrarr
& rLists
)
547 const USHORT nCount
= rLists
.Count();
548 for( USHORT nCur
= 0; nCur
< nCount
; nCur
++ )
550 SvPtrarr
* pArr
= (SvPtrarr
*)rLists
[ nCur
];
553 rLists
.Remove( 0, rLists
.Count() );
556 IcnGridMap_Impl::IcnGridMap_Impl(SvxIconChoiceCtrl_Impl
* pView
)
564 IcnGridMap_Impl::~IcnGridMap_Impl()
566 delete[] _pGridMap
, _pGridMap
=0;
569 void IcnGridMap_Impl::Expand()
575 USHORT nNewGridRows
= _nGridRows
;
576 USHORT nNewGridCols
= _nGridCols
;
577 if( _pView
->nWinBits
& WB_ALIGN_TOP
)
582 BOOL
* pNewGridMap
= new BOOL
[nNewGridRows
*nNewGridCols
];
583 memset( pNewGridMap
, 0, nNewGridRows
* nNewGridCols
* sizeof(BOOL
) );
584 memcpy( pNewGridMap
, _pGridMap
, _nGridRows
* _nGridCols
* sizeof(BOOL
) );
586 _pGridMap
= pNewGridMap
;
587 _nGridRows
= nNewGridRows
;
588 _nGridCols
= nNewGridCols
;
592 void IcnGridMap_Impl::Create_Impl()
594 DBG_ASSERT(!_pGridMap
,"Unnecessary call to IcnGridMap_Impl::Create_Impl()");
597 GetMinMapSize( _nGridCols
, _nGridRows
);
598 if( _pView
->nWinBits
& WB_ALIGN_TOP
)
599 _nGridRows
+= 50; // avoid resize of gridmap too often
603 _pGridMap
= new BOOL
[ _nGridRows
* _nGridCols
];
604 memset( (void*)_pGridMap
, 0, _nGridRows
* _nGridCols
);
606 const ULONG nCount
= _pView
->aEntries
.Count();
607 for( ULONG nCur
=0; nCur
< nCount
; nCur
++ )
608 OccupyGrids( (SvxIconChoiceCtrlEntry
*)_pView
->aEntries
.GetObject( nCur
));
611 void IcnGridMap_Impl::GetMinMapSize( USHORT
& rDX
, USHORT
& rDY
) const
614 if( _pView
->nWinBits
& WB_ALIGN_TOP
)
616 // The view grows in vertical direction. Its max. width is _pView->nMaxVirtWidth
617 nX
= _pView
->nMaxVirtWidth
;
619 nX
= _pView
->pView
->GetOutputSizePixel().Width();
620 if( !(_pView
->nFlags
& F_ARRANGING
) )
621 nX
-= _pView
->nVerSBarWidth
;
623 nY
= _pView
->aVirtOutputSize
.Height();
627 // The view grows in horizontal direction. Its max. height is _pView->nMaxVirtHeight
628 nY
= _pView
->nMaxVirtHeight
;
630 nY
= _pView
->pView
->GetOutputSizePixel().Height();
631 if( !(_pView
->nFlags
& F_ARRANGING
) )
632 nY
-= _pView
->nHorSBarHeight
;
633 nX
= _pView
->aVirtOutputSize
.Width();
637 nX
= DEFAULT_MAX_VIRT_WIDTH
;
639 nY
= DEFAULT_MAX_VIRT_HEIGHT
;
641 long nDX
= nX
/ _pView
->nGridDX
;
642 long nDY
= nY
/ _pView
->nGridDY
;
653 GridId
IcnGridMap_Impl::GetGrid( USHORT nGridX
, USHORT nGridY
)
656 if( _pView
->nWinBits
& WB_ALIGN_TOP
)
657 return nGridX
+ ( nGridY
* _nGridCols
);
659 return nGridY
+ ( nGridX
* _nGridRows
);
662 GridId
IcnGridMap_Impl::GetGrid( const Point
& rDocPos
, BOOL
* pbClipped
)
666 long nX
= rDocPos
.X();
667 long nY
= rDocPos
.Y();
668 nX
-= LROFFS_WINBORDER
;
669 nY
-= TBOFFS_WINBORDER
;
670 nX
/= _pView
->nGridDX
;
671 nY
/= _pView
->nGridDY
;
672 BOOL bClipped
= FALSE
;
673 if( nX
>= _nGridCols
)
678 if( nY
>= _nGridRows
)
683 GridId nId
= GetGrid( (USHORT
)nX
, (USHORT
)nY
);
685 *pbClipped
= bClipped
;
686 DBG_ASSERT(nId
<(ULONG
)(_nGridCols
*_nGridRows
),"GetGrid failed");
690 Rectangle
IcnGridMap_Impl::GetGridRect( GridId nId
)
693 USHORT nGridX
, nGridY
;
694 GetGridCoord( nId
, nGridX
, nGridY
);
695 const long nLeft
= nGridX
* _pView
->nGridDX
+ LROFFS_WINBORDER
;
696 const long nTop
= nGridY
* _pView
->nGridDY
+ TBOFFS_WINBORDER
;
699 nLeft
+ _pView
->nGridDX
,
700 nTop
+ _pView
->nGridDY
);
703 GridId
IcnGridMap_Impl::GetUnoccupiedGrid( BOOL bOccupyFound
)
707 BOOL bExpanded
= FALSE
;
711 const ULONG nCount
= (USHORT
)(_nGridCols
* _nGridRows
);
712 for( ULONG nCur
= nStart
; nCur
< nCount
; nCur
++ )
714 if( !_pGridMap
[ nCur
] )
717 _pGridMap
[ nCur
] = TRUE
;
721 DBG_ASSERT(!bExpanded
,"ExpandGrid failed");
723 return 0; // prevent never ending loop
730 // ein Eintrag belegt nur das unter seinem Zentrum liegende GridRect
731 // diese Variante ist bedeutend schneller als die Belegung ueber das
732 // Bounding-Rect, kann aber zu kleinen Ueberlappungen fuehren
733 #define OCCUPY_CENTER
735 void IcnGridMap_Impl::OccupyGrids( const SvxIconChoiceCtrlEntry
* pEntry
, BOOL bOccupy
)
737 if( !_pGridMap
|| !_pView
->IsBoundingRectValid( pEntry
->aRect
))
739 #ifndef OCCUPY_CENTER
740 OccupyGrids( pEntry
->aRect
, bOccupy
);
742 OccupyGrid( GetGrid( pEntry
->aRect
.Center()), bOccupy
);
747 void IcnGridMap_Impl::OccupyGrids( const Rectangle
& rRect
, BOOL bUsed
)
754 if( _aLastOccupiedGrid
== rRect
)
756 _aLastOccupiedGrid
= rRect
;
759 _aLastOccupiedGrid
.SetEmpty();
761 BOOL bTopLeftClipped
, bBottomRightClipped
;
762 GridId nIdTL
= GetGrid( rRect
.TopLeft(), &bTopLeftClipped
);
763 GridId nIdBR
= GetGrid( rRect
.BottomRight(), &bBottomRightClipped
);
765 if( bTopLeftClipped
&& bBottomRightClipped
)
768 USHORT nX1
,nX2
,nY1
,nY2
;
769 GetGridCoord( nIdTL
, nX1
, nY1
);
770 GetGridCoord( nIdBR
, nX2
, nY2
);
784 for( ; nX1
<= nX2
; nX1
++ )
785 for( ; nY1
<= nY2
; nY1
++ )
786 OccupyGrid( GetGrid( nX1
, nY1
) );
789 void IcnGridMap_Impl::Clear()
793 delete[] _pGridMap
, _pGridMap
=0;
796 _aLastOccupiedGrid
.SetEmpty();
800 ULONG
IcnGridMap_Impl::GetGridCount( const Size
& rSizePixel
, USHORT nDX
, USHORT nDY
)
802 long ndx
= (rSizePixel
.Width() - LROFFS_WINBORDER
) / nDX
;
803 if( ndx
< 0 ) ndx
*= -1;
804 long ndy
= (rSizePixel
.Height() - TBOFFS_WINBORDER
) / nDY
;
805 if( ndy
< 0 ) ndy
*= -1;
806 return (ULONG
)(ndx
* ndy
);
809 void IcnGridMap_Impl::OutputSizeChanged()
814 GetMinMapSize( nCols
, nRows
);
815 if( _pView
->nWinBits
& WB_ALIGN_TOP
)
817 if( nCols
!= _nGridCols
)
819 else if( nRows
>= _nGridRows
)
824 if( nRows
!= _nGridRows
)
826 else if( nCols
>= _nGridCols
)
832 // Independendly of the views alignment (TOP or LEFT) the gridmap
833 // should contain the data in a continues region, to make it possible
834 // to copy the whole block if the gridmap needs to be expanded.
835 void IcnGridMap_Impl::GetGridCoord( GridId nId
, USHORT
& rGridX
, USHORT
& rGridY
)
838 if( _pView
->nWinBits
& WB_ALIGN_TOP
)
840 rGridX
= (USHORT
)(nId
% _nGridCols
);
841 rGridY
= (USHORT
)(nId
/ _nGridCols
);
845 rGridX
= (USHORT
)(nId
/ _nGridRows
);
846 rGridY
= (USHORT
)(nId
% _nGridRows
);