summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-10-21 09:26:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-10-22 08:01:03 +0200
commit76319347a83aecee7a423a614d67287182b31b00 (patch)
treeb5dc3e246067e81356f3000bde2c99ca87202384 /sd
parent620b293808f6111556c31674437917e70b106e9e (diff)
set stylesheet parent at creation time
avoids a bunch of broadcasting. a similar mega-master-page scenario as reported in tdf#158773 9.1 - 7.0s Some re-ordering of SVG output occurs, which means tweaking some unit tests. Change-Id: I447a4639a96c12c627a074f7e0f1ede8b3cbaf72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175299 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/stlpool.hxx3
-rw-r--r--sd/inc/stlsheet.hxx3
-rw-r--r--sd/qa/unit/SVGExportTests.cxx32
-rw-r--r--sd/source/core/stlpool.cxx41
-rw-r--r--sd/source/core/stlsheet.cxx7
5 files changed, 40 insertions, 46 deletions
diff --git a/sd/inc/stlpool.hxx b/sd/inc/stlpool.hxx
index 9e1693249f86..a72acb6d9330 100644
--- a/sd/inc/stlpool.hxx
+++ b/sd/inc/stlpool.hxx
@@ -122,7 +122,8 @@ private:
void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets );
void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets, std::u16string_view rRenameSuffix );
- virtual rtl::Reference<SfxStyleSheetBase> Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits nMask) override;
+ virtual rtl::Reference<SfxStyleSheetBase> Create(const OUString& rName, SfxStyleFamily eFamily,
+ SfxStyleSearchBits nMask, const OUString& rParentStyleSheetName) override;
using SfxStyleSheetPool::Create;
virtual ~SdStyleSheetPool() override;
diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx
index aa7238e5b0e8..f11500b620f7 100644
--- a/sd/inc/stlsheet.hxx
+++ b/sd/inc/stlsheet.hxx
@@ -54,7 +54,8 @@ typedef cppu::ImplInheritanceHelper< SfxUnoStyleSheet,
class SdStyleSheet final : public SdStyleSheetBase
{
public:
- SdStyleSheet( const OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, SfxStyleSearchBits nMask );
+ SdStyleSheet( const OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily,
+ SfxStyleSearchBits nMask, const OUString& rParentStyleSheetName = u""_ustr );
virtual bool SetParent (const OUString& rParentName) override;
virtual SfxItemSet& GetItemSet() override;
diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx
index bd800a516db9..bcd0b2908f06 100644
--- a/sd/qa/unit/SVGExportTests.cxx
+++ b/sd/qa/unit/SVGExportTests.cxx
@@ -131,20 +131,20 @@ public:
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2] ), "class", u"Master_Slide");
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2] ), "class", u"Master_Slide");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
// Current Date Field
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[4] ), "class", u"TextShape");
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[4]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Date");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[4] ), "class", u"TextShape");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[4]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Date");
// Current Time Field
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[5] ), "class", u"TextShape");
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[5]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Time");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[5] ), "class", u"TextShape");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[5]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Time");
// Slide Name Field
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
// Slide Number Field
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
}
void testSVGExportEmbeddedVideo()
@@ -280,15 +280,15 @@ public:
xmlDocUniquePtr svgDoc = parseXml(maTempFile);
CPPUNIT_ASSERT(svgDoc);
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2] ), "class", u"Master_Slide");
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2] ), "class", u"Master_Slide");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects");
// Slide Name Field
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName");
// Slide Number Field
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
- assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape");
+ assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber");
}
CPPUNIT_TEST_SUITE(SdSVGFilterTest);
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 2cfd2544fe00..9823c031c251 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -130,9 +130,10 @@ SdStyleSheetPool::~SdStyleSheetPool()
DBG_ASSERT( mpDoc == nullptr, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" );
}
-rtl::Reference<SfxStyleSheetBase> SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits _nMask )
+rtl::Reference<SfxStyleSheetBase> SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily,
+ SfxStyleSearchBits _nMask, const OUString& rParentStyleSheetName )
{
- return new SdStyleSheet(rName, *this, eFamily, _nMask);
+ return new SdStyleSheet(rName, *this, eFamily, _nMask, rParentStyleSheetName);
}
SfxStyleSheetBase* SdStyleSheetPool::GetTitleSheet(std::u16string_view rLayoutName)
@@ -211,10 +212,19 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName,
if (!Find(aLevelName, SfxStyleFamily::Page))
{
bCreated = true;
- pSheet = &Make(aLevelName, SfxStyleFamily::Page,nUsedMask);
- pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
- pSheet->SetParent( OUString() );
+ OUString sParentStyleSheetName;
+ // if we created outline styles, we need to chain them
+ if (nLevel > 1)
+ {
+ OUString aPreviousLevelName( aPrefix + aName + " " + OUString::number( nLevel-1 ) );
+ SfxStyleSheetBase* pParent = Find(aPreviousLevelName, SfxStyleFamily::Page);
+ if (pParent)
+ sParentStyleSheetName = pParent->GetName();
+ }
+
+ pSheet = &Make(aLevelName, SfxStyleFamily::Page, nUsedMask, sParentStyleSheetName);
+ pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
// attributing for level 1, the others levels inherit
if (nLevel == 1)
@@ -297,27 +307,6 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName,
}
}
- // if we created outline styles, we need to chain them
- if( bCreated )
- {
- SfxStyleSheetBase* pParent = nullptr;
- for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
- {
- OUString aLevelName( aPrefix + aName + " " + OUString::number( nLevel ) );
-
- pSheet = Find(aLevelName, SfxStyleFamily::Page);
-
- DBG_ASSERT( pSheet, "missing layout style!");
-
- if( pSheet )
- {
- if (pParent)
- pSheet->SetParent(pParent->GetName());
- pParent = pSheet;
- }
- }
- }
-
/**************************************************************************
* Title
**************************************************************************/
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 60ae6f2588b7..0389adbb145f 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -140,8 +140,11 @@ void ModifyListenerForwarder::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*r
mpStyleSheet->notifyModifyListener();
}
-SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, SfxStyleFamily eFamily, SfxStyleSearchBits _nMask)
-: SdStyleSheetBase( rDisplayName, _rPool, eFamily, _nMask)
+SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool,
+ SfxStyleFamily eFamily,
+ SfxStyleSearchBits _nMask,
+ const OUString& rParentStyleSheetName)
+: SdStyleSheetBase( rDisplayName, _rPool, eFamily, _nMask, rParentStyleSheetName)
, msApiName( rDisplayName )
, mxPool( &_rPool )
{