LCOV - code coverage report
Current view: top level - sc/inc - markdata.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2012-08-25 Functions: 7 7 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SC_MARKDATA_HXX
      30                 :            : #define SC_MARKDATA_HXX
      31                 :            : 
      32                 :            : #include "address.hxx"
      33                 :            : #include <tools/solar.h>
      34                 :            : #include "scdllapi.h"
      35                 :            : 
      36                 :            : #include <set>
      37                 :            : 
      38                 :            : class ScMarkArray;
      39                 :            : class ScRangeList;
      40                 :            : 
      41                 :            : //!     todo:
      42                 :            : //!     It should be possible to have MarkArrays for each table, in order to
      43                 :            : //!     enable "search all" across more than one table again!
      44                 :            : 
      45                 :            : 
      46                 :            : class SC_DLLPUBLIC ScMarkData
      47                 :            : {
      48                 :            : public:
      49                 :            :     typedef std::set<SCTAB> MarkedTabsType;
      50                 :            : private:
      51                 :            :     MarkedTabsType  maTabMarked;
      52                 :            : 
      53                 :            :     ScRange         aMarkRange;             // area
      54                 :            :     ScRange         aMultiRange;            // maximum area altogether
      55                 :            :     ScMarkArray*    pMultiSel;              // multi selection
      56                 :            :     bool            bMarked:1;                // rectangle marked
      57                 :            :     bool            bMultiMarked:1;
      58                 :            : 
      59                 :            :     bool            bMarking:1;               // area is being marked -> no MarkToMulti
      60                 :            :     bool            bMarkIsNeg:1;             // cancel if multi selection
      61                 :            : 
      62                 :            : public:
      63                 :            :                 ScMarkData();
      64                 :            :                 ScMarkData(const ScMarkData& rData);
      65                 :            :                 ~ScMarkData();
      66                 :            : 
      67                 :            :     ScMarkData& operator=(const ScMarkData& rData);
      68                 :            : 
      69                 :            :     void        ResetMark();
      70                 :            :     void        SetMarkArea( const ScRange& rRange );
      71                 :            : 
      72                 :            :     void        SetMultiMarkArea( const ScRange& rRange, bool bMark = true );
      73                 :            : 
      74                 :            :     void        MarkToMulti();
      75                 :            :     void        MarkToSimple();
      76                 :            : 
      77                 :      29687 :     bool        IsMarked() const                { return bMarked; }
      78                 :     566201 :     bool        IsMultiMarked() const           { return bMultiMarked; }
      79                 :            : 
      80                 :            :     void        GetMarkArea( ScRange& rRange ) const;
      81                 :            :     void        GetMultiMarkArea( ScRange& rRange ) const;
      82                 :            : 
      83                 :            :     void        SetAreaTab( SCTAB nTab );
      84                 :            : 
      85                 :            :     void        SelectTable( SCTAB nTab, bool bNew );
      86                 :            :     bool        GetTableSelect( SCTAB nTab ) const;
      87                 :            : 
      88                 :            :     void        SelectOneTable( SCTAB nTab );
      89                 :            :     SCTAB       GetSelectCount() const;
      90                 :            :     SCTAB       GetFirstSelected() const;
      91                 :            :     SCTAB       GetLastSelected() const;
      92                 :            : 
      93                 :            :     const MarkedTabsType& GetSelectedTabs() const;
      94                 :            :     void SetSelectedTabs(const MarkedTabsType& rTabs);
      95                 :            : 
      96                 :         27 :     void        SetMarkNegative( bool bFlag )   { bMarkIsNeg = bFlag; }
      97                 :        224 :     bool        IsMarkNegative() const          { return bMarkIsNeg;  }
      98                 :       2231 :     void        SetMarking( bool bFlag )        { bMarking = bFlag;   }
      99                 :         34 :     bool        GetMarkingFlag() const          { return bMarking;    }
     100                 :            : 
     101                 :            :     //  for FillInfo / Document etc.
     102                 :     521988 :     const ScMarkArray* GetArray() const         { return pMultiSel; }
     103                 :            : 
     104                 :            :     bool        IsCellMarked( SCCOL nCol, SCROW nRow, bool bNoSimple = false ) const;
     105                 :            :     void        FillRangeListWithMarks( ScRangeList* pList, bool bClear ) const;
     106                 :            :     void        ExtendRangeListTables( ScRangeList* pList ) const;
     107                 :            : 
     108                 :            :     void        MarkFromRangeList( const ScRangeList& rList, bool bReset );
     109                 :            : 
     110                 :            :     SCCOLROW    GetMarkColumnRanges( SCCOLROW* pRanges );
     111                 :            :     SCCOLROW    GetMarkRowRanges( SCCOLROW* pRanges );
     112                 :            : 
     113                 :            :     bool        IsColumnMarked( SCCOL nCol ) const;
     114                 :            :     bool        IsRowMarked( SCROW nRow ) const;
     115                 :            :     bool        IsAllMarked( const ScRange& rRange ) const;     // Multi
     116                 :            : 
     117                 :            :                 /// May return -1
     118                 :            :     SCsROW      GetNextMarked( SCCOL nCol, SCsROW nRow, bool bUp ) const;
     119                 :            :     bool        HasMultiMarks( SCCOL nCol ) const;
     120                 :            :     bool        HasAnyMultiMarks() const;
     121                 :            : 
     122                 :            :     //  adjust table marking:
     123                 :            :     void        InsertTab( SCTAB nTab );
     124                 :            :     void        DeleteTab( SCTAB nTab );
     125                 :            : 
     126                 :            :     // iterators for table access
     127                 :            :     typedef std::set<SCTAB>::iterator iterator;
     128                 :            :     typedef std::set<SCTAB>::const_iterator const_iterator;
     129                 :            :     iterator begin();
     130                 :            :     iterator end();
     131                 :            :     const_iterator begin() const;
     132                 :            :     const_iterator end() const;
     133                 :            : };
     134                 :            : 
     135                 :            : 
     136                 :            : 
     137                 :            : #endif
     138                 :            : 
     139                 :            : 
     140                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10