sc/CppunitTest_sc_jumbosheets_test.mk        |    1 
 sc/qa/unit/bugfix-test.cxx                   |    6 
 sc/qa/unit/data/ods/sum-whole-column-row.ods |binary
 sc/qa/unit/filters-test.cxx                  |    8 -
 sc/qa/unit/helper/qahelper.cxx               |   40 +++--
 sc/qa/unit/helper/qahelper.hxx               |   14 +
 sc/qa/unit/helper/xpath.cxx                  |    2 
 sc/qa/unit/jumbosheets-test.cxx              |   95 ++++++++++--
 sc/qa/unit/pivottable_filters_test.cxx       |   79 ++++------
 sc/qa/unit/subsequent_export_test.cxx        |  210 +++++++++++----------------
 sc/qa/unit/subsequent_export_test2.cxx       |  207 +++++++++++---------------
 11 files changed, 335 insertions(+), 327 deletions(-)

New commits:
commit 7714bee48caafc80135f3df78e00b5e407e7ee22
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Fri Feb 11 21:45:18 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Feb 15 08:18:26 2022 +0100

    "&(*xShell)" -> "*xShell"
    
    Change-Id: I259ff2b545491591ca5918380208ec96e223e2af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129854
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 7fd56122216e..dc8538590e20 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -164,7 +164,7 @@ void ScFiltersTest::testTdf137576_Measureline()
     lcl_AssertPointEqualWithTolerance("Load, end point: ", Point(4800, 5200), 
aEnd, 1);
 
     // Save and reload
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_ODS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_ODS);
     ScDocument& rDoc2 = xDocSh->GetDocument();
 
     // Get shape
@@ -238,7 +238,7 @@ void ScFiltersTest::testTdf137044_CoverHiddenRows()
     rDoc.SetRowHidden(4, 5, 0, true);
 
     // Save and reload
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_ODS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_ODS);
     ScDocument& rDoc2 = xDocSh->GetDocument();
 
     // Get shape
@@ -282,7 +282,7 @@ void ScFiltersTest::testTdf137020_FlipVertical()
     lcl_AssertRectEqualWithTolerance("Mirror:", aSnapRectOrig, aSnapRectFlip, 
1);
 
     // Save and reload
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_ODS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_ODS);
     ScDocument& rDoc2 = xDocSh->GetDocument();
 
     // Get shape
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 923f2e229391..81d84520fff5 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -486,7 +486,7 @@ void ScFiltersTest::testTdf79998()
     CPPUNIT_ASSERT_EQUAL(OUString("Utilities (FX Kurse, Kreditkarten etc)"), 
aTabNames1[1]);
 
     // check: saved XLSX document has truncated tab name
-    xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload( *xDocSh, FORMAT_XLSX);
     ScDocument& rDoc2 = xDocSh->GetDocument();
     const std::vector<OUString> aTabNames2 = rDoc2.GetAllTableNames();
     CPPUNIT_ASSERT_EQUAL(OUString("Utilities (FX Kurse, Kreditkart"), 
aTabNames2[1]);
@@ -580,7 +580,7 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
         // test save and reload
         // for some reason having this test in subsequent_export-test.cxx 
causes
         // a core dump in editeng ( so moved to here )
-        xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
+        xDocSh = saveAndReload( *xDocSh, FORMAT_ODS);
         ScDocument& rDoc2 = xDocSh->GetDocument();
         impl_testLegacyCellAnchoredRotatedShape( rDoc2, aRect, aAnchor );
 
@@ -607,7 +607,7 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
         rDoc.SetDrawPageSize(0); // trigger recalcpos
         impl_testLegacyCellAnchoredRotatedShape( rDoc, aRect, aAnchor);
         // test save and reload
-        xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
+        xDocSh = saveAndReload( *xDocSh, FORMAT_ODS);
         ScDocument& rDoc2 = xDocSh->GetDocument();
         impl_testLegacyCellAnchoredRotatedShape( rDoc2, aRect, aAnchor );
 
@@ -631,7 +631,7 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
         // test import
         impl_testLegacyCellAnchoredRotatedShape( rDoc, aRect, aAnchor );
         // test save and reload
-        xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
+        xDocSh = saveAndReload( *xDocSh, FORMAT_ODS);
         ScDocument& rDoc2 = xDocSh->GetDocument();
         impl_testLegacyCellAnchoredRotatedShape( rDoc2, aRect, aAnchor );
 
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 66c970d1468e..6bef6d0823f4 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -699,7 +699,7 @@ void ScBootstrapFixture::createCSVPath(std::u16string_view 
aFileBase, OUString&
 }
 
 ScDocShellRef ScBootstrapFixture::saveAndReload(
-    ScDocShell* pShell, const OUString &rFilter,
+    ScDocShell& rShell, const OUString &rFilter,
     const OUString &rUserData, const OUString& rTypeName, SfxFilterFlags 
nFormatType, const OUString* pPassword, bool bClose)
 {
 
@@ -724,9 +724,9 @@ ScDocShellRef ScBootstrapFixture::saveAndReload(
         uno::Reference< embed::XStorage > xMedStorage = 
aStoreMedium.GetStorage();
         ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( 
xMedStorage, aEncryptionData );
     }
-    pShell->DoSaveAs( aStoreMedium );
+    rShell.DoSaveAs( aStoreMedium );
     if (bClose)
-        pShell->DoClose();
+        rShell.DoClose();
 
     //std::cout << "File: " << aTempFile.GetURL() << std::endl;
 
@@ -743,40 +743,40 @@ ScDocShellRef ScBootstrapFixture::saveAndReload(
     return xDocSh;
 }
 
-ScDocShellRef ScBootstrapFixture::saveAndReload( ScDocShell* pShell, sal_Int32 
nFormat )
+ScDocShellRef ScBootstrapFixture::saveAndReload( ScDocShell& rShell, sal_Int32 
nFormat )
 {
     OUString aFilterName(aFileFormats[nFormat].pFilterName, 
strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ;
     OUString aFilterType(aFileFormats[nFormat].pTypeName, 
strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8);
-    ScDocShellRef xDocSh = saveAndReload(pShell, aFilterName, OUString(), 
aFilterType, aFileFormats[nFormat].nFormatType);
+    ScDocShellRef xDocSh = saveAndReload(rShell, aFilterName, OUString(), 
aFilterType, aFileFormats[nFormat].nFormatType);
 
     CPPUNIT_ASSERT(xDocSh.is());
     return xDocSh;
 }
 
-ScDocShellRef ScBootstrapFixture::saveAndReloadPassword( ScDocShell* pShell, 
sal_Int32 nFormat )
+ScDocShellRef ScBootstrapFixture::saveAndReloadPassword( ScDocShell& rShell, 
sal_Int32 nFormat )
 {
     OUString aFilterName(aFileFormats[nFormat].pFilterName, 
strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ;
     OUString aFilterType(aFileFormats[nFormat].pTypeName, 
strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8);
     OUString aPass("test");
 
-    ScDocShellRef xDocSh = saveAndReload(pShell, aFilterName, OUString(), 
aFilterType, aFileFormats[nFormat].nFormatType, &aPass);
+    ScDocShellRef xDocSh = saveAndReload(rShell, aFilterName, OUString(), 
aFilterType, aFileFormats[nFormat].nFormatType, &aPass);
 
     CPPUNIT_ASSERT(xDocSh.is());
     return xDocSh;
 }
 
-ScDocShellRef ScBootstrapFixture::saveAndReloadNoClose( ScDocShell* pShell, 
sal_Int32 nFormat )
+ScDocShellRef ScBootstrapFixture::saveAndReloadNoClose( ScDocShell& rShell, 
sal_Int32 nFormat )
 {
     OUString aFilterName(aFileFormats[nFormat].pFilterName, 
strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ;
     OUString aFilterType(aFileFormats[nFormat].pTypeName, 
strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8);
 
-    ScDocShellRef xDocSh = saveAndReload(pShell, aFilterName, OUString(), 
aFilterType, aFileFormats[nFormat].nFormatType, nullptr, false);
+    ScDocShellRef xDocSh = saveAndReload(rShell, aFilterName, OUString(), 
aFilterType, aFileFormats[nFormat].nFormatType, nullptr, false);
 
     CPPUNIT_ASSERT(xDocSh.is());
     return xDocSh;
 }
 
-std::shared_ptr<utl::TempFile> ScBootstrapFixture::saveAs( ScDocShell* pShell, 
sal_Int32 nFormat )
+std::shared_ptr<utl::TempFile> ScBootstrapFixture::saveAs( ScDocShell& rShell, 
sal_Int32 nFormat )
 {
     OUString aFilterName(aFileFormats[nFormat].pFilterName, 
strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ;
     OUString aFilterType(aFileFormats[nFormat].pTypeName, 
strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8);
@@ -794,15 +794,15 @@ std::shared_ptr<utl::TempFile> 
ScBootstrapFixture::saveAs( ScDocShell* pShell, s
         OUString(), "private:factory/scalc*" );
     pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
     aStoreMedium.SetFilter(pExportFilter);
-    pShell->DoSaveAs( aStoreMedium );
+    rShell.DoSaveAs( aStoreMedium );
 
     return pTempFile;
 }
 
-std::shared_ptr<utl::TempFile> ScBootstrapFixture::exportTo( ScDocShell* 
pShell, sal_Int32 nFormat )
+std::shared_ptr<utl::TempFile> ScBootstrapFixture::exportTo( ScDocShell& 
rShell, sal_Int32 nFormat )
 {
-    std::shared_ptr<utl::TempFile> pTempFile = saveAs(pShell, nFormat);
-    pShell->DoClose();
+    std::shared_ptr<utl::TempFile> pTempFile = saveAs(rShell, nFormat);
+    rShell.DoClose();
 
     SfxFilterFlags nFormatType = aFileFormats[nFormat].nFormatType;
     if(nFormatType == XLSX_FORMAT_TYPE)
@@ -825,7 +825,7 @@ void ScBootstrapFixture::miscRowHeightsTest( TestParam 
const * aTestValues, unsi
         CPPUNIT_ASSERT(xShell.is());
 
         if ( nExportType != -1 )
-            xShell = saveAndReload(&(*xShell), nExportType );
+            xShell = saveAndReload(*xShell, nExportType );
 
         CPPUNIT_ASSERT(xShell.is());
 
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index d03ba046933a..b61734fd1da1 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -214,16 +214,16 @@ public:
     void createCSVPath(const char* aFileBase, OUString& rCSVPath);
     void createCSVPath(std::u16string_view aFileBase, OUString& rCSVPath);
 
-    ScDocShellRef saveAndReload(ScDocShell* pShell, const OUString &rFilter,
+    ScDocShellRef saveAndReload(ScDocShell& rShell, const OUString &rFilter,
     const OUString &rUserData, const OUString& rTypeName, SfxFilterFlags 
nFormatType, const OUString* pPassword = nullptr,
     bool bClose = true );
 
-    ScDocShellRef saveAndReload( ScDocShell* pShell, sal_Int32 nFormat );
-    ScDocShellRef saveAndReloadPassword( ScDocShell* pShell, sal_Int32 nFormat 
);
-    ScDocShellRef saveAndReloadNoClose( ScDocShell* pShell, sal_Int32 nFormat 
);
+    ScDocShellRef saveAndReload( ScDocShell& rShell, sal_Int32 nFormat );
+    ScDocShellRef saveAndReloadPassword( ScDocShell& rShell, sal_Int32 nFormat 
);
+    ScDocShellRef saveAndReloadNoClose( ScDocShell& rShell, sal_Int32 nFormat 
);
 
-    std::shared_ptr<utl::TempFile> saveAs(ScDocShell* pShell, sal_Int32 
nFormat);
-    std::shared_ptr<utl::TempFile> exportTo(ScDocShell* pShell, sal_Int32 
nFormat);
+    std::shared_ptr<utl::TempFile> saveAs(ScDocShell& rShell, sal_Int32 
nFormat);
+    std::shared_ptr<utl::TempFile> exportTo(ScDocShell& rShell, sal_Int32 
nFormat);
 
     void miscRowHeightsTest( TestParam const * aTestValues, unsigned int 
numElems );
 };
diff --git a/sc/qa/unit/helper/xpath.cxx b/sc/qa/unit/helper/xpath.cxx
index 39f9b36e9ed0..458147d37248 100644
--- a/sc/qa/unit/helper/xpath.cxx
+++ b/sc/qa/unit/helper/xpath.cxx
@@ -21,7 +21,7 @@
 
 xmlDocUniquePtr XPathHelper::parseExport2(ScBootstrapFixture & rFixture, 
ScDocShell& rShell, uno::Reference<lang::XMultiServiceFactory> const & 
xSFactory, const OUString& rFile, sal_Int32 nFormat)
 {
-    std::shared_ptr<utl::TempFile> pTempFile = rFixture.exportTo(&rShell, 
nFormat);
+    std::shared_ptr<utl::TempFile> pTempFile = rFixture.exportTo(rShell, 
nFormat);
 
     return parseExport(pTempFile, xSFactory, rFile);
 }
diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx
index f17d2801f829..74ad1cffb61a 100644
--- a/sc/qa/unit/jumbosheets-test.cxx
+++ b/sc/qa/unit/jumbosheets-test.cxx
@@ -108,7 +108,7 @@ void 
ScJumboSheetsTest::testRoundtripColumn2000(std::u16string_view name, int fo
         CPPUNIT_ASSERT_EQUAL(-5.0, rDoc.GetValue(0, 0, 0));
     }
 
-    ScDocShellRef xDocSh2 = saveAndReload(&(*xDocSh1), format);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh1, format);
     CPPUNIT_ASSERT(xDocSh2.is());
 
     {
@@ -137,7 +137,7 @@ void ScJumboSheetsTest::testRoundtripColumnRange()
         CPPUNIT_ASSERT_EQUAL(OUString("=SUM(C:C)"), rDoc.GetFormula(1, 0, 0));
     }
 
-    ScDocShellRef xDocSh2 = saveAndReloadNoClose(&(*xDocSh1), FORMAT_ODS);
+    ScDocShellRef xDocSh2 = saveAndReloadNoClose(*xDocSh1, FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh2.is());
 
     {
@@ -157,7 +157,7 @@ void ScJumboSheetsTest::testRoundtripColumnRange()
                     "formula", "of:=SUM([.C:.C])");
     }
 
-    ScDocShellRef xDocSh3 = saveAndReloadNoClose(&(*xDocSh1), FORMAT_XLSX);
+    ScDocShellRef xDocSh3 = saveAndReloadNoClose(*xDocSh1, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh3.is());
 
     {
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 8ad8fbffee81..ef31fcf81282 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -544,7 +544,7 @@ void 
ScPivotTableFiltersTest::testPivotTableSharedDateGroupXLSX()
     ScDocShellRef xDocSh1 = loadDoc(u"pivot-table/shared-dategroup.", 
FORMAT_XLSX);
     testThis(xDocSh1);
     // Now test round-trip of group fields
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh1.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh1, FORMAT_XLSX);
     testThis(xDocSh2);
     xDocSh2->DoClose();
     xDocSh1->DoClose();
@@ -596,7 +596,7 @@ void 
ScPivotTableFiltersTest::testPivotTableSharedNestedDateGroupXLSX()
     ScDocShellRef xDocSh1 = loadDoc(u"pivot-table/shared-nested-dategroup.", 
FORMAT_XLSX);
     testThis(xDocSh1);
     // Now test round-trip of group fields
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh1.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh1, FORMAT_XLSX);
     testThis(xDocSh2);
     xDocSh2->DoClose();
     xDocSh1->DoClose();
@@ -744,8 +744,7 @@ void ScPivotTableFiltersTest::testPivotTableExportXLSX()
     ScDocShellRef xShell = loadDoc(u"tdf89139_pivot_table.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pTable
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotTables/pivotTable1.xml");
     CPPUNIT_ASSERT(pTable);
@@ -764,8 +763,7 @@ void 
ScPivotTableFiltersTest::testPivotTableExportXLSXSingleDataField()
     ScDocShellRef xShell = loadDoc(u"tdf123421_1datafield.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pTable
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotTables/pivotTable1.xml");
     CPPUNIT_ASSERT(pTable);
@@ -788,8 +786,7 @@ void 
ScPivotTableFiltersTest::testPivotTableExportXLSXMultipleDataFields()
     ScDocShellRef xShell = loadDoc(u"tdf123421_2datafields.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pTable
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotTables/pivotTable1.xml");
     CPPUNIT_ASSERT(pTable);
@@ -823,8 +820,7 @@ void ScPivotTableFiltersTest::testPivotCacheExportXLSX()
     ScDocShellRef xShell = 
loadDoc(u"pivot-table/with-strings-integers-and-dates.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pCacheDef = XPathHelper::parseExport(pXPathFile, 
m_xSFactory,
                                                          
"xl/pivotCache/pivotCacheDefinition1.xml");
     CPPUNIT_ASSERT(pCacheDef);
@@ -1191,7 +1187,7 @@ void ScPivotTableFiltersTest::testPivotTableXLSX()
     bool bCheck = aTest.check(*pDoc);
     CPPUNIT_ASSERT_MESSAGE("Initial check failed.", bCheck);
 
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLSX);
     xDocSh->DoClose();
     CPPUNIT_ASSERT(xDocSh2.is());
     pDoc = &xDocSh2->GetDocument();
@@ -1315,7 +1311,7 @@ void 
ScPivotTableFiltersTest::testPivotTableTwoDataFieldsXLSX()
     bool bCheck = aTest.check(*pDoc);
     CPPUNIT_ASSERT_MESSAGE("Initial check failed.", bCheck);
 
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLSX);
     xDocSh->DoClose();
     CPPUNIT_ASSERT(xDocSh2.is());
     pDoc = &xDocSh2->GetDocument();
@@ -1333,7 +1329,7 @@ void ScPivotTableFiltersTest::testPivotTableMedianODS()
     CPPUNIT_ASSERT_MESSAGE("Failed to load test document.", xDocSh.is());
 
     // Export the document and import again for a check
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_ODS);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_ODS);
     xDocSh->DoClose();
 
     // Check sheet
@@ -1400,7 +1396,7 @@ void ScPivotTableFiltersTest::testPivotTableRowHeaderXLS()
     }
 
     // Check also after a reload
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
 
@@ -1444,7 +1440,7 @@ void 
ScPivotTableFiltersTest::testPivotTableDoubleFieldFilter()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -1546,7 +1542,7 @@ void 
ScPivotTableFiltersTest::testPivotTableStringFieldFilter()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -1582,7 +1578,7 @@ void 
ScPivotTableFiltersTest::testPivotTableDateFieldFilter()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -1673,7 +1669,7 @@ void 
ScPivotTableFiltersTest::testPivotTableBoolFieldFilter()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -1709,7 +1705,7 @@ void 
ScPivotTableFiltersTest::testPivotTableRowColPageFieldFilter()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -1819,7 +1815,7 @@ void ScPivotTableFiltersTest::testPivotTableEmptyItem()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -1859,7 +1855,7 @@ void 
ScPivotTableFiltersTest::testPivotTablePageFieldFilter()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -1962,8 +1958,7 @@ void 
ScPivotTableFiltersTest::testPivotTableFirstHeaderRowXLSX()
     ScDocShellRef xShell = loadDoc(u"pivot_table_first_header_row.", 
FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pTable
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotTables/pivotTable1.xml");
     CPPUNIT_ASSERT(pTable);
@@ -1989,7 +1984,7 @@ void 
ScPivotTableFiltersTest::testPivotTableDoubleFieldFilterXLSX()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -2091,7 +2086,7 @@ void 
ScPivotTableFiltersTest::testPivotTableStringFieldFilterXLSX()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -2127,7 +2122,7 @@ void 
ScPivotTableFiltersTest::testPivotTableDateFieldFilterXLSX()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -2203,7 +2198,7 @@ void 
ScPivotTableFiltersTest::testPivotTableBoolFieldFilterXLSX()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -2239,7 +2234,7 @@ void 
ScPivotTableFiltersTest::testPivotTableRowColPageFieldFilterXLSX()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check filtering of row dimensions
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -2347,7 +2342,7 @@ void 
ScPivotTableFiltersTest::testPivotTableErrorItemFilterXLSX()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check whether filtering is preserved
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -2374,8 +2369,7 @@ void 
ScPivotTableFiltersTest::testPivotTableOutlineModeXLSX()
     ScDocShellRef xShell = loadDoc(u"pivottable_outline_mode.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pTable
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotTables/pivotTable1.xml");
     CPPUNIT_ASSERT(pTable);
@@ -2395,8 +2389,7 @@ void 
ScPivotTableFiltersTest::testPivotTableDuplicatedMemberFilterXLSX()
     ScDocShellRef xShell = loadDoc(u"pivottable_duplicated_member_filter.", 
FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pTable
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotTables/pivotTable1.xml");
     CPPUNIT_ASSERT(pTable);
@@ -2415,8 +2408,7 @@ void 
ScPivotTableFiltersTest::testPivotTableTabularModeXLSX()
     ScDocShellRef xShell = loadDoc(u"pivottable_tabular_mode.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pTable
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotTables/pivotTable1.xml");
     CPPUNIT_ASSERT(pTable);
@@ -2437,8 +2429,7 @@ void 
ScPivotTableFiltersTest::testPivotTableDuplicateFields()
     ScDocShellRef xShell = loadDoc(u"caseinsensitive-duplicate-fields.", 
FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pCacheDef = XPathHelper::parseExport(pXPathFile, 
m_xSFactory,
                                                          
"xl/pivotCache/pivotCacheDefinition1.xml");
     CPPUNIT_ASSERT(pCacheDef);
@@ -2467,7 +2458,7 @@ void ScPivotTableFiltersTest::testTdf112106()
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
 
     // Reload and check data layout dim
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     pDPs = rLoadedDoc.GetDPCollection();
@@ -2494,8 +2485,7 @@ void ScPivotTableFiltersTest::testTdf123923()
     ScDocShellRef xShell = loadDoc(u"pivot-table-err-in-cache.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory,
                                                       
"xl/pivotCache/pivotCacheDefinition1.xml");
     CPPUNIT_ASSERT(pTable);
@@ -2511,8 +2501,7 @@ void ScPivotTableFiltersTest::testTdf123939()
     ScDocShellRef xShell = loadDoc(u"pivot-table-str-and-err-in-data.", 
FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory,
                                                       
"xl/pivotCache/pivotCacheDefinition1.xml");
     CPPUNIT_ASSERT(pTable);
@@ -2550,8 +2539,7 @@ void ScPivotTableFiltersTest::testTdf124736()
     ScDocShellRef xDocSh = loadDoc(u"pivot-table/shared-dategroup.", 
FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xDocSh->DoClose();
 
     xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory,
@@ -2604,8 +2592,7 @@ void ScPivotTableFiltersTest::tesTtdf124772NumFmt()
     ScDocShellRef xDocSh = loadDoc(u"pivot-table-num-fmt.", FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xDocSh->DoClose();
 
     xmlDocUniquePtr pTable
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 779d74413122..0e81567e38a7 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -312,7 +312,7 @@ void ScExportTest::test()
 
     rDoc.SetValue(0, 0, 0, 1.0);
 
-    ScDocShellRef xDocSh = saveAndReload(pShell, FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*pShell, FORMAT_ODS);
 
     CPPUNIT_ASSERT(xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
@@ -331,7 +331,7 @@ void ScExportTest::testDefaultFontHeight()
     pPool->SetPoolDefaultItem(SvxFontHeightItem(400, 100, 
ATTR_CJK_FONT_HEIGHT));
     pPool->SetPoolDefaultItem(SvxFontHeightItem(400, 100, 
ATTR_CTL_FONT_HEIGHT));
 
-    xDocSh = saveAndReload(xDocSh.get(), FORMAT_ODS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_ODS);
 
     pPool = xDocSh->GetDocument().GetPool();
     const SvxFontHeightItem& rItem = pPool->GetDefaultItem(ATTR_FONT_HEIGHT);
@@ -349,11 +349,10 @@ void ScExportTest::testTdf139167()
     ScDocShellRef xShell = loadDoc(u"tdf139167.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/styles.xml");
     CPPUNIT_ASSERT(pDoc);
 
@@ -369,11 +368,10 @@ void ScExportTest::testTdf113271()
     ScDocShellRef xShell = loadDoc(u"tdf113271.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/styles.xml");
     CPPUNIT_ASSERT(pDoc);
 
@@ -393,11 +391,10 @@ void ScExportTest::testTdf139394()
     ScDocShellRef xShell = loadDoc(u"tdf139394.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pDoc);
@@ -426,11 +423,10 @@ void ScExportTest::testExtCondFormatXLSX()
     ScDocShellRef xShell = loadDoc(u"tdf139021.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pDoc);
@@ -474,11 +470,10 @@ void ScExportTest::testTdf90104()
     ScDocShellRef xShell = loadDoc(u"tdf90104.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -501,7 +496,7 @@ void ScExportTest::testTdf111876()
     ScDocShellRef xShell = loadDoc(u"tdf111876.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(
@@ -526,7 +521,7 @@ void ScExportTest::testPasswordExportODS()
 
     rDoc.SetValue(0, 0, 0, 1.0);
 
-    ScDocShellRef xDocSh = saveAndReloadPassword(pShell, FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReloadPassword(*pShell, FORMAT_ODS);
 
     CPPUNIT_ASSERT(xDocSh.is());
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
@@ -547,7 +542,7 @@ void ScExportTest::testTdf134332()
 
     ASSERT_DOUBLES_EQUAL(238.0, rDoc.GetValue(ScAddress(0, 10144, 0)));
 
-    ScDocShellRef xDocSh = saveAndReloadPassword(xShell.get(), FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReloadPassword(*xShell, FORMAT_ODS);
 
     // Without the fixes in place, it would have failed here
     CPPUNIT_ASSERT(xDocSh.is());
@@ -564,7 +559,7 @@ void ScExportTest::testConditionalFormatExportODS()
     ScDocShellRef xShell = loadDoc(u"new_cond_format_test_export.", 
FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
     ScDocument& rDoc = xDocSh->GetDocument();
     OUString aCSVPath;
@@ -578,7 +573,7 @@ void ScExportTest::testCondFormatExportCellIs()
 {
     ScDocShellRef xShell = loadDoc(u"condFormat_cellis.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -615,7 +610,7 @@ void ScExportTest::testConditionalFormatExportXLSX()
     ScDocShellRef xShell = loadDoc(u"new_cond_format_test_export.", 
FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
     ScDocument& rDoc = xDocSh->GetDocument();
     {
@@ -637,7 +632,7 @@ void ScExportTest::testTdf99856_dataValidationTest()
     ScDocShellRef xShell = loadDoc(u"tdf99856_dataValidationTest.", 
FORMAT_ODS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load doc", xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -668,8 +663,7 @@ void ScExportTest::testProtectionKeyODS_UTF16LErtlSHA1()
 
     // we can't assume that the user entered the password; check that we
     // round-trip the password as-is
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS);
     xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "content.xml");
     assertXPath(pXmlDoc,
                 "//office:spreadsheet[@table:structure-protected='true' and "
@@ -698,8 +692,7 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA1()
 
     // we can't assume that the user entered the password; check that we
     // round-trip the password as-is
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS);
     xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "content.xml");
     assertXPath(pXmlDoc,
                 "//office:spreadsheet[@table:structure-protected='true' and "
@@ -728,8 +721,7 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA256ODF12()
 
     // we can't assume that the user entered the password; check that we
     // round-trip the password as-is
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS);
     xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "content.xml");
     assertXPath(
         pXmlDoc,
@@ -760,8 +752,7 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA256W3C()
 
     // we can't assume that the user entered the password; check that we
     // round-trip the password as-is
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS);
     xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "content.xml");
     assertXPath(
         pXmlDoc,
@@ -792,8 +783,7 @@ void ScExportTest::testProtectionKeyODS_XL_SHA1()
 
     // we can't assume that the user entered the password; check that we
     // round-trip the password as-is
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS);
     xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "content.xml");
     assertXPath(
         pXmlDoc,
@@ -818,7 +808,7 @@ void ScExportTest::testColorScaleExportODS()
     ScDocShellRef xShell = loadDoc(u"colorscale.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -834,7 +824,7 @@ void ScExportTest::testColorScaleExportXLSX()
     ScDocShellRef xShell = loadDoc(u"colorscale.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -850,7 +840,7 @@ void ScExportTest::testDataBarExportODS()
     ScDocShellRef xShell = loadDoc(u"databar.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -865,7 +855,7 @@ void ScExportTest::testFormatExportODS()
     ScDocShellRef xShell = loadDoc(u"formats.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -881,8 +871,7 @@ void ScExportTest::testCommentExportXLSX()
     ScDocShellRef xShell = loadDoc(u"comment.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pComments
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/comments1.xml");
     CPPUNIT_ASSERT(pComments);
@@ -928,8 +917,7 @@ void ScExportTest::testCommentExportXLSX_2_XLSX()
 
     pNote->ShowCaption(aPosC9, true);
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pComments
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/comments1.xml");
     CPPUNIT_ASSERT(pComments);
@@ -953,8 +941,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
     ScDocShellRef xShell = loadDoc(u"custom_column_width.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1030,8 +1017,7 @@ void ScExportTest::testXfDefaultValuesXLSX()
     ScDocShellRef xShell = loadDoc(u"xf_default_values.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/styles.xml");
     CPPUNIT_ASSERT(pSheet);
 
@@ -1120,7 +1106,7 @@ void ScExportTest::testODF13()
         pBatch->commit();
 
         std::shared_ptr<utl::TempFile> pXPathFile
-            = ScBootstrapFixture::exportTo(&(*pShell), FORMAT_ODS);
+            = ScBootstrapFixture::exportTo(*pShell, FORMAT_ODS);
 
         // check XML
         xmlDocUniquePtr pContentXml
@@ -1148,8 +1134,7 @@ void ScExportTest::testODF13()
         officecfg::Office::Common::Save::ODF::DefaultVersion::set(9, pBatch);
         pBatch->commit();
 
-        std::shared_ptr<utl::TempFile> pXPathFile
-            = ScBootstrapFixture::saveAs(&(*pShell), FORMAT_ODS);
+        std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::saveAs(*pShell, FORMAT_ODS);
         pShell->DoClose();
 
         // check XML
@@ -1178,8 +1163,7 @@ void ScExportTest::testODF13()
         officecfg::Office::Common::Save::ODF::DefaultVersion::set(4, pBatch);
         pBatch->commit();
 
-        std::shared_ptr<utl::TempFile> pXPathFile
-            = ScBootstrapFixture::saveAs(&(*pShell), FORMAT_ODS);
+        std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::saveAs(*pShell, FORMAT_ODS);
         pShell->DoClose();
 
         // check XML
@@ -1211,8 +1195,7 @@ void ScExportTest::testColumnWidthResaveXLSX()
     ScDocShellRef xShell = loadDoc(u"different-column-width-excel2010.", 
FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1283,7 +1266,7 @@ void ScExportTest::testColumnWidthExportFromODStoXLSX()
     // Export to .xlsx and compare column width with the .ods
     // We expect that column width from .ods will be exactly the same as 
imported from .xlsx
 
-    ScDocShellRef xXlsxDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xXlsxDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xXlsxDocSh.is());
 
     ScDocument& rDoc = xXlsxDocSh->GetDocument();
@@ -1320,8 +1303,7 @@ void ScExportTest::testOutlineExportXLSX()
     ScDocShellRef xShell = loadDoc(u"outline.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1470,7 +1452,7 @@ void ScExportTest::testAllRowsHiddenXLSX()
     CPPUNIT_ASSERT(xOrigDocSh.is());
 
     std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xOrigDocSh), FORMAT_XLSX);
+        = ScBootstrapFixture::exportTo(*xOrigDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1486,8 +1468,7 @@ void ScExportTest::testHiddenEmptyRowsXLSX()
     ScDocShellRef xShell = loadDoc(u"hidden-empty-rows.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1507,8 +1488,7 @@ void ScExportTest::testHiddenEmptyColsODS()
     ScDocShellRef xShell = loadDoc(u"tdf128895_emptyHiddenCols.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS);
     xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"content.xml");
     CPPUNIT_ASSERT(pSheet);
     assertXPath(pSheet, "//table:table/table:table-column[2]");
@@ -1523,8 +1503,7 @@ void ScExportTest::testLandscapeOrientationXLSX()
     ScDocShellRef xShell = loadDoc(u"hidden-empty-rows.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1541,7 +1520,7 @@ void ScExportTest::testDataBarExportXLSX()
     ScDocShellRef xShell = loadDoc(u"databar.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -1691,7 +1670,7 @@ void ScExportTest::testNamedRangeBugfdo62729()
     rDoc.DeleteTab(0);
     //should be still a single named range
     CPPUNIT_ASSERT_EQUAL(size_t(1), pNames->size());
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_ODS);
     xShell->DoClose();
 
     CPPUNIT_ASSERT(xDocSh.is());
@@ -1708,7 +1687,7 @@ void ScExportTest::testBuiltinRangesXLSX()
 {
     ScDocShellRef xShell = loadDoc(u"built-in_ranges.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
     xShell->DoClose();
 
@@ -2121,7 +2100,7 @@ void ScExportTest::testRichTextExportODS()
     }
 
     // Now, save and reload this document.
-    ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh.get(), FORMAT_ODS);
+    ScDocShellRef xNewDocSh = saveAndReload(*xOrigDocSh, FORMAT_ODS);
     {
         xOrigDocSh->DoClose();
         CPPUNIT_ASSERT(xNewDocSh.is());
@@ -2142,7 +2121,7 @@ void ScExportTest::testRichTextExportODS()
     }
 
     // Reload the doc again, and check the content of B2 and B4.
-    ScDocShellRef xNewDocSh2 = saveAndReload(xNewDocSh.get(), FORMAT_ODS);
+    ScDocShellRef xNewDocSh2 = saveAndReload(*xNewDocSh, FORMAT_ODS);
     {
         ScDocument& rDoc3 = xNewDocSh2->GetDocument();
         ScFieldEditEngine* pEE = &rDoc3.GetEditEngine();
@@ -2209,7 +2188,7 @@ void ScExportTest::testRichTextExportODS()
     }
 
     // Reload the doc again, and check the content of B2, B4, B6 and B7.
-    ScDocShellRef xNewDocSh3 = saveAndReload(xNewDocSh2.get(), FORMAT_ODS);
+    ScDocShellRef xNewDocSh3 = saveAndReload(*xNewDocSh2, FORMAT_ODS);
     ScDocument& rDoc4 = xNewDocSh3->GetDocument();
     xNewDocSh2->DoClose();
 
@@ -2243,8 +2222,7 @@ void ScExportTest::testRichTextCellFormatXLSX()
     ScDocShellRef xDocSh = loadDoc(u"cellformat.", FORMAT_XLS);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -2285,7 +2263,7 @@ void ScExportTest::testFormulaRefSheetNameODS()
         ASSERT_FORMULA_EQUAL(rDoc, ScAddress(1, 1, 0), "'90''s Data'.B2", 
"Wrong formula");
     }
     // Now, save and reload this document.
-    ScDocShellRef xNewDocSh = saveAndReload(xDocSh.get(), FORMAT_ODS);
+    ScDocShellRef xNewDocSh = saveAndReload(*xDocSh, FORMAT_ODS);
     xDocSh->DoClose();
 
     ScDocument& rDoc = xNewDocSh->GetDocument();
@@ -2328,7 +2306,7 @@ void ScExportTest::testCellValuesExportODS()
         rDoc.SetString(ScAddress(0, 7, 0), "=$A$6"); //A8
     }
     // save and reload
-    ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh.get(), FORMAT_ODS);
+    ScDocShellRef xNewDocSh = saveAndReload(*xOrigDocSh, FORMAT_ODS);
     xOrigDocSh->DoClose();
     CPPUNIT_ASSERT(xNewDocSh.is());
     ScDocument& rDoc = xNewDocSh->GetDocument();
@@ -2385,7 +2363,7 @@ void ScExportTest::testCellNoteExportODS()
         CPPUNIT_ASSERT_MESSAGE("There should be a note at A2.", 
rDoc.HasNote(aPos));
     }
     // save and reload
-    ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh.get(), FORMAT_ODS);
+    ScDocShellRef xNewDocSh = saveAndReload(*xOrigDocSh, FORMAT_ODS);
     xOrigDocSh->DoClose();
     CPPUNIT_ASSERT(xNewDocSh.is());
     ScDocument& rDoc = xNewDocSh->GetDocument();
@@ -2421,7 +2399,7 @@ void ScExportTest::testCellNoteExportXLS()
         CPPUNIT_ASSERT(rDoc.HasNote(ScAddress(0, 2, 2)));
     }
     // save and reload as XLS.
-    ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh.get(), FORMAT_XLS);
+    ScDocShellRef xNewDocSh = saveAndReload(*xOrigDocSh, FORMAT_XLS);
     {
         xOrigDocSh->DoClose();
         CPPUNIT_ASSERT(xNewDocSh.is());
@@ -2476,7 +2454,7 @@ void ScExportTest::testInlineArrayXLS()
     ScDocShellRef xShell = loadDoc(u"inline-array.", FORMAT_XLS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLS);
     xShell->DoClose();
     CPPUNIT_ASSERT(xDocSh.is());
 
@@ -2499,8 +2477,7 @@ void ScExportTest::testEmbeddedChartODS()
     ScDocShellRef xShell = loadDoc(u"embedded-chart.", FORMAT_XLS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pTempFile(
-        ScBootstrapFixture::exportTo(xShell.get(), FORMAT_ODS));
+    std::shared_ptr<utl::TempFile> 
pTempFile(ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS));
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport(pTempFile, m_xSFactory, 
"content.xml");
     CPPUNIT_ASSERT(pDoc);
@@ -2518,7 +2495,7 @@ void ScExportTest::testEmbeddedChartXLS()
     ScDocShellRef xShell = loadDoc(u"embedded-chart.", FORMAT_XLS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLS);
     xShell->DoClose();
     CPPUNIT_ASSERT(xDocSh.is());
 
@@ -2547,7 +2524,7 @@ void ScExportTest::testCellAnchoredGroupXLS()
     ScDocShellRef xDocSh_in = loadDoc(u"cell-anchored-group.", FORMAT_XLS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load cell-anchored-group.xls", 
xDocSh_in.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xDocSh_in), FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*xDocSh_in, FORMAT_ODS);
     CPPUNIT_ASSERT_MESSAGE("Failed to save and reload 
cell-anchored-group.ods", xDocSh.is());
 
     // the document contains a group anchored on the first cell, make sure 
it's there in the right place
@@ -2573,7 +2550,7 @@ void ScExportTest::testFormulaReferenceXLS()
     ScDocShellRef xShell = loadDoc(u"formula-reference.", FORMAT_XLS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLS);
     xShell->DoClose();
     CPPUNIT_ASSERT(xDocSh.is());
 
@@ -2598,7 +2575,7 @@ void ScExportTest::testSheetProtectionXLSX()
     ScDocShellRef xShell = loadDoc(u"ProtecteSheet1234Pass.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -2622,7 +2599,7 @@ void ScExportTest::testSheetProtectionXLSB()
     ScDocShellRef xShell = loadDoc(u"tdf108017_calcProtection.", FORMAT_XLSB);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -2699,7 +2676,7 @@ void ScExportTest::testExcelCellBorders(sal_uLong 
nFormatType)
         }
     }
 
-    ScDocShellRef xNewDocSh = saveAndReload(xDocSh.get(), nFormatType);
+    ScDocShellRef xNewDocSh = saveAndReload(*xDocSh, nFormatType);
     xDocSh->DoClose();
     ScDocument& rDoc = xNewDocSh->GetDocument();
     for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
@@ -2895,7 +2872,7 @@ void ScExportTest::testBordersExchangeXLSX()
     CPPUNIT_ASSERT(xShell.is());
 
     ScDocShellRef xDocSh
-        = saveAndReload(&(*xShell), FORMAT_XLSX); // save the ods to xlsx and 
load xlsx
+        = saveAndReload(*xShell, FORMAT_XLSX); // save the ods to xlsx and 
load xlsx
     CPPUNIT_ASSERT(xDocSh.is());
     ScDocument& rDoc = xDocSh->GetDocument();
 
@@ -3147,7 +3124,7 @@ void ScExportTest::testTrackChangesSimpleXLSX()
     bool bGood = aTest.check(*pDoc);
     CPPUNIT_ASSERT_MESSAGE("Initial check failed (xls).", bGood);
 
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLS);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLS);
     xDocSh->DoClose();
     pDoc = &xDocSh2->GetDocument();
     bGood = aTest.check(*pDoc);
@@ -3174,7 +3151,7 @@ void ScExportTest::testTrackChangesSimpleXLSX()
     aTest.check(*pDoc);
     CPPUNIT_ASSERT_MESSAGE("Initial check failed (xlsx).", bGood);
 
-    xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLSX);
     xDocSh->DoClose();
     pDoc = &xDocSh2->GetDocument();
     bGood = aTest.check(*pDoc);
@@ -3242,7 +3219,7 @@ void ScExportTest::testSheetTabColorsXLSX()
         CPPUNIT_ASSERT_MESSAGE("Failed on the initial content check.", bRes);
     }
 
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to reload file.", xDocSh2.is());
     xDocSh->DoClose();
     ScDocument& rDoc = xDocSh2->GetDocument();
@@ -3257,8 +3234,7 @@ void ScExportTest::testTdf133487()
     ScDocShellRef xShell = loadDoc(u"shapes_foreground_background.", 
FORMAT_FODS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS);
     xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "content.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
@@ -3408,7 +3384,7 @@ void ScExportTest::testSharedFormulaExportXLS()
         CPPUNIT_ASSERT_MESSAGE("Content check on the original document 
failed.", bRes);
     }
 
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLS);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLS);
     xDocSh->DoClose();
     CPPUNIT_ASSERT_MESSAGE("Failed to reload file.", xDocSh2.is());
 
@@ -3508,7 +3484,7 @@ void ScExportTest::testSharedFormulaExportXLSX()
     }
 
     // Save and reload, and check the content again.
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLSX);
     xDocSh->DoClose();
 
     CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh2.is());
@@ -3581,7 +3557,7 @@ void 
ScExportTest::testSharedFormulaStringResultExportXLSX()
         CPPUNIT_ASSERT_MESSAGE("Content check on the initial recalculated 
document failed.", bRes);
     }
     // Reload and check again.
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLSX);
     xDocSh->DoClose();
     CPPUNIT_ASSERT_MESSAGE("Failed to re-load file.", xDocSh2.is());
     ScDocument& rDoc = xDocSh2->GetDocument();
@@ -3597,7 +3573,7 @@ void ScExportTest::testFunctionsExcel2010(sal_uLong 
nFormatType)
     ScDocShellRef xShell = loadDoc(u"functions-excel-2010.", FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), nFormatType);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, nFormatType);
     ScDocument& rDoc = xDocSh->GetDocument();
     rDoc.CalcAll(); // perform hard re-calculation.
 
@@ -3615,7 +3591,7 @@ void ScExportTest::testCeilingFloor(sal_uLong nFormatType)
     ScDocShellRef xShell = loadDoc(u"ceiling-floor.", FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), nFormatType);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, nFormatType);
     ScDocument& rDoc = xDocSh->GetDocument();
     rDoc.CalcAll(); // perform hard re-calculation.
 
@@ -3632,8 +3608,7 @@ void ScExportTest::testCeilingFloorODSToXLSX()
     ScDocShellRef xShell = loadDoc(u"ceiling-floor.", FORMAT_ODS);
     CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/workbook.xml");
     CPPUNIT_ASSERT(pSheet);
 
@@ -3653,8 +3628,7 @@ void ScExportTest::testCustomXml()
     ScDocShellRef xShell = loadDoc(u"customxml.", FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pXmlDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"customXml/item1.xml");
     CPPUNIT_ASSERT(pXmlDoc);
@@ -3690,7 +3664,7 @@ void ScExportTest::testRelativePathsODS()
     ScDocShellRef xDocSh = loadDoc(u"fdo79305.", FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pTempFile = exportTo(xDocSh.get(), 
FORMAT_ODS);
+    std::shared_ptr<utl::TempFile> pTempFile = exportTo(*xDocSh, FORMAT_ODS);
     xmlDocUniquePtr pDoc = XPathHelper::parseExport(pTempFile, m_xSFactory, 
"content.xml");
     CPPUNIT_ASSERT(pDoc);
     OUString aURL = getXPath(pDoc,
@@ -3739,7 +3713,7 @@ void ScExportTest::testSheetProtectionODS()
         testSheetProtection_Impl(rDoc);
     }
 
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_ODS);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_ODS);
     {
         ScDocument& rDoc = xDocSh2->GetDocument();
         testSheetProtection_Impl(rDoc);
@@ -3778,7 +3752,7 @@ void ScExportTest::testSwappedOutImageExport()
         CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDocSh.is());
 
         // Export the document and import again for a check
-        ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), nFilter);
+        ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, nFilter);
         xDocSh->DoClose();
 
         // Check whether graphic exported well after it was swapped out
@@ -3858,7 +3832,7 @@ void ScExportTest::testSupBookVirtualPathXLS()
     ScDocShellRef xShell = loadDoc(u"external-ref.", FORMAT_XLS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLS);
     xShell->DoClose();
     CPPUNIT_ASSERT(xDocSh.is());
 
@@ -3903,7 +3877,7 @@ void ScExportTest::testLinkedGraphicRT()
             = OString::Concat("Failed on filter: ") + aFilterNames[nFilter];
 
         // Export the document and import again for a check
-        ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), nFilter);
+        ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, nFilter);
         xDocSh->DoClose();
 
         // Check whether graphic imported well after export
@@ -3950,7 +3924,7 @@ void ScExportTest::testImageWithSpecialID()
         CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDocSh.is());
 
         // Export the document and import again for a check
-        ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), nFilter);
+        ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, nFilter);
         xDocSh->DoClose();
 
         // Check whether graphic was exported well
@@ -4007,7 +3981,7 @@ void ScExportTest::testAbsNamedRangeHTML()
 {
     ScDocShellRef xDocSh = loadDoc(u"numberformat.", FORMAT_HTML);
     xDocSh->DoHardRecalc();
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_ODS);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_ODS);
     xDocSh->DoClose();
     xDocSh2->DoHardRecalc();
 
