LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/inc - markdata.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2013-07-09 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef SC_MARKDATA_HXX
      21             : #define SC_MARKDATA_HXX
      22             : 
      23             : #include "address.hxx"
      24             : #include <tools/solar.h>
      25             : #include "scdllapi.h"
      26             : 
      27             : #include <set>
      28             : 
      29             : class ScMarkArray;
      30             : class ScRangeList;
      31             : 
      32             : //!     todo:
      33             : //!     It should be possible to have MarkArrays for each table, in order to
      34             : //!     enable "search all" across more than one table again!
      35             : 
      36             : 
      37             : class SC_DLLPUBLIC ScMarkData
      38             : {
      39             : public:
      40             :     typedef std::set<SCTAB> MarkedTabsType;
      41             : private:
      42             :     MarkedTabsType  maTabMarked;
      43             : 
      44             :     ScRange         aMarkRange;             // area
      45             :     ScRange         aMultiRange;            // maximum area altogether
      46             :     ScMarkArray*    pMultiSel;              // multi selection
      47             :     bool            bMarked:1;                // rectangle marked
      48             :     bool            bMultiMarked:1;
      49             : 
      50             :     bool            bMarking:1;               // area is being marked -> no MarkToMulti
      51             :     bool            bMarkIsNeg:1;             // cancel if multi selection
      52             : 
      53             : public:
      54             :                 ScMarkData();
      55             :                 ScMarkData(const ScMarkData& rData);
      56             :                 ~ScMarkData();
      57             : 
      58             :     ScMarkData& operator=(const ScMarkData& rData);
      59             : 
      60             :     void        ResetMark();
      61             :     void        SetMarkArea( const ScRange& rRange );
      62             : 
      63             :     void        SetMultiMarkArea( const ScRange& rRange, bool bMark = true );
      64             : 
      65             :     void        MarkToMulti();
      66             :     void        MarkToSimple();
      67             : 
      68       32110 :     bool        IsMarked() const                { return bMarked; }
      69      514444 :     bool        IsMultiMarked() const           { return bMultiMarked; }
      70             : 
      71             :     void        GetMarkArea( ScRange& rRange ) const;
      72             :     void        GetMultiMarkArea( ScRange& rRange ) const;
      73             : 
      74             :     void        SetAreaTab( SCTAB nTab );
      75             : 
      76             :     void        SelectTable( SCTAB nTab, bool bNew );
      77             :     bool        GetTableSelect( SCTAB nTab ) const;
      78             : 
      79             :     void        SelectOneTable( SCTAB nTab );
      80             :     SCTAB       GetSelectCount() const;
      81             :     SCTAB       GetFirstSelected() const;
      82             :     SCTAB       GetLastSelected() const;
      83             : 
      84             :     const MarkedTabsType& GetSelectedTabs() const;
      85             :     void SetSelectedTabs(const MarkedTabsType& rTabs);
      86             : 
      87         163 :     void        SetMarkNegative( bool bFlag )   { bMarkIsNeg = bFlag; }
      88         246 :     bool        IsMarkNegative() const          { return bMarkIsNeg;  }
      89        2794 :     void        SetMarking( bool bFlag )        { bMarking = bFlag;   }
      90         113 :     bool        GetMarkingFlag() const          { return bMarking;    }
      91             : 
      92             :     //  for FillInfo / Document etc.
      93      400389 :     const ScMarkArray* GetArray() const         { return pMultiSel; }
      94             : 
      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;
      98             : 
      99             :     ScRangeList GetMarkedRanges() const;
     100             : 
     101             :     void        MarkFromRangeList( const ScRangeList& rList, bool bReset );
     102             : 
     103             :     SCCOLROW    GetMarkColumnRanges( SCCOLROW* pRanges );
     104             :     SCCOLROW    GetMarkRowRanges( SCCOLROW* pRanges );
     105             : 
     106             :     bool        IsColumnMarked( SCCOL nCol ) const;
     107             :     bool        IsRowMarked( SCROW nRow ) const;
     108             :     bool        IsAllMarked( const ScRange& rRange ) const;     // Multi
     109             : 
     110             :                 /// May return -1
     111             :     SCsROW      GetNextMarked( SCCOL nCol, SCsROW nRow, bool bUp ) const;
     112             :     bool        HasMultiMarks( SCCOL nCol ) const;
     113             :     bool        HasAnyMultiMarks() const;
     114             : 
     115             :     //  adjust table marking:
     116             :     void        InsertTab( SCTAB nTab );
     117             :     void        DeleteTab( SCTAB nTab );
     118             : 
     119             :     // iterators for table access
     120             :     typedef std::set<SCTAB>::iterator iterator;
     121             :     typedef std::set<SCTAB>::const_iterator const_iterator;
     122             :     iterator begin();
     123             :     iterator end();
     124             :     const_iterator begin() const;
     125             :     const_iterator end() const;
     126             : };
     127             : 
     128             : 
     129             : 
     130             : #endif
     131             : 
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10