Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_MARKARR_HXX
30 : : #define SC_MARKARR_HXX
31 : :
32 : : #include "address.hxx"
33 : : #include <tools/solar.h>
34 : :
35 : : #define SC_MARKARRAY_DELTA 4
36 : :
37 : : struct ScMarkEntry
38 : : {
39 : : SCROW nRow;
40 : : sal_Bool bMarked;
41 : : };
42 : :
43 : : class ScMarkArray
44 : : {
45 : : SCSIZE nCount;
46 : : SCSIZE nLimit;
47 : : ScMarkEntry* pData;
48 : :
49 : : friend class ScMarkArrayIter;
50 : : friend class ScDocument; // for FillInfo
51 : :
52 : : public:
53 : : ScMarkArray();
54 : : ~ScMarkArray();
55 : : void Reset( sal_Bool bMarked = false );
56 : : sal_Bool GetMark( SCROW nRow ) const;
57 : : void SetMarkArea( SCROW nStartRow, SCROW nEndRow, sal_Bool bMarked );
58 : : sal_Bool IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const;
59 : : sal_Bool HasOneMark( SCROW& rStartRow, SCROW& rEndRow ) const;
60 : :
61 [ + + ][ + + ]: 149961 : sal_Bool HasMarks() const { return ( nCount > 1 || ( nCount == 1 && pData[0].bMarked ) ); }
[ + + ]
62 : :
63 : : void CopyMarksTo( ScMarkArray& rDestMarkArray ) const;
64 : :
65 : : sal_Bool Search( SCROW nRow, SCSIZE& nIndex ) const;
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 // iterate over selected range
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 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|