1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <rtl/ustring.hxx>
13 #include <string_view>
16 #include <config_options_calc.h>
21 struct ScFormulaCellGroup
;
26 struct VectorRefArray
;
30 namespace osl
{ class File
; }
34 #if ENABLE_FORMULA_LOGGER
37 * Outputs formula calculation log outputs to specified file.
41 std::unique_ptr
<osl::File
> mpLogFile
;
43 sal_Int32 mnNestLevel
= 0;
44 const ScFormulaCellGroup
* mpLastGroup
= nullptr;
46 void writeAscii( const char* s
);
47 void writeAscii( const char* s
, size_t n
);
48 void write( std::u16string_view ou
);
49 void write( sal_Int32 n
);
53 void writeNestLevel();
57 static FormulaLogger
& get();
60 * This class is only moveable.
64 friend class FormulaLogger
;
67 std::unique_ptr
<Impl
> mpImpl
;
70 GroupScope() = delete;
71 GroupScope( const GroupScope
& ) = delete;
72 GroupScope
& operator= ( const GroupScope
& ) = delete;
76 FormulaLogger
& rLogger
, const OUString
& rPrefix
,
77 const ScDocument
& rDoc
, const ScFormulaCell
& rCell
,
78 bool bOutputEnabled
);
81 GroupScope(GroupScope
&& r
) noexcept
;
85 * Add an arbitrary message to dump to the log.
87 void addMessage( const OUString
& rMsg
);
90 * Add to the log a vector reference information for a single
94 const ScAddress
& rCellPos
, const ScAddress
& rRefPos
, size_t nLen
,
95 const formula::VectorRefArray
& rArray
);
98 * Add to the log a vector reference information for a range
102 const ScAddress
& rCellPos
, const ScAddress
& rRefPos
, size_t nLen
,
103 const std::vector
<formula::VectorRefArray
>& rArrays
);
106 * Add to the log a single cell reference information.
109 const ScAddress
& rCellPos
, const ScAddress
& rRefPos
,
110 const formula::FormulaToken
& rToken
);
112 void addGroupSizeThresholdMessage( const ScFormulaCell
& rCell
);
115 * Call this when the group calculation has finished successfully.
117 void setCalcComplete();
120 FormulaLogger( const FormulaLogger
& ) = delete;
121 FormulaLogger
& operator= ( const FormulaLogger
& ) = delete;
126 GroupScope
enterGroup( const ScDocument
& rDoc
, const ScFormulaCell
& rCell
);
132 * Dummy class with all empty inline methods.
138 static FormulaLogger
get()
140 return FormulaLogger();
146 void addMessage( [[maybe_unused
]] const OUString
& /*rMsg*/ ) { (void) this; /* loplugin:staticmethods */ }
149 const ScAddress
& /*rCellPos*/, const ScAddress
& /*rRefPos*/, size_t /*nLen*/,
150 const formula::VectorRefArray
& /*rArray*/ )
152 (void) this; /* loplugin:staticmethods */
156 const ScAddress
& /*rCellPos*/, const ScAddress
& /*rRefPos*/, size_t /*nLen*/,
157 const std::vector
<formula::VectorRefArray
>& /*rArrays*/ )
159 (void) this; /* loplugin:staticmethods */
163 const ScAddress
& /*rCellPos*/, const ScAddress
& /*rRefPos*/,
164 const formula::FormulaToken
& /*rToken*/ )
166 (void) this; /* loplugin:staticmethods */
169 void addGroupSizeThresholdMessage( const ScFormulaCell
& /*rCell*/ )
171 (void) this; /* loplugin:staticmethods */
174 void setCalcComplete() { (void) this; /* loplugin:staticmethods */ }
177 GroupScope
enterGroup( const ScDocument
& /*rDoc*/, const ScFormulaCell
& /*rCell*/ )
179 (void) this; /* loplugin:staticmethods */
184 #endif // ENABLE_FORMULA_LOGGER
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */