xref: /trunk/main/sc/inc/markdata.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_MARKDATA_HXX
29 #define SC_MARKDATA_HXX
30 
31 #include "address.hxx"
32 #include <tools/solar.h>
33 #include "scdllapi.h"
34 
35 class ScMarkArray;
36 class ScRangeList;
37 
38 //!     todo:
39 //!     Es muss auch die Moeglichkeit geben, MarkArrays pro Tabelle zu halten,
40 //!     damit "alle suchen" ueber mehrere Tabellen wieder funktioniert!
41 
42 
43 class SC_DLLPUBLIC ScMarkData
44 {
45 private:
46     ScRange         aMarkRange;             // Bereich
47     ScRange         aMultiRange;            // maximaler Bereich insgesamt
48     ScMarkArray*    pMultiSel;              // Mehrfachselektion
49     sal_Bool            bTabMarked[MAXTABCOUNT];// Tabelle selektiert
50     sal_Bool            bMarked;                // Rechteck markiert
51     sal_Bool            bMultiMarked;           // mehrfach markiert
52 
53     sal_Bool            bMarking;               // Bereich wird aufgezogen -> kein MarkToMulti
54     sal_Bool            bMarkIsNeg;             // Aufheben bei Mehrfachselektion
55 
56 public:
57                 ScMarkData();
58                 ScMarkData(const ScMarkData& rData);
59                 ~ScMarkData();
60 
61     ScMarkData& operator=(const ScMarkData& rData);
62 
63     void        ResetMark();
64     void        SetMarkArea( const ScRange& rRange );
65 
66     void        SetMultiMarkArea( const ScRange& rRange, sal_Bool bMark = sal_True );
67 
68     void        MarkToMulti();
69     void        MarkToSimple();
70 
71     sal_Bool        IsMarked() const                { return bMarked; }
72     sal_Bool        IsMultiMarked() const           { return bMultiMarked; }
73 
74     void        GetMarkArea( ScRange& rRange ) const;
75     void        GetMultiMarkArea( ScRange& rRange ) const;
76 
77     void        SetAreaTab( SCTAB nTab );
78 
79     void        SelectTable( SCTAB nTab, sal_Bool bNew )        { bTabMarked[nTab] = bNew; }
80     sal_Bool        GetTableSelect( SCTAB nTab ) const          { return bTabMarked[nTab]; }
81 
82     void        SelectOneTable( SCTAB nTab );
83     SCTAB       GetSelectCount() const;
84     SCTAB       GetFirstSelected() const;
85 
86     void        SetMarkNegative( sal_Bool bFlag )   { bMarkIsNeg = bFlag; }
87     sal_Bool        IsMarkNegative() const          { return bMarkIsNeg;  }
88     void        SetMarking( sal_Bool bFlag )        { bMarking = bFlag;   }
89     sal_Bool        GetMarkingFlag() const          { return bMarking;    }
90 
91     //  fuer FillInfo / Document etc.
92     const ScMarkArray* GetArray() const         { return pMultiSel; }
93 
94     sal_Bool        IsCellMarked( SCCOL nCol, SCROW nRow, sal_Bool bNoSimple = sal_False ) const;
95     void        FillRangeListWithMarks( ScRangeList* pList, sal_Bool bClear ) const;
96     void        ExtendRangeListTables( ScRangeList* pList ) const;
97 
98     void        MarkFromRangeList( const ScRangeList& rList, sal_Bool bReset );
99 
100     SCCOLROW    GetMarkColumnRanges( SCCOLROW* pRanges );
101     SCCOLROW    GetMarkRowRanges( SCCOLROW* pRanges );
102 
103     sal_Bool        IsColumnMarked( SCCOL nCol ) const;
104     sal_Bool        IsRowMarked( SCROW nRow ) const;
105     sal_Bool        IsAllMarked( const ScRange& rRange ) const;     // Multi
106 
107                 /// May return -1
108     SCsROW      GetNextMarked( SCCOL nCol, SCsROW nRow, sal_Bool bUp ) const;
109     sal_Bool        HasMultiMarks( SCCOL nCol ) const;
110     sal_Bool        HasAnyMultiMarks() const;
111 
112     //  Tabellen-Markierungen anpassen:
113     void        InsertTab( SCTAB nTab );
114     void        DeleteTab( SCTAB nTab );
115 };
116 
117 
118 
119 #endif
120 
121 
122