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 {
47 };
48 
50 {
54  static bool bColorsInitialized;
55 
58 
59  enum class DrawPosMode
60  {
61  TopLeft,
62  BottomRight,
63  DetectiveArrow,
64  };
65 
67  Point GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) const;
68 
70  tools::Rectangle GetDrawRect( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
71 
73  tools::Rectangle GetDrawRect( SCCOL nCol, SCROW nRow ) const;
74 
75  bool HasArrow( const ScAddress& rStart,
76  SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );
77 
78  void DeleteArrowsAt( SCCOL nCol, SCROW nRow, bool bDestPnt );
79  void DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
80 
81  bool HasError( const ScRange& rRange, ScAddress& rErrPos );
82 
84  void InsertArrow( SCCOL nCol, SCROW nRow,
85  SCCOL nRefStartCol, SCROW nRefStartRow,
86  SCCOL nRefEndCol, SCROW nRefEndRow,
87  bool bFromOtherTab, bool bRed,
88  ScDetectiveData& rData );
89  void InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
90  SCCOL nEndCol, SCROW nEndRow, bool bRed,
91  ScDetectiveData& rData );
92 
94  bool DrawEntry( SCCOL nCol, SCROW nRow, const ScRange& rRef,
95  ScDetectiveData& rData );
96  bool DrawAlienEntry( const ScRange& rRef,
97  ScDetectiveData& rData );
98 
99  void DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData );
100 
101  sal_uInt16 InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel );
102  sal_uInt16 InsertPredLevelArea( const ScRange& rRef,
103  ScDetectiveData& rData, sal_uInt16 nLevel );
104  sal_uInt16 FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nLevel, sal_uInt16 nDeleteLevel );
105  sal_uInt16 FindPredLevelArea( const ScRange& rRef,
106  sal_uInt16 nLevel, sal_uInt16 nDeleteLevel );
107 
108  sal_uInt16 InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel );
109 
110  sal_uInt16 InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
111  ScDetectiveData& rData, sal_uInt16 nLevel );
112  sal_uInt16 FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
113  sal_uInt16 nLevel, sal_uInt16 nDeleteLevel );
114 
115  void FindFrameForObject( const SdrObject* pObject, ScRange& rRange );
116 
117  void Modified();
118 
119 public:
120  ScDetectiveFunc(ScDocument& rDocument, SCTAB nTable) : rDoc(rDocument),nTab(nTable) {}
121 
122  bool ShowSucc( SCCOL nCol, SCROW nRow );
123  bool ShowPred( SCCOL nCol, SCROW nRow );
124  bool ShowError( SCCOL nCol, SCROW nRow );
125 
126  bool DeleteSucc( SCCOL nCol, SCROW nRow );
127  bool DeletePred( SCCOL nCol, SCROW nRow );
128  bool DeleteAll( ScDetectiveDelete eWhat );
129  bool DeleteCirclesAt( SCCOL nCol, SCROW nRow );
130 
131  bool MarkInvalid(bool& rOverflow);
132 
133  void GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScTokenRef>& rRefTokens);
134  void GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScTokenRef>& rRefTokens);
135 
136  static void UpdateAllComments( ScDocument& rDoc );
137  void UpdateAllArrowColors();
138 
139  static bool IsNonAlienArrow( const SdrObject* pObject );
140 
141  ScDetectiveObjType GetDetectiveObjectType( SdrObject* pObject, SCTAB nObjTab,
142  ScAddress& rPosition, ScRange& rSource, bool& rRedLine );
143  void InsertObject( ScDetectiveObjType eType, const ScAddress& rPosition,
144  const ScRange& rSource, bool bRedLine );
145 
146  static Color GetArrowColor();
147  static Color GetErrorColor();
148  static Color GetCommentColor();
149  static void InitializeColors();
150  static bool IsColorsInitialized();
151  static void AppendChangTrackNoteSeparator(OUString &str);
152 };
153 
154 #endif
155 
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static Color nArrowColor
Definition: detfunc.hxx:51
static Color nErrorColor
Definition: detfunc.hxx:52
ScDetectiveObjType
Definition: detfunc.hxx:39
ScDetectiveFunc(ScDocument &rDocument, SCTAB nTable)
Definition: detfunc.hxx:120
sal_Int16 SCCOL
Definition: types.hxx:22
static bool bColorsInitialized
Definition: detfunc.hxx:54
static Color nCommentColor
Definition: detfunc.hxx:53
sal_Int32 SCROW
Definition: types.hxx:18
ScDetectiveDelete
Definition: detfunc.hxx:37
#define SC_DLLPUBLIC
Definition: scdllapi.h:28
sal_Int16 SCTAB
Definition: types.hxx:23
ScDocument & rDoc
Definition: detfunc.hxx:56