LCOV - code coverage report
Current view: top level - sc/inc - detfunc.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-08-25 Functions: 1 1 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_DETFUNC_HXX
      30                 :            : #define SC_DETFUNC_HXX
      31                 :            : 
      32                 :            : #include "address.hxx"
      33                 :            : #include <tools/gen.hxx>
      34                 :            : #include <tools/color.hxx>
      35                 :            : #include "scdllapi.h"
      36                 :            : #include "token.hxx"
      37                 :            : 
      38                 :            : #include <vector>
      39                 :            : 
      40                 :            : class SdrObject;
      41                 :            : 
      42                 :            : class ScDetectiveData;
      43                 :            : class ScDocument;
      44                 :            : class ScAddress;
      45                 :            : class ScRange;
      46                 :            : 
      47                 :            : #define SC_DET_MAXCIRCLE    1000
      48                 :            : 
      49                 :            : enum ScDetectiveDelete { SC_DET_ALL, SC_DET_DETECTIVE, SC_DET_CIRCLES, SC_DET_ARROWS };
      50                 :            : 
      51                 :            : enum ScDetectiveObjType
      52                 :            : {
      53                 :            :     SC_DETOBJ_NONE,
      54                 :            :     SC_DETOBJ_ARROW,
      55                 :            :     SC_DETOBJ_FROMOTHERTAB,
      56                 :            :     SC_DETOBJ_TOOTHERTAB,
      57                 :            :     SC_DETOBJ_CIRCLE
      58                 :            : };
      59                 :            : 
      60                 :            : class SC_DLLPUBLIC ScDetectiveFunc
      61                 :            : {
      62                 :            :     static ColorData nArrowColor;
      63                 :            :     static ColorData nErrorColor;
      64                 :            :     static ColorData nCommentColor;
      65                 :            :     static sal_Bool      bColorsInitialized;
      66                 :            : 
      67                 :            :     ScDocument*     pDoc;
      68                 :            :     SCTAB           nTab;
      69                 :            : 
      70                 :            :     enum DrawPosMode
      71                 :            :     {
      72                 :            :         DRAWPOS_TOPLEFT,        /// Top-left edge of the cell.
      73                 :            :         DRAWPOS_BOTTOMRIGHT,    /// Bottom-right edge of the cell.
      74                 :            :         DRAWPOS_DETARROW,       /// Position inside cell for detective arrows.
      75                 :            :         DRAWPOS_CAPTIONLEFT,    /// Top-left edge of the cell for captions.
      76                 :            :         DRAWPOS_CAPTIONRIGHT    /// Top-right edge of the cell for captions (incl. merged cells).
      77                 :            :     };
      78                 :            : 
      79                 :            :     /** Returns a drawing layer position for the passed cell address. */
      80                 :            :     Point       GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) const;
      81                 :            : 
      82                 :            :     /** Returns the drawing layer rectangle for the passed cell range. */
      83                 :            :     Rectangle   GetDrawRect( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
      84                 :            : 
      85                 :            :     /** Returns the drawing layer rectangle for the passed cell address. */
      86                 :            :     Rectangle   GetDrawRect( SCCOL nCol, SCROW nRow ) const;
      87                 :            : 
      88                 :            :     sal_Bool        HasArrow( const ScAddress& rStart,
      89                 :            :                             SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );
      90                 :            : 
      91                 :            :     void        DeleteArrowsAt( SCCOL nCol, SCROW nRow, sal_Bool bDestPnt );
      92                 :            :     void        DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
      93                 :            : 
      94                 :            :     sal_Bool        HasError( const ScRange& rRange, ScAddress& rErrPos );
      95                 :            : 
      96                 :            :     void        FillAttributes( ScDetectiveData& rData );
      97                 :            : 
      98                 :            :                 // called from DrawEntry/DrawAlienEntry and InsertObject
      99                 :            :     sal_Bool        InsertArrow( SCCOL nCol, SCROW nRow,
     100                 :            :                                 SCCOL nRefStartCol, SCROW nRefStartRow,
     101                 :            :                                 SCCOL nRefEndCol, SCROW nRefEndRow,
     102                 :            :                                 sal_Bool bFromOtherTab, sal_Bool bRed,
     103                 :            :                                 ScDetectiveData& rData );
     104                 :            :     sal_Bool        InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
     105                 :            :                                 SCCOL nEndCol, SCROW nEndRow, sal_Bool bRed,
     106                 :            :                                 ScDetectiveData& rData );
     107                 :            : 
     108                 :            :                 // DrawEntry / DrawAlienEntry check for existing arrows and errors
     109                 :            :     sal_Bool        DrawEntry( SCCOL nCol, SCROW nRow, const ScRange& rRef,
     110                 :            :                                 ScDetectiveData& rData );
     111                 :            :     sal_Bool        DrawAlienEntry( const ScRange& rRef,
     112                 :            :                                 ScDetectiveData& rData );
     113                 :            : 
     114                 :            :     void        DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData );
     115                 :            : 
     116                 :            :     sal_uInt16      InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel );
     117                 :            :     sal_uInt16      InsertPredLevelArea( const ScRange& rRef,
     118                 :            :                                         ScDetectiveData& rData, sal_uInt16 nLevel );
     119                 :            :     sal_uInt16      FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nLevel, sal_uInt16 nDeleteLevel );
     120                 :            :     sal_uInt16      FindPredLevelArea( const ScRange& rRef,
     121                 :            :                                     sal_uInt16 nLevel, sal_uInt16 nDeleteLevel );
     122                 :            : 
     123                 :            :     sal_uInt16      InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel );
     124                 :            : 
     125                 :            :     sal_uInt16      InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
     126                 :            :                                         ScDetectiveData& rData, sal_uInt16 nLevel );
     127                 :            :     sal_uInt16      FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
     128                 :            :                                 sal_uInt16 nLevel, sal_uInt16 nDeleteLevel );
     129                 :            : 
     130                 :            :     sal_Bool        FindFrameForObject( SdrObject* pObject, ScRange& rRange );
     131                 :            : 
     132                 :            :     void        Modified();
     133                 :            : 
     134                 :            : public:
     135                 :         46 :                 ScDetectiveFunc(ScDocument* pDocument, SCTAB nTable) : pDoc(pDocument),nTab(nTable) {}
     136                 :            : 
     137                 :            :     sal_Bool        ShowSucc( SCCOL nCol, SCROW nRow );
     138                 :            :     sal_Bool        ShowPred( SCCOL nCol, SCROW nRow );
     139                 :            :     sal_Bool        ShowError( SCCOL nCol, SCROW nRow );
     140                 :            : 
     141                 :            :     sal_Bool        DeleteSucc( SCCOL nCol, SCROW nRow );
     142                 :            :     sal_Bool        DeletePred( SCCOL nCol, SCROW nRow );
     143                 :            :     sal_Bool        DeleteAll( ScDetectiveDelete eWhat );
     144                 :            : 
     145                 :            :     sal_Bool        MarkInvalid(sal_Bool& rOverflow);
     146                 :            : 
     147                 :            :     void        GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScTokenRef>& rRefTokens);
     148                 :            :     void        GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScTokenRef>& rRefTokens);
     149                 :            : 
     150                 :            :     static void UpdateAllComments( ScDocument& rDoc );        // on all tables
     151                 :            :     void        UpdateAllArrowColors();     // on all tables
     152                 :            : 
     153                 :            :     static sal_Bool IsNonAlienArrow( SdrObject* pObject );
     154                 :            : 
     155                 :            :     ScDetectiveObjType GetDetectiveObjectType( SdrObject* pObject, SCTAB nObjTab,
     156                 :            :                                 ScAddress& rPosition, ScRange& rSource, bool& rRedLine );
     157                 :            :     void        InsertObject( ScDetectiveObjType eType, const ScAddress& rPosition,
     158                 :            :                                 const ScRange& rSource, sal_Bool bRedLine );
     159                 :            : 
     160                 :            :     static ColorData GetArrowColor();
     161                 :            :     static ColorData GetErrorColor();
     162                 :            :     static ColorData GetCommentColor();
     163                 :            :     static void InitializeColors();
     164                 :            :     static sal_Bool IsColorsInitialized();
     165                 :            : };
     166                 :            : 
     167                 :            : 
     168                 :            : 
     169                 :            : #endif
     170                 :            : 
     171                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10