include/svl/style.hxx | 18 +++++++---- sc/inc/stlpool.hxx | 6 ++- sc/inc/stlsheet.hxx | 3 + sc/source/core/data/stlpool.cxx | 12 ++++--- sc/source/core/data/stlsheet.cxx | 5 +-- sd/inc/stlpool.hxx | 3 + sd/inc/stlsheet.hxx | 3 + sd/qa/unit/SVGExportTests.cxx | 32 ++++++++++---------- sd/source/core/stlpool.cxx | 41 +++++++++----------------- sd/source/core/stlsheet.cxx | 7 +++- svl/qa/unit/items/test_IndexedStyleSheets.cxx | 2 - svl/source/items/style.cxx | 28 ++++++++++------- sw/inc/docstyle.hxx | 5 +-- sw/source/uibase/app/docstyle.cxx | 13 +++++--- 14 files changed, 97 insertions(+), 81 deletions(-)
New commits: commit 76319347a83aecee7a423a614d67287182b31b00 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Oct 21 09:26:31 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Oct 22 08:01:03 2024 +0200 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.mcnam...@collabora.com> diff --git a/include/svl/style.hxx b/include/svl/style.hxx index 9f765bcaf1b0..1882a1a2f5e8 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -130,7 +130,8 @@ protected: bool bMySet; // sal_True: delete Set in dtor bool bHidden; - SfxStyleSheetBase( const OUString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, SfxStyleSearchBits mask ); + SfxStyleSheetBase( const OUString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, + SfxStyleSearchBits mask, const OUString& rParentStyleSheetName ); SfxStyleSheetBase( const SfxStyleSheetBase& ); virtual ~SfxStyleSheetBase() override; @@ -236,7 +237,7 @@ protected: SfxItemPool& rPool; void ChangeParent(std::u16string_view rOld, const OUString& rNew, SfxStyleFamily eFamily, bool bVirtual = true); - virtual rtl::Reference<SfxStyleSheetBase> Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits ); + virtual rtl::Reference<SfxStyleSheetBase> Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits, const OUString& rParentStyleSheetName ); virtual rtl::Reference<SfxStyleSheetBase> Create( const SfxStyleSheetBase& ); virtual ~SfxStyleSheetBasePool() override; @@ -260,7 +261,8 @@ public: virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily eFam, - SfxStyleSearchBits nMask = SfxStyleSearchBits::All); + SfxStyleSearchBits nMask = SfxStyleSearchBits::All, + const OUString& rParentStyleSheetName = u""_ustr); virtual void Remove( SfxStyleSheetBase* ); void Insert( SfxStyleSheetBase* ); @@ -287,7 +289,8 @@ class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, { public: - SfxStyleSheet( const OUString&, const SfxStyleSheetBasePool&, SfxStyleFamily, SfxStyleSearchBits ); + SfxStyleSheet( const OUString&, const SfxStyleSheetBasePool&, SfxStyleFamily, + SfxStyleSearchBits, const OUString& rParentStyleSheetName = u""_ustr ); SfxStyleSheet( const SfxStyleSheet& ); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; @@ -306,7 +309,8 @@ class SVL_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool { protected: using SfxStyleSheetBasePool::Create; - virtual rtl::Reference<SfxStyleSheetBase> Create(const OUString&, SfxStyleFamily, SfxStyleSearchBits mask) override; + virtual rtl::Reference<SfxStyleSheetBase> Create(const OUString&, SfxStyleFamily, + SfxStyleSearchBits mask, const OUString& rParentStyleSheetName) override; public: SfxStyleSheetPool( SfxItemPool const& ); @@ -342,7 +346,9 @@ public: class SVL_DLLPUBLIC SfxUnoStyleSheet : public cppu::ImplInheritanceHelper<SfxStyleSheet, css::style::XStyle> { public: - SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask ); + SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, + SfxStyleSearchBits _nMask, + const OUString& rParentStyleSheetName = u""_ustr ); static SfxUnoStyleSheet* getUnoStyleSheet( const css::uno::Reference< css::style::XStyle >& xStyle ); }; diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx index 2d31c4ee8024..206ec79dc507 100644 --- a/sc/inc/stlpool.hxx +++ b/sc/inc/stlpool.hxx @@ -57,7 +57,8 @@ public: ScStyleSheet* FindAutoStyle(const OUString& rName); SC_DLLPUBLIC virtual SfxStyleSheetBase& Make( const OUString&, SfxStyleFamily eFam, - SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override; + SfxStyleSearchBits nMask = SfxStyleSearchBits::All, + const OUString& rParentStyleSheetName = u""_ustr) override; void setAllParaStandard(); @@ -68,7 +69,8 @@ private: virtual rtl::Reference<SfxStyleSheetBase> Create( const OUString& rName, SfxStyleFamily eFamily, - SfxStyleSearchBits nMask) override; + SfxStyleSearchBits nMask, + const OUString& rParentStyleSheetName) override; virtual rtl::Reference<SfxStyleSheetBase> Create( const SfxStyleSheetBase& rStyle ) override; SfxStyleSheetBase* pActualStyleSheet; diff --git a/sc/inc/stlsheet.hxx b/sc/inc/stlsheet.hxx index e1e2c5b85ef5..6eab3e5a1128 100644 --- a/sc/inc/stlsheet.hxx +++ b/sc/inc/stlsheet.hxx @@ -60,7 +60,8 @@ private: ScStyleSheet( const OUString& rName, const ScStyleSheetPool& rPool, SfxStyleFamily eFamily, - SfxStyleSearchBits nMask ); + SfxStyleSearchBits nMask, + const OUString& rParentStyleSheetName ); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index 2f9ee31d5d14..4516fe3638b4 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -69,7 +69,8 @@ void ScStyleSheetPool::SetDocument( ScDocument* pDocument ) } SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName, - SfxStyleFamily eFam, SfxStyleSearchBits mask) + SfxStyleFamily eFam, SfxStyleSearchBits mask, + const OUString& rParentStyleSheetName) { if ( rName == STRING_STANDARD && Find( rName, eFam ) != nullptr ) { @@ -85,21 +86,22 @@ SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName, { OUString aNewName = ScResId(STR_STYLENAME_STANDARD) + OUString::number( nAdd ); if ( Find( aNewName, eFam ) == nullptr ) - return SfxStyleSheetPool::Make(aNewName, eFam, mask); + return SfxStyleSheetPool::Make(aNewName, eFam, mask, rParentStyleSheetName); } } // Core uses translated names for both naming and display. // This for all three, loading standard builtin styles from styles.xml // configuration, loading documents and updating from templates. - return SfxStyleSheetPool::Make( ScStyleNameConversion::ProgrammaticToDisplayName( rName, eFam), eFam, mask); + return SfxStyleSheetPool::Make( ScStyleNameConversion::ProgrammaticToDisplayName( rName, eFam), eFam, mask, rParentStyleSheetName); } rtl::Reference<SfxStyleSheetBase> ScStyleSheetPool::Create( const OUString& rName, SfxStyleFamily eFamily, - SfxStyleSearchBits nMaskP ) + SfxStyleSearchBits nMaskP, + const OUString& rParentStyleSheetName ) { - rtl::Reference<ScStyleSheet> pSheet = new ScStyleSheet( rName, *this, eFamily, nMaskP ); + rtl::Reference<ScStyleSheet> pSheet = new ScStyleSheet( rName, *this, eFamily, nMaskP, rParentStyleSheetName ); if ( eFamily != SfxStyleFamily::Page && ScResId(STR_STYLENAME_STANDARD) != rName ) pSheet->SetParent( ScResId(STR_STYLENAME_STANDARD) ); diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 1fd2f1ae8a42..4f9ebcb5527d 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -52,9 +52,10 @@ constexpr auto HFDIST_CM = o3tl::convert(250, o3tl::Length::mm100, o3tl::Length: ScStyleSheet::ScStyleSheet( const OUString& rName, const ScStyleSheetPool& rPoolP, SfxStyleFamily eFamily, - SfxStyleSearchBits nMaskP ) + SfxStyleSearchBits nMaskP, + const OUString& rParentStyleSheetName) - : SfxStyleSheet ( rName, rPoolP, eFamily, nMaskP ) + : SfxStyleSheet ( rName, rPoolP, eFamily, nMaskP, rParentStyleSheetName ) , eUsage( Usage::UNKNOWN ) { } 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 ) { diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx index 37e741709558..1b404db5fdab 100644 --- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx +++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx @@ -26,7 +26,7 @@ class MockedStyleSheet : public SfxStyleSheetBase { public: MockedStyleSheet(const OUString& name, SfxStyleFamily fam = SfxStyleFamily::Char) - : SfxStyleSheetBase(name, nullptr, fam, SfxStyleSearchBits::Auto) + : SfxStyleSheetBase(name, nullptr, fam, SfxStyleSearchBits::Auto, u""_ustr) {} }; diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 73c0c0cdbd98..54b9e227ebce 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -101,10 +101,12 @@ public: }; -SfxStyleSheetBase::SfxStyleSheetBase( const OUString& rName, SfxStyleSheetBasePool* p, SfxStyleFamily eFam, SfxStyleSearchBits mask ) +SfxStyleSheetBase::SfxStyleSheetBase( const OUString& rName, SfxStyleSheetBasePool* p, + SfxStyleFamily eFam, SfxStyleSearchBits mask, const OUString& rParentStyleSheetName ) : m_pPool( p ) , nFamily( eFam ) , aName( rName ) + , aParent( rParentStyleSheetName ) , aFollow( rName ) , pSet( nullptr ) , nMask(mask) @@ -627,10 +629,11 @@ rtl::Reference<SfxStyleSheetBase> SfxStyleSheetBasePool::Create ( const OUString& rName, SfxStyleFamily eFam, - SfxStyleSearchBits mask + SfxStyleSearchBits mask, + const OUString& sParentStyleSheetName ) { - return new SfxStyleSheetBase( rName, this, eFam, mask ); + return new SfxStyleSheetBase( rName, this, eFam, mask, sParentStyleSheetName ); } rtl::Reference<SfxStyleSheetBase> SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r ) @@ -638,7 +641,8 @@ rtl::Reference<SfxStyleSheetBase> SfxStyleSheetBasePool::Create( const SfxStyleS return new SfxStyleSheetBase( r ); } -SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleFamily eFam, SfxStyleSearchBits mask) +SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleFamily eFam, SfxStyleSearchBits mask, + const OUString& sParentStyleSheetName) { OSL_ENSURE( eFam != SfxStyleFamily::All, "svl::SfxStyleSheetBasePool::Make(), FamilyAll is not an allowed Family" ); @@ -648,7 +652,7 @@ SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleF if( !xStyle.is() ) { - xStyle = Create( rName, eFam, mask ); + xStyle = Create( rName, eFam, mask, sParentStyleSheetName ); StoreStyleSheet(xStyle); } return *xStyle; @@ -797,8 +801,9 @@ void SfxStyleSheetBasePool::ChangeParent(std::u16string_view rOld, SfxStyleSheet::SfxStyleSheet(const OUString &rName, const SfxStyleSheetBasePool& r_Pool, SfxStyleFamily eFam, - SfxStyleSearchBits mask ) - : SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool* >( &r_Pool ), eFam, mask) + SfxStyleSearchBits mask, + const OUString& rParentStyleSheetName) + : SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool* >( &r_Pool ), eFam, mask, rParentStyleSheetName) { } @@ -866,13 +871,14 @@ SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool const& rSet) } rtl::Reference<SfxStyleSheetBase> SfxStyleSheetPool::Create( const OUString& rName, - SfxStyleFamily eFam, SfxStyleSearchBits mask ) + SfxStyleFamily eFam, SfxStyleSearchBits mask, + const OUString& rParentStyleSheetName) { - return new SfxStyleSheet( rName, *this, eFam, mask ); + return new SfxStyleSheet( rName, *this, eFam, mask, rParentStyleSheetName ); } -SfxUnoStyleSheet::SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask ) -: cppu::ImplInheritanceHelper<SfxStyleSheet, css::style::XStyle>(_rName, _rPool, _eFamily, _nMask) +SfxUnoStyleSheet::SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask, const OUString& rParentStyleSheetName ) +: cppu::ImplInheritanceHelper<SfxStyleSheet, css::style::XStyle>(_rName, _rPool, _eFamily, _nMask, rParentStyleSheetName) { } diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index d550f98c0386..e53dc2c743e6 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -212,7 +212,7 @@ class SwDocStyleSheetPool final : public SfxStyleSheetBasePool SwDoc& m_rDoc; bool m_bOrganizer : 1; ///< Organizer - virtual rtl::Reference<SfxStyleSheetBase> Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits nMask) override; + virtual rtl::Reference<SfxStyleSheetBase> Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits nMask, const OUString& rParentStyleSheetName) override; virtual rtl::Reference<SfxStyleSheetBase> Create( const SfxStyleSheetBase& ) override; using SfxStyleSheetBasePool::Find; @@ -221,7 +221,8 @@ public: SwDocStyleSheetPool( SwDoc&, bool bOrganizer ); virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily, - SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override; + SfxStyleSearchBits nMask = SfxStyleSearchBits::All, + const OUString& rParentStyleSheetName = u""_ustr) override; virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All ) override; diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index ea256a2668e3..6aae548adb29 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -129,9 +129,10 @@ public: using SfxStyleSheetPool::Create; rtl::Reference<SfxStyleSheetBase> Create(const OUString& rName, SfxStyleFamily eFamily, - SfxStyleSearchBits nMask) override + SfxStyleSearchBits nMask, + const OUString& rParentStyleSheetName) override { - return new EEStyleSheet(rName, *this, eFamily, nMask); + return new EEStyleSheet(rName, *this, eFamily, nMask, rParentStyleSheetName); } void Notify(SfxBroadcaster&, const SfxHint& rHint) override @@ -573,7 +574,7 @@ void SwStyleSheetIterator::SwPoolFormatList::Append( SfxStyleFamily eFam, const SwDocStyleSheet::SwDocStyleSheet( SwDoc& rDocument, SwDocStyleSheetPool& rPool) : - SfxStyleSheetBase( OUString(), &rPool, SfxStyleFamily::Char, SfxStyleSearchBits::Auto ), + SfxStyleSheetBase( OUString(), &rPool, SfxStyleFamily::Char, SfxStyleSearchBits::Auto, u""_ustr ), m_pCharFormat(nullptr), m_pColl(nullptr), m_pFrameFormat(nullptr), @@ -2631,7 +2632,8 @@ SwDocStyleSheetPool::~SwDocStyleSheetPool() SfxStyleSheetBase& SwDocStyleSheetPool::Make( const OUString& rName, SfxStyleFamily eFam, - SfxStyleSearchBits _nMask) + SfxStyleSearchBits _nMask, + const OUString& rParentStyleSheetName) { mxStyleSheet->PresetName(rName); mxStyleSheet->PresetParent(OUString()); @@ -2639,6 +2641,7 @@ SfxStyleSheetBase& SwDocStyleSheetPool::Make( const OUString& rName, mxStyleSheet->SetMask(_nMask) ; mxStyleSheet->SetFamily(eFam); mxStyleSheet->SetPhysical(true); + mxStyleSheet->SetParent(rParentStyleSheetName); mxStyleSheet->Create(); return *mxStyleSheet; @@ -2651,7 +2654,7 @@ rtl::Reference<SfxStyleSheetBase> SwDocStyleSheetPool::Create( const SfxStyleShe } rtl::Reference<SfxStyleSheetBase> SwDocStyleSheetPool::Create( const OUString &, - SfxStyleFamily, SfxStyleSearchBits ) + SfxStyleFamily, SfxStyleSearchBits, const OUString& ) { OSL_ENSURE( false, "Create in SW-Stylesheet-Pool not possible" ); return nullptr;