sc/qa/unit/helper/qahelper.cxx  |  169 ++++++++++++++++++++--------------------
 sc/qa/unit/helper/qahelper.hxx  |   70 ++++++++--------
 sc/qa/unit/ucalc.cxx            |   28 +++---
 sc/qa/unit/ucalc_copypaste.cxx  |  100 ++++++++++++-----------
 sc/qa/unit/ucalc_formula.cxx    |   42 ++++++---
 sc/qa/unit/ucalc_pivottable.cxx |   73 +++++++++--------
 6 files changed, 252 insertions(+), 230 deletions(-)

New commits:
commit 9f49fc7b2a56e0d806ab8aab6e32fd1cd55c5c93
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Nov 17 12:54:12 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Nov 18 18:52:28 2022 +0100

    sc: these methods are only used in ScSimpleBootstrapFixture
    
    reduce the scope
    
    Change-Id: Ie9e36a6d1b48ca87ce0fd8e29cafd76adf9caaaa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142834
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 3cfadc926ff1..a4af811db503 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -469,54 +469,6 @@ bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, 
const char* pExpected
     return true;
 }
 
-bool checkFormulaPosition(ScDocument& rDoc, const ScAddress& rPos)
-{
-    OUString aStr(rPos.Format(ScRefFlags::VALID));
-    const ScFormulaCell* pFC = rDoc.GetFormulaCell(rPos);
-    if (!pFC)
-    {
-        cerr << "Formula cell expected at " << aStr << " but not found." << 
endl;
-        return false;
-    }
-
-    if (pFC->aPos != rPos)
-    {
-        OUString aStr2(pFC->aPos.Format(ScRefFlags::VALID));
-        cerr << "Formula cell at " << aStr << " has incorrect position of " << 
aStr2 << endl;
-        return false;
-    }
-
-    return true;
-}
-
-bool checkFormulaPositions(
-    ScDocument& rDoc, SCTAB nTab, SCCOL nCol, const SCROW* pRows, size_t 
nRowCount)
-{
-    ScAddress aPos(nCol, 0, nTab);
-    for (size_t i = 0; i < nRowCount; ++i)
-    {
-        SCROW nRow = pRows[i];
-        aPos.SetRow(nRow);
-
-        if (!checkFormulaPosition(rDoc, aPos))
-        {
-            OUString aStr(aPos.Format(ScRefFlags::VALID));
-            cerr << "Formula cell position failed at " << aStr << "." << endl;
-            return false;
-        }
-    }
-    return true;
-}
-
-std::unique_ptr<ScTokenArray> compileFormula(
-    ScDocument* pDoc, const OUString& rFormula,
-    formula::FormulaGrammar::Grammar eGram )
-{
-    ScAddress aPos(0,0,0);
-    ScCompiler aComp(*pDoc, aPos, eGram);
-    return aComp.CompileString(rFormula);
-}
-
 bool checkOutput(
     const ScDocument* pDoc, const ScRange& aOutRange,
     const std::vector<std::vector<const char*>>& aCheck, const char* pCaption )
@@ -555,25 +507,6 @@ bool checkOutput(
     return bResult;
 }
 
-void clearFormulaCellChangedFlag( ScDocument& rDoc, const ScRange& rRange )
-{
-    const ScAddress& s = rRange.aStart;
-    const ScAddress& e = rRange.aEnd;
-    for (SCTAB nTab = s.Tab(); nTab <= e.Tab(); ++nTab)
-    {
-        for (SCCOL nCol = s.Col(); nCol <= e.Col(); ++nCol)
-        {
-            for (SCROW nRow = s.Row(); nRow <= e.Row(); ++nRow)
-            {
-                ScAddress aPos(nCol, nRow, nTab);
-                ScFormulaCell* pFC = rDoc.GetFormulaCell(aPos);
-                if (pFC)
-                    pFC->SetChanged(false);
-            }
-        }
-    }
-}
-
 bool isFormulaWithoutError(ScDocument& rDoc, const ScAddress& rPos)
 {
     ScFormulaCell* pFC = rDoc.GetFormulaCell(rPos);
@@ -799,7 +732,7 @@ void checkFormula(ScDocument& rDoc, const ScAddress& rPos, 
const char* expected,
     }
 }
 
-ScRange insertRangeData(
+ScRange ScSimpleBootstrapFixture::insertRangeData(
     ScDocument* pDoc, const ScAddress& rPos, const 
std::vector<std::vector<const char*>>& rData )
 {
     if (rData.empty())
@@ -846,7 +779,7 @@ ScRange insertRangeData(
     return aRange;
 }
 
-ScUndoCut* cutToClip(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* 
pClipDoc, bool bCreateUndo)
+ScUndoCut* ScSimpleBootstrapFixture::cutToClip(ScDocShell& rDocSh, const 
ScRange& rRange, ScDocument* pClipDoc, bool bCreateUndo)
 {
     ScDocument* pSrcDoc = &rDocSh.GetDocument();
 
@@ -880,7 +813,7 @@ ScUndoCut* cutToClip(ScDocShell& rDocSh, const ScRange& 
rRange, ScDocument* pCli
     return nullptr;
 }
 
-void copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* 
pClipDoc)
+void ScSimpleBootstrapFixture::copyToClip(ScDocument* pSrcDoc, const ScRange& 
rRange, ScDocument* pClipDoc)
 {
     ScClipParam aClipParam(rRange, false);
     ScMarkData aMark(pSrcDoc->GetSheetLimits());
@@ -888,14 +821,14 @@ void copyToClip(ScDocument* pSrcDoc, const ScRange& 
rRange, ScDocument* pClipDoc
     pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark, false, false);
 }
 
-void pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, 
ScDocument* pClipDoc)
+void ScSimpleBootstrapFixture::pasteFromClip(ScDocument* pDestDoc, const 
ScRange& rDestRange, ScDocument* pClipDoc)
 {
     ScMarkData aMark(pDestDoc->GetSheetLimits());
     aMark.SetMarkArea(rDestRange);
     pDestDoc->CopyFromClip(rDestRange, aMark, InsertDeleteFlags::ALL, nullptr, 
pClipDoc);
 }
 
-ScUndoPaste* createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, 
ScDocumentUniquePtr pUndoDoc)
+ScUndoPaste* ScSimpleBootstrapFixture::createUndoPaste(ScDocShell& rDocSh, 
const ScRange& rRange, ScDocumentUniquePtr pUndoDoc)
 {
     ScDocument& rDoc = rDocSh.GetDocument();
     ScMarkData aMarkData(rDoc.GetSheetLimits());
@@ -906,7 +839,7 @@ ScUndoPaste* createUndoPaste(ScDocShell& rDocSh, const 
ScRange& rRange, ScDocume
         &rDocSh, rRange, aMarkData, std::move(pUndoDoc), nullptr, 
InsertDeleteFlags::ALL, std::move(pRefUndoData), false);
 }
 
