Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / inc / markarr.hxx
blobd8a6710f058dc7c71244624135101c2ed944a883
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_MARKARR_HXX
21 #define SC_MARKARR_HXX
23 #include "address.hxx"
24 #include <tools/solar.h>
26 #define SC_MARKARRAY_DELTA 4
28 struct ScMarkEntry
30 SCROW nRow;
31 sal_Bool bMarked;
34 class ScMarkArray
36 SCSIZE nCount;
37 SCSIZE nLimit;
38 ScMarkEntry* pData;
40 friend class ScMarkArrayIter;
41 friend class ScDocument; // for FillInfo
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;
52 sal_Bool HasMarks() const { return ( nCount > 1 || ( nCount == 1 && pData[0].bMarked ) ); }
54 void CopyMarksTo( ScMarkArray& rDestMarkArray ) const;
56 sal_Bool Search( SCROW nRow, SCSIZE& nIndex ) const;
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;
64 class ScMarkArrayIter // iterate over selected range
66 const ScMarkArray* pArray;
67 SCSIZE nPos;
68 public:
69 ScMarkArrayIter( const ScMarkArray* pNewArray );
70 ~ScMarkArrayIter();
72 sal_Bool Next( SCROW& rTop, SCROW& rBottom );
77 #endif
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */