sc/inc/refdata.hxx | 4 +- sc/qa/unit/helper/qahelper.cxx | 43 +++++++++++++++++++++++++ sc/qa/unit/helper/qahelper.hxx | 11 ++++++ sc/qa/unit/subsequent_export-test.cxx | 42 ++++++++++++++++++++++++ sc/qa/unit/ucalc_formula.cxx | 42 ------------------------ sc/source/core/data/formulaiter.cxx | 4 +- sc/source/core/tool/compiler.cxx | 2 - sc/source/core/tool/interpr1.cxx | 5 +- sc/source/core/tool/interpr4.cxx | 26 ++------------- sc/source/core/tool/refdata.cxx | 56 ++++++++++++++------------------- sc/source/core/tool/reftokenhelper.cxx | 16 +-------- sc/source/core/tool/token.cxx | 4 +- sc/source/filter/excel/excform8.cxx | 9 +---- sc/source/filter/inc/namebuff.hxx | 25 ++------------ sc/source/filter/lotus/lotform.cxx | 5 +- sc/source/ui/unoobj/funcuno.cxx | 8 ---- 16 files changed, 146 insertions(+), 156 deletions(-)
New commits: commit 5a027080eadd3bf141a62649b53c910bfa7f05e1 Author: Kohei Yoshida <[email protected]> Date: Fri Jul 26 20:53:54 2013 -0400 More on the ref object. Change-Id: Id75bf12a04a1756aed4178df397c5a28787307a8 diff --git a/sc/source/core/data/formulaiter.cxx b/sc/source/core/data/formulaiter.cxx index f14817d..d055ecb 100644 --- a/sc/source/core/data/formulaiter.cxx +++ b/sc/source/core/data/formulaiter.cxx @@ -55,8 +55,8 @@ bool ScDetectiveRefIter::GetNextRef( ScRange& rRange ) if( p ) { SingleDoubleRefProvider aProv( *p ); - rRange.aStart.Set( aProv.Ref1.nCol, aProv.Ref1.nRow, aProv.Ref1.nTab ); - rRange.aEnd.Set( aProv.Ref2.nCol, aProv.Ref2.nRow, aProv.Ref2.nTab ); + rRange.aStart = aProv.Ref1.toAbs(aPos); + rRange.aEnd = aProv.Ref2.toAbs(aPos); bRet = true; } diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index a18a42d..f9c3a4c 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3989,8 +3989,9 @@ void ScInterpreter::ScColumns() String aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef); - nVal += static_cast<sal_uLong>(aRef.Ref2.nTab - aRef.Ref1.nTab + 1) * - static_cast<sal_uLong>(aRef.Ref2.nCol - aRef.Ref1.nCol + 1); + ScRange aAbs = aRef.toAbs(aPos); + nVal += static_cast<sal_uLong>(aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1) * + static_cast<sal_uLong>(aAbs.aEnd.Col() - aAbs.aStart.Col() + 1); } break; default: diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index c3a47a4..12f49b6 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -1872,10 +1872,7 @@ void ScInterpreter::PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab) if (!IfErrorPushError()) { ScSingleRefData aRef; - aRef.InitFlags(); - aRef.nCol = nCol; - aRef.nRow = nRow; - aRef.nTab = nTab; + aRef.InitAddress(ScAddress(nCol,nRow,nTab)); PushTempTokenWithoutError( new ScSingleRefToken( aRef ) ); } } @@ -1887,13 +1884,7 @@ void ScInterpreter::PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, if (!IfErrorPushError()) { ScComplexRefData aRef; - aRef.InitFlags(); - aRef.Ref1.nCol = nCol1; - aRef.Ref1.nRow = nRow1; - aRef.Ref1.nTab = nTab1; - aRef.Ref2.nCol = nCol2; - aRef.Ref2.nRow = nRow2; - aRef.Ref2.nTab = nTab2; + aRef.InitRange(ScRange(nCol1,nRow1,nTab1,nCol2,nRow2,nTab2)); PushTempTokenWithoutError( new ScDoubleRefToken( aRef ) ); } } @@ -1905,10 +1896,7 @@ void ScInterpreter::PushExternalSingleRef( if (!IfErrorPushError()) { ScSingleRefData aRef; - aRef.InitFlags(); - aRef.nCol = nCol; - aRef.nRow = nRow; - aRef.nTab = nTab; + aRef.InitAddress(ScAddress(nCol,nRow,nTab)); PushTempTokenWithoutError( new ScExternalSingleRefToken(nFileId, rTabName, aRef)) ; } } @@ -1921,13 +1909,7 @@ void ScInterpreter::PushExternalDoubleRef( if (!IfErrorPushError()) { ScComplexRefData aRef; - aRef.InitFlags(); - aRef.Ref1.nCol = nCol1; - aRef.Ref1.nRow = nRow1; - aRef.Ref1.nTab = nTab1; - aRef.Ref2.nCol = nCol2; - aRef.Ref2.nRow = nRow2; - aRef.Ref2.nTab = nTab2; + aRef.InitRange(ScRange(nCol1,nRow1,nTab1,nCol2,nRow2,nTab2)); PushTempTokenWithoutError( new ScExternalDoubleRefToken(nFileId, rTabName, aRef) ); } } diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx index 0dcda68..6b8d288 100644 --- a/sc/source/core/tool/reftokenhelper.cxx +++ b/sc/source/core/tool/reftokenhelper.cxx @@ -171,24 +171,12 @@ void ScRefTokenHelper::getRangeListFromTokens( void ScRefTokenHelper::getTokenFromRange(ScTokenRef& pToken, const ScRange& rRange) { ScComplexRefData aData; - aData.InitFlags(); - aData.Ref1.nCol = rRange.aStart.Col(); - aData.Ref1.nRow = rRange.aStart.Row(); - aData.Ref1.nTab = rRange.aStart.Tab(); - aData.Ref1.SetColRel(false); - aData.Ref1.SetRowRel(false); - aData.Ref1.SetTabRel(false); + aData.InitRange(rRange); aData.Ref1.SetFlag3D(true); - aData.Ref2.nCol = rRange.aEnd.Col(); - aData.Ref2.nRow = rRange.aEnd.Row(); - aData.Ref2.nTab = rRange.aEnd.Tab(); - aData.Ref2.SetColRel(false); - aData.Ref2.SetRowRel(false); - aData.Ref2.SetTabRel(false); // Display sheet name on 2nd reference only when the 1st and 2nd refs are on // different sheets. - aData.Ref2.SetFlag3D(aData.Ref1.nTab != aData.Ref2.nTab); + aData.Ref2.SetFlag3D(rRange.aStart.Tab() != rRange.aEnd.Tab()); pToken.reset(new ScDoubleRefToken(aData)); } diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 7241901..7a180e4 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -498,8 +498,6 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, aIn >> nRow >> nCol; - aSRD.nCol = static_cast<SCCOL>(nCol); - aSRD.nRow = nRow & 0x3FFF; aSRD.SetRelTab(0); aSRD.SetFlag3D( bRangeName && !bCondFormat ); @@ -1050,8 +1048,6 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa aIn >> nRow >> nCol; - aSRD.nCol = static_cast<SCCOL>(nCol); - aSRD.nRow = nRow & 0x3FFF; aSRD.SetRelTab(0); aSRD.SetFlag3D( bRangeName && !bCondFormat ); @@ -1191,9 +1187,8 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa if( nFirstScTab != nLastScTab ) { aCRD.Ref1 = aSRD; - aCRD.Ref2.nCol = aSRD.nCol; - aCRD.Ref2.nRow = aSRD.nRow; - aCRD.Ref2.nTab = nLastScTab; + aCRD.Ref2 = aSRD; + aCRD.Ref2.SetAbsTab(nLastScTab); rRangeList.Append( aCRD, nTab ); } else diff --git a/sc/source/filter/inc/namebuff.hxx b/sc/source/filter/inc/namebuff.hxx index a8b3089..38ead51 100644 --- a/sc/source/filter/inc/namebuff.hxx +++ b/sc/source/filter/inc/namebuff.hxx @@ -214,31 +214,14 @@ inline void RangeNameBufferWK3::Add( const String& rName, const ScRange& aScRang { ScComplexRefData aCRD; ScSingleRefData* pSRD; - const ScAddress* pScAddr; pSRD = &aCRD.Ref1; - pScAddr = &aScRange.aStart; - pSRD->SetFlag3D( sal_True ); - pSRD->nCol = pScAddr->Col(); - pSRD->nRow = pScAddr->Row(); - pSRD->nTab = pScAddr->Tab(); - - // zunaechst ALLE Refs nur absolut - pSRD->SetColRel( false ); - pSRD->SetRowRel( false ); - pSRD->SetTabRel( false ); + pSRD->InitAddress(aScRange.aStart); + pSRD->SetFlag3D(true); pSRD = &aCRD.Ref2; - pScAddr = &aScRange.aEnd; - pSRD->SetFlag3D( sal_True ); - pSRD->nCol = pScAddr->Col(); - pSRD->nRow = pScAddr->Row(); - pSRD->nTab = pScAddr->Tab(); - - // zunaechst ALLE Refs nur absolut - pSRD->SetColRel( false ); - pSRD->SetRowRel( false ); - pSRD->SetTabRel( false ); + pSRD->InitAddress(aScRange.aEnd); + pSRD->SetFlag3D(true); Add( rName, aCRD ); } diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index ed4d076..aaca8d2 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -464,7 +464,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest, nNewId = aPool.Store( rR ); else { - nId = rRangeList.GetIndex( rR.nCol, rR.nRow ); + nId = rRangeList.GetIndex(rR.Col(), rR.Row()); if( nId == ID_FAIL ) // kein Range dazu @@ -491,8 +491,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest, nNewId = aPool.Store( aCRD ); else { - nId = rRangeList.GetIndex( - rR.nCol, rR.nRow, aCRD.Ref2.nCol, aCRD.Ref2.nRow ); + nId = rRangeList.GetIndex(rR.Col(), rR.Row(), aCRD.Ref2.Col(), aCRD.Ref2.Row()); if( nId == ID_FAIL ) // kein Range dazu diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 1090ea1..de55b28 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -355,13 +355,7 @@ static sal_Bool lcl_AddFunctionToken( ScTokenArray& rArray, const OUString& rNam static void lcl_AddRef( ScTokenArray& rArray, long nStartRow, long nColCount, long nRowCount ) { ScComplexRefData aRef; - aRef.InitFlags(); - aRef.Ref1.nTab = 0; - aRef.Ref2.nTab = 0; - aRef.Ref1.nCol = 0; - aRef.Ref1.nRow = (SCROW) nStartRow; - aRef.Ref2.nCol = (SCCOL) (nColCount - 1); - aRef.Ref2.nRow = (SCROW) (nStartRow + nRowCount - 1); + aRef.InitRange(ScRange(0,nStartRow,0,nColCount-1,nStartRow+nRowCount-1,0)); rArray.AddDoubleReference(aRef); } commit 38f0ef2e038f934acee71b2182d2f49b43bd12da Author: Kohei Yoshida <[email protected]> Date: Fri Jul 26 20:07:31 2013 -0400 Add test for exporting and importing of formula refs from xls format. Change-Id: I98f17889c8ad19114c055e87f9ab5dc4e864c817 diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index e145f58..6ba96ce 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -10,6 +10,7 @@ #include "qahelper.hxx" #include "csv_handler.hxx" #include "drwlayer.hxx" +#include "compiler.hxx" #include "svx/svdpage.hxx" #include "svx/svdoole2.hxx" @@ -235,6 +236,48 @@ ScRangeList getChartRanges(ScDocument& rDoc, const SdrOle2Obj& rChartObj) return aRanges; } +namespace { + +ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos) +{ + ScFormulaCell* pCell = rDoc.GetFormulaCell(rPos); + if (!pCell) + return NULL; + + return pCell->GetCode(); +} + +} + +bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected) +{ + ScTokenArray* pCode = getTokens(rDoc, rPos); + if (!pCode) + { + cerr << "Empty token array." << endl; + return false; + } + + OUString aFormula = toString(rDoc, rPos, *pCode); + if (aFormula != OUString::createFromAscii(pExpected)) + { + cerr << "Formula '" << pExpected << "' expected, but '" << aFormula << "' found" << endl; + return false; + } + + return true; +} + +OUString toString( + ScDocument& rDoc, const ScAddress& rPos, ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram) +{ + ScCompiler aComp(&rDoc, rPos, rArray); + aComp.SetGrammar(eGram); + OUStringBuffer aBuf; + aComp.CreateStringFromTokenArray(aBuf); + return aBuf.makeStringAndClear(); +} + ScDocShellRef ScBootstrapFixture::load( bool bReadWrite, const OUString& rURL, const OUString& rFilter, const OUString &rUserData, const OUString& rTypeName, unsigned int nFilterFlags, unsigned int nClipboardID, diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 6e332fe..a4966a1 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -24,6 +24,7 @@ #include <sfx2/docfilt.hxx> #include "sfx2/docfile.hxx" #include "svl/stritem.hxx" +#include "formula/grammar.hxx" #include <string> #include <sstream> @@ -52,6 +53,7 @@ SC_DLLPUBLIC bool testEqualsWithTolerance( long nVal1, long nVal2, long nTol ); class SdrOle2Obj; class ScRangeList; +class ScTokenArray; // data format for row height tests struct TestParam @@ -95,6 +97,15 @@ SC_DLLPUBLIC std::vector<OUString> getChartRangeRepresentations(const SdrOle2Obj SC_DLLPUBLIC ScRangeList getChartRanges(ScDocument& rDoc, const SdrOle2Obj& rChartObj); +SC_DLLPUBLIC bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected); + +/** + * Convert formula token array to a formula string. + */ +SC_DLLPUBLIC OUString toString( + ScDocument& rDoc, const ScAddress& rPos, ScTokenArray& rArray, + formula::FormulaGrammar::Grammar eGram = formula::FormulaGrammar::GRAM_NATIVE); + inline std::string print(const ScAddress& rAddr) { std::ostringstream str; diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 1a8eca8..19ecd3d 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -27,6 +27,7 @@ #include "document.hxx" #include "cellform.hxx" #include "formulacell.hxx" +#include "tokenarray.hxx" #include "svx/svdoole2.hxx" @@ -56,6 +57,7 @@ public: void testInlineArrayXLS(); void testEmbeddedChartXLS(); + void testFormulaReferenceXLS(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -70,6 +72,7 @@ public: CPPUNIT_TEST(testNamedRangeBugfdo62729); CPPUNIT_TEST(testInlineArrayXLS); CPPUNIT_TEST(testEmbeddedChartXLS); + CPPUNIT_TEST(testFormulaReferenceXLS); CPPUNIT_TEST_SUITE_END(); private: @@ -405,6 +408,45 @@ void ScExportTest::testEmbeddedChartXLS() xDocSh->DoClose(); } +void ScExportTest::testFormulaReferenceXLS() +{ + ScDocShellRef xShell = loadDoc("formula-reference.", XLS); + CPPUNIT_ASSERT(xShell.Is()); + + ScDocShellRef xDocSh = saveAndReload(xShell, XLS); + xShell->DoClose(); + CPPUNIT_ASSERT(xDocSh.Is()); + + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + if (!checkFormula(*pDoc, ScAddress(3,1,0), "$A$2+$B$2+$C$2")) + CPPUNIT_FAIL("Wrong formula in D2"); + + if (!checkFormula(*pDoc, ScAddress(3,2,0), "A3+B3+C3")) + CPPUNIT_FAIL("Wrong formula in D3"); + + if (!checkFormula(*pDoc, ScAddress(3,5,0), "SUM($A$6:$C$6)")) + CPPUNIT_FAIL("Wrong formula in D6"); + + if (!checkFormula(*pDoc, ScAddress(3,6,0), "SUM(A7:C7)")) + CPPUNIT_FAIL("Wrong formula in D7"); + + if (!checkFormula(*pDoc, ScAddress(3,9,0), "$Two.$A$2+$Two.$B$2+$Two.$C$2")) + CPPUNIT_FAIL("Wrong formula in D10"); + + if (!checkFormula(*pDoc, ScAddress(3,10,0), "$Two.A3+$Two.B3+$Two.C3")) + CPPUNIT_FAIL("Wrong formula in D11"); + + if (!checkFormula(*pDoc, ScAddress(3,13,0), "MIN($Two.$A$2:$C$2)")) + CPPUNIT_FAIL("Wrong formula in D14"); + + if (!checkFormula(*pDoc, ScAddress(3,14,0), "MAX($Two.A3:C3)")) + CPPUNIT_FAIL("Wrong formula in D15"); + + xDocSh->DoClose(); +} + ScExportTest::ScExportTest() : ScBootstrapFixture("/sc/qa/unit/data") { diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index a8a54d3..def3902 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -155,48 +155,6 @@ void Test::testFormulaRefData() CPPUNIT_ASSERT_MESSAGE("Wrong end position of extended range.", aTest.aEnd == ScAddress(8,6,0)); } -namespace { - -OUString toString( - ScDocument& rDoc, const ScAddress& rPos, ScTokenArray& rArray, FormulaGrammar::Grammar eGram = FormulaGrammar::GRAM_NATIVE) -{ - ScCompiler aComp(&rDoc, rPos, rArray); - aComp.SetGrammar(eGram); - OUStringBuffer aBuf; - aComp.CreateStringFromTokenArray(aBuf); - return aBuf.makeStringAndClear(); -} - -ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos) -{ - ScFormulaCell* pCell = rDoc.GetFormulaCell(rPos); - if (!pCell) - return NULL; - - return pCell->GetCode(); -} - -bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected) -{ - ScTokenArray* pCode = getTokens(rDoc, rPos); - if (!pCode) - { - cerr << "Empty token array." << endl; - return false; - } - - OUString aFormula = toString(rDoc, rPos, *pCode); - if (aFormula != OUString::createFromAscii(pExpected)) - { - cerr << "Formula '" << pExpected << "' expected, but '" << aFormula << "' found" << endl; - return false; - } - - return true; -} - -} - void Test::testFormulaCompiler() { struct { commit 8f9c1cd2e97d5680080cf27c0939d11799423958 Author: Kohei Yoshida <[email protected]> Date: Fri Jul 26 19:59:55 2013 -0400 Use correct sheet index values, to fix sheet name display issue. Change-Id: I8bafdbe5c30060802016b17a5a2077dfac2317cf diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 198f653..5e020d5 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -833,7 +833,7 @@ struct ConventionOOO_A1 : public Convention_A1 if (!bSingleRef) { rBuffer.append(sal_Unicode(':')); - MakeOneRefStrImpl(rBuffer, rComp, aRef.Ref2, aAbs2, (aRef.Ref2.nTab != aRef.Ref1.nTab), bODF); + MakeOneRefStrImpl(rBuffer, rComp, aRef.Ref2, aAbs2, aAbs1.Tab() != aAbs2.Tab(), bODF); } } if (bODF) commit acf4c57040cc3d63d651af8d5a9eaa395b12622e Author: Kohei Yoshida <[email protected]> Date: Fri Jul 26 19:58:19 2013 -0400 Organize the reference dumping code a bit. Change-Id: I97bfdc85ba1391cfe4f11148adb91d5e6960225a diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx index 337b66c..653d1a0 100644 --- a/sc/inc/refdata.hxx +++ b/sc/inc/refdata.hxx @@ -102,7 +102,7 @@ struct SC_DLLPUBLIC ScSingleRefData bool operator!=( const ScSingleRefData& ) const; #if DEBUG_FORMULA_COMPILER - void Dump() const; + void Dump( int nIndent = 0 ) const; #endif }; @@ -152,7 +152,7 @@ struct ScComplexRefData ScComplexRefData& Extend( const ScComplexRefData & rRef, const ScAddress & rPos ); #if DEBUG_FORMULA_COMPILER - void Dump() const; + void Dump( int nIndent = 0 ) const; #endif }; diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx index 45676a5..5969c88 100644 --- a/sc/source/core/tool/refdata.cxx +++ b/sc/source/core/tool/refdata.cxx @@ -222,16 +222,21 @@ bool ScSingleRefData::operator!=( const ScSingleRefData& r ) const } #if DEBUG_FORMULA_COMPILER -void ScSingleRefData::Dump() const -{ - cout << " address type column: " << (IsColRel()?"relative":"absolute") - << " row : " << (IsRowRel()?"relative":"absolute") << " sheet: " - << (IsTabRel()?"relative":"absolute") << endl; - cout << " deleted column: " << (IsColDeleted()?"yes":"no") - << " row : " << (IsRowDeleted()?"yes":"no") << " sheet: " - << (IsTabDeleted()?"yes":"no") << endl; - cout << " absolute pos column: " << nCol << " row: " << nRow << " sheet: " << nTab << endl; - cout << " relative pos column: " << nRelCol << " row: " << nRelRow << " sheet: " << nRelTab << endl; +void ScSingleRefData::Dump( int nIndent ) const +{ + std::string aIndent; + for (int i = 0; i < nIndent; ++i) + aIndent += " "; + + cout << aIndent << "address type column: " << (IsColRel()?"relative":"absolute") + << " row : " << (IsRowRel()?"relative":"absolute") << " sheet: " + << (IsTabRel()?"relative":"absolute") << endl; + cout << aIndent << "deleted column: " << (IsColDeleted()?"yes":"no") + << " row : " << (IsRowDeleted()?"yes":"no") << " sheet: " + << (IsTabDeleted()?"yes":"no") << endl; + cout << aIndent << "absolute pos column: " << nCol << " row: " << nRow << " sheet: " << nTab << endl; + cout << aIndent << "relative pos column: " << nRelCol << " row: " << nRelRow << " sheet: " << nRelTab << endl; + cout << aIndent << "3d ref: " << (IsFlag3D()?"yes":"no") << endl; } #endif @@ -396,27 +401,16 @@ void ScComplexRefData::SetRange( const ScRange& rRange, const ScAddress& rPos ) } #if DEBUG_FORMULA_COMPILER -void ScComplexRefData::Dump() const -{ - cout << " ref 1" << endl; - cout << " address type column: " << (Ref1.IsColRel()?"relative":"absolute") - << " row: " << (Ref1.IsRowRel()?"relative":"absolute") - << " sheet: " << (Ref1.IsTabRel()?"relative":"absolute") << endl; - cout << " deleted column: " << (Ref1.IsColDeleted()?"yes":"no") - << " row: " << (Ref1.IsRowDeleted()?"yes":"no") - << " sheet: " << (Ref1.IsTabDeleted()?"yes":"no") << endl; - cout << " absolute pos column: " << Ref1.nCol << " row: " << Ref1.nRow << " sheet: " << Ref1.nTab << endl; - cout << " relative pos column: " << Ref1.nRelCol << " row: " << Ref1.nRelRow << " sheet: " << Ref1.nRelTab << endl; - - cout << " ref 2" << endl; - cout << " address type column: " << (Ref2.IsColRel()?"relative":"absolute") - << " row: " << (Ref2.IsRowRel()?"relative":"absolute") - << " sheet: " << (Ref2.IsTabRel()?"relative":"absolute") << endl; - cout << " deleted column: " << (Ref2.IsColDeleted()?"yes":"no") - << " row: " << (Ref2.IsRowDeleted()?"yes":"no") - << " sheet: " << (Ref2.IsTabDeleted()?"yes":"no") << endl; - cout << " absolute pos column: " << Ref2.nCol << " row: " << Ref2.nRow << " sheet: " << Ref2.nTab << endl; - cout << " relative pos column: " << Ref2.nRelCol << " row: " << Ref2.nRelRow << " sheet: " << Ref2.nRelTab << endl; +void ScComplexRefData::Dump( int nIndent ) const +{ + std::string aIndent; + for (int i = 0; i < nIndent; ++i) + aIndent += " "; + + cout << aIndent << "ref 1" << endl; + Ref1.Dump(nIndent+1); + cout << aIndent << "ref 2" << endl; + Ref2.Dump(nIndent+1); } #endif diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 79bdfa3..a46d33e 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -761,7 +761,7 @@ bool ScSingleRefToken::operator==( const FormulaToken& r ) const void ScSingleRefToken::Dump() const { cout << "-- ScSingleRefToken" << endl; - aSingleRef.Dump(); + aSingleRef.Dump(1); } #endif @@ -780,7 +780,7 @@ bool ScDoubleRefToken::operator==( const FormulaToken& r ) const void ScDoubleRefToken::Dump() const { cout << "-- ScDoubleRefToken" << endl; - aDoubleRef.Dump(); + aDoubleRef.Dump(1); } #endif _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
