sc: Don't save the sheet view holder table to the ODF, OOXML file

Sheet view holder table is temporary and shouldn't be saved to the
document file.
This also includes a test, which checks if the ODF, OOXML files
have the sheet view holder table saved.

Change-Id: Iaf93b7723be7b10d7c10f829db7079a92deb1a8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192146
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192365
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
This commit is contained in:
Tomaž Vajngerl
2025-10-14 14:40:47 +02:00
committed by Tomaž Vajngerl
parent 43b63465a6
commit 73a6735652
3 changed files with 36 additions and 1 deletions
@@ -478,6 +478,38 @@ CPPUNIT_TEST_FIXTURE(SheetViewTest, testSheetViewManager)
CPPUNIT_ASSERT_EQUAL(sc::InvalidSheetViewID, maSheetViewManager.getPreviousSheetView(-99));
}
CPPUNIT_TEST_FIXTURE(SheetViewTest, testCheckIfSheetViewIsSavedInDocument_ODF)
{
// Check if sheet view holder table is saved into the ODF document
ScModelObj* pModelObj = createDoc("SheetView_AutoFilter.ods");
pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
dispatchCommand(mxComponent, u".uno:NewSheetView"_ustr, {});
Scheduler::ProcessEventsToIdle();
save(u"calc8"_ustr);
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr);
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "//table:table", 1);
}
CPPUNIT_TEST_FIXTURE(SheetViewTest, testCheckIfSheetViewIsSavedInDocument_OOXML)
{
// Check if sheet view holder table is saved into the OOXML document
ScModelObj* pModelObj = createDoc("SheetView_AutoFilter.ods");
pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
dispatchCommand(mxComponent, u".uno:NewSheetView"_ustr, {});
Scheduler::ProcessEventsToIdle();
save(u"Calc Office Open XML"_ustr);
xmlDocUniquePtr pXmlDoc = parseExport(u"xl/workbook.xml"_ustr);
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/x:workbook/x:sheets/x:sheet", 1);
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+1 -1
View File
@@ -659,7 +659,7 @@ XclExpTabInfo::XclExpTabInfo( const XclExpRoot& rRoot ) :
for( nScTab = 0; nScTab < mnScCnt; ++nScTab )
{
// ignored sheets (skipped by export, with invalid Excel sheet index)
if( rDoc.IsScenario( nScTab ) )
if (rDoc.IsScenario(nScTab) || rDoc.IsSheetViewHolder(nScTab))
{
SetFlag( nScTab, ExcTabBufFlags::Ignore );
}
+3
View File
@@ -1915,6 +1915,9 @@ void ScXMLExport::ExportContent_()
WriteTheLabelRanges(*pDoc, xSpreadDoc);
for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable)
{
// We need to skip tables that hold the data for a sheet view
if (pDoc->IsSheetViewHolder(nTable))
continue;
sal_Int64 nStartOffset = -1;
sal_Int64 nEndOffset = -1;
if (pSheetData && pDoc->IsStreamValid(static_cast<SCTAB>(nTable)) && !pDoc->GetChangeTrack())