Dump the single cell vector reference info to the log.
Change-Id: If0ee6dca6642063501c728bec3b4e5d7b6401442
This commit is contained in:
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
class ScFormulaCell;
|
class ScFormulaCell;
|
||||||
class ScDocument;
|
class ScDocument;
|
||||||
|
class ScAddress;
|
||||||
|
|
||||||
|
namespace formula { struct VectorRefArray; }
|
||||||
|
|
||||||
namespace sc {
|
namespace sc {
|
||||||
|
|
||||||
@@ -73,6 +76,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
void addMessage( const OUString& rMsg );
|
void addMessage( const OUString& rMsg );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add to the log a vector reference information for a single
|
||||||
|
* reference.
|
||||||
|
*/
|
||||||
|
void addRefMessage( const ScAddress& rPos, size_t nLen, const formula::VectorRefArray& rArray );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this when the group calculation has finished successfullly.
|
* Call this when the group calculation has finished successfullly.
|
||||||
*/
|
*/
|
||||||
@@ -106,6 +115,8 @@ public:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void addMessage( const OUString& /*rMsg*/ ) { (void) this; /* loplugin:staticmethods */ }
|
void addMessage( const OUString& /*rMsg*/ ) { (void) this; /* loplugin:staticmethods */ }
|
||||||
|
void addRefMessage( const ScAddress& /*rPos*/, size_t /*nLen*/, const formula::VectorRefArray& /*rArray*/ )
|
||||||
|
{ (void) this; /* loplugin:staticmethods */ }
|
||||||
void setCalcComplete() { (void) this; /* loplugin:staticmethods */ }
|
void setCalcComplete() { (void) this; /* loplugin:staticmethods */ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -4125,7 +4125,7 @@ bool ScFormulaCell::InterpretFormulaGroup()
|
|||||||
|
|
||||||
ScTokenArray aCode;
|
ScTokenArray aCode;
|
||||||
ScGroupTokenConverter aConverter(aCode, *pDocument, *this, xGroup->mpTopCell->aPos);
|
ScGroupTokenConverter aConverter(aCode, *pDocument, *this, xGroup->mpTopCell->aPos);
|
||||||
if (!aConverter.convert(*pCode))
|
if (!aConverter.convert(*pCode, aScope))
|
||||||
{
|
{
|
||||||
SAL_INFO("sc.opencl", "conversion of group " << this << " failed, disabling");
|
SAL_INFO("sc.opencl", "conversion of group " << this << " failed, disabling");
|
||||||
mxGroup->meCalcState = sc::GroupCalcDisabled;
|
mxGroup->meCalcState = sc::GroupCalcDisabled;
|
||||||
|
@@ -7,12 +7,12 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <grouptokenconverter.hxx>
|
||||||
|
#include <compiler.hxx>
|
||||||
|
|
||||||
#include <formula/token.hxx>
|
#include <formula/token.hxx>
|
||||||
#include <formula/vectortoken.hxx>
|
#include <formula/vectortoken.hxx>
|
||||||
|
|
||||||
#include "compiler.hxx"
|
|
||||||
#include "grouptokenconverter.hxx"
|
|
||||||
|
|
||||||
using namespace formula;
|
using namespace formula;
|
||||||
|
|
||||||
bool ScGroupTokenConverter::isSelfReferenceRelative(const ScAddress& rRefPos, SCROW nRelRow)
|
bool ScGroupTokenConverter::isSelfReferenceRelative(const ScAddress& rRefPos, SCROW nRelRow)
|
||||||
@@ -83,13 +83,16 @@ SCROW ScGroupTokenConverter::trimLength(SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SC
|
|||||||
return nRowLen;
|
return nRowLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScGroupTokenConverter::ScGroupTokenConverter(ScTokenArray& rGroupTokens, ScDocument& rDoc, ScFormulaCell& rCell, const ScAddress& rPos) :
|
ScGroupTokenConverter::ScGroupTokenConverter(
|
||||||
mrGroupTokens(rGroupTokens), mrDoc(rDoc), mrCell(rCell), mrPos(rPos)
|
ScTokenArray& rGroupTokens, ScDocument& rDoc, ScFormulaCell& rCell, const ScAddress& rPos) :
|
||||||
|
mrGroupTokens(rGroupTokens),
|
||||||
|
mrDoc(rDoc),
|
||||||
|
mrCell(rCell),
|
||||||
|
mrPos(rPos)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScGroupTokenConverter::convert(ScTokenArray& rCode)
|
bool ScGroupTokenConverter::convert( ScTokenArray& rCode, sc::FormulaLogger::GroupScope& rScope )
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
{ // debug to start with:
|
{ // debug to start with:
|
||||||
@@ -135,6 +138,7 @@ bool ScGroupTokenConverter::convert(ScTokenArray& rCode)
|
|||||||
|
|
||||||
formula::SingleVectorRefToken aTok(aArray, nLen, nTrimLen);
|
formula::SingleVectorRefToken aTok(aArray, nLen, nTrimLen);
|
||||||
mrGroupTokens.AddToken(aTok);
|
mrGroupTokens.AddToken(aTok);
|
||||||
|
rScope.addRefMessage(aRefPos, nLen, aArray);
|
||||||
|
|
||||||
if (nTrimLen && !mxFormulaGroupContext)
|
if (nTrimLen && !mxFormulaGroupContext)
|
||||||
{
|
{
|
||||||
@@ -250,7 +254,7 @@ bool ScGroupTokenConverter::convert(ScTokenArray& rCode)
|
|||||||
|
|
||||||
mrGroupTokens.AddOpCode(ocOpen);
|
mrGroupTokens.AddOpCode(ocOpen);
|
||||||
|
|
||||||
if (!convert(*pNamedTokens))
|
if (!convert(*pNamedTokens, rScope))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mrGroupTokens.AddOpCode(ocClose);
|
mrGroupTokens.AddOpCode(ocClose);
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include "scdllapi.h"
|
#include "scdllapi.h"
|
||||||
#include "tokenarray.hxx"
|
#include "tokenarray.hxx"
|
||||||
#include "types.hxx"
|
#include "types.hxx"
|
||||||
|
#include <formulalogger.hxx>
|
||||||
|
|
||||||
class SC_DLLPUBLIC ScGroupTokenConverter
|
class SC_DLLPUBLIC ScGroupTokenConverter
|
||||||
{
|
{
|
||||||
@@ -31,7 +32,7 @@ class SC_DLLPUBLIC ScGroupTokenConverter
|
|||||||
public:
|
public:
|
||||||
ScGroupTokenConverter(ScTokenArray& rGroupTokens, ScDocument& rDoc, ScFormulaCell& rCell, const ScAddress& rPos);
|
ScGroupTokenConverter(ScTokenArray& rGroupTokens, ScDocument& rDoc, ScFormulaCell& rCell, const ScAddress& rPos);
|
||||||
|
|
||||||
bool convert(ScTokenArray& rCode);
|
bool convert( ScTokenArray& rCode, sc::FormulaLogger::GroupScope& rScope );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDED_SC_SOURCE_CORE_INC_GROUPTOKENCONVERTER_HXX
|
#endif // INCLUDED_SC_SOURCE_CORE_INC_GROUPTOKENCONVERTER_HXX
|
||||||
|
@@ -10,11 +10,14 @@
|
|||||||
#include <tokenarray.hxx>
|
#include <tokenarray.hxx>
|
||||||
#include <document.hxx>
|
#include <document.hxx>
|
||||||
#include <tokenstringcontext.hxx>
|
#include <tokenstringcontext.hxx>
|
||||||
|
#include <address.hxx>
|
||||||
|
|
||||||
#include <o3tl/make_unique.hxx>
|
#include <o3tl/make_unique.hxx>
|
||||||
#include <sfx2/objsh.hxx>
|
#include <sfx2/objsh.hxx>
|
||||||
#include <sfx2/docfile.hxx>
|
#include <sfx2/docfile.hxx>
|
||||||
#include <tools/urlobj.hxx>
|
#include <tools/urlobj.hxx>
|
||||||
|
#include <formula/vectortoken.hxx>
|
||||||
|
#include <rtl/ustrbuf.hxx>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
@@ -48,6 +51,7 @@ FormulaLogger& FormulaLogger::get()
|
|||||||
struct FormulaLogger::GroupScope::Impl
|
struct FormulaLogger::GroupScope::Impl
|
||||||
{
|
{
|
||||||
FormulaLogger& mrLogger;
|
FormulaLogger& mrLogger;
|
||||||
|
const ScDocument& mrDoc;
|
||||||
|
|
||||||
OUString maPrefix;
|
OUString maPrefix;
|
||||||
std::vector<OUString> maMessages;
|
std::vector<OUString> maMessages;
|
||||||
@@ -55,7 +59,7 @@ struct FormulaLogger::GroupScope::Impl
|
|||||||
bool mbCalcComplete = false;
|
bool mbCalcComplete = false;
|
||||||
|
|
||||||
Impl( FormulaLogger& rLogger, const OUString& rPrefix, const ScDocument& rDoc, const ScFormulaCell& rCell ) :
|
Impl( FormulaLogger& rLogger, const OUString& rPrefix, const ScDocument& rDoc, const ScFormulaCell& rCell ) :
|
||||||
mrLogger(rLogger), maPrefix(rPrefix)
|
mrLogger(rLogger), mrDoc(rDoc), maPrefix(rPrefix)
|
||||||
{
|
{
|
||||||
++mrLogger.mnNestLevel;
|
++mrLogger.mnNestLevel;
|
||||||
|
|
||||||
@@ -112,6 +116,47 @@ void FormulaLogger::GroupScope::addMessage( const OUString& rMsg )
|
|||||||
mpImpl->maMessages.push_back(rMsg);
|
mpImpl->maMessages.push_back(rMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormulaLogger::GroupScope::addRefMessage(
|
||||||
|
const ScAddress& rPos, size_t nLen, const formula::VectorRefArray& rArray )
|
||||||
|
{
|
||||||
|
OUStringBuffer aBuf;
|
||||||
|
|
||||||
|
ScRange aRefRange(rPos);
|
||||||
|
aRefRange.aEnd.IncRow(nLen-1);
|
||||||
|
OUString aRangeStr = aRefRange.Format(ScRefFlags::VALID, &mpImpl->mrDoc);
|
||||||
|
aBuf.append(aRangeStr);
|
||||||
|
aBuf.appendAscii(": ");
|
||||||
|
|
||||||
|
if (rArray.mpNumericArray)
|
||||||
|
{
|
||||||
|
if (rArray.mpStringArray)
|
||||||
|
{
|
||||||
|
// mixture of numeric and string cells.
|
||||||
|
aBuf.appendAscii("numeric and string");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// numeric cells only.
|
||||||
|
aBuf.appendAscii("numeric only");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (rArray.mpStringArray)
|
||||||
|
{
|
||||||
|
// string cells only.
|
||||||
|
aBuf.appendAscii("string only");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// empty cells.
|
||||||
|
aBuf.appendAscii("empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mpImpl->maMessages.push_back(aBuf.makeStringAndClear());
|
||||||
|
}
|
||||||
|
|
||||||
void FormulaLogger::GroupScope::setCalcComplete()
|
void FormulaLogger::GroupScope::setCalcComplete()
|
||||||
{
|
{
|
||||||
mpImpl->mbCalcComplete = true;
|
mpImpl->mbCalcComplete = true;
|
||||||
|
Reference in New Issue
Block a user