@@ -4024,7 +3998,7 @@ void ScExportTest::testTdf80149()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf80149.", FORMAT_CSV);
     xDocSh->DoHardRecalc();
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLSX);
     xDocSh->DoClose();
     xDocSh2->DoHardRecalc();
 
@@ -4051,7 +4025,7 @@ void ScExportTest::testSheetLocalRangeNameXLS()
 {
     ScDocShellRef xDocSh = loadDoc(u"named-ranges-local.", FORMAT_XLS);
     xDocSh->DoHardRecalc();
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLS);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLS);
     xDocSh->DoClose();
     xDocSh2->DoHardRecalc();
 
@@ -4074,7 +4048,7 @@ void ScExportTest::testRelativeNamedExpressionsXLS()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf113991_relativeNamedRanges.", 
FORMAT_ODS);
     xDocSh->DoHardRecalc();
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLS);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLS);
     xDocSh->DoClose();
     xDocSh2->DoHardRecalc();
     ScDocument& rDoc = xDocSh2->GetDocument();
@@ -4103,7 +4077,7 @@ void ScExportTest::testSheetTextBoxHyperlinkXLSX()
     ScDocShellRef xShell = loadDoc(u"textbox-hyperlink.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
@@ -4139,7 +4113,7 @@ void ScExportTest::testSheetCharacterKerningSpaceXLSX()
     ScDocShellRef xShell = loadDoc(u"textbox-CharKerningSpace.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
@@ -4161,7 +4135,7 @@ void ScExportTest::testSheetCondensedCharacterSpaceXLSX()
     ScDocShellRef xShell = loadDoc(u"textbox-CondensedCharacterSpace.", 
FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
@@ -4217,7 +4191,7 @@ void ScExportTest::testSheetRunParagraphPropertyXLSX()
     ScDocShellRef xShell = loadDoc(u"TextColor.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
@@ -4233,7 +4207,7 @@ void ScExportTest::testSheetRunParagraphPropertyXLSX()
 void ScExportTest::testPreserveTextWhitespaceXLSX()
 {
     ScDocShellRef xShell = loadDoc(u"preserve-whitespace.", FORMAT_XLSX);
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
@@ -4246,7 +4220,7 @@ void ScExportTest::testPreserveTextWhitespaceXLSX()
 void ScExportTest::testPreserveTextWhitespace2XLSX()
 {
     ScDocShellRef xShell = loadDoc(u"preserve_space.", FORMAT_XLSX);
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
@@ -4396,7 +4370,7 @@ void ScExportTest::testMoveCellAnchoredShapesODS()
     aNDataEnd = pNData->maEnd;
 
     // Save the document and load again to check anchor persist
-    ScDocShellRef xDocSh1 = saveAndReload(&(*xDocSh), FORMAT_ODS);
+    ScDocShellRef xDocSh1 = saveAndReload(*xDocSh, FORMAT_ODS);
 
     // There are two cell-anchored objects on the first sheet.
     ScDocument& rDoc1 = xDocSh1->GetDocument();
@@ -4461,7 +4435,7 @@ void ScExportTest::testMoveCellAnchoredShapesODS()
     aNDataEnd = pNData->maEnd;
 
     // Save the document and load again to check anchor persist
-    ScDocShellRef xDocSh2 = saveAndReload(&(*xDocSh1), FORMAT_ODS);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh1, FORMAT_ODS);
 
     // There are two cell-anchored objects on the first sheet.
     ScDocument& rDoc2 = xDocSh2->GetDocument();
@@ -4591,7 +4565,7 @@ void ScExportTest::testTdf113646()
     ScDocShellRef xShell = loadDoc(u"tdf113646.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    auto pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/styles.xml");
     CPPUNIT_ASSERT(pSheet);
 
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 6c9dcd240765..be3382af0ce6 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -343,7 +343,7 @@ void ScExportTest2::testMatrixMultiplicationXLSX()
     ScDocShellRef xShell = loadDoc(u"matrix-multiplication.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
@@ -369,7 +369,7 @@ void ScExportTest2::testRefStringXLSX()
     CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
 
     //make sure ref syntax gets saved for MSO-produced docs
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -385,7 +385,7 @@ void ScExportTest2::testRefStringConfigXLSX()
     ScDocShellRef xDocSh = loadDoc(u"empty.", FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
 
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -411,7 +411,7 @@ void ScExportTest2::testRefStringConfigXLSX()
     aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_XL_R1C1;
     rDoc2.SetCalcConfig(aConfig);
 
-    ScDocShellRef xNewDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    ScDocShellRef xNewDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to reload 2nd doc", xNewDocSh.is());
 
     // ... and make sure it got saved
@@ -441,7 +441,7 @@ void ScExportTest2::testRefStringUnspecified()
     // change formula syntax (i.e. not string ref syntax) to ExcelA1
     rDoc.SetGrammar(formula::FormulaGrammar::GRAM_NATIVE_XL_A1);
 
-    ScDocShellRef xDocSh = saveAndReload(pShell, FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*pShell, FORMAT_ODS);
     CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.is());
 
     // with string ref syntax at its default value, we should've saved ExcelA1
@@ -458,7 +458,7 @@ void ScExportTest2::testHeaderImageODS()
 {
     // Graphic as header background was lost on export.
     ScDocShellRef xShell = loadDoc(u"header-image.", FORMAT_ODS);
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_ODS);
     uno::Reference<style::XStyleFamiliesSupplier> 
xStyleFamiliesSupplier(xDocSh->GetModel(),
                                                                          
uno::UNO_QUERY);
     uno::Reference<container::XNameAccess> xStyleFamilies
@@ -476,7 +476,7 @@ void ScExportTest2::testHeaderImageODS()
 void ScExportTest2::testHeaderFooterContentODS()
 {
     ScDocShellRef xShell = loadDoc(u"header-footer-content.", FORMAT_ODS);
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_ODS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_ODS);
     uno::Reference<style::XStyleFamiliesSupplier> 
xStyleFamiliesSupplier(xDocSh->GetModel(),
                                                                          
uno::UNO_QUERY);
     uno::Reference<container::XNameAccess> xStyleFamilies
@@ -675,7 +675,7 @@ xmlDocUniquePtr 
ScExportTest2::testTdf95640(std::u16string_view rFileName, sal_I
     ScDocShellRef xShell = loadDoc(rFileName, nSourceFormat);
     CPPUNIT_ASSERT(xShell);
 
-    auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), nDestFormat);
+    auto pXPathFile = ScBootstrapFixture::exportTo(*xShell, nDestFormat);
     xShell->DoClose();
 
     return XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -808,7 +808,7 @@ void ScExportTest2::testAutofilterColorsOOXML()
         ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_XLSX);
         CPPUNIT_ASSERT(xDocSh.is());
         std::shared_ptr<utl::TempFile> pXPathFile
-            = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+            = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
         xmlDocUniquePtr pTable1
             = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/tables/table1.xml");
         CPPUNIT_ASSERT(pTable1);
@@ -830,7 +830,7 @@ void ScExportTest2::testAutofilterColorsOOXML()
         ScDocShellRef xDocSh = loadDoc(u"autofilter-colors-fg.", FORMAT_XLSX);
         CPPUNIT_ASSERT(xDocSh.is());
         std::shared_ptr<utl::TempFile> pXPathFile
-            = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+            = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
         xmlDocUniquePtr pTable1
             = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/tables/table1.xml");
         CPPUNIT_ASSERT(pTable1);
@@ -911,7 +911,7 @@ void ScExportTest2::testEscapeCharInNumberFormatXLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf81939.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc
@@ -944,7 +944,7 @@ void ScExportTest2::testNatNumInNumberFormatXLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf79398_NatNum5.", FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX); // Convert [NatNum5] to 
[DBNum2] in Chinese
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX); // Convert [NatNum5] to 
[DBNum2] in Chinese
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc
@@ -961,10 +961,10 @@ void ScExportTest2::testExponentWithoutSignFormatXLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf102370_ExponentWithoutSign.", 
FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_ODS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
 
     ScDocument& rDoc = xDocSh->GetDocument();
@@ -982,7 +982,7 @@ void ScExportTest2::testExtendedLCIDXLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf36038_ExtendedLCID.", FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc
@@ -1043,7 +1043,7 @@ void ScExportTest2::testHiddenRepeatedRowsODS()
         rDoc.SetRowHidden(0, 20, 0, true);
     }
 
-    xDocSh = saveAndReload(&(*xDocSh), FORMAT_ODS);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_ODS);
     ScDocument& rDoc = xDocSh->GetDocument();
     SCROW nFirstRow = 0;
     SCROW nLastRow = 0;
@@ -1089,7 +1089,7 @@ void ScExportTest2::testOpenDocumentAsReadOnly()
 {
     ScDocShellRef xDocSh = loadDoc(u"open-as-read-only.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh->IsSecurityOptOpenReadOnly());
-    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh2 = saveAndReload(*xDocSh, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh2->IsSecurityOptOpenReadOnly());
     xDocSh->DoClose();
     xDocSh2->DoClose();
@@ -1100,8 +1100,7 @@ void ScExportTest2::testKeepSettingsOfBlankRows()
     ScDocShellRef xDocSh = loadDoc(u"tdf41425.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1117,8 +1116,7 @@ void ScExportTest2::testTdf133595()
     ScDocShellRef xDocSh = loadDoc(u"tdf133595.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1134,8 +1132,7 @@ void ScExportTest2::testTdf134769()
     ScDocShellRef xDocSh = loadDoc(u"tdf134769.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1158,8 +1155,7 @@ void ScExportTest2::testTdf106181()
     ScDocShellRef xDocSh = loadDoc(u"tdf106181.", FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pSheet);
@@ -1197,7 +1193,7 @@ void ScExportTest2::testTdf145057()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf145057.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
-    xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
                                                      "xl/tables/table1.xml", 
FORMAT_XLSX);
@@ -1210,7 +1206,7 @@ void ScExportTest2::testTdf105272()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf105272.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
-    xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     ScDocument& rDoc = xDocSh->GetDocument();
     //without the fix in place,it would fail
     //Expected: Table1[[#This Row],[Total]]/Table1[[#This Row],['# Athletes]]
@@ -1225,7 +1221,7 @@ void ScExportTest2::testTdf118990()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf118990.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
-    xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
     ScDocument& rDoc = xDocSh->GetDocument();
 
     // TODO: also test A1, which contains a UNC reference to 
\\localhost\share\lookupsource.xlsx,
@@ -1248,7 +1244,7 @@ void ScExportTest2::testTdf121612()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf121612.", FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
-    xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
 
     ScDocument& rDoc = xDocSh->GetDocument();
 
@@ -1301,7 +1297,7 @@ void ScExportTest2::testPivotCacheAfterExportXLSX()
     CPPUNIT_ASSERT(xDocSh.is());
 
     // export only
-    std::shared_ptr<utl::TempFile> pTemp = saveAs(xDocSh.get(), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pTemp = saveAs(*xDocSh, FORMAT_XLSX);
 
     ScDocument& rDoc = xDocSh->GetDocument();
     CPPUNIT_ASSERT(rDoc.HasPivotTable());
@@ -1360,7 +1356,7 @@ void ScExportTest2::testTdf142764()
     ScDocShellRef xShell = loadDoc(u"tdf142764.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell);
 
-    auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    auto pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
 
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -1376,8 +1372,7 @@ void ScExportTest2::testTdf91634XLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"image_hyperlink.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
@@ -1421,8 +1416,7 @@ void ScExportTest2::testValidationCopyPaste()
     rDestDoc.CopyFromClip(aDstRange, aMark2, InsertDeleteFlags::ALL, nullptr, 
&aClipDoc);
 
     // save as XLSX
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*pShell2), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*pShell2, FORMAT_XLSX);
 
     // check validation
     xmlDocUniquePtr pDoc
@@ -1435,7 +1429,7 @@ void ScExportTest2::testTdf115159()
 {
     ScDocShellRef xShell = loadDoc(u"tdf115159.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
     xShell->DoClose();
 
@@ -1463,7 +1457,7 @@ void ScExportTest2::testTdf112567()
 
     ScDocShellRef xShell = loadDoc(u"tdf112567.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
     xShell->DoClose();
 
@@ -1495,7 +1489,7 @@ void ScExportTest2::testTdf122191()
     ScDocument& rDoc = xShell->GetDocument();
     CPPUNIT_ASSERT_EQUAL(OUString("IGAZ"), rDoc.GetString(0, 0, 0));
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
     xShell->DoClose();
 
@@ -1513,8 +1507,7 @@ void ScExportTest2::testTdf142881()
     ScDocShellRef xDocSh = loadDoc(u"tdf142881.", FORMAT_XLSX);
     CPPUNIT_ASSERT_MESSAGE("Failed to load tdf142881.xlsx", xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pDrawing1
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
     CPPUNIT_ASSERT(pDrawing1);
@@ -1557,7 +1550,7 @@ void ScExportTest2::testTdf112567b()
 
     ScDocShellRef xShell = loadDoc(u"tdf112567.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
     xShell->DoClose();
 
@@ -1579,8 +1572,7 @@ void ScExportTest2::testTdf123645XLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"chart_hyperlink.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
@@ -1621,8 +1613,7 @@ void ScExportTest2::testTdf125173XLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"text_box_hyperlink.", FORMAT_ODS);
     CPPUNIT_ASSERT(xDocSh.is());
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
@@ -1644,8 +1635,7 @@ void ScExportTest2::testTdf79972XLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf79972.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -1666,8 +1656,7 @@ void ScExportTest2::testTdf126024XLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"hyperlink_formula.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -1688,8 +1677,7 @@ void ScExportTest2::testTdf126177XLSX()
 {
     ScDocShellRef xDocSh = loadDoc(u"hyperlink_export.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -1712,8 +1700,7 @@ void ScExportTest2::testCommentTextVAlignment()
     ScDocShellRef xShell = loadDoc(u"CommentTextVAlign.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
 
     xmlDocUniquePtr pVmlDrawing
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/vmlDrawing1.vml");
@@ -1730,8 +1717,7 @@ void ScExportTest2::testCommentTextHAlignment()
     ScDocShellRef xShell = loadDoc(u"CommentTextHAlign.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
 
     xmlDocUniquePtr pVmlDrawing
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/vmlDrawing1.vml");
@@ -1753,7 +1739,7 @@ void ScExportTest2::testRotatedImageODS()
     ScDocShellRef xDocSh = loadDoc(u"tdf103092_RotatedImage.", FORMAT_ODS, 
true);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pTemp = saveAs(xDocSh.get(), FORMAT_ODS);
+    std::shared_ptr<utl::TempFile> pTemp = saveAs(*xDocSh, FORMAT_ODS);
     CPPUNIT_ASSERT(pTemp);
     xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pTemp, m_xSFactory, 
"content.xml");
     CPPUNIT_ASSERT(pXmlDoc);
@@ -1779,7 +1765,7 @@ void ScExportTest2::testTdf128976()
     ScDocShellRef xShell = loadDoc(u"tdf128976.", FORMAT_XLS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLS);
     xShell->DoClose();
     CPPUNIT_ASSERT(xDocSh.is());
 
@@ -1834,7 +1820,7 @@ void ScExportTest2::testTdf143979()
 
     CPPUNIT_ASSERT_EQUAL(OUString("2021-08Aug-30Mon"), 
rDoc.GetString(ScAddress(0, 0, 0)));
 
-    ScDocShellRef pDocSh = saveAndReload(&(*xShell), FORMAT_ODS);
+    ScDocShellRef pDocSh = saveAndReload(*xShell, FORMAT_ODS);
     CPPUNIT_ASSERT(pDocSh.is());
 
     ScDocument& rDoc2 = pDocSh->GetDocument();
@@ -1872,8 +1858,7 @@ void ScExportTest2::testTdf120502()
     const auto nOldWidth = rDoc.GetColWidth(nMaxCol, 0);
     rDoc.SetColWidth(nMaxCol, 0, nOldWidth + 100);
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xShell->DoClose();
     xmlDocUniquePtr pSheet1
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -1888,7 +1873,7 @@ void ScExportTest2::testTdf131372()
     ScDocShellRef xShell = loadDoc(u"tdf131372.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell);
 
-    auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    auto pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
 
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -1905,7 +1890,7 @@ void ScExportTest2::testTdf81470()
     CPPUNIT_ASSERT(xShell);
 
     //without the fix in place, it would have crashed at export time
-    auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    auto pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
 
     //also check revisions are exported
     xmlDocUniquePtr pHeaders
@@ -1927,7 +1912,7 @@ void ScExportTest2::testTdf122331()
     ScDocShellRef xShell = loadDoc(u"tdf122331.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell);
 
-    auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    auto pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
 
     xmlDocUniquePtr pSheet
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -1946,7 +1931,7 @@ void ScExportTest2::testTdf83779()
     ScDocShellRef xShell = loadDoc(u"tdf83779.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell);
 
-    auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    auto pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
 
     xmlDocUniquePtr pVmlDrawing
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -1964,8 +1949,7 @@ void 
ScExportTest2::testTdf121715_FirstPageHeaderFooterXLSX()
     ScDocShellRef xShell = loadDoc(u"tdf121715.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pDoc);
@@ -1986,11 +1970,10 @@ void 
ScExportTest2::testTdf121716_ExportEvenHeaderFooterXLSX()
     ScDocShellRef xShell = loadDoc(u"tdf121716_EvenHeaderFooter.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pDoc);
@@ -2021,7 +2004,7 @@ void ScExportTest2::testTdf134459_HeaderFooterColorXLSX()
     ScDocShellRef xShell = loadDoc(u"tdf134459_HeaderFooterColor.", 
FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
@@ -2042,7 +2025,7 @@ void 
ScExportTest2::testTdf134817_HeaderFooterTextWith2SectionXLSX()
     ScDocShellRef xShell = loadDoc(u"tdf134817_HeaderFooterTextWith2Section.", 
FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
     xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
@@ -2063,11 +2046,10 @@ void 
ScExportTest2::testTdf121718_UseFirstPageNumberXLSX()
     ScDocShellRef xShell = loadDoc(u"tdf121718_UseFirstPageNumber.", 
FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pDoc);
@@ -2127,11 +2109,10 @@ void ScExportTest2::testTdf135828_Shape_Rect()
     ScDocShellRef xShell = loadDoc(u"tdf135828_Shape_Rect.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDrawing
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
@@ -2219,11 +2200,10 @@ void ScExportTest2::testTdf123353()
     ScDocShellRef xShell = loadDoc(u"tdf123353.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -2239,11 +2219,10 @@ void ScExportTest2::testTdf140098()
     ScDocShellRef xShell = loadDoc(u"tdf140098.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
@@ -2260,8 +2239,7 @@ void ScExportTest2::testTdf133688_precedents()
     ScDocShellRef xShell = loadDoc(u"tdf133688_dont_save_precedents_to_xlsx.", 
FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pDrawing
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
     CPPUNIT_ASSERT(pDrawing);
@@ -2277,11 +2255,10 @@ void 
ScExportTest2::testTdf91251_missingOverflowRoundtrip()
     ScDocShellRef xShell = loadDoc(u"tdf91251_missingOverflowRoundtrip.", 
FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
 
     xmlDocUniquePtr pDrawing
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
@@ -2302,8 +2279,7 @@ void ScExportTest2::testTdf137000_handle_upright()
     ScDocShellRef xShell = loadDoc(u"tdf137000_export_upright.", FORMAT_XLSX);
     CPPUNIT_ASSERT(xShell.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
     xmlDocUniquePtr pDrawing
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
     CPPUNIT_ASSERT(pDrawing);
@@ -2317,11 +2293,10 @@ void 
ScExportTest2::testTdf126305_DataValidatyErrorAlert()
     ScDocShellRef xShell = loadDoc(u"tdf126305.", FORMAT_ODS);
     CPPUNIT_ASSERT(xShell.is());
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pDoc
         = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
     CPPUNIT_ASSERT(pDoc);
@@ -2396,7 +2371,7 @@ void ScExportTest2::testTdf87973_externalLinkSkipUnuseds()
     rDoc.SetFormula(ScAddress(3, 2, 0), aFormula, 
formula::FormulaGrammar::GRAM_NATIVE_UI);
 
     // save and load back
-    ScDocShellRef pDocSh = saveAndReload(&(*pShell), FORMAT_XLSX);
+    ScDocShellRef pDocSh = saveAndReload(*pShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(pDocSh.is());
 
     // check if the new filename is present in the link (and not replaced by 
'[2]')
@@ -2426,7 +2401,7 @@ void ScExportTest2::testTdf51022_lostPrintRange()
     rDoc.AddPrintRange(0, aRange2);
 
     // save and load back
-    ScDocShellRef pDocSh = saveAndReload(&(*pShell), FORMAT_ODS);
+    ScDocShellRef pDocSh = saveAndReload(*pShell, FORMAT_ODS);
     CPPUNIT_ASSERT(pDocSh.is());
 
     // check if the same print ranges are present
@@ -2444,7 +2419,7 @@ void 
ScExportTest2::testTdf138741_externalLinkSkipUnusedsCrash()
     CPPUNIT_ASSERT(xShell);
 
     //without the fix in place, it would have crashed at export time
-    ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX);
 
     xShell->DoClose();
 }
@@ -2472,11 +2447,10 @@ void 
ScExportTest2::testTdf138824_linkToParentDirectory()
     aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, 
aTempFilename);
     rDoc.SetFormula(ScAddress(3, 1, 0), aFormula, 
formula::FormulaGrammar::GRAM_NATIVE_UI);
 
-    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX);
     CPPUNIT_ASSERT(xDocSh.is());
 
-    std::shared_ptr<utl::TempFile> pXPathFile
-        = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+    std::shared_ptr<utl::TempFile> pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
     xmlDocUniquePtr pDoc = XPathHelper::parseExport(

... etc. - the rest is truncated

Reply via email to