Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef SC_MARKARR_HXX
21 : #define SC_MARKARR_HXX
22 :
23 : #include "address.hxx"
24 : #include <tools/solar.h>
25 :
26 : #define SC_MARKARRAY_DELTA 4
27 :
28 : struct ScMarkEntry
29 : {
30 : SCROW nRow;
31 : sal_Bool bMarked;
32 : };
33 :
34 : class ScMarkArray
35 : {
36 : SCSIZE nCount;
37 : SCSIZE nLimit;
38 : ScMarkEntry* pData;
39 :
40 : friend class ScMarkArrayIter;
41 : friend class ScDocument; // for FillInfo
42 :
43 : public:
44 : ScMarkArray();
45 : ~ScMarkArray();
46 : void Reset( sal_Bool bMarked = false );
47 : sal_Bool GetMark( SCROW nRow ) const;
48 : void SetMarkArea( SCROW nStartRow, SCROW nEndRow, sal_Bool bMarked );
49 : sal_Bool IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const;
50 : sal_Bool HasOneMark( SCROW& rStartRow, SCROW& rEndRow ) const;
51 :
52 673163 : sal_Bool HasMarks() const { return ( nCount > 1 || ( nCount == 1 && pData[0].bMarked ) ); }
53 :
54 : void CopyMarksTo( ScMarkArray& rDestMarkArray ) const;
55 :
56 : sal_Bool Search( SCROW nRow, SCSIZE& nIndex ) const;
57 :
58 : /// Including current row, may return -1 if bUp and not found
59 : SCsROW GetNextMarked( SCsROW nRow, sal_Bool bUp ) const;
60 : SCROW GetMarkEnd( SCROW nRow, sal_Bool bUp ) const;
61 : };
62 :
63 :
64 : class ScMarkArrayIter // iterate over selected range
65 : {
66 : const ScMarkArray* pArray;
67 : SCSIZE nPos;
68 : public:
69 : ScMarkArrayIter( const ScMarkArray* pNewArray );
70 : ~ScMarkArrayIter();
71 :
72 : sal_Bool Next( SCROW& rTop, SCROW& rBottom );
73 : };
74 :
75 :
76 :
77 : #endif
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|