-void pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, 
ScDocument* pClipDoc, InsertDeleteFlags eFlags)
+void ScSimpleBootstrapFixture::pasteOneCellFromClip(ScDocument* pDestDoc, 
const ScRange& rDestRange, ScDocument* pClipDoc, InsertDeleteFlags eFlags)
 {
     ScMarkData aMark(pDestDoc->GetSheetLimits());
     aMark.SetMarkArea(rDestRange);
@@ -918,14 +851,14 @@ void pasteOneCellFromClip(ScDocument* pDestDoc, const 
ScRange& rDestRange, ScDoc
             rDestRange.aEnd.Col(), rDestRange.aEnd.Row());
 }
 
-void setCalcAsShown(ScDocument* pDoc, bool bCalcAsShown)
+void ScSimpleBootstrapFixture::setCalcAsShown(ScDocument* pDoc, bool 
bCalcAsShown)
 {
     ScDocOptions aOpt = pDoc->GetDocOptions();
     aOpt.SetCalcAsShown(bCalcAsShown);
     pDoc->SetDocOptions(aOpt);
 }
 
-ScDocShell* findLoadedDocShellByName(std::u16string_view rName)
+ScDocShell* 
ScSimpleBootstrapFixture::findLoadedDocShellByName(std::u16string_view rName)
 {
     ScDocShell* pShell = 
static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>,
 false));
     while (pShell)
@@ -942,7 +875,7 @@ ScDocShell* findLoadedDocShellByName(std::u16string_view 
rName)
     return nullptr;
 }
 
