LibreOffice Module sc (master)  1
detfunc.hxx
Go to the documentation of this file.
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 INCLUDED_SC_INC_DETFUNC_HXX
21 #define INCLUDED_SC_INC_DETFUNC_HXX
22 
23 #include "address.hxx"
24 #include <tools/gen.hxx>
25 #include <tools/color.hxx>
26 #include "scdllapi.h"
27 
28 #include <vector>
29 
30 class SdrObject;
31 
32 class ScDetectiveData;
33 class ScDocument;
34 
35 #define SC_DET_MAXCIRCLE 1000
36 
38 
40 {
46 };
47 
49 {
53  static bool bColorsInitialized;
54 
57 
58  enum class DrawPosMode
59  {
60  TopLeft,
61  BottomRight,
63  };
64 
66  Point GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) const;
67 
69  tools::Rectangle GetDrawRect( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
70 
72  tools::Rectangle GetDrawRect( SCCOL nCol, SCROW nRow ) const;
73 
74  bool HasArrow( const ScAddress& rStart,
75  SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );
76 
77  void DeleteArrowsAt( SCCOL nCol, SCROW nRow, bool bDestPnt );
78  void DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
79 
80  bool HasError( const ScRange& rRange, ScAddress& rErrPos );
81 
83  void InsertArrow( SCCOL nCol, SCROW nRow,
84  SCCOL nRefStartCol, SCROW nRefStartRow,
85  SCCOL nRefEndCol, SCROW nRefEndRow,
86  bool bFromOtherTab, bool bRed,
87  ScDetectiveData& rData );
88  void InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
89  SCCOL nEndCol, SCROW nEndRow, bool bRed,
90  ScDetectiveData& rData );
91 
93  bool DrawEntry( SCCOL nCol, SCROW nRow, const ScRange& rRef,
94  ScDetectiveData& rData );
95  bool DrawAlienEntry( const ScRange& rRef,
96  ScDetectiveData& rData );
97 
98  void DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData );
99 
100  sal_uInt16 InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel );
101  sal_uInt16 InsertPredLevelArea( const ScRange& rRef,
102  ScDetectiveData& rData, sal_uInt16 nLevel );
103  sal_uInt16 FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nLevel, sal_uInt16 nDeleteLevel );
104  sal_uInt16 FindPredLevelArea( const ScRange& rRef,
105  sal_uInt16 nLevel, sal_uInt16 nDeleteLevel );
106 
107  sal_uInt16 InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel );
108 
109  sal_uInt16 InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
110  ScDetectiveData& rData, sal_uInt16 nLevel );
111  sal_uInt16 FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
112  sal_uInt16 nLevel, sal_uInt16 nDeleteLevel );
113 
114  void FindFrameForObject( const SdrObject* pObject, ScRange& rRange );
115 
116  void Modified();
117 
118 public:
119  ScDetectiveFunc(ScDocument* pDocument, SCTAB nTable) : pDoc(pDocument),nTab(nTable) {}
120 
121  bool ShowSucc( SCCOL nCol, SCROW nRow );
122  bool ShowPred( SCCOL nCol, SCROW nRow );
123  bool ShowError( SCCOL nCol, SCROW nRow );
124 
125  bool DeleteSucc( SCCOL nCol, SCROW nRow );
126  bool DeletePred( SCCOL nCol, SCROW nRow );
127  bool DeleteAll( ScDetectiveDelete eWhat );
128 
129  bool MarkInvalid(bool& rOverflow);
130 
131  void GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScTokenRef>& rRefTokens);
132  void GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScTokenRef>& rRefTokens);
133 
134  static void UpdateAllComments( ScDocument& rDoc );
135  void UpdateAllArrowColors();
136 
137  static bool IsNonAlienArrow( const SdrObject* pObject );
138 
140  ScAddress& rPosition, ScRange& rSource, bool& rRedLine );
141  void InsertObject( ScDetectiveObjType eType, const ScAddress& rPosition,
142  const ScRange& rSource, bool bRedLine );
143 
144  static Color GetArrowColor();
145  static Color GetErrorColor();
146  static Color GetCommentColor();
147  static void InitializeColors();
148  static bool IsColorsInitialized();
149  static void AppendChangTrackNoteSeparator(OUString &str);
150 };
151 
152 #endif
153 
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Rectangle GetDrawRect(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
Definition: detfunc.cxx:346
bool ShowPred(SCCOL nCol, SCROW nRow)
Definition: detfunc.cxx:1156
static Color nArrowColor
Definition: detfunc.hxx:50
void DeleteBox(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
Definition: detfunc.cxx:737
void FindFrameForObject(const SdrObject *pObject, ScRange &rRange)
Definition: detfunc.cxx:1535
bool ShowSucc(SCCOL nCol, SCROW nRow)
Definition: detfunc.cxx:1176
sal_uInt16 InsertPredLevelArea(const ScRange &rRef, ScDetectiveData &rData, sal_uInt16 nLevel)
Definition: detfunc.cxx:784
sal_uInt16 FindPredLevel(SCCOL nCol, SCROW nRow, sal_uInt16 nLevel, sal_uInt16 nDeleteLevel)
Definition: detfunc.cxx:904
ScDetectiveFunc(ScDocument *pDocument, SCTAB nTable)
Definition: detfunc.hxx:119
static bool IsNonAlienArrow(const SdrObject *pObject)
Definition: detfunc.cxx:430
sal_uInt16 InsertErrorLevel(SCCOL nCol, SCROW nRow, ScDetectiveData &rData, sal_uInt16 nLevel)
Definition: detfunc.cxx:962
static Color GetErrorColor()
Definition: detfunc.cxx:1663
void InsertObject(ScDetectiveObjType eType, const ScAddress &rPosition, const ScRange &rSource, bool bRedLine)
Definition: detfunc.cxx:1624
void UpdateAllArrowColors()
on all tables
Definition: detfunc.cxx:1457
void GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,::std::vector< ScTokenRef > &rRefTokens)
Definition: detfunc.cxx:1365
bool ShowError(SCCOL nCol, SCROW nRow)
Definition: detfunc.cxx:1196
Point GetDrawPos(SCCOL nCol, SCROW nRow, DrawPosMode eMode) const
Definition: detfunc.cxx:311
static Color nErrorColor
Definition: detfunc.hxx:51
static Color GetArrowColor()
Definition: detfunc.cxx:1656
sal_uInt16 InsertSuccLevel(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScDetectiveData &rData, sal_uInt16 nLevel)
Definition: detfunc.cxx:1010
Top-left edge of the cell.
bool DeletePred(SCCOL nCol, SCROW nRow)
Definition: detfunc.cxx:1228
void Modified()
Definition: detfunc.cxx:280
bool DrawEntry(SCCOL nCol, SCROW nRow, const ScRange &rRef, ScDetectiveData &rData)
DrawEntry / DrawAlienEntry check for existing arrows and errors.
Definition: detfunc.cxx:603
ScDocument * pDoc
Definition: detfunc.hxx:55
sal_uInt16 FindSuccLevel(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nLevel, sal_uInt16 nDeleteLevel)
Definition: detfunc.cxx:1096
static bool IsColorsInitialized()
Definition: detfunc.cxx:1689
void DrawCircle(SCCOL nCol, SCROW nRow, ScDetectiveData &rData)
Definition: detfunc.cxx:636
Bottom-right edge of the cell.
ScDetectiveObjType
Definition: detfunc.hxx:39
sal_Int16 SCCOL
Definition: types.hxx:22
static bool bColorsInitialized
Definition: detfunc.hxx:53
bool MarkInvalid(bool &rOverflow)
Definition: detfunc.cxx:1298
static Color nCommentColor
Definition: detfunc.hxx:52
static void UpdateAllComments(ScDocument &rDoc)
on all tables
Definition: detfunc.cxx:1413
sal_uInt16 InsertPredLevel(SCCOL nCol, SCROW nRow, ScDetectiveData &rData, sal_uInt16 nLevel)
Definition: detfunc.cxx:817
sal_uInt16 FindPredLevelArea(const ScRange &rRef, sal_uInt16 nLevel, sal_uInt16 nDeleteLevel)
Definition: detfunc.cxx:883
bool DeleteAll(ScDetectiveDelete eWhat)
Definition: detfunc.cxx:1241
bool DeleteSucc(SCCOL nCol, SCROW nRow)
Definition: detfunc.cxx:1215
static Color GetCommentColor()
Definition: detfunc.cxx:1670
sal_Int32 SCROW
Definition: types.hxx:18
ScDetectiveDelete
Definition: detfunc.hxx:37
void GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,::std::vector< ScTokenRef > &rRefTokens)
Definition: detfunc.cxx:1384
static void AppendChangTrackNoteSeparator(OUString &str)
Definition: detfunc.cxx:1694
bool HasError(const ScRange &rRange, ScAddress &rErrPos)
Definition: detfunc.cxx:292
static void InitializeColors()
Definition: detfunc.cxx:1677
bool HasArrow(const ScAddress &rStart, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab)
Definition: detfunc.cxx:378
Position inside cell for detective arrows.
bool DrawAlienEntry(const ScRange &rRef, ScDetectiveData &rData)
Definition: detfunc.cxx:621
void DeleteArrowsAt(SCCOL nCol, SCROW nRow, bool bDestPnt)
Definition: detfunc.cxx:667
void InsertToOtherTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool bRed, ScDetectiveData &rData)
Definition: detfunc.cxx:531
void InsertArrow(SCCOL nCol, SCROW nRow, SCCOL nRefStartCol, SCROW nRefStartRow, SCCOL nRefEndCol, SCROW nRefEndRow, bool bFromOtherTab, bool bRed, ScDetectiveData &rData)
called from DrawEntry/DrawAlienEntry and InsertObject
Definition: detfunc.cxx:450
sal_Int16 SCTAB
Definition: types.hxx:23
ScDetectiveObjType GetDetectiveObjectType(SdrObject *pObject, SCTAB nObjTab, ScAddress &rPosition, ScRange &rSource, bool &rRedLine)
Definition: detfunc.cxx:1570