summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2023-03-29 16:53:48 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2023-03-29 17:22:55 +0000
commit8085a68be7604e7bd00004e0d9445be5e266ffbb (patch)
tree68cca09c412bca42099ff3e3f5b46d32920399f5 /sc
parent10daade356692417e43faaa1909d3794e279054b (diff)
tdf#154445 - Export all page styles even if they are not in use
Change-Id: If0ca5ea97ad545058c6a70d223158a87bf9207ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149729 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/subsequent_export_test4.cxx23
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx6
2 files changed, 27 insertions, 2 deletions
diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx
index 3033ff4fef85..275493f61387 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -18,6 +18,8 @@
#include <stlpool.hxx>
#include <formulacell.hxx>
#include <validat.hxx>
+#include <scresid.hxx>
+#include <globstr.hrc>
#include <editeng/wghtitem.hxx>
#include <editeng/postitem.hxx>
@@ -418,6 +420,27 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testHeaderFontStyleXLSX)
CPPUNIT_ASSERT_MESSAGE("Second line should be italic.", bHasItalic);
}
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf154445_unused_pagestyles)
+{
+ createScDoc("ods/tdf108188_pagestyle.ods");
+
+ // Check if the user defined page style is present
+ const OUString aTestPageStyle = "TestPageStyle";
+ ScDocument* pDoc = getScDoc();
+ CPPUNIT_ASSERT_EQUAL(aTestPageStyle, pDoc->GetPageStyle(0));
+
+ // Change page style to default so the user defined one is not used anymore
+ pDoc->SetPageStyle(0, ScResId(STR_STYLENAME_STANDARD));
+
+ // Save and reload the document to check if the unused page styles are still present
+ saveAndReload("calc8");
+ pDoc = getScDoc();
+
+ // Without the accompanying fix in place, the unused page styles don't exist anymore
+ ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ CPPUNIT_ASSERT(pStylePool->Find(aTestPageStyle, SfxStyleFamily::Page));
+}
+
CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf135828_Shape_Rect)
{
if (!IsDefaultDPI())
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index cbf8dcf11a0a..4c306de2c907 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2609,7 +2609,8 @@ void ScXMLExport::collectAutoStyles()
}
if (getExportFlags() & SvXMLExportFlags::MASTERSTYLES)
- GetPageExport()->collectAutoStyles(true);
+ // tdf#154445 - export all page styles even if they are not in use
+ GetPageExport()->collectAutoStyles(false);
mbAutoStylesCollected = true;
}
@@ -2671,7 +2672,8 @@ void ScXMLExport::ExportAutoStyles_()
void ScXMLExport::ExportMasterStyles_()
{
- GetPageExport()->exportMasterStyles( true );
+ // tdf#154445 - export all page styles even if they are not in use
+ GetPageExport()->exportMasterStyles( false );
}
void ScXMLExport::CollectInternalShape( uno::Reference< drawing::XShape > const & xShape )