-bool insertRangeNames(
+bool ScSimpleBootstrapFixture::insertRangeNames(
     ScDocument* pDoc, ScRangeName* pNames, const RangeNameDef* p, const 
RangeNameDef* pEnd)
 {
     ScAddress aA1(0, 0, 0);
@@ -966,20 +899,20 @@ bool insertRangeNames(
     return true;
 }
 
-OUString getRangeByName(ScDocument* pDoc, const OUString& aRangeName)
+OUString ScSimpleBootstrapFixture::getRangeByName(ScDocument* pDoc, const 
OUString& aRangeName)
 {
     ScRangeData* pName = 
pDoc->GetRangeName()->findByUpperName(aRangeName.toAsciiUpperCase());
     CPPUNIT_ASSERT(pName);
     return pName->GetSymbol(pDoc->GetGrammar());
 }
 
-OUString getFormula(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab)
+OUString ScSimpleBootstrapFixture::getFormula(ScDocument* pDoc, SCCOL nCol, 
SCROW nRow, SCTAB nTab)
 {
     return pDoc->GetFormula(nCol, nRow, nTab);
 }
 
 #if CALC_DEBUG_OUTPUT != 0
-void printFormula(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const 
char* pCaption)
+void ScSimpleBootstrapFixture::printFormula(ScDocument* pDoc, SCCOL nCol, 
SCROW nRow, SCTAB nTab, const char* pCaption)
 {
     if (pCaption != nullptr)
         cout << pCaption << ", ";
@@ -988,10 +921,10 @@ void printFormula(ScDocument* pDoc, SCCOL nCol, SCROW 
nRow, SCTAB nTab, const ch
 }
 #else
 // Avoid unused parameter warning
-void printFormula(ScDocument*, SCCOL, SCROW, SCTAB, const char*) {}
+void ScSimpleBootstrapFixture::printFormula(ScDocument*, SCCOL, SCROW, SCTAB, 
const char*) {}
 #endif
 
-void printRange(ScDocument* pDoc, const ScRange& rRange, const char* pCaption,
+void ScSimpleBootstrapFixture::printRange(ScDocument* pDoc, const ScRange& 
rRange, const char* pCaption,
                 const bool printFormula)
 {
     SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
@@ -1011,13 +944,13 @@ void printRange(ScDocument* pDoc, const ScRange& rRange, 
const char* pCaption,
     printer.print(pCaption);
 }
 
-void printRange(ScDocument* pDoc, const ScRange& rRange, const OString& 
rCaption,
+void ScSimpleBootstrapFixture::printRange(ScDocument* pDoc, const ScRange& 
rRange, const OString& rCaption,
                 const bool printFormula)
 {
     printRange(pDoc, rRange, rCaption.getStr(), printFormula);
 }
 
-void clearRange(ScDocument* pDoc, const ScRange& rRange)
+void ScSimpleBootstrapFixture::clearRange(ScDocument* pDoc, const ScRange& 
rRange)
 {
     ScMarkData aMarkData(pDoc->GetSheetLimits());
     aMarkData.SetMarkArea(rRange);
@@ -1026,10 +959,78 @@ void clearRange(ScDocument* pDoc, const ScRange& rRange)
         rRange.aEnd.Col(), rRange.aEnd.Row(), aMarkData, 
InsertDeleteFlags::CONTENTS);
 }
 
-void clearSheet(ScDocument* pDoc, SCTAB nTab)
+void ScSimpleBootstrapFixture::clearSheet(ScDocument* pDoc, SCTAB nTab)
 {
     ScRange aRange(0,0,nTab,pDoc->MaxCol(),pDoc->MaxRow(),nTab);
     clearRange(pDoc, aRange);
 }
 
+bool ScSimpleBootstrapFixture::checkFormulaPosition(ScDocument& rDoc, const 
ScAddress& rPos)
+{
+    OUString aStr(rPos.Format(ScRefFlags::VALID));
+    const ScFormulaCell* pFC = rDoc.GetFormulaCell(rPos);
+    if (!pFC)
+    {
+        cerr << "Formula cell expected at " << aStr << " but not found." << 
endl;
+        return false;
+    }
+
+    if (pFC->aPos != rPos)
+    {
+        OUString aStr2(pFC->aPos.Format(ScRefFlags::VALID));
+        cerr << "Formula cell at " << aStr << " has incorrect position of " << 
aStr2 << endl;
+        return false;
+    }
+
+    return true;
+}
+
+bool ScSimpleBootstrapFixture::checkFormulaPositions(
+    ScDocument& rDoc, SCTAB nTab, SCCOL nCol, const SCROW* pRows, size_t 
nRowCount)
+{
+    ScAddress aPos(nCol, 0, nTab);
+    for (size_t i = 0; i < nRowCount; ++i)
+    {
+        SCROW nRow = pRows[i];
+        aPos.SetRow(nRow);
+
+        if (!checkFormulaPosition(rDoc, aPos))
+        {
+            OUString aStr(aPos.Format(ScRefFlags::VALID));
+            cerr << "Formula cell position failed at " << aStr << "." << endl;
+            return false;
+        }
+    }
+    return true;
+}
+
+std::unique_ptr<ScTokenArray> ScSimpleBootstrapFixture::compileFormula(
+    ScDocument* pDoc, const OUString& rFormula,
+    formula::FormulaGrammar::Grammar eGram )
+{
+    ScAddress aPos(0,0,0);
+    ScCompiler aComp(*pDoc, aPos, eGram);
+    return aComp.CompileString(rFormula);
+}
+
+void ScSimpleBootstrapFixture::clearFormulaCellChangedFlag( ScDocument& rDoc, 
const ScRange& rRange )
+{
+    const ScAddress& s = rRange.aStart;
+    const ScAddress& e = rRange.aEnd;
+    for (SCTAB nTab = s.Tab(); nTab <= e.Tab(); ++nTab)
+    {
+        for (SCCOL nCol = s.Col(); nCol <= e.Col(); ++nCol)
+        {
+            for (SCROW nRow = s.Row(); nRow <= e.Row(); ++nRow)
+            {
+                ScAddress aPos(nCol, nRow, nTab);
+                ScFormulaCell* pFC = rDoc.GetFormulaCell(aPos);
+                if (pFC)
+                    pFC->SetChanged(false);
+            }
+        }
+    }
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 0b16869879b3..e1e7ad4652e8 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -115,20 +115,10 @@ SCQAHELPER_DLLPUBLIC std::ostream& 
operator<<(std::ostream& rStrm, const OpCode&
 
 bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* 
pExpected);
 
-bool checkFormulaPosition(ScDocument& rDoc, const ScAddress& rPos);
-bool checkFormulaPositions(
-    ScDocument& rDoc, SCTAB nTab, SCCOL nCol, const SCROW* pRows, size_t 
nRowCount);
-
-std::unique_ptr<ScTokenArray> compileFormula(
-    ScDocument* pDoc, const OUString& rFormula,
-    formula::FormulaGrammar::Grammar eGram = 
formula::FormulaGrammar::GRAM_NATIVE );
-
 SCQAHELPER_DLLPUBLIC bool checkOutput(
     const ScDocument* pDoc, const ScRange& aOutRange,
     const std::vector<std::vector<const char*>>& aCheck, const char* pCaption 
);
 
-void clearFormulaCellChangedFlag( ScDocument& rDoc, const ScRange& rRange );
-
 /**
  * Check if the cell at specified position is a formula cell that doesn't
  * have an error value.
@@ -197,6 +187,40 @@ public:
     virtual void setUp() override;
     virtual void tearDown() override;
 
+    ScRange insertRangeData(ScDocument* pDoc, const ScAddress& rPos,
+                                       const std::vector<std::vector<const 
char*>>& rData);
+    void copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* 
pClipDoc);
+    void pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange,
+                                        ScDocument* pClipDoc);
+    ScUndoPaste* createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange,
+                                        ScDocumentUniquePtr pUndoDoc);
+    void pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange,
+                                         ScDocument* pClipDoc,
+                                         InsertDeleteFlags eFlags = 
InsertDeleteFlags::ALL);
+    void setCalcAsShown(ScDocument* pDoc, bool bCalcAsShown);
+    ScDocShell* findLoadedDocShellByName(std::u16string_view rName);
+    ScUndoCut* cutToClip(ScDocShell& rDocSh, const ScRange& rRange, 
ScDocument* pClipDoc,
+                                        bool bCreateUndo);
+    bool insertRangeNames(ScDocument* pDoc, ScRangeName* pNames, const 
RangeNameDef* p,
+                                       const RangeNameDef* pEnd);
+    OUString getRangeByName(ScDocument* pDoc, const OUString& aRangeName);
+    OUString getFormula(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab);
+    void printFormula(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
+                                           const char* pCaption = nullptr);
+    void printRange(ScDocument* pDoc, const ScRange& rRange, const char* 
pCaption,
+                                         const bool printFormula = false);
+    void printRange(ScDocument* pDoc, const ScRange& rRange,
+                                         const OString& rCaption, const bool 
printFormula = false);
+    void clearRange(ScDocument* pDoc, const ScRange& rRange);
+    void clearSheet(ScDocument* pDoc, SCTAB nTab);
+    bool checkFormulaPosition(ScDocument& rDoc, const ScAddress& rPos);
+    bool checkFormulaPositions(
+        ScDocument& rDoc, SCTAB nTab, SCCOL nCol, const SCROW* pRows, size_t 
nRowCount);
+    std::unique_ptr<ScTokenArray> compileFormula(
+        ScDocument* pDoc, const OUString& rFormula,
+        formula::FormulaGrammar::Grammar eGram = 
formula::FormulaGrammar::GRAM_NATIVE );
+    void clearFormulaCellChangedFlag( ScDocument& rDoc, const ScRange& rRange 
);
+
 protected:
     ScDocShellRef m_xDocShell;
     ScDocument* m_pDoc;
@@ -255,31 +279,5 @@ SCQAHELPER_DLLPUBLIC ScTokenArray* getTokens(ScDocument& 
rDoc, const ScAddress&
 
 SCQAHELPER_DLLPUBLIC std::string to_std_string(const OUString& rStr);
 
-SCQAHELPER_DLLPUBLIC ScUndoCut* cutToClip(ScDocShell& rDocSh, const ScRange& 
rRange, ScDocument* pClipDoc,
-                                    bool bCreateUndo);
-SCQAHELPER_DLLPUBLIC void copyToClip(ScDocument* pSrcDoc, const ScRange& 
rRange, ScDocument* pClipDoc);
-SCQAHELPER_DLLPUBLIC void pasteFromClip(ScDocument* pDestDoc, const ScRange& 
rDestRange,
-                                    ScDocument* pClipDoc);
-SCQAHELPER_DLLPUBLIC ScUndoPaste* createUndoPaste(ScDocShell& rDocSh, const 
ScRange& rRange,
-                                    ScDocumentUniquePtr pUndoDoc);
-SCQAHELPER_DLLPUBLIC void pasteOneCellFromClip(ScDocument* pDestDoc, const 
ScRange& rDestRange,
-                                     ScDocument* pClipDoc,
-                                     InsertDeleteFlags eFlags = 
InsertDeleteFlags::ALL);
-SCQAHELPER_DLLPUBLIC void setCalcAsShown(ScDocument* pDoc, bool bCalcAsShown);
-SCQAHELPER_DLLPUBLIC ScDocShell* findLoadedDocShellByName(std::u16string_view 
rName);
-SCQAHELPER_DLLPUBLIC ScRange insertRangeData(ScDocument* pDoc, const 
ScAddress& rPos,
-                                   const std::vector<std::vector<const 
char*>>& rData);
-SCQAHELPER_DLLPUBLIC bool insertRangeNames(ScDocument* pDoc, ScRangeName* 
pNames, const RangeNameDef* p,
-                                   const RangeNameDef* pEnd);
-SCQAHELPER_DLLPUBLIC OUString getRangeByName(ScDocument* pDoc, const OUString& 
aRangeName);
-SCQAHELPER_DLLPUBLIC OUString getFormula(ScDocument* pDoc, SCCOL nCol, SCROW 
nRow, SCTAB nTab);
-SCQAHELPER_DLLPUBLIC void printFormula(ScDocument* pDoc, SCCOL nCol, SCROW 
nRow, SCTAB nTab,
-                                       const char* pCaption = nullptr);
-SCQAHELPER_DLLPUBLIC void printRange(ScDocument* pDoc, const ScRange& rRange, 
const char* pCaption,
-                                     const bool printFormula = false);
-SCQAHELPER_DLLPUBLIC void printRange(ScDocument* pDoc, const ScRange& rRange,
-                                     const OString& rCaption, const bool 
printFormula = false);
-SCQAHELPER_DLLPUBLIC void clearRange(ScDocument* pDoc, const ScRange& rRange);
-SCQAHELPER_DLLPUBLIC void clearSheet(ScDocument* pDoc, SCTAB nTab);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 12a70a1db4dd..321977460cb7 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -67,6 +67,17 @@
 class ScUndoPaste;
 class ScUndoCut;
 
+namespace {
+
+struct HoriIterCheck
+{
+    SCCOL nCol;
+    SCROW nRow;
+    const char* pVal;
+};
+
+}
+
 class Test : public ScSimpleBootstrapFixture
 {
 public:
@@ -322,6 +333,10 @@ public:
     CPPUNIT_TEST(testProtectedSheetEditByColumn);
     CPPUNIT_TEST(testInsertColumnsWithFormulaCells);
     CPPUNIT_TEST_SUITE_END();
+
+private:
+    bool checkHorizontalIterator(ScDocument& rDoc, const 
std::vector<std::vector<const char*>>& rData,
+            const HoriIterCheck* pChecks, size_t nCheckCount);
 };
 
 void Test::getNewDocShell( ScDocShellRef& rDocShellRef )
@@ -1094,16 +1109,7 @@ void Test::testCopyToDocument()
     m_pDoc->DeleteTab(0);
 }
 
-namespace {
-
-struct HoriIterCheck
-{
-    SCCOL nCol;
-    SCROW nRow;
-    const char* pVal;
-};
-
-bool checkHorizontalIterator(ScDocument& rDoc, const 
std::vector<std::vector<const char*>>& rData, const HoriIterCheck* pChecks, 
size_t nCheckCount)
+bool Test::checkHorizontalIterator(ScDocument& rDoc, const 
std::vector<std::vector<const char*>>& rData, const HoriIterCheck* pChecks, 
size_t nCheckCount)
 {
     ScAddress aPos(0,0,0);
     insertRangeData(&rDoc, aPos, rData);
@@ -1144,8 +1150,6 @@ bool checkHorizontalIterator(ScDocument& rDoc, const 
std::vector<std::vector<con
     return true;
 }
 
-}
-
 void Test::testHorizontalIterator()
 {
     m_pDoc->InsertTab(0, "test");
diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index ab3572ce05f5..0dde661423ff 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -310,6 +310,8 @@ private:
                                ScPasteFunc nFunction = ScPasteFunc::NONE,
                                InsCellCmd eMoveMode = InsCellCmd::INS_NONE);
 
+    void printValuesAndFormulasInRange(ScDocument* pDoc, const ScRange& rRange,
+                                       const OString& rCaption);
     OUString getFormula(SCCOL nCol, SCROW nRow, SCTAB nTab);
     OUString getRangeByName(const OUString& aRangeName);
     ScAddress setNote(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString 
noteText);
@@ -330,8 +332,8 @@ static ScAddress lcl_getMergeSizeOfCell(const ScDocument& 
rDoc, SCCOL nCol, SCRO
     return ScAddress(rMerge.GetColMerge(), rMerge.GetRowMerge(), nTab);
 }
 
-static void lcl_printValuesAndFormulasInRange(ScDocument* pDoc, const ScRange& 
rRange,
-                                              const OString& rCaption)
+void TestCopyPaste::printValuesAndFormulasInRange(ScDocument* pDoc, const 
ScRange& rRange,
+                                                  const OString& rCaption)
 {
     printRange(pDoc, rRange, rCaption, false);
     printRange(pDoc, rRange, rCaption, true);
@@ -339,12 +341,12 @@ static void lcl_printValuesAndFormulasInRange(ScDocument* 
pDoc, const ScRange& r
 
 OUString TestCopyPaste::getFormula(SCCOL nCol, SCROW nRow, SCTAB nTab)
 {
-    return ::getFormula(m_pDoc, nCol, nRow, nTab);
+    return ScSimpleBootstrapFixture::getFormula(m_pDoc, nCol, nRow, nTab);
 }
 
 OUString TestCopyPaste::getRangeByName(const OUString& aRangeName)
 {
-    return ::getRangeByName(m_pDoc, aRangeName);
+    return ScSimpleBootstrapFixture::getRangeByName(m_pDoc, aRangeName);
 }
 
 ScAddress TestCopyPaste::setNote(SCCOL nCol, SCROW nRow, SCTAB nTab, OUString 
noteText)
@@ -2056,7 +2058,7 @@ void TestCopyPaste::executeCopyPasteSpecial(const SCTAB 
srcSheet, const SCTAB de
 
             m_pDoc->CopyFromClip(aDestRange, aDestMark, aFlags, 
pPasteRefUndoDoc.get(), &aClipDoc,
                                  true, bAsLink, bIncludedFiltered, bSkipEmpty);
-            lcl_printValuesAndFormulasInRange(m_pDoc, aDestRange, "Dest 
sheet");
+            printValuesAndFormulasInRange(m_pDoc, aDestRange, "Dest sheet");
         }
 
         if (bCut)
@@ -7283,8 +7285,8 @@ void 
TestCopyPaste::checkReferencedCutRangesRowIntitial(const SCTAB nSrcTab, con
             CPPUNIT_ASSERT_EQUAL(OUString(), getFormula(j, i, nSrcTab));
         }
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative 
references");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative references");
     CPPUNIT_ASSERT_EQUAL(OUString("=B2"), getFormula(0, 20, nSrcTab)); // A21
     CPPUNIT_ASSERT_EQUAL(OUString("=C2"), getFormula(1, 20, nSrcTab)); // B21
     CPPUNIT_ASSERT_EQUAL(OUString("=D2"), getFormula(2, 20, nSrcTab)); // C21
@@ -7298,8 +7300,8 @@ void 
TestCopyPaste::checkReferencedCutRangesRowIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(1, 21, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(22.0, m_pDoc->GetValue(2, 21, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 30, nSrcTab, 2, 31, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Absolute 
references");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 30, nSrcTab, 2, 31, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Absolute references");
     CPPUNIT_ASSERT_EQUAL(OUString("=$B$2"), getFormula(0, 30, nSrcTab)); // A31
     CPPUNIT_ASSERT_EQUAL(OUString("=$C$2"), getFormula(1, 30, nSrcTab)); // B31
     CPPUNIT_ASSERT_EQUAL(OUString("=$D$2"), getFormula(2, 30, nSrcTab)); // C31
@@ -7324,8 +7326,8 @@ void 
TestCopyPaste::checkReferencedCutRangesRowIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(OUString("$Test.$B$2:$D$3"), 
getRangeByName("Range_B2_D3"));
     CPPUNIT_ASSERT_EQUAL(OUString("B2"), getRangeByName("RelRange_Cm20_R0"));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 40, nSrcTab, 2, 41, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Absolute ranges");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 40, nSrcTab, 2, 41, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Absolute ranges");
     CPPUNIT_ASSERT_EQUAL(OUString("=Range_B2"), getFormula(0, 40, nSrcTab)); 
// A41
     CPPUNIT_ASSERT_EQUAL(OUString("=Range_C2"), getFormula(1, 40, nSrcTab)); 
// B41
     CPPUNIT_ASSERT_EQUAL(OUString("=Range_D2"), getFormula(2, 40, nSrcTab)); 
// C41
@@ -7339,8 +7341,8 @@ void 
TestCopyPaste::checkReferencedCutRangesRowIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(1, 41, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(22.0, m_pDoc->GetValue(2, 41, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 50, nSrcTab, 2, 51, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative ranges");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 50, nSrcTab, 2, 51, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative ranges");
     CPPUNIT_ASSERT_EQUAL(OUString("=RelRange_Cm20_R0"), getFormula(0, 50, 
nSrcTab)); // A51
     CPPUNIT_ASSERT_EQUAL(OUString("=RelRange_Cm20_R0"), getFormula(1, 50, 
nSrcTab)); // B51
     CPPUNIT_ASSERT_EQUAL(OUString("=RelRange_Cm20_R0"), getFormula(2, 50, 
nSrcTab)); // C51
@@ -7354,8 +7356,8 @@ void 
TestCopyPaste::checkReferencedCutRangesRowIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(1, 51, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(22.0, m_pDoc->GetValue(2, 51, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 60, nSrcTab, 2, 61, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 60, nSrcTab, 2, 61, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B2:D2)"), getFormula(0, 60, nSrcTab)); 
// A61
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B2:D2)"), getFormula(1, 60, nSrcTab)); 
// B61
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B2:D2)"), getFormula(2, 60, nSrcTab)); 
// C61
@@ -7369,8 +7371,8 @@ void 
TestCopyPaste::checkReferencedCutRangesRowIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(1, 61, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(2, 61, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 70, nSrcTab, 2, 71, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Absolute sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 70, nSrcTab, 2, 71, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Absolute sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$D$2)"), getFormula(0, 70, 
nSrcTab)); // A71
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$D$2)"), getFormula(1, 70, 
nSrcTab)); // B71
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$D$2)"), getFormula(2, 70, 
nSrcTab)); // C71
@@ -7384,8 +7386,8 @@ void 
TestCopyPaste::checkReferencedCutRangesRowIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(1, 71, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(2, 71, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 80, nSrcTab, 2, 81, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative range sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 80, nSrcTab, 2, 81, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative range sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_D2)"), getFormula(0, 80, 
nSrcTab)); // A81
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_D2)"), getFormula(1, 80, 
nSrcTab)); // B81
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_D2)"), getFormula(2, 80, 
nSrcTab)); // C81
@@ -7399,8 +7401,8 @@ void 
TestCopyPaste::checkReferencedCutRangesRowIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(1, 81, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(2, 81, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 90, nSrcTab, 2, 91, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Absolute sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 90, nSrcTab, 2, 91, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Absolute sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$D$3)"), getFormula(0, 90, 
nSrcTab)); // A91
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$D$3)"), getFormula(1, 90, 
nSrcTab)); // B91
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$D$3)"), getFormula(2, 90, 
nSrcTab)); // C91
@@ -7414,8 +7416,8 @@ void 
TestCopyPaste::checkReferencedCutRangesRowIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(69.0, m_pDoc->GetValue(1, 91, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(69.0, m_pDoc->GetValue(2, 91, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 100, nSrcTab, 2, 101, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative range sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 100, nSrcTab, 2, 101, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative range sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_D3)"), getFormula(0, 100, 
nSrcTab)); // A101
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_D3)"), getFormula(1, 100, 
nSrcTab)); // B101
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_D3)"), getFormula(2, 100, 
nSrcTab)); // C101
@@ -7606,12 +7608,12 @@ void TestCopyPaste::executeReferencedCutRangesRow(const 
bool bTransposed, const
         // Paste
         m_pDoc->CopyFromClip(aDestRange, aDestMark, aFlags, 
pPasteRefUndoDoc.get(),
                              pTransClip.get(), true, false, true, false);
-        lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 
21, nSrcTab),
-                                          "Relative references after copy");
+        printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, 
nSrcTab),
+                                      "Relative references after copy");
 
         m_pDoc->UpdateTranspose(aDestRange.aStart, pOrigClipDoc, aDestMark, 
pPasteRefUndoDoc.get());
-        lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 
21, nSrcTab),
-                                          "Relative references after 
UpdateTranspose");
+        printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, 
nSrcTab),
+                                      "Relative references after 
UpdateTranspose");
         pTransClip.reset();
     }
     else
@@ -8197,8 +8199,8 @@ void 
TestCopyPaste::checkReferencedCutRangesColIntitial(const SCTAB nSrcTab, con
             CPPUNIT_ASSERT_EQUAL(OUString(), getFormula(j, i, nSrcTab));
         }
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 1, 22, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative 
references");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 1, 22, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative references");
     CPPUNIT_ASSERT_EQUAL(OUString("=B2"), getFormula(0, 20, nSrcTab)); // A21
     CPPUNIT_ASSERT_EQUAL(OUString("=B3"), getFormula(0, 21, nSrcTab)); // A22
     CPPUNIT_ASSERT_EQUAL(OUString("=B4"), getFormula(0, 22, nSrcTab)); // A23
@@ -8212,8 +8214,8 @@ void 
TestCopyPaste::checkReferencedCutRangesColIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(1, 21, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(22.0, m_pDoc->GetValue(1, 22, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 30, nSrcTab, 1, 32, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Absolute 
references");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 30, nSrcTab, 1, 32, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Absolute references");
     CPPUNIT_ASSERT_EQUAL(OUString("=$B$2"), getFormula(0, 30, nSrcTab)); // A31
     CPPUNIT_ASSERT_EQUAL(OUString("=$B$3"), getFormula(0, 31, nSrcTab)); // A32
     CPPUNIT_ASSERT_EQUAL(OUString("=$B$4"), getFormula(0, 32, nSrcTab)); // A33
@@ -8238,8 +8240,8 @@ void 
TestCopyPaste::checkReferencedCutRangesColIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(OUString("$Test.$B$2:$C$4"), 
getRangeByName("Range_B2_C4"));
     CPPUNIT_ASSERT_EQUAL(OUString("B2"), getRangeByName("RelRange_Cm20_R0"));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 40, nSrcTab, 1, 42, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Absolute ranges");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 40, nSrcTab, 1, 42, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Absolute ranges");
     CPPUNIT_ASSERT_EQUAL(OUString("=Range_B2"), getFormula(0, 40, nSrcTab)); 
// A41
     CPPUNIT_ASSERT_EQUAL(OUString("=Range_B3"), getFormula(0, 41, nSrcTab)); 
// A42
     CPPUNIT_ASSERT_EQUAL(OUString("=Range_B4"), getFormula(0, 42, nSrcTab)); 
// A43
@@ -8253,8 +8255,8 @@ void 
TestCopyPaste::checkReferencedCutRangesColIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(1, 41, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(22.0, m_pDoc->GetValue(1, 42, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 50, nSrcTab, 1, 52, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative ranges");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 50, nSrcTab, 1, 52, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative ranges");
     CPPUNIT_ASSERT_EQUAL(OUString("=RelRange_Cm20_R0"), getFormula(0, 50, 
nSrcTab)); // A51
     CPPUNIT_ASSERT_EQUAL(OUString("=RelRange_Cm20_R0"), getFormula(0, 51, 
nSrcTab)); // A52
     CPPUNIT_ASSERT_EQUAL(OUString("=RelRange_Cm20_R0"), getFormula(0, 52, 
nSrcTab)); // A53
@@ -8268,8 +8270,8 @@ void 
TestCopyPaste::checkReferencedCutRangesColIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(1, 51, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(22.0, m_pDoc->GetValue(1, 52, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 60, nSrcTab, 1, 62, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 60, nSrcTab, 1, 62, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B2:B4)"), getFormula(0, 60, nSrcTab)); 
// A61
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B2:B4)"), getFormula(0, 61, nSrcTab)); 
// A62
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B2:B4)"), getFormula(0, 62, nSrcTab)); 
// A63
@@ -8283,8 +8285,8 @@ void 
TestCopyPaste::checkReferencedCutRangesColIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(1, 61, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(1, 62, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 70, nSrcTab, 1, 72, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Absolute sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 70, nSrcTab, 1, 72, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Absolute sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$B$4)"), getFormula(0, 70, 
nSrcTab)); // A71
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$B$4)"), getFormula(0, 71, 
nSrcTab)); // A72
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$B$4)"), getFormula(0, 72, 
nSrcTab)); // A73
@@ -8298,8 +8300,8 @@ void 
TestCopyPaste::checkReferencedCutRangesColIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(1, 71, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(1, 72, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 80, nSrcTab, 1, 82, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative range sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 80, nSrcTab, 1, 82, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative range sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_B4)"), getFormula(0, 80, 
nSrcTab)); // A81
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_B4)"), getFormula(0, 81, 
nSrcTab)); // A82
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_B4)"), getFormula(0, 82, 
nSrcTab)); // A83
@@ -8313,8 +8315,8 @@ void 
TestCopyPaste::checkReferencedCutRangesColIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(1, 81, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(1, 82, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 90, nSrcTab, 1, 92, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Absolute sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 90, nSrcTab, 1, 92, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Absolute sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$C$4)"), getFormula(0, 90, 
nSrcTab)); // A91
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$C$4)"), getFormula(0, 91, 
nSrcTab)); // A92
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM($B$2:$C$4)"), getFormula(0, 92, 
nSrcTab)); // A93
@@ -8328,8 +8330,8 @@ void 
TestCopyPaste::checkReferencedCutRangesColIntitial(const SCTAB nSrcTab, con
     CPPUNIT_ASSERT_EQUAL(69.0, m_pDoc->GetValue(1, 91, nSrcTab));
     CPPUNIT_ASSERT_EQUAL(69.0, m_pDoc->GetValue(1, 92, nSrcTab));
 
-    lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 100, nSrcTab, 1, 102, 
nSrcTab),
-                                      rDesc.toUtf8() + ": Relative range sum");
+    printValuesAndFormulasInRange(m_pDoc, ScRange(0, 100, nSrcTab, 1, 102, 
nSrcTab),
+                                  rDesc.toUtf8() + ": Relative range sum");
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_C4)"), getFormula(0, 100, 
nSrcTab)); // A101
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_C4)"), getFormula(0, 101, 
nSrcTab)); // A102
     CPPUNIT_ASSERT_EQUAL(OUString("=SUM(Range_B2_C4)"), getFormula(0, 102, 
nSrcTab)); // A103
@@ -8551,12 +8553,12 @@ void TestCopyPaste::executeReferencedCutRangesCol(const 
bool bTransposed, const
         // Paste
         m_pDoc->CopyFromClip(aDestRange, aDestMark, aFlags, 
pPasteRefUndoDoc.get(),
                              pTransClip.get(), true, false, true, false);
-        lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 
21, nSrcTab),
-                                          "Relative references after copy");
+        printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, 
nSrcTab),
+                                      "Relative references after copy");
 
         m_pDoc->UpdateTranspose(aDestRange.aStart, pOrigClipDoc, aDestMark, 
pPasteRefUndoDoc.get());
-        lcl_printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 
21, nSrcTab),
-                                          "Relative references after 
UpdateTranspose");
+        printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, 
nSrcTab),
+                                      "Relative references after 
UpdateTranspose");
         pTransClip.reset();
     }
     else
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 311765a6afde..0a1abe05c2f5 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -186,6 +186,15 @@ public:
 
 }
 
+namespace {
+
+struct StrStrCheck {
+    const char* pVal;
+    const char* pRes;
+};
+
+}
+
 class TestFormula : public ScSimpleBootstrapFixture
 {
 public:
@@ -430,6 +439,18 @@ public:
     CPPUNIT_TEST(testFuncJumpMatrixArrayOFFSET);
 
     CPPUNIT_TEST_SUITE_END();
+
+private:
+    template<size_t DataSize, size_t FormulaSize, int Type>
+    void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], const 
StrStrCheck aChecks[FormulaSize]);
+
+    template<size_t DataSize, size_t FormulaSize, int Type>
+    void runTestHorizontalMATCH(ScDocument* pDoc, const char* aData[DataSize], 
const StrStrCheck aChecks[FormulaSize]);
+
+    void testExtRefFuncT(ScDocument* pDoc, ScDocument& rExtDoc);
+    void testExtRefFuncOFFSET(ScDocument* pDoc, ScDocument& rExtDoc);
+    void testExtRefFuncVLOOKUP(ScDocument* pDoc, ScDocument& rExtDoc);
+    void testExtRefConcat(ScDocument* pDoc, ScDocument& rExtDoc);
 };
 
 void TestFormula::testFormulaCreateStringFromTokens()
@@ -5977,17 +5998,8 @@ void TestFormula::testFuncVLOOKUP()
     m_pDoc->DeleteTab(0);
 }
 
-namespace {
-
-struct StrStrCheck {
-    const char* pVal;
-    const char* pRes;
-};
-
-}
-
 template<size_t DataSize, size_t FormulaSize, int Type>
-static void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], const 
StrStrCheck aChecks[FormulaSize])
+void TestFormula::runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], 
const StrStrCheck aChecks[FormulaSize])
 {
     size_t nDataSize = DataSize;
     for (size_t i = 0; i < nDataSize; ++i)
@@ -6019,7 +6031,7 @@ static void runTestMATCH(ScDocument* pDoc, const char* 
aData[DataSize], const St
 }
 
 template<size_t DataSize, size_t FormulaSize, int Type>
-static void runTestHorizontalMATCH(ScDocument* pDoc, const char* 
aData[DataSize], const StrStrCheck aChecks[FormulaSize])
+void TestFormula::runTestHorizontalMATCH(ScDocument* pDoc, const char* 
aData[DataSize], const StrStrCheck aChecks[FormulaSize])
 {
     size_t nDataSize = DataSize;
     for (size_t i = 0; i < nDataSize; ++i)
@@ -7015,7 +7027,7 @@ void TestFormula::testExternalRangeName()
     m_pDoc->DeleteTab(0);
 }
 
-static void testExtRefFuncT(ScDocument* pDoc, ScDocument& rExtDoc)
+void TestFormula::testExtRefFuncT(ScDocument* pDoc, ScDocument& rExtDoc)
 {
     clearRange(pDoc, ScRange(0, 0, 0, 1, 9, 0));
     clearRange(&rExtDoc, ScRange(0, 0, 0, 1, 9, 0));
@@ -7036,7 +7048,7 @@ static void testExtRefFuncT(ScDocument* pDoc, ScDocument& 
rExtDoc)
     CPPUNIT_ASSERT_MESSAGE("Unexpected result with T.", aRes.isEmpty());
 }
 
-static void testExtRefFuncOFFSET(ScDocument* pDoc, ScDocument& rExtDoc)
+void TestFormula::testExtRefFuncOFFSET(ScDocument* pDoc, ScDocument& rExtDoc)
 {
     clearRange(pDoc, ScRange(0, 0, 0, 1, 9, 0));
     clearRange(&rExtDoc, ScRange(0, 0, 0, 1, 9, 0));
@@ -7049,7 +7061,7 @@ static void testExtRefFuncOFFSET(ScDocument* pDoc, 
ScDocument& rExtDoc)
     CPPUNIT_ASSERT_EQUAL(1.2, pDoc->GetValue(ScAddress(0,0,0)));
 }
 
-static void testExtRefFuncVLOOKUP(ScDocument* pDoc, ScDocument& rExtDoc)
+void TestFormula::testExtRefFuncVLOOKUP(ScDocument* pDoc, ScDocument& rExtDoc)
 {
     clearRange(pDoc, ScRange(0, 0, 0, 1, 9, 0));
     clearRange(&rExtDoc, ScRange(0, 0, 0, 1, 9, 0));
@@ -7080,7 +7092,7 @@ static void testExtRefFuncVLOOKUP(ScDocument* pDoc, 
ScDocument& rExtDoc)
     CPPUNIT_ASSERT_EQUAL(OUString("B2"), pDoc->GetString(ScAddress(1,0,0)));
 }
 
-static void testExtRefConcat(ScDocument* pDoc, ScDocument& rExtDoc)
+void TestFormula::testExtRefConcat(ScDocument* pDoc, ScDocument& rExtDoc)
 {
     clearRange(pDoc, ScRange(0, 0, 0, 1, 9, 0));
     clearRange(&rExtDoc, ScRange(0, 0, 0, 1, 9, 0));
diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx
index e2b7380ef713..d0e86997bab9 100644
--- a/sc/qa/unit/ucalc_pivottable.cxx
+++ b/sc/qa/unit/ucalc_pivottable.cxx
@@ -43,40 +43,6 @@ struct DPFieldDef
     bool bRepeatItemLabels;
 };
 
-template<size_t Size>
-ScRange insertDPSourceData(ScDocument* pDoc, DPFieldDef const aFields[], 
size_t nFieldCount, const char* aData[][Size], size_t nDataCount)
-{
-    // Insert field names in row 0.
-    for (size_t i = 0; i < nFieldCount; ++i)
-        pDoc->SetString(static_cast<SCCOL>(i), 0, 0, 
OUString(aFields[i].pName, strlen(aFields[i].pName), RTL_TEXTENCODING_UTF8));
-
-    // Insert data into row 1 and downward.
-    for (size_t i = 0; i < nDataCount; ++i)
-    {
-        SCROW nRow = static_cast<SCROW>(i) + 1;
-        for (size_t j = 0; j < nFieldCount; ++j)
-        {
-            SCCOL nCol = static_cast<SCCOL>(j);
-            pDoc->SetString(
-                nCol, nRow, 0, OUString(aData[i][j], strlen(aData[i][j]), 
RTL_TEXTENCODING_UTF8));
-        }
-    }
-
-    SCROW nRow1 = 0, nRow2 = 0;
-    SCCOL nCol1 = 0, nCol2 = 0;
-    pDoc->GetDataArea(0, nCol1, nRow1, nCol2, nRow2, true, false);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Data is expected to start from 
(col=0,row=0).", SCCOL(0), nCol1);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Data is expected to start from 
(col=0,row=0).", SCROW(0), nRow1);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected data range.",
-                           static_cast<SCCOL>(nFieldCount - 1), nCol2);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected data range.",
-                           static_cast<SCROW>(nDataCount), nRow2);
-
-    ScRange aSrcRange(nCol1, nRow1, 0, nCol2, nRow2, 0);
-    printRange(pDoc, aSrcRange, "Data sheet content");
-    return aSrcRange;
-}
-
 bool checkDPTableOutput(
     const ScDocument* pDoc, const ScRange& aOutRange,
     const std::vector<std::vector<const char*>>& aOutputCheck, const char* 
pCaption )
@@ -304,8 +270,47 @@ public:
     CPPUNIT_TEST(testPivotTableMedianFunc);
 
     CPPUNIT_TEST_SUITE_END();
+
+private:
+    template<size_t Size>
+    ScRange insertDPSourceData(ScDocument* pDoc, DPFieldDef const aFields[], 
size_t nFieldCount, const char* aData[][Size], size_t nDataCount);
 };
 
+template<size_t Size>
+ScRange TestPivottable::insertDPSourceData(ScDocument* pDoc, DPFieldDef const 
aFields[], size_t nFieldCount, const char* aData[][Size], size_t nDataCount)
+{
+    // Insert field names in row 0.
+    for (size_t i = 0; i < nFieldCount; ++i)
+        pDoc->SetString(static_cast<SCCOL>(i), 0, 0, 
OUString(aFields[i].pName, strlen(aFields[i].pName), RTL_TEXTENCODING_UTF8));
+
+    // Insert data into row 1 and downward.
+    for (size_t i = 0; i < nDataCount; ++i)
+    {
+        SCROW nRow = static_cast<SCROW>(i) + 1;
+        for (size_t j = 0; j < nFieldCount; ++j)
+        {
+            SCCOL nCol = static_cast<SCCOL>(j);
+            pDoc->SetString(
+                nCol, nRow, 0, OUString(aData[i][j], strlen(aData[i][j]), 
RTL_TEXTENCODING_UTF8));
+        }
+    }
+
+    SCROW nRow1 = 0, nRow2 = 0;
+    SCCOL nCol1 = 0, nCol2 = 0;
+    pDoc->GetDataArea(0, nCol1, nRow1, nCol2, nRow2, true, false);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Data is expected to start from 
(col=0,row=0).", SCCOL(0), nCol1);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Data is expected to start from 
(col=0,row=0).", SCROW(0), nRow1);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected data range.",
+                           static_cast<SCCOL>(nFieldCount - 1), nCol2);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected data range.",
+                           static_cast<SCROW>(nDataCount), nRow2);
+
+    ScRange aSrcRange(nCol1, nRow1, 0, nCol2, nRow2, 0);
+    printRange(pDoc, aSrcRange, "Data sheet content");
+    return aSrcRange;
+}
+
+
 void TestPivottable::testPivotTable()
 {
     m_pDoc->InsertTab(0, "Data");

Reply via email to