1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SC_MARKARR_HXX 29 #define SC_MARKARR_HXX 30 31 #include "address.hxx" 32 #include <tools/solar.h> 33 34 #define SC_MARKARRAY_DELTA 4 35 36 struct ScMarkEntry 37 { 38 SCROW nRow; 39 sal_Bool bMarked; 40 }; 41 42 class ScMarkArray 43 { 44 SCSIZE nCount; 45 SCSIZE nLimit; 46 ScMarkEntry* pData; 47 48 friend class ScMarkArrayIter; 49 friend class ScDocument; // fuer FillInfo 50 51 public: 52 ScMarkArray(); 53 ~ScMarkArray(); 54 void Reset( sal_Bool bMarked = sal_False ); 55 sal_Bool GetMark( SCROW nRow ) const; 56 void SetMarkArea( SCROW nStartRow, SCROW nEndRow, sal_Bool bMarked ); 57 sal_Bool IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const; 58 sal_Bool HasOneMark( SCROW& rStartRow, SCROW& rEndRow ) const; 59 60 sal_Bool HasMarks() const { return ( nCount > 1 || ( nCount == 1 && pData[0].bMarked ) ); } 61 62 void CopyMarksTo( ScMarkArray& rDestMarkArray ) const; 63 64 sal_Bool Search( SCROW nRow, SCSIZE& nIndex ) const; 65 //UNUSED2009-05 void DeleteArea(SCROW nStartRow, SCROW nEndRow); 66 67 /// Including current row, may return -1 if bUp and not found 68 SCsROW GetNextMarked( SCsROW nRow, sal_Bool bUp ) const; 69 SCROW GetMarkEnd( SCROW nRow, sal_Bool bUp ) const; 70 }; 71 72 73 class ScMarkArrayIter // selektierte Bereiche durchgehen 74 { 75 const ScMarkArray* pArray; 76 SCSIZE nPos; 77 public: 78 ScMarkArrayIter( const ScMarkArray* pNewArray ); 79 ~ScMarkArrayIter(); 80 81 sal_Bool Next( SCROW& rTop, SCROW& rBottom ); 82 }; 83 84 85 86 #endif 87 88