[Libreoffice-commits] core.git: compilerplugins/clang sc/CppunitTest_sc_ucalc.mk sc/CppunitTest_sc_ucalc_sharedformula.mk sc/inc sc/Module_sc.mk sc/qa sc/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri May 14 10:45:15 UTC 2021


 compilerplugins/clang/unusedmethods.results |    2 
 sc/CppunitTest_sc_ucalc.mk                  |    1 
 sc/CppunitTest_sc_ucalc_sharedformula.mk    |  119 ++++++++++++++++
 sc/Module_sc.mk                             |    1 
 sc/inc/document.hxx                         |    4 
 sc/qa/unit/helper/qahelper.cxx              |   87 ++++++++++++
 sc/qa/unit/helper/qahelper.hxx              |   19 ++
 sc/qa/unit/ucalc.cxx                        |   84 -----------
 sc/qa/unit/ucalc.hxx                        |   69 ---------
 sc/qa/unit/ucalc_sharedformula.cxx          |  199 +++++++++++++++++++++-------
 sc/source/ui/inc/refundo.hxx                |    3 
 sc/source/ui/inc/undobase.hxx               |    4 
 sc/source/ui/inc/undoblk.hxx                |    4 
 13 files changed, 387 insertions(+), 209 deletions(-)

New commits:
commit 9da5f12be26d1420c65b172af728f47347a6ce2d
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu May 13 16:26:47 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri May 14 12:44:29 2021 +0200

    sc_ucalc: move shared formula tests to their own module
    
    in order to split sc_ucalc monster into smaller
    modules
    
    Change-Id: I399daeb57dd5fba7077fef6584b0a3772df84d84
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115559
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/compilerplugins/clang/unusedmethods.results b/compilerplugins/clang/unusedmethods.results
index 682f24ce9a56..5591c686020a 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1184,8 +1184,6 @@ sc/qa/unit/ucalc.hxx:251
     void Test::testExternalRefUnresolved()
 sc/qa/unit/ucalc.hxx:391
     void Test::testCopyPasteSkipEmptyConditionalFormatting()
-sc/qa/unit/ucalc.hxx:418
-    void Test::testSharedFormulaMoveBlock()
 sc/qa/unit/ucalc.hxx:536
     void Test::testCondFormatUpdateMoveTab()
 sc/qa/unit/ucalc.hxx:537
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 4f20bb1c598e..bdf28c70a8be 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -19,7 +19,6 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sc_ucalc, \
     sc/qa/unit/ucalc_condformat \
     sc/qa/unit/ucalc_formula \
     sc/qa/unit/ucalc_pivottable \
-    sc/qa/unit/ucalc_sharedformula \
 ))
 
 $(eval $(call gb_CppunitTest_use_library_objects,sc_ucalc, \
diff --git a/sc/CppunitTest_sc_ucalc_sharedformula.mk b/sc/CppunitTest_sc_ucalc_sharedformula.mk
new file mode 100644
index 000000000000..6dca333f0013
--- /dev/null
+++ b/sc/CppunitTest_sc_ucalc_sharedformula.mk
@@ -0,0 +1,119 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_ucalc_sharedformula))
+
+$(eval $(call gb_Library_use_common_precompiled_header,sc_ucalc_sharedformula))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_ucalc_sharedformula, \
+    sc/qa/unit/ucalc_sharedformula \
+))
+
+$(eval $(call gb_CppunitTest_use_library_objects,sc_ucalc_sharedformula, \
+	sc \
+	scqahelper \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sc_ucalc_sharedformula,\
+	boost_headers \
+    $(call gb_Helper_optional,OPENCL, \
+        clew) \
+    icu_headers \
+    icui18n \
+    icuuc \
+	libxml2 \
+	mdds_headers \
+	orcus \
+	orcus-parser \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_ucalc_sharedformula, \
+	$(call gb_Helper_optional,AVMEDIA,avmedia) \
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    dbtools \
+    drawinglayer \
+    editeng \
+    for \
+    forui \
+    i18nlangtag \
+    i18nutil \
+	$(call gb_Helper_optional,OPENCL, \
+		opencl) \
+    sal \
+    salhelper \
+    sax \
+    sb \
+    sfx \
+    sot \
+    svl \
+    svt \
+    svx \
+    svxcore \
+	test \
+    tk \
+    tl \
+    ucbhelper \
+	unotest \
+    utl \
+    vbahelper \
+    vcl \
+    xo \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_ucalc_sharedformula,\
+    -I$(SRCDIR)/sc/source/ui/inc \
+    -I$(SRCDIR)/sc/source/core/inc \
+    -I$(SRCDIR)/sc/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sc_ucalc_sharedformula,\
+	udkapi \
+	offapi \
+	oovbaapi \
+))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sc_ucalc_sharedformula,\
+	officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_ucalc_sharedformula))
+$(eval $(call gb_CppunitTest_use_vcl,sc_ucalc_sharedformula))
+
+$(eval $(call gb_CppunitTest_use_components,sc_ucalc_sharedformula,\
+    configmgr/source/configmgr \
+    framework/util/fwk \
+    i18npool/source/search/i18nsearch \
+    i18npool/util/i18npool \
+    sax/source/expatwrap/expwrap \
+    scaddins/source/analysis/analysis \
+    scaddins/source/datefunc/date \
+    scaddins/source/pricing/pricing \
+    sfx2/util/sfx \
+    ucb/source/core/ucb1 \
+    ucb/source/ucp/file/ucpfile1 \
+    unoxml/source/service/unoxml \
+    uui/util/uui \
+    vcl/vcl.common \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_CppunitTest_add_libs,sc_ucalc_sharedformula,\
+     -lrt \
+))
+endif
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_ucalc_sharedformula))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 78d28fba4ded..1c9d8989ad01 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
 	Library_scqahelper \
 	$(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \
 		CppunitTest_sc_ucalc) \
+	CppunitTest_sc_ucalc_sharedformula \
 	CppunitTest_sc_ucalc_sort \
 	CppunitTest_sc_bugfix_test \
 	CppunitTest_sc_filters_test \
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 7ad0b8689820..e3cf5e9929a0 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1686,7 +1686,7 @@ public:
                                 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
                                 InsertDeleteFlags nFlags, bool bMarked, ScDocument& rDestDoc);
 
-    void            CopyToDocument(const ScRange& rRange,
+    SC_DLLPUBLIC void           CopyToDocument(const ScRange& rRange,
                                 InsertDeleteFlags nFlags, bool bMarked, ScDocument& rDestDoc,
                                 const ScMarkData* pMarks = nullptr, bool bColRowFlags = true);
     void            UndoToDocument(const ScRange& rRange,
@@ -1871,7 +1871,7 @@ public:
 
     SC_DLLPUBLIC void           ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
                                                        ScEditDataArray* pDataArray = nullptr, bool* pIsChanged = nullptr );
-    void                        DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
+    SC_DLLPUBLIC void           DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
     void                        DeleteSelectionTab( SCTAB nTab, InsertDeleteFlags nDelFlag, const ScMarkData& rMark );
 
     SC_DLLPUBLIC void           SetColWidth( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth );
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 6802e27c960b..26d4b43ccd98 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -24,8 +24,10 @@
 #include <editeng/brushitem.hxx>
 #include <editeng/justifyitem.hxx>
 #include <formula/errorcodes.hxx>
+#include <clipparam.hxx>
 #include <cppunit/Asserter.h>
 #include <cppunit/AdditionalMessage.h>
+#include <refundo.hxx>
 #include <sal/log.hxx>
 #include <sfx2/sfxsids.hrc>
 #include <svl/stritem.hxx>
@@ -34,6 +36,7 @@
 #include <sfx2/docfilt.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/frame.hxx>
+#include <undoblk.hxx>
 #include <unotools/tempfile.hxx>
 #include <scitems.hxx>
 #include <stringutil.hxx>
@@ -903,6 +906,90 @@ ScRange insertRangeData(
     return aRange;
 }
 
+ScUndoCut* cutToClip(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pClipDoc, bool bCreateUndo)
+{
+    ScDocument* pSrcDoc = &rDocSh.GetDocument();
+
+    ScClipParam aClipParam(rRange, true);
+    ScMarkData aMark(pSrcDoc->GetSheetLimits());
+    aMark.SetMarkArea(rRange);
+    pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark, false, false);
+
+    // Taken from ScViewFunc::CutToClip()
+    ScDocumentUniquePtr pUndoDoc;
+    if (bCreateUndo)
+    {
+        pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
+        pUndoDoc->InitUndoSelected( *pSrcDoc, aMark );
+        // all sheets - CopyToDocument skips those that don't exist in pUndoDoc
+        ScRange aCopyRange = rRange;
+        aCopyRange.aStart.SetTab(0);
+        aCopyRange.aEnd.SetTab(pSrcDoc->GetTableCount()-1);
+        pSrcDoc->CopyToDocument( aCopyRange,
+                (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS,
+                false, *pUndoDoc );
+    }
+
+    aMark.MarkToMulti();
+    pSrcDoc->DeleteSelection( InsertDeleteFlags::ALL, aMark );
+    aMark.MarkToSimple();
+
+    if (pUndoDoc)
+        return new ScUndoCut( &rDocSh, rRange, rRange.aEnd, aMark, std::move(pUndoDoc) );
+
+    return nullptr;
+}
+
+void copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc)
+{
+    ScClipParam aClipParam(rRange, false);
+    ScMarkData aMark(pSrcDoc->GetSheetLimits());
+    aMark.SetMarkArea(rRange);
+    pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark, false, false);
+}
+
+void 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)
+{
+    ScDocument& rDoc = rDocSh.GetDocument();
+    ScMarkData aMarkData(rDoc.GetSheetLimits());
+    aMarkData.SetMarkArea(rRange);
+    std::unique_ptr<ScRefUndoData> pRefUndoData(new ScRefUndoData(&rDoc));
+
+    return new ScUndoPaste(
+        &rDocSh, rRange, aMarkData, std::move(pUndoDoc), nullptr, InsertDeleteFlags::ALL, std::move(pRefUndoData), false);
+}
+
+bool insertRangeNames(
+    ScDocument* pDoc, ScRangeName* pNames, const RangeNameDef* p, const RangeNameDef* pEnd)
+{
+    ScAddress aA1(0, 0, 0);
+    for (; p != pEnd; ++p)
+    {
+        ScRangeData* pNew = new ScRangeData(
+            *pDoc,
+            OUString::createFromAscii(p->mpName),
+            OUString::createFromAscii(p->mpExpr),
+            aA1, ScRangeData::Type::Name,
+            formula::FormulaGrammar::GRAM_ENGLISH);
+        pNew->SetIndex(p->mnIndex);
+        bool bSuccess = pNames->insert(pNew);
+        if (!bSuccess)
+        {
+            cerr << "Insertion failed." << endl;
+            return false;
+        }
+    }
+
+    return true;
+}
+
 void printRange(ScDocument* pDoc, const ScRange& rRange, const char* pCaption)
 {
     SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 49ff66d5bc94..d2e7d42c4bda 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -24,6 +24,7 @@
 #include <string>
 #include <string_view>
 #include <sstream>
+#include <undoblk.hxx>
 
 #include <sal/types.h>
 
@@ -68,6 +69,7 @@ class SdrOle2Obj;
 class ScRangeList;
 class ScTokenArray;
 
+
 // data format for row height tests
 struct TestParam
 {
@@ -87,6 +89,13 @@ struct TestParam
     RowData const * pData;
 };
 
+struct RangeNameDef
+{
+    const char* mpName;
+    const char* mpExpr;
+    sal_uInt16 mnIndex;
+};
+
 struct FileFormat {
     const char* pName; const char* pFilterName; const char* pTypeName; SfxFilterFlags nFormatType;
 };
@@ -233,8 +242,18 @@ 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 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 void printRange(ScDocument* pDoc, const ScRange& rRange, const char* pCaption);
 SCQAHELPER_DLLPUBLIC void clearRange(ScDocument* pDoc, const ScRange& rRange);
 SCQAHELPER_DLLPUBLIC void clearSheet(ScDocument* pDoc, SCTAB nTab);
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b13bd77592c1..ca01cf38c768 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -12378,79 +12378,6 @@ ScDocShell* Test::findLoadedDocShellByName(std::u16string_view rName)
     return nullptr;
 }
 
-bool Test::insertRangeNames(
-    ScDocument* pDoc, ScRangeName* pNames, const RangeNameDef* p, const RangeNameDef* pEnd)
-{
-    ScAddress aA1(0, 0, 0);
-    for (; p != pEnd; ++p)
-    {
-        ScRangeData* pNew = new ScRangeData(
-            *pDoc,
-            OUString::createFromAscii(p->mpName),
-            OUString::createFromAscii(p->mpExpr),
-            aA1, ScRangeData::Type::Name,
-            formula::FormulaGrammar::GRAM_ENGLISH);
-        pNew->SetIndex(p->mnIndex);
-        bool bSuccess = pNames->insert(pNew);
-        if (!bSuccess)
-        {
-            cerr << "Insertion failed." << endl;
-            return false;
-        }
-    }
-
-    return true;
-}
-
-ScUndoCut* Test::cutToClip(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pClipDoc, bool bCreateUndo)
-{
-    ScDocument* pSrcDoc = &rDocSh.GetDocument();
-
-    ScClipParam aClipParam(rRange, true);
-    ScMarkData aMark(pSrcDoc->GetSheetLimits());
-    aMark.SetMarkArea(rRange);
-    pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark, false, false);
-
-    // Taken from ScViewFunc::CutToClip()
-    ScDocumentUniquePtr pUndoDoc;
-    if (bCreateUndo)
-    {
-        pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
-        pUndoDoc->InitUndoSelected( *pSrcDoc, aMark );
-        // all sheets - CopyToDocument skips those that don't exist in pUndoDoc
-        ScRange aCopyRange = rRange;
-        aCopyRange.aStart.SetTab(0);
-        aCopyRange.aEnd.SetTab(pSrcDoc->GetTableCount()-1);
-        pSrcDoc->CopyToDocument( aCopyRange,
-                (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS,
-                false, *pUndoDoc );
-    }
-
-    aMark.MarkToMulti();
-    pSrcDoc->DeleteSelection( InsertDeleteFlags::ALL, aMark );
-    aMark.MarkToSimple();
-
-    if (pUndoDoc)
-        return new ScUndoCut( &rDocSh, rRange, rRange.aEnd, aMark, std::move(pUndoDoc) );
-
-    return nullptr;
-}
-
-void Test::copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc)
-{
-    ScClipParam aClipParam(rRange, false);
-    ScMarkData aMark(pSrcDoc->GetSheetLimits());
-    aMark.SetMarkArea(rRange);
-    pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark, false, false);
-}
-
-void Test::pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc)
-{
-    ScMarkData aMark(pDestDoc->GetSheetLimits());
-    aMark.SetMarkArea(rDestRange);
-    pDestDoc->CopyFromClip(rDestRange, aMark, InsertDeleteFlags::ALL, nullptr, pClipDoc);
-}
-
 void Test::pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc, InsertDeleteFlags eFlags)
 {
     ScMarkData aMark(pDestDoc->GetSheetLimits());
@@ -12463,17 +12390,6 @@ void Test::pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange,
             rDestRange.aEnd.Col(), rDestRange.aEnd.Row());
 }
 
-ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocumentUniquePtr pUndoDoc)
-{
-    ScDocument& rDoc = rDocSh.GetDocument();
-    ScMarkData aMarkData(rDoc.GetSheetLimits());
-    aMarkData.SetMarkArea(rRange);
-    std::unique_ptr<ScRefUndoData> pRefUndoData(new ScRefUndoData(&rDoc));
-
-    return new ScUndoPaste(
-        &rDocSh, rRange, aMarkData, std::move(pUndoDoc), nullptr, InsertDeleteFlags::ALL, std::move(pRefUndoData), false);
-}
-
 void Test::setExpandRefs(bool bExpand)
 {
     ScModule* pMod = SC_MOD();
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 9fb3d4c4b8e3..3515740a9d33 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -23,26 +23,10 @@ class ScUndoCut;
 class Test : public test::BootstrapFixture
 {
 public:
-    struct RangeNameDef
-    {
-        const char* mpName;
-        const char* mpExpr;
-        sal_uInt16 mnIndex;
-    };
-
     static ScDocShell* findLoadedDocShellByName(std::u16string_view rName);
-    static bool insertRangeNames(ScDocument* pDoc, ScRangeName* pNames, const RangeNameDef* p,
-                                 const RangeNameDef* pEnd);
-    static ScUndoCut* cutToClip(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pClipDoc,
-                                bool bCreateUndo);
-    static void copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc);
-    static void pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange,
-                              ScDocument* pClipDoc);
     static void pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange,
                                      ScDocument* pClipDoc,
                                      InsertDeleteFlags eFlags = InsertDeleteFlags::ALL);
-    static ScUndoPaste* createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange,
-                                        ScDocumentUniquePtr pUndoDoc);
 
     /**
      * Enable or disable expand reference options which controls how
@@ -402,33 +386,6 @@ public:
     void testMergedCells();
     void testUpdateReference();
     void testSearchCells();
-    void testSharedFormulas();
-    void testSharedFormulasRefUpdate();
-    void testSharedFormulasRefUpdateMove();
-    void testSharedFormulasRefUpdateMove2();
-    void testSharedFormulasRefUpdateRange();
-    void testSharedFormulasRefUpdateRangeDeleteRow();
-    void testSharedFormulasRefUpdateExternal();
-    void testSharedFormulasInsertRow();
-    void testSharedFormulasDeleteRows();
-    void testSharedFormulasDeleteColumns();
-    void testSharedFormulasRefUpdateMoveSheets();
-    void testSharedFormulasRefUpdateCopySheets();
-    void testSharedFormulasRefUpdateDeleteSheets();
-    void testSharedFormulasCopyPaste();
-    void testSharedFormulaInsertColumn();
-    void testSharedFormulaMoveBlock();
-    void testSharedFormulaUpdateOnNamedRangeChange();
-    void testSharedFormulaUpdateOnDBChange();
-    void testSharedFormulaAbsCellListener();
-    void testSharedFormulaUnshareAreaListeners();
-    void testSharedFormulaListenerDeleteArea();
-    void testSharedFormulaUpdateOnReplacement();
-    void testSharedFormulaDeleteTopCell();
-    void testSharedFormulaCutCopyMoveIntoRef();
-    void testSharedFormulaCutCopyMoveWithRef();
-    void testSharedFormulaCutCopyMoveWithinRun();
-    void testSharedFormulaInsertShift();
     void testFormulaPosition();
     void testFormulaWizardSubformula();
 
@@ -802,32 +759,6 @@ public:
     CPPUNIT_TEST(testMergedCells);
     CPPUNIT_TEST(testUpdateReference);
     CPPUNIT_TEST(testSearchCells);
-    CPPUNIT_TEST(testSharedFormulas);
-    CPPUNIT_TEST(testSharedFormulasRefUpdate);
-    CPPUNIT_TEST(testSharedFormulasRefUpdateMove);
-    CPPUNIT_TEST(testSharedFormulasRefUpdateMove2);
-    CPPUNIT_TEST(testSharedFormulasRefUpdateRange);
-    CPPUNIT_TEST(testSharedFormulasRefUpdateRangeDeleteRow);
-    CPPUNIT_TEST(testSharedFormulasRefUpdateExternal);
-    CPPUNIT_TEST(testSharedFormulasInsertRow);
-    CPPUNIT_TEST(testSharedFormulasDeleteRows);
-    CPPUNIT_TEST(testSharedFormulasDeleteColumns);
-    CPPUNIT_TEST(testSharedFormulasRefUpdateMoveSheets);
-    CPPUNIT_TEST(testSharedFormulasRefUpdateCopySheets);
-    CPPUNIT_TEST(testSharedFormulasRefUpdateDeleteSheets);
-    CPPUNIT_TEST(testSharedFormulasCopyPaste);
-    CPPUNIT_TEST(testSharedFormulaInsertColumn);
-    CPPUNIT_TEST(testSharedFormulaUpdateOnNamedRangeChange);
-    CPPUNIT_TEST(testSharedFormulaUpdateOnDBChange);
-    CPPUNIT_TEST(testSharedFormulaAbsCellListener);
-    CPPUNIT_TEST(testSharedFormulaUnshareAreaListeners);
-    CPPUNIT_TEST(testSharedFormulaListenerDeleteArea);
-    CPPUNIT_TEST(testSharedFormulaUpdateOnReplacement);
-    CPPUNIT_TEST(testSharedFormulaDeleteTopCell);
-    CPPUNIT_TEST(testSharedFormulaCutCopyMoveIntoRef);
-    CPPUNIT_TEST(testSharedFormulaCutCopyMoveWithRef);
-    CPPUNIT_TEST(testSharedFormulaCutCopyMoveWithinRun);
-    CPPUNIT_TEST(testSharedFormulaInsertShift);
     CPPUNIT_TEST(testFormulaPosition);
     CPPUNIT_TEST(testFormulaWizardSubformula);
     CPPUNIT_TEST(testMixData);
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index 3efd3fc448a3..61b35d5cadad 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -7,9 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <test/bootstrapfixture.hxx>
 #include <memory>
 #include <string_view>
-#include "ucalc.hxx"
 #include "helper/debughelper.hxx"
 #include "helper/qahelper.hxx"
 #include <editutil.hxx>
@@ -26,13 +26,116 @@
 #include <dbdata.hxx>
 #include <bcaslot.hxx>
 #include <sharedformula.hxx>
+#include <scdll.hxx>
 
 #include <svl/sharedstring.hxx>
 #include <sfx2/docfile.hxx>
 
 #include <formula/grammar.hxx>
 
-void Test::testSharedFormulas()
+class TestSharedFormula : public test::BootstrapFixture
+{
+public:
+    TestSharedFormula();
+
+    virtual void setUp() override;
+    virtual void tearDown() override;
+
+    void testSharedFormulas();
+    void testSharedFormulasRefUpdate();
+    void testSharedFormulasRefUpdateMove();
+    void testSharedFormulasRefUpdateMove2();
+    void testSharedFormulasRefUpdateRange();
+    void testSharedFormulasRefUpdateRangeDeleteRow();
+    void testSharedFormulasRefUpdateExternal();
+    void testSharedFormulasInsertRow();
+    void testSharedFormulasDeleteRows();
+    void testSharedFormulasDeleteColumns();
+    void testSharedFormulasRefUpdateMoveSheets();
+    void testSharedFormulasRefUpdateCopySheets();
+    void testSharedFormulasRefUpdateDeleteSheets();
+    void testSharedFormulasCopyPaste();
+    void testSharedFormulaInsertColumn();
+    void testSharedFormulaMoveBlock();
+    void testSharedFormulaUpdateOnNamedRangeChange();
+    void testSharedFormulaUpdateOnDBChange();
+    void testSharedFormulaAbsCellListener();
+    void testSharedFormulaUnshareAreaListeners();
+    void testSharedFormulaListenerDeleteArea();
+    void testSharedFormulaUpdateOnReplacement();
+    void testSharedFormulaDeleteTopCell();
+    void testSharedFormulaCutCopyMoveIntoRef();
+    void testSharedFormulaCutCopyMoveWithRef();
+    void testSharedFormulaCutCopyMoveWithinRun();
+    void testSharedFormulaInsertShift();
+
+    CPPUNIT_TEST_SUITE(TestSharedFormula);
+
+    CPPUNIT_TEST(testSharedFormulas);
+    CPPUNIT_TEST(testSharedFormulasRefUpdate);
+    CPPUNIT_TEST(testSharedFormulasRefUpdateMove);
+    CPPUNIT_TEST(testSharedFormulasRefUpdateMove2);
+    CPPUNIT_TEST(testSharedFormulasRefUpdateRange);
+    CPPUNIT_TEST(testSharedFormulasRefUpdateRangeDeleteRow);
+    CPPUNIT_TEST(testSharedFormulasRefUpdateExternal);
+    CPPUNIT_TEST(testSharedFormulasInsertRow);
+    CPPUNIT_TEST(testSharedFormulasDeleteRows);
+    CPPUNIT_TEST(testSharedFormulasDeleteColumns);
+    CPPUNIT_TEST(testSharedFormulasRefUpdateMoveSheets);
+    CPPUNIT_TEST(testSharedFormulasRefUpdateCopySheets);
+    CPPUNIT_TEST(testSharedFormulasRefUpdateDeleteSheets);
+    CPPUNIT_TEST(testSharedFormulasCopyPaste);
+    CPPUNIT_TEST(testSharedFormulaInsertColumn);
+    CPPUNIT_TEST(testSharedFormulaMoveBlock);
+    CPPUNIT_TEST(testSharedFormulaUpdateOnNamedRangeChange);
+    CPPUNIT_TEST(testSharedFormulaUpdateOnDBChange);
+    CPPUNIT_TEST(testSharedFormulaAbsCellListener);
+    CPPUNIT_TEST(testSharedFormulaUnshareAreaListeners);
+    CPPUNIT_TEST(testSharedFormulaListenerDeleteArea);
+    CPPUNIT_TEST(testSharedFormulaUpdateOnReplacement);
+    CPPUNIT_TEST(testSharedFormulaDeleteTopCell);
+    CPPUNIT_TEST(testSharedFormulaCutCopyMoveIntoRef);
+    CPPUNIT_TEST(testSharedFormulaCutCopyMoveWithRef);
+    CPPUNIT_TEST(testSharedFormulaCutCopyMoveWithinRun);
+    CPPUNIT_TEST(testSharedFormulaInsertShift);
+
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    ScDocShellRef m_xDocShell;
+    ScDocument* m_pDoc;
+};
+
+
+TestSharedFormula::TestSharedFormula()
+{
+}
+
+void TestSharedFormula::setUp()
+{
+    BootstrapFixture::setUp();
+
+    ScDLL::Init();
+
+    m_xDocShell = new ScDocShell(
+        SfxModelFlags::EMBEDDED_OBJECT |
+        SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
+        SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
+    m_xDocShell->SetIsInUcalc();
+    m_xDocShell->DoInitUnitTest();
+
+    m_pDoc = &m_xDocShell->GetDocument();
+}
+
+void TestSharedFormula::tearDown()
+{
+    m_xDocShell->DoClose();
+    m_xDocShell.clear();
+
+    test::BootstrapFixture::tearDown();
+}
+
+void TestSharedFormula::testSharedFormulas()
 {
     m_pDoc->InsertTab(0, "Test");
 
@@ -302,7 +405,7 @@ void Test::testSharedFormulas()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasRefUpdate()
+void TestSharedFormula::testSharedFormulasRefUpdate()
 {
     m_pDoc->InsertTab(0, "Test");
 
@@ -439,7 +542,7 @@ void Test::testSharedFormulasRefUpdate()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasRefUpdateMove()
+void TestSharedFormula::testSharedFormulasRefUpdateMove()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
     FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
@@ -470,7 +573,7 @@ void Test::testSharedFormulasRefUpdateMove()
     CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(2,3,0)));
 
     // Move B2:B4 to B1:B3.
-    bool bMoved = getDocShell().GetDocFunc().MoveBlock(ScRange(1,1,0,1,3,0), ScAddress(1,0,0), true, true, false, true);
+    bool bMoved = m_xDocShell->GetDocFunc().MoveBlock(ScRange(1,1,0,1,3,0), ScAddress(1,0,0), true, true, false, true);
     CPPUNIT_ASSERT(bMoved);
 
     // Make sure the values have been moved for real.
@@ -500,7 +603,7 @@ void Test::testSharedFormulasRefUpdateMove()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasRefUpdateMove2()
+void TestSharedFormula::testSharedFormulasRefUpdateMove2()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, false); // turn auto calc off this time.
     FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
@@ -540,7 +643,7 @@ void Test::testSharedFormulasRefUpdateMove2()
     CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(5,2,0)));
 
     // Move B2:C3 to C3:D4.
-    bool bMoved = getDocShell().GetDocFunc().MoveBlock(
+    bool bMoved = m_xDocShell->GetDocFunc().MoveBlock(
         ScRange(1,1,0,2,2,0), ScAddress(2,2,0), true, true, false, true);
     CPPUNIT_ASSERT(bMoved);
 
@@ -572,7 +675,7 @@ void Test::testSharedFormulasRefUpdateMove2()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasRefUpdateRange()
+void TestSharedFormula::testSharedFormulasRefUpdateRange()
 {
     m_pDoc->InsertTab(0, "Test");
 
@@ -658,7 +761,7 @@ struct SortByArea
 
 }
 
-void Test::testSharedFormulasRefUpdateRangeDeleteRow()
+void TestSharedFormula::testSharedFormulasRefUpdateRangeDeleteRow()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
     m_pDoc->InsertTab(0, "Formula");
@@ -710,7 +813,7 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
     CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
 
     // Delete row 3.  This will merge the two formula groups.
-    ScDocFunc& rFunc = getDocShell().GetDocFunc();
+    ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
     ScMarkData aMark(m_pDoc->GetSheetLimits());
     aMark.SelectOneTable(0);
     rFunc.DeleteCells(ScRange(0,2,0,MAXCOL,2,0), &aMark, DelCellCmd::Rows, true);
@@ -778,7 +881,7 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasRefUpdateExternal()
+void TestSharedFormula::testSharedFormulasRefUpdateExternal()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
     m_pDoc->InsertTab(0, "Formula");
@@ -823,7 +926,7 @@ void Test::testSharedFormulasRefUpdateExternal()
     ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,9,0), "COUNTA('file:///extdata.fake'#$Data.A1:A3)", "Wrong formula!");
 
     // Delete rows 1 and 2. This should not change the references in the formula cells below.
-    ScDocFunc& rDocFunc = getDocShell().GetDocFunc();
+    ScDocFunc& rDocFunc = m_xDocShell->GetDocFunc();
     ScMarkData aMark(m_pDoc->GetSheetLimits());
     aMark.SelectOneTable(0);
     rDocFunc.DeleteCells(ScRange(0,0,0,MAXCOL,1,0), &aMark, DelCellCmd::CellsUp, true);
@@ -855,7 +958,7 @@ void Test::testSharedFormulasRefUpdateExternal()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasInsertRow()
+void TestSharedFormula::testSharedFormulasInsertRow()
 {
     struct
     {
@@ -937,7 +1040,7 @@ void Test::testSharedFormulasInsertRow()
     }
 
     // Insert a new row at row 3.
-    ScDocFunc& rFunc = getDocShell().GetDocFunc();
+    ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
     ScMarkData aMark(m_pDoc->GetSheetLimits());
     aMark.SelectOneTable(0);
     rFunc.InsertCells(ScRange(0,2,0,MAXCOL,2,0), &aMark, INS_INSROWS_BEFORE, true, true);
@@ -961,7 +1064,7 @@ void Test::testSharedFormulasInsertRow()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasDeleteRows()
+void TestSharedFormula::testSharedFormulasDeleteRows()
 {
     m_pDoc->InsertTab(0, "Test");
     FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
@@ -1057,7 +1160,7 @@ void Test::testSharedFormulasDeleteRows()
     CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedLength());
 }
 
-void Test::testSharedFormulasDeleteColumns()
+void TestSharedFormula::testSharedFormulasDeleteColumns()
 {
     using namespace formula;
 
@@ -1066,7 +1169,7 @@ void Test::testSharedFormulasDeleteColumns()
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
     FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
 
-    ScDocFunc& rFunc = getDocShell().GetDocFunc();
+    ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
     ScMarkData aMark(m_pDoc->GetSheetLimits());
     aMark.SelectOneTable(0);
 
@@ -1147,7 +1250,7 @@ void Test::testSharedFormulasDeleteColumns()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasRefUpdateMoveSheets()
+void TestSharedFormula::testSharedFormulasRefUpdateMoveSheets()
 {
     m_pDoc->InsertTab(0, "Sheet1");
     m_pDoc->InsertTab(1, "Sheet2");
@@ -1227,7 +1330,7 @@ void Test::testSharedFormulasRefUpdateMoveSheets()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasRefUpdateCopySheets()
+void TestSharedFormula::testSharedFormulasRefUpdateCopySheets()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // make sure auto calc is on.
 
@@ -1263,7 +1366,7 @@ void Test::testSharedFormulasRefUpdateCopySheets()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasRefUpdateDeleteSheets()
+void TestSharedFormula::testSharedFormulasRefUpdateDeleteSheets()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // make sure auto calc is on.
 
@@ -1290,7 +1393,7 @@ void Test::testSharedFormulasRefUpdateDeleteSheets()
     ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "Sheet2.B4", "Wrong formula");
 
     // Delete Sheet2.
-    ScDocFunc& rFunc = getDocShell().GetDocFunc();
+    ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
     rFunc.DeleteTable(1, true);
 
     ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,0,0), "#REF!.B2", "Wrong formula");
@@ -1313,7 +1416,7 @@ void Test::testSharedFormulasRefUpdateDeleteSheets()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulasCopyPaste()
+void TestSharedFormula::testSharedFormulasCopyPaste()
 {
     m_pDoc->InsertTab(0, "Test");
     FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
@@ -1354,7 +1457,7 @@ void Test::testSharedFormulasCopyPaste()
     ScDocument* pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
     pUndoDoc->InitUndo(*m_pDoc, 0, 0, true, true);
     m_pDoc->CopyToDocument(aRange, InsertDeleteFlags::CONTENTS, false, *pUndoDoc);
-    std::unique_ptr<ScUndoPaste> pUndo(createUndoPaste(getDocShell(), aRange, ScDocumentUniquePtr(pUndoDoc)));
+    std::unique_ptr<ScUndoPaste> pUndo(createUndoPaste(*m_xDocShell, aRange, ScDocumentUniquePtr(pUndoDoc)));
 
     // First, make sure the formula cells are shared in the undo document.
     aPos.SetCol(1);
@@ -1392,7 +1495,7 @@ void Test::testSharedFormulasCopyPaste()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulaInsertColumn()
+void TestSharedFormula::testSharedFormulaInsertColumn()
 {
     m_pDoc->InsertTab(0, "Test");
 
@@ -1409,7 +1512,7 @@ void Test::testSharedFormulaInsertColumn()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulaMoveBlock()
+void TestSharedFormula::testSharedFormulaMoveBlock()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
     FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
@@ -1435,7 +1538,7 @@ void Test::testSharedFormulaMoveBlock()
     clearFormulaCellChangedFlag(*m_pDoc, aFormulaRange);
 
     // Move A1:A3 to D1:D3.
-    ScDocFunc& rFunc = getDocShell().GetDocFunc();
+    ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
     bool bMoved = rFunc.MoveBlock(ScRange(0,0,0,0,2,0), ScAddress(3,0,0), true, true, false, true);
     CPPUNIT_ASSERT(bMoved);
 
@@ -1517,7 +1620,7 @@ void Test::testSharedFormulaMoveBlock()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulaUpdateOnNamedRangeChange()
+void TestSharedFormula::testSharedFormulaUpdateOnNamedRangeChange()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -1588,7 +1691,7 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange()
     bSuccess = insertRangeNames(m_pDoc, pNames.get(), &aName, &aName + 1);
     CPPUNIT_ASSERT(bSuccess);
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pNames->size());
-    ScDocFunc& rFunc = getDocShell().GetDocFunc();
+    ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
 
     typedef std::map<OUString, std::unique_ptr<ScRangeName>> NameMapType;
     NameMapType aNewNames;
@@ -1623,7 +1726,7 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulaUpdateOnDBChange()
+void TestSharedFormula::testSharedFormulaUpdateOnDBChange()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -1656,7 +1759,7 @@ void Test::testSharedFormulaUpdateOnDBChange()
     CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(2,2,0)));
     CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(2,3,0)));
 
-    ScDBDocFunc aFunc(getDocShell());
+    ScDBDocFunc aFunc(*m_xDocShell);
 
     // Change the range referenced by MyRange to A1:A4.
     ScDBCollection aNewDBs(*m_pDoc);
@@ -1690,7 +1793,7 @@ void Test::testSharedFormulaUpdateOnDBChange()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulaAbsCellListener()
+void TestSharedFormula::testSharedFormulaAbsCellListener()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -1741,7 +1844,7 @@ static double checkNewValuesNotification( ScDocument* pDoc, const ScAddress& rOr
     return fVal;
 }
 
-void Test::testSharedFormulaUnshareAreaListeners()
+void TestSharedFormula::testSharedFormulaUnshareAreaListeners()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -1802,7 +1905,7 @@ void Test::testSharedFormulaUnshareAreaListeners()
                 // ScDocument::SetString(), mimicking formula input in view.
                 {
                     ScFormulaCell* pCell = new ScFormulaCell( *m_pDoc, aPos, "=B4");
-                    ScDocFunc& rDocFunc = getDocShell().GetDocFunc();
+                    ScDocFunc& rDocFunc = m_xDocShell->GetDocFunc();
                     rDocFunc.SetFormulaCell( aPos, pCell, false);
                 }
             break;
@@ -2226,7 +2329,7 @@ void Test::testSharedFormulaUnshareAreaListeners()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulaListenerDeleteArea()
+void TestSharedFormula::testSharedFormulaListenerDeleteArea()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -2270,7 +2373,7 @@ void Test::testSharedFormulaListenerDeleteArea()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulaUpdateOnReplacement()
+void TestSharedFormula::testSharedFormulaUpdateOnReplacement()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -2313,7 +2416,7 @@ void Test::testSharedFormulaUpdateOnReplacement()
     ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO));
     pUndoDoc->InitUndo(*m_pDoc, 0, 0);
     m_pDoc->CopyToDocument(aUndoRange, InsertDeleteFlags::CONTENTS, false, *pUndoDoc, &aMark);
-    ScUndoDeleteContents aUndo(&getDocShell(), aMark, aUndoRange, std::move(pUndoDoc), false, InsertDeleteFlags::CONTENTS, true);
+    ScUndoDeleteContents aUndo(m_xDocShell.get(), aMark, aUndoRange, std::move(pUndoDoc), false, InsertDeleteFlags::CONTENTS, true);
 
     // Delete A4.
     clearRange(m_pDoc, aUndoRange);
@@ -2425,7 +2528,7 @@ void Test::testSharedFormulaUpdateOnReplacement()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulaDeleteTopCell()
+void TestSharedFormula::testSharedFormulaDeleteTopCell()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -2451,7 +2554,7 @@ void Test::testSharedFormulaDeleteTopCell()
     // Delete cell A1.
     ScMarkData aMark(m_pDoc->GetSheetLimits());
     aMark.SelectOneTable(0);
-    getDocShell().GetDocFunc().DeleteCell( ScAddress(0,0,0), aMark, InsertDeleteFlags::CONTENTS, false, /*bApi=*/ true);
+    m_xDocShell->GetDocFunc().DeleteCell( ScAddress(0,0,0), aMark, InsertDeleteFlags::CONTENTS, false, /*bApi=*/ true);
     // Check it's gone.
     CPPUNIT_ASSERT(!m_pDoc->GetFormulaCell( ScAddress(0,0,0)));
 
@@ -2467,7 +2570,7 @@ void Test::testSharedFormulaDeleteTopCell()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testSharedFormulaCutCopyMoveIntoRef()
+void TestSharedFormula::testSharedFormulaCutCopyMoveIntoRef()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -2491,7 +2594,7 @@ void Test::testSharedFormulaCutCopyMoveIntoRef()
         ScDocument aClipDoc(SCDOCMODE_CLIP);
         aClipDoc.ResetClip(m_pDoc, &aMark);
         // Cut C1:C2 to clipboard.
-        cutToClip( getDocShell(), ScRange(2,0,0, 2,1,0), &aClipDoc, false);
+        cutToClip(*m_xDocShell, ScRange(2,0,0, 2,1,0), &aClipDoc, false);
 
         // Paste to B1:B2
         ScRange aPasteRange(1,0,0, 1,1,0);
@@ -2538,7 +2641,7 @@ void Test::testSharedFormulaCutCopyMoveIntoRef()
         ScDocument aClipDoc(SCDOCMODE_CLIP);
         aClipDoc.ResetClip(m_pDoc, &aMark);
         // Cut B1:B2 to clipboard.
-        cutToClip( getDocShell(), ScRange(1,0,0, 1,1,0), &aClipDoc, false);
+        cutToClip(*m_xDocShell, ScRange(1,0,0, 1,1,0), &aClipDoc, false);
 
         // Check results in C1:C4 after Cut.
         const double fVec1[] = { 1.0, 4.0, 48.0, 192.0 };
@@ -2582,7 +2685,7 @@ void Test::testSharedFormulaCutCopyMoveIntoRef()
 }
 
 // tdf#121002
-void Test::testSharedFormulaCutCopyMoveWithRef()
+void TestSharedFormula::testSharedFormulaCutCopyMoveWithRef()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -2616,7 +2719,7 @@ void Test::testSharedFormulaCutCopyMoveWithRef()
     ScDocument aClipDoc(SCDOCMODE_CLIP);
     aClipDoc.ResetClip(m_pDoc, &aMark);
     // Cut A3:B3 to clipboard.
-    cutToClip( getDocShell(), ScRange(0,2,0, 1,2,0), &aClipDoc, false);
+    cutToClip(*m_xDocShell, ScRange(0,2,0, 1,2,0), &aClipDoc, false);
 
     // Check results in C1:C4 after Cut.
     const double fVec1[] = { 0.0, 0.0, 0.0, 12.0 };
@@ -2654,7 +2757,7 @@ void Test::testSharedFormulaCutCopyMoveWithRef()
 }
 
 // tdf#120013
-void Test::testSharedFormulaCutCopyMoveWithinRun()
+void TestSharedFormula::testSharedFormulaCutCopyMoveWithinRun()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -2699,7 +2802,7 @@ void Test::testSharedFormulaCutCopyMoveWithinRun()
     ScDocument aClipDoc(SCDOCMODE_CLIP);
     aClipDoc.ResetClip(m_pDoc, &aMark);
     // Cut A8:D8 to clipboard.
-    cutToClip( getDocShell(), ScRange(0,7,0, 3,7,0), &aClipDoc, false);
+    cutToClip(*m_xDocShell, ScRange(0,7,0, 3,7,0), &aClipDoc, false);
 
     // Check results in E3:E9 after Cut.
     const double fVec1[] = { 2200.0, 2200.0, 300.0, 300.0, 1900.0, 1900.0, 1900.0 };
@@ -2730,7 +2833,7 @@ void Test::testSharedFormulaCutCopyMoveWithinRun()
 }
 
 // tdf#129396
-void Test::testSharedFormulaInsertShift()
+void TestSharedFormula::testSharedFormulaInsertShift()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
 
@@ -2795,4 +2898,8 @@ void Test::testSharedFormulaInsertShift()
     m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_SUITE_REGISTRATION(TestSharedFormula);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/refundo.hxx b/sc/source/ui/inc/refundo.hxx
index 2ddf6c584ba1..bf0eb62e9161 100644
--- a/sc/source/ui/inc/refundo.hxx
+++ b/sc/source/ui/inc/refundo.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <memory>
+#include <scdllapi.h>
 
 class ScDocument;
 class ScDBCollection;
@@ -31,7 +32,7 @@ class ScChartListenerCollection;
 class ScAreaLinkSaveCollection;
 class ScUnoRefList;
 
-class ScRefUndoData
+class SC_DLLPUBLIC ScRefUndoData
 {
 private:
     std::unique_ptr<ScDBCollection>             pDBCollection;
diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx
index 698fcc51b81f..4e07e6ae50fe 100644
--- a/sc/source/ui/inc/undobase.hxx
+++ b/sc/source/ui/inc/undobase.hxx
@@ -30,7 +30,7 @@ class SdrUndoAction;
 class ScRefUndoData;
 class ScDBData;
 
-class ScSimpleUndo: public SfxUndoAction
+class SC_DLLPUBLIC ScSimpleUndo: public SfxUndoAction
 {
     ScSimpleUndo(const ScSimpleUndo&) = delete;
 
@@ -95,7 +95,7 @@ protected:
     void            ShowBlock();
 };
 
-class ScMultiBlockUndo: public ScSimpleUndo
+class SC_DLLPUBLIC ScMultiBlockUndo: public ScSimpleUndo
 {
 public:
     ScMultiBlockUndo(ScDocShell* pDocSh, const ScRangeList& rRanges);
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index 48b8cdeb5003..39f1792a8327 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -131,7 +131,7 @@ private:
     void            SetChangeTrack();
 };
 
-class ScUndoCut: public ScBlockUndo
+class SC_DLLPUBLIC ScUndoCut: public ScBlockUndo
 {
 public:
     ScUndoCut(ScDocShell* pNewDocShell,
@@ -177,7 +177,7 @@ struct ScUndoPasteOptions
     {}
 };
 
-class ScUndoPaste: public ScMultiBlockUndo
+class SC_DLLPUBLIC ScUndoPaste: public ScMultiBlockUndo
 {
 public:
     ScUndoPaste(ScDocShell* pNewDocShell, const ScRangeList& rRanges,


More information about the Libreoffice-commits mailing list