xref: /AOO41X/main/sc/inc/markarr.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_MARKARR_HXX
25 #define SC_MARKARR_HXX
26 
27 #include "address.hxx"
28 #include <tools/solar.h>
29 
30 #define SC_MARKARRAY_DELTA    4
31 
32 struct ScMarkEntry
33 {
34     SCROW           nRow;
35     sal_Bool            bMarked;
36 };
37 
38 class ScMarkArray
39 {
40     SCSIZE          nCount;
41     SCSIZE          nLimit;
42     ScMarkEntry*    pData;
43 
44 friend class ScMarkArrayIter;
45 friend class ScDocument;                // fuer FillInfo
46 
47 public:
48             ScMarkArray();
49             ~ScMarkArray();
50     void    Reset( sal_Bool bMarked = sal_False );
51     sal_Bool    GetMark( SCROW nRow ) const;
52     void    SetMarkArea( SCROW nStartRow, SCROW nEndRow, sal_Bool bMarked );
53     sal_Bool    IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const;
54     sal_Bool    HasOneMark( SCROW& rStartRow, SCROW& rEndRow ) const;
55 
HasMarks() const56     sal_Bool    HasMarks() const    { return ( nCount > 1 || ( nCount == 1 && pData[0].bMarked ) ); }
57 
58     void    CopyMarksTo( ScMarkArray& rDestMarkArray ) const;
59 
60     sal_Bool    Search( SCROW nRow, SCSIZE& nIndex ) const;
61 //UNUSED2009-05 void    DeleteArea(SCROW nStartRow, SCROW nEndRow);
62 
63     /// Including current row, may return -1 if bUp and not found
64     SCsROW  GetNextMarked( SCsROW nRow, sal_Bool bUp ) const;
65     SCROW   GetMarkEnd( SCROW nRow, sal_Bool bUp ) const;
66 };
67 
68 
69 class ScMarkArrayIter                   // selektierte Bereiche durchgehen
70 {
71     const ScMarkArray*  pArray;
72     SCSIZE              nPos;
73 public:
74                 ScMarkArrayIter( const ScMarkArray* pNewArray );
75                 ~ScMarkArrayIter();
76 
77     sal_Bool        Next( SCROW& rTop, SCROW& rBottom );
78 };
79 
80 
81 
82 #endif
83 
84