1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_MARKDATA_HXX
21 #define SC_MARKDATA_HXX
23 #include "address.hxx"
24 #include <tools/solar.h>
33 //! It should be possible to have MarkArrays for each table, in order to
34 //! enable "search all" across more than one table again!
37 class SC_DLLPUBLIC ScMarkData
40 typedef std::set
<SCTAB
> MarkedTabsType
;
42 MarkedTabsType maTabMarked
;
44 ScRange aMarkRange
; // area
45 ScRange aMultiRange
; // maximum area altogether
46 ScMarkArray
* pMultiSel
; // multi selection
47 bool bMarked
:1; // rectangle marked
50 bool bMarking
:1; // area is being marked -> no MarkToMulti
51 bool bMarkIsNeg
:1; // cancel if multi selection
55 ScMarkData(const ScMarkData
& rData
);
58 ScMarkData
& operator=(const ScMarkData
& rData
);
61 void SetMarkArea( const ScRange
& rRange
);
63 void SetMultiMarkArea( const ScRange
& rRange
, bool bMark
= true );
68 bool IsMarked() const { return bMarked
; }
69 bool IsMultiMarked() const { return bMultiMarked
; }
71 void GetMarkArea( ScRange
& rRange
) const;
72 void GetMultiMarkArea( ScRange
& rRange
) const;
74 void SetAreaTab( SCTAB nTab
);
76 void SelectTable( SCTAB nTab
, bool bNew
);
77 bool GetTableSelect( SCTAB nTab
) const;
79 void SelectOneTable( SCTAB nTab
);
80 SCTAB
GetSelectCount() const;
81 SCTAB
GetFirstSelected() const;
82 SCTAB
GetLastSelected() const;
84 const MarkedTabsType
& GetSelectedTabs() const;
85 void SetSelectedTabs(const MarkedTabsType
& rTabs
);
87 void SetMarkNegative( bool bFlag
) { bMarkIsNeg
= bFlag
; }
88 bool IsMarkNegative() const { return bMarkIsNeg
; }
89 void SetMarking( bool bFlag
) { bMarking
= bFlag
; }
90 bool GetMarkingFlag() const { return bMarking
; }
92 // for FillInfo / Document etc.
93 const ScMarkArray
* GetArray() const { return pMultiSel
; }
95 bool IsCellMarked( SCCOL nCol
, SCROW nRow
, bool bNoSimple
= false ) const;
96 void FillRangeListWithMarks( ScRangeList
* pList
, bool bClear
) const;
97 void ExtendRangeListTables( ScRangeList
* pList
) const;
99 ScRangeList
GetMarkedRanges() const;
101 void MarkFromRangeList( const ScRangeList
& rList
, bool bReset
);
103 SCCOLROW
GetMarkColumnRanges( SCCOLROW
* pRanges
);
104 SCCOLROW
GetMarkRowRanges( SCCOLROW
* pRanges
);
106 bool IsColumnMarked( SCCOL nCol
) const;
107 bool IsRowMarked( SCROW nRow
) const;
108 bool IsAllMarked( const ScRange
& rRange
) const; // Multi
111 SCsROW
GetNextMarked( SCCOL nCol
, SCsROW nRow
, bool bUp
) const;
112 bool HasMultiMarks( SCCOL nCol
) const;
113 bool HasAnyMultiMarks() const;
115 // adjust table marking:
116 void InsertTab( SCTAB nTab
);
117 void DeleteTab( SCTAB nTab
);
119 // iterators for table access
120 typedef std::set
<SCTAB
>::iterator iterator
;
121 typedef std::set
<SCTAB
>::const_iterator const_iterator
;
124 const_iterator
begin() const;
125 const_iterator
end() const;
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */