sw/inc/unoxstyle.hxx | 19 ++-- sw/qa/extras/odfimport/odfimport.cxx | 6 - sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 4 sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 6 - sw/qa/extras/rtfimport/rtfimport.cxx | 24 +---- sw/qa/extras/ww8export/ww8export3.cxx | 4 sw/source/core/doc/SwStyleNameMapper.cxx | 4 sw/source/core/edit/edfcol.cxx | 7 + sw/source/core/unocore/unostyle.cxx | 141 +++++++++++++++--------------- 9 files changed, 112 insertions(+), 103 deletions(-)
New commits: commit 06a9f0d102c74106c1414dc984858b0f47e5be6f Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Dec 10 12:01:26 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Dec 10 18:38:21 2024 +0100 tdf#159549 sw: rename SwXStyle variables to make it more obvious There are only 2 actual changes in behaviour, in SwXStyle::getName() and SwXStyle::setName(): these now convert the name, but in practice it should not make any difference, because it looks like any attempt to set the name of a built-in style, or set a style's name to the name of a built-in style, will eventually throw an exception without changing the document model. Change-Id: If11fba2797e28b10c98c383c5d130f19ce0c77b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178209 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit f32ee6801ad7e268224a1da918517a3577e8a582) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178248 diff --git a/sw/inc/unoxstyle.hxx b/sw/inc/unoxstyle.hxx index 459dff27375e..8c77c6fa24c2 100644 --- a/sw/inc/unoxstyle.hxx +++ b/sw/inc/unoxstyle.hxx @@ -45,6 +45,15 @@ class SwDocShell; class SwXNumberingRules; class SwDocStyleSheet; +/** The names of built-in styles at the API are ProgNames which are not subject + to i18n and must never change - these are written into ODF files. + + The names of built-in styles in the core document model are UINames which + are subject to i18n and may change in different versions. + + Take care to use SwStyleNameMapper::GetProgName() or + SwStyleNameMapper::GetUIName() to convert here in the UNO service. + */ class SAL_DLLPUBLIC_RTTI SwXStyle : public cppu::ImplInheritanceHelper< SwXBaseStyle, css::beans::XMultiPropertySet, css::lang::XServiceInfo, @@ -53,11 +62,11 @@ class SAL_DLLPUBLIC_RTTI SwXStyle public SvtListener { SwDoc* m_pDoc; - OUString m_sStyleName; + OUString m_sStyleUIName; ///< UIName, needs conversion to ProgName const StyleFamilyEntry& m_rEntry; bool m_bIsDescriptor; bool m_bIsConditional; - OUString m_sParentStyleName; + OUString m_sParentStyleUIName; ///< UIName, needs conversion to ProgName // cache UNO stylesheets std::unordered_map<SfxStyleSheetBase*, rtl::Reference<SwDocStyleSheet>> maUnoStyleSheets; @@ -177,12 +186,12 @@ public: SW_DLLPUBLIC rtl::Reference<SwXNumberingRules> getNumberingRules(); - const OUString& GetStyleName() const { return m_sStyleName; } + const OUString& GetStyleUIName() const { return m_sStyleUIName; } SfxStyleFamily GetFamily() const; bool IsDescriptor() const { return m_bIsDescriptor; } bool IsConditional() const { return m_bIsConditional; } - const OUString& GetParentStyleName() const { return m_sParentStyleName; } + const OUString& GetParentStyleUIName() const { return m_sParentStyleUIName; } void SetDoc(SwDoc* pDc, SfxStyleSheetBasePool* pPool) { m_bIsDescriptor = false; @@ -193,7 +202,7 @@ public: SwDoc* GetDoc() const { return m_pDoc; } void Invalidate(); void ApplyDescriptorProperties(); - void SetStyleName(const OUString& rSet) { m_sStyleName = rSet; } + void SetStyleUIName(const OUString& rSet) { m_sStyleUIName = rSet; } /// @throws beans::PropertyVetoException /// @throws lang::IllegalArgumentException /// @throws lang::WrappedTargetException diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index ae1306b66f0a..73f22f1b993c 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -447,14 +447,14 @@ private: rtl::Reference<SwDocStyleSheet> m_xNewBase; SfxItemSet* m_pItemSet; std::optional<SfxItemSet> m_oMyItemSet; - OUString m_rStyleName; + OUString m_sStyleUIName; const SwAttrSet* m_pParentStyle; public: - SwStyleBase_Impl(SwDoc& rSwDoc, OUString aName, const SwAttrSet* pParentStyle) + SwStyleBase_Impl(SwDoc& rSwDoc, OUString sUIName, const SwAttrSet* pParentStyle) : m_rDoc(rSwDoc) , m_pOldPageDesc(nullptr) , m_pItemSet(nullptr) - , m_rStyleName(std::move(aName)) + , m_sStyleUIName(std::move(sUIName)) , m_pParentStyle(pParentStyle) { } @@ -565,29 +565,29 @@ public: } }; -static rtl::Reference<SwXStyle> CreateStyleCharOrParaOrPseudo(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& sStyleName, SfxStyleFamily eFamily) +static rtl::Reference<SwXStyle> CreateStyleCharOrParaOrPseudo(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& rStyleUIName, SfxStyleFamily eFamily) { - return pBasePool ? new SwXStyle(pBasePool, eFamily, pDocShell->GetDoc(), sStyleName) : new SwXStyle(pDocShell->GetDoc(), eFamily, false); + return pBasePool ? new SwXStyle(pBasePool, eFamily, pDocShell->GetDoc(), rStyleUIName) : new SwXStyle(pDocShell->GetDoc(), eFamily, false); } -static rtl::Reference<SwXFrameStyle> CreateStyleFrame(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& sStyleName) +static rtl::Reference<SwXFrameStyle> CreateStyleFrame(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& rStyleUIName) { - return pBasePool ? new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), sStyleName) : new SwXFrameStyle(pDocShell->GetDoc()); + return pBasePool ? new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), rStyleUIName) : new SwXFrameStyle(pDocShell->GetDoc()); } -static rtl::Reference<SwXPageStyle> CreateStylePage(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& sStyleName) +static rtl::Reference<SwXPageStyle> CreateStylePage(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& rStyleUIName) { - return pBasePool ? new SwXPageStyle(*pBasePool, pDocShell, sStyleName) : new SwXPageStyle(pDocShell); + return pBasePool ? new SwXPageStyle(*pBasePool, pDocShell, rStyleUIName) : new SwXPageStyle(pDocShell); } -static rtl::Reference<SwXTextTableStyle> CreateStyleTable(SwDocShell* pDocShell, const OUString& sStyleName) +static rtl::Reference<SwXTextTableStyle> CreateStyleTable(SwDocShell* pDocShell, const OUString& rStyleUIName) { - return SwXTextTableStyle::CreateXTextTableStyle(pDocShell, sStyleName); + return SwXTextTableStyle::CreateXTextTableStyle(pDocShell, rStyleUIName); } -static rtl::Reference<SwXTextCellStyle> CreateStyleCell(SwDocShell* pDocShell, const OUString& sStyleName) +static rtl::Reference<SwXTextCellStyle> CreateStyleCell(SwDocShell* pDocShell, const OUString& rStyleUIName) { - return SwXTextCellStyle::CreateXTextCellStyle(pDocShell, sStyleName); + return SwXTextCellStyle::CreateXTextCellStyle(pDocShell, rStyleUIName); } sal_Int32 SwXStyleFamily::GetCountOrName(OUString* pString, sal_Int32 nIndex) @@ -953,16 +953,16 @@ rtl::Reference<SwXStyle> SwXStyleFamily::getParagraphStyleByName(const OUString& return xCharStyle; } -rtl::Reference<SwXBaseStyle> SwXStyleFamily::getStyleByName(const OUString& rName) +rtl::Reference<SwXBaseStyle> SwXStyleFamily::getStyleByName(const OUString& rProgName) { SolarMutexGuard aGuard; if(!m_pBasePool) throw uno::RuntimeException(); OUString sStyleName; - SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId()); + SwStyleNameMapper::FillUIName(rProgName, sStyleName, m_rEntry.poolId()); SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_rEntry.family()); if(!pBase) - throw container::NoSuchElementException(rName); + throw container::NoSuchElementException(rProgName); rtl::Reference<SwXBaseStyle> xStyle = FindStyle(sStyleName); if(!xStyle.is()) switch (m_rEntry.family()) @@ -1006,37 +1006,37 @@ uno::Sequence<OUString> SwXStyleFamily::getElementNames() return comphelper::containerToSequence(vRet); } -sal_Bool SwXStyleFamily::hasByName(const OUString& rName) +sal_Bool SwXStyleFamily::hasByName(const OUString& rProgName) { SolarMutexGuard aGuard; if(!m_pBasePool) throw uno::RuntimeException(); OUString sStyleName; - SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId()); + SwStyleNameMapper::FillUIName(rProgName, sStyleName, m_rEntry.poolId()); SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_rEntry.family()); return nullptr != pBase; } -void SwXStyleFamily::insertStyleByName(const OUString& rName, const rtl::Reference<SwXStyle>& pNewStyle) +void SwXStyleFamily::insertStyleByName(const OUString& rProgName, const rtl::Reference<SwXStyle>& pNewStyle) { SolarMutexGuard aGuard; if(!m_pBasePool) throw uno::RuntimeException(); OUString sStyleName; - SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId()); + SwStyleNameMapper::FillUIName(rProgName, sStyleName, m_rEntry.poolId()); SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_rEntry.family()); if (pBase) throw container::ElementExistException(); insertStyleByNameImpl(pNewStyle, sStyleName); } -void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement) +void SwXStyleFamily::insertByName(const OUString& rProgName, const uno::Any& rElement) { SolarMutexGuard aGuard; if(!m_pBasePool) throw uno::RuntimeException(); OUString sStyleName; - SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId()); + SwStyleNameMapper::FillUIName(rProgName, sStyleName, m_rEntry.poolId()); SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_rEntry.family()); if (pBase) throw container::ElementExistException(); @@ -1077,7 +1077,7 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen } } -void SwXStyleFamily::insertStyleByNameImpl(const rtl::Reference<SwXStyle>& pNewStyle, const OUString& sStyleName) +void SwXStyleFamily::insertStyleByNameImpl(const rtl::Reference<SwXStyle>& pNewStyle, const OUString& rUIName) { if (!pNewStyle->IsDescriptor() || pNewStyle->GetFamily() != m_rEntry.family()) throw lang::IllegalArgumentException(); @@ -1085,21 +1085,21 @@ void SwXStyleFamily::insertStyleByNameImpl(const rtl::Reference<SwXStyle>& pNewS SfxStyleSearchBits nMask = SfxStyleSearchBits::All; if(m_rEntry.family() == SfxStyleFamily::Para && !pNewStyle->IsConditional()) nMask &= ~SfxStyleSearchBits::SwCondColl; - auto pStyle = &m_pBasePool->Make(sStyleName, m_rEntry.family(), nMask); + auto pStyle = &m_pBasePool->Make(rUIName, m_rEntry.family(), nMask); pNewStyle->SetDoc(m_pDocShell->GetDoc(), m_pBasePool); - pNewStyle->SetStyleName(sStyleName); - pStyle->SetParent(pNewStyle->GetParentStyleName()); + pNewStyle->SetStyleUIName(rUIName); + pStyle->SetParent(pNewStyle->GetParentStyleUIName()); // after all, we still need to apply the properties of the descriptor pNewStyle->ApplyDescriptorProperties(); } -void SwXStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement) +void SwXStyleFamily::replaceByName(const OUString& rProgName, const uno::Any& rElement) { SolarMutexGuard aGuard; if(!m_pBasePool) throw uno::RuntimeException(); OUString sStyleName; - SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId()); + SwStyleNameMapper::FillUIName(rProgName, sStyleName, m_rEntry.poolId()); SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_rEntry.family()); // replacements only for userdefined styles if(!pBase) @@ -1150,29 +1150,29 @@ void SwXStyleFamily::replaceByName(const OUString& rName, const uno::Any& rEleme pStyle->Invalidate(); } m_pBasePool->Remove(pBase); - insertByName(rName, rElement); + insertByName(rProgName, rElement); } } -void SwXStyleFamily::removeByName(const OUString& rName) +void SwXStyleFamily::removeByName(const OUString& rProgName) { SolarMutexGuard aGuard; if(!m_pBasePool) throw uno::RuntimeException(); OUString sName; - SwStyleNameMapper::FillUIName(rName, sName, m_rEntry.poolId()); + SwStyleNameMapper::FillUIName(rProgName, sName, m_rEntry.poolId()); SfxStyleSheetBase* pBase = m_pBasePool->Find(sName, m_rEntry.family()); if(!pBase) throw container::NoSuchElementException(); if (SwGetPoolIdFromName::CellStyle == m_rEntry.poolId()) { // handle cell style - m_pDocShell->GetDoc()->GetCellStyles().RemoveBoxFormat(rName); + m_pDocShell->GetDoc()->GetCellStyles().RemoveBoxFormat(rProgName); } else if (SwGetPoolIdFromName::TabStyle == m_rEntry.poolId()) { // handle table style - m_pDocShell->GetDoc()->GetTableStyles().EraseAutoFormat(rName); + m_pDocShell->GetDoc()->GetTableStyles().EraseAutoFormat(rProgName); } else m_pBasePool->Remove(pBase); @@ -1203,7 +1203,7 @@ SwXStyle* SwXStyleFamily::FindStyle(std::u16string_view rStyleName) const SwXStyle* pTempStyle = static_cast<SwXStyle*>(pListener); if(pTempStyle && pTempStyle->GetFamily() == aParams.m_rEntry.family() - && pTempStyle->GetStyleName() == aParams.aStyleName) + && pTempStyle->GetStyleUIName() == aParams.aStyleName) { aParams.pFoundStyle = pTempStyle; return true; // break @@ -1349,7 +1349,7 @@ SwXStyle::SwXStyle(SwDoc* pDoc, SfxStyleFamily eFamily, bool bConditional) SwXStyle::SwXStyle(SfxStyleSheetBasePool* pPool, SfxStyleFamily eFamily, SwDoc* pDoc, const OUString& rStyleName) : m_pDoc(pDoc) - , m_sStyleName(rStyleName) + , m_sStyleUIName(rStyleName) , m_rEntry(lcl_GetStyleEntry(eFamily)) , m_bIsDescriptor(false) , m_bIsConditional(lcl_InitConditional(pPool, eFamily, rStyleName)) @@ -1379,8 +1379,12 @@ OUString SwXStyle::getName() { SolarMutexGuard aGuard; if(!m_pBasePool) - return m_sStyleName; - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family()); + { + OUString ret; + SwStyleNameMapper::FillProgName(m_sStyleUIName, ret, lcl_GetSwEnumFromSfxEnum(m_rEntry.family())); + return ret; + } + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family()); SAL_WARN_IF(!pBase, "sw.uno", "where is the style?"); if(!pBase) throw uno::RuntimeException(); @@ -1389,22 +1393,27 @@ OUString SwXStyle::getName() return aString; } -void SwXStyle::setName(const OUString& rName) +void SwXStyle::setName(const OUString& rProgName) { SolarMutexGuard aGuard; if(!m_pBasePool) { - m_sStyleName = rName; + // it looks like a descriptor style with a built-in name cannot be + // inserted into the document anyway - just convert name for consistency + SwStyleNameMapper::FillUIName(rProgName, m_sStyleUIName, m_rEntry.poolId()); return; } - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family()); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family()); SAL_WARN_IF(!pBase, "sw.uno", "where is the style?"); if(!pBase || !pBase->IsUserDefined()) throw uno::RuntimeException(); + OUString sUIName; + // conversion should actully be irrelevant due to IsUserDefined() check + SwStyleNameMapper::FillUIName(rProgName, sUIName, m_rEntry.poolId()); rtl::Reference<SwDocStyleSheet> xTmp(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase))); - if(!xTmp->SetName(rName)) + if (!xTmp->SetName(sUIName)) throw uno::RuntimeException(); - m_sStyleName = rName; + m_sStyleUIName = sUIName; } sal_Bool SwXStyle::isUserDefined() @@ -1412,7 +1421,7 @@ sal_Bool SwXStyle::isUserDefined() SolarMutexGuard aGuard; if(!m_pBasePool) throw uno::RuntimeException(); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family()); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family()); //if it is not found it must be non user defined return pBase && pBase->IsUserDefined(); } @@ -1422,7 +1431,7 @@ sal_Bool SwXStyle::isInUse() SolarMutexGuard aGuard; if(!m_pBasePool) throw uno::RuntimeException(); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family(), SfxStyleSearchBits::Used); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family(), SfxStyleSearchBits::Used); return pBase && pBase->IsUsed(); } @@ -1434,10 +1443,10 @@ OUString SwXStyle::getParentStyle() if(!m_bIsDescriptor) throw uno::RuntimeException(); OUString ret; - SwStyleNameMapper::FillProgName(m_sParentStyleName, ret, lcl_GetSwEnumFromSfxEnum(m_rEntry.family())); + SwStyleNameMapper::FillProgName(m_sParentStyleUIName, ret, lcl_GetSwEnumFromSfxEnum(m_rEntry.family())); return ret; } - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family()); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family()); OUString aString; if(pBase) aString = pBase->GetParent(); @@ -1445,26 +1454,26 @@ OUString SwXStyle::getParentStyle() return aString; } -void SwXStyle::setParentStyle(const OUString& rParentStyle) +void SwXStyle::setParentStyle(const OUString& rParentStyleProgName) { SolarMutexGuard aGuard; OUString sParentStyle; - SwStyleNameMapper::FillUIName(rParentStyle, sParentStyle, lcl_GetSwEnumFromSfxEnum(m_rEntry.family())); + SwStyleNameMapper::FillUIName(rParentStyleProgName, sParentStyle, lcl_GetSwEnumFromSfxEnum(m_rEntry.family())); if(!m_pBasePool) { if(!m_bIsDescriptor) throw uno::RuntimeException(); - m_sParentStyleName = sParentStyle; + m_sParentStyleUIName = sParentStyle; try { - const auto aAny = m_xStyleFamily->getByName(rParentStyle); + const auto aAny = m_xStyleFamily->getByName(rParentStyleProgName); m_xStyleData = aAny.get<decltype(m_xStyleData)>(); } catch(...) { } return; } - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family()); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family()); if(!pBase) throw uno::RuntimeException(); rtl::Reference<SwDocStyleSheet> xBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase))); @@ -1516,7 +1525,7 @@ const SwPageDesc* SwStyleBase_Impl::GetOldPageDesc() { if(!m_pOldPageDesc) { - SwPageDesc *pd = m_rDoc.FindPageDesc(m_rStyleName); + SwPageDesc *pd = m_rDoc.FindPageDesc(m_sStyleUIName); if(pd) m_pOldPageDesc = pd; @@ -1524,7 +1533,7 @@ const SwPageDesc* SwStyleBase_Impl::GetOldPageDesc() { for (size_t i = 0; i < SAL_N_ELEMENTS(STR_POOLPAGE_ARY); ++i) { - if (SwResId(STR_POOLPAGE_ARY[i]) == m_rStyleName) + if (SwResId(STR_POOLPAGE_ARY[i]) == m_sStyleUIName) { m_pOldPageDesc = m_rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_BEGIN + i); break; @@ -2025,10 +2034,10 @@ void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNa if(rPropertyNames.getLength() != rValues.getLength()) throw lang::IllegalArgumentException(); - SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName, &GetDoc()->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent + SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleUIName, &GetDoc()->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent if(m_pBasePool) { - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family()); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family()); SAL_WARN_IF(!pBase, "sw.uno", "where is the style?"); if(!pBase) throw uno::RuntimeException(); @@ -2078,7 +2087,7 @@ SfxStyleSheetBase* SwXStyle::GetStyleSheetBase() { if(!m_pBasePool) return nullptr; - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family()); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family()); return pBase; } void SwXStyle::PrepareStyleBase(SwStyleBase_Impl& rBase) @@ -2398,7 +2407,7 @@ uno::Any SwXStyle::GetPropertyValue_Impl(const SfxItemPropertySet* pPropSet, SwS rtl::Reference<SwXNumberingRules> SwXStyle::getNumberingRules() { - SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName, &m_pDoc->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent + SwStyleBase_Impl aBase(*m_pDoc, m_sStyleUIName, &m_pDoc->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent if(m_pBasePool) { PrepareStyleBase(aBase); @@ -2418,7 +2427,7 @@ uno::Any SwXStyle::getPropertyValue(const OUString& rPropertyName) throw uno::RuntimeException(); sal_uInt16 nPropSetId = m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.propMapType(); const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName, &m_pDoc->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent + SwStyleBase_Impl aBase(*m_pDoc, m_sStyleUIName, &m_pDoc->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent return GetPropertyValue_Impl(pPropSet, aBase, rPropertyName); } @@ -2452,7 +2461,7 @@ void SwXStyle::getToggleAttributes( SolarMutexGuard aGuard; assert(m_pDoc); assert(m_pBasePool); - SfxStyleSheetBase* pStyleSheetBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family()); + SfxStyleSheetBase* pStyleSheetBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family()); assert(pStyleSheetBase); rtl::Reference<SwDocStyleSheet> xDocStyleSheet; auto it = maUnoStyleSheets.find(pStyleSheetBase); @@ -2507,7 +2516,7 @@ uno::Sequence<uno::Any> SwXStyle::getPropertyValues(const uno::Sequence<OUString throw uno::RuntimeException(); sal_uInt16 nPropSetId = m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.propMapType(); const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName, &m_pDoc->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent + SwStyleBase_Impl aBase(*m_pDoc, m_sStyleUIName, &m_pDoc->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent uno::Sequence<uno::Any> aValues(rPropertyNames.getLength()); auto aValuesRange = asNonConstRange(aValues); // workaround for bad designed API @@ -2569,7 +2578,7 @@ uno::Sequence<beans::PropertyState> SwXStyle::getPropertyStates(const uno::Seque if(!m_pBasePool) throw uno::RuntimeException(); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family()); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleUIName, m_rEntry.family()); SAL_WARN_IF(!pBase, "sw.uno", "where is the style?"); if(!pBase) @@ -2876,7 +2885,7 @@ void SwXStyle::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) else if(rHint.GetId() == SfxHintId::StyleSheetChanged) { SfxStyleSheetBasePool& rBP = static_cast<SfxStyleSheetBasePool&>(rBC); - SfxStyleSheetBase* pOwnBase = rBP.Find(m_sStyleName, m_rEntry.family()); + SfxStyleSheetBase* pOwnBase = rBP.Find(m_sStyleUIName, m_rEntry.family()); if(!pOwnBase) { SfxListener::EndListening(rBC); @@ -2887,7 +2896,7 @@ void SwXStyle::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) void SwXStyle::Invalidate() { - m_sStyleName.clear(); + m_sStyleUIName.clear(); m_pBasePool = nullptr; m_pDoc = nullptr; m_xStyleData.clear(); @@ -2935,7 +2944,7 @@ void SwXPageStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rProper const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); - SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrameFormat()->GetAttrSet()); // add pDfltFrameFormat as parent + SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleUIName(), &GetDoc()->GetDfltFrameFormat()->GetAttrSet()); // add pDfltFrameFormat as parent if(!m_pBasePool) { if(!IsDescriptor()) @@ -3193,7 +3202,7 @@ uno::Sequence<uno::Any> SwXPageStyle::GetPropertyValues_Impl(const uno::Sequence } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); - SwStyleBase_Impl aBase(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrameFormat()->GetAttrSet()); // add pDfltFrameFormat as parent + SwStyleBase_Impl aBase(*GetDoc(), GetStyleUIName(), &GetDoc()->GetDfltFrameFormat()->GetAttrSet()); // add pDfltFrameFormat as parent SfxStyleSheetBase* pBase = GetStyleSheetBase(); if(!pBase) throw uno::RuntimeException(); @@ -3403,7 +3412,7 @@ void SwXPageStyle::setPropertyValue(const OUString& rPropertyName, const uno::An { auto pPageDesc = &GetDoc()->GetPageDesc(i); // If we have the right page descriptor stash the necessary formats in import time. - if (pPageDesc->GetName() == GetStyleName()) + if (pPageDesc->GetName() == GetStyleUIName()) { auto pLeftHeader = pPageDesc->GetLeft().GetHeader().GetHeaderFormat(); if (bIsHeader && pLeftHeader) commit 1355e214e29ef01990bd9fb194af9593f1c24a39 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Dec 9 15:53:40 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Dec 10 18:38:14 2024 +0100 tdf#159549 sw: fix style mapping for Character Styles Change-Id: If6a130f21bfb29fe834c7004788183849f39f51e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178172 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit 44878a26e0d934a80ab39d5bf597ca49e46db86e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178247 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index c3e18bfbae48..58be11a12b37 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -861,7 +861,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82173_footnoteStyle, "tdf82173_footnoteStyle.doc // This was footnote text, which didn't match with newly created footnotes CPPUNIT_ASSERT_EQUAL(u"Footnote"_ustr, getProperty<OUString>(getParagraphOfText(1, xFootnoteText), u"ParaStyleName"_ustr)); - uno::Reference<beans::XPropertySet> xPageStyle(getStyles(u"CharacterStyles"_ustr)->getByName(u"Footnote Characters"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPageStyle(getStyles(u"CharacterStyles"_ustr)->getByName(u"Footnote Symbol"_ustr), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL( sal_Int32(58), getProperty< sal_Int32 >(xPageStyle, u"CharEscapementHeight"_ustr) ); CPPUNIT_ASSERT_EQUAL( COL_LIGHTGREEN, getProperty<Color>(xPageStyle, u"CharColor"_ustr)); @@ -890,7 +890,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82173_endnoteStyle, "tdf82173_endnoteStyle.docx" CPPUNIT_ASSERT_EQUAL(u"Endnote"_ustr, getProperty<OUString>(getParagraphOfText(1, xEndnoteText), u"ParaStyleName"_ustr)); CPPUNIT_ASSERT_EQUAL(Color(0x993300), getProperty<Color>(getParagraphOfText(1, xEndnoteText), u"CharColor"_ustr)); - uno::Reference<beans::XPropertySet> xPageStyle(getStyles(u"CharacterStyles"_ustr)->getByName(u"Endnote Characters"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPageStyle(getStyles(u"CharacterStyles"_ustr)->getByName(u"Endnote Symbol"_ustr), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL( sal_Int32(58), getProperty< sal_Int32 >(xPageStyle, u"CharEscapementHeight"_ustr) ); CPPUNIT_ASSERT_EQUAL( COL_LIGHTMAGENTA, getProperty<Color>(xPageStyle, u"CharColor"_ustr)); diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx index 9bf3ae40f050..11bc8089e5ca 100644 --- a/sw/source/core/doc/SwStyleNameMapper.cxx +++ b/sw/source/core/doc/SwStyleNameMapper.cxx @@ -263,7 +263,7 @@ void SwStyleNameMapper::FillProgName( rFillName = rName; if (nId == USHRT_MAX ) { - if (eFlags == SwGetPoolIdFromName::TxtColl || eFlags == SwGetPoolIdFromName::PageDesc) + if (eFlags == SwGetPoolIdFromName::TxtColl || eFlags == SwGetPoolIdFromName::PageDesc || eFlags == SwGetPoolIdFromName::ChrFmt) { // check if it has a " (user)" suffix, if so remove it lcl_CheckSuffixAndDelete(rFillName); @@ -305,7 +305,7 @@ void SwStyleNameMapper::FillUIName( if ( nId == USHRT_MAX ) { rFillName = aName; - if ((eFlags != SwGetPoolIdFromName::TxtColl && eFlags != SwGetPoolIdFromName::PageDesc) || // FIXME do it for all ids + if ((eFlags != SwGetPoolIdFromName::TxtColl && eFlags != SwGetPoolIdFromName::PageDesc && eFlags != SwGetPoolIdFromName::ChrFmt) || // FIXME do it for all ids GetPoolIdFromUIName(aName, eFlags) == USHRT_MAX) { // aName isn't in our Prog name table...check if it has a " (user)" suffix, if so remove it commit 81c55d3929472a75cbf81979a1107c120f9e55f5 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Dec 5 13:15:47 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Dec 10 18:38:08 2024 +0100 tdf#159549 sw: fix style mapping for Page Styles lcl_getUsedPageStyles() needs to convert the style names. Lots of tests request the UIName, testTdf87533_bidi even checks the same style twice with different names. Change-Id: Id173493daffadd0d0a74e089ecba8f19d2b267c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177859 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 0bc6fe5c1b889496fb83730545f9c8593ca65863) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178246 diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index dd22a4937ee2..6cf97a2a9628 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -293,7 +293,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf41542_borderlessPadding) CPPUNIT_TEST_FIXTURE(Test, testPageStyleLayoutDefault) { createSwDoc("hello.odt"); - uno::Reference<beans::XPropertySet> xPropertySet(getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); // This was style::PageStyleLayout_MIRRORED. CPPUNIT_ASSERT_EQUAL(style::PageStyleLayout_ALL, getProperty<style::PageStyleLayout>(xPropertySet, u"PageStyleLayout"_ustr)); } @@ -504,7 +504,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf74524) CPPUNIT_TEST_FIXTURE(Test, testPageStyleLayoutRight) { createSwDoc("hello.odt"); - uno::Reference<beans::XPropertySet> xPropertySet(getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); // This caused a crash. xPropertySet->setPropertyValue(u"PageStyleLayout"_ustr, uno::Any(style::PageStyleLayout_RIGHT)); } @@ -562,7 +562,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo79269_header) CPPUNIT_TEST_FIXTURE(Test, testPageBackground) { createSwDoc("PageBackground.odt"); - uno::Reference<beans::XPropertySet> xPropertySet(getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); // The background image was lost CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, getProperty<drawing::FillStyle>(xPropertySet, u"FillStyle"_ustr)); CPPUNIT_ASSERT_EQUAL(u"Sky"_ustr, getProperty<OUString>(xPropertySet, u"FillBitmapName"_ustr)); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 13490dff0ffe..4ce5edb38557 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1727,12 +1727,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf87533_bidi) // "w:bidi" (specified inside Default paragraph properties) should not be ignored static constexpr OUString writingMode = u"WritingMode"_ustr; //getPropertyName(PROP_WRITING_MODE); - // check: "Default Style" master-style has RTL - { - const uno::Reference<beans::XPropertySet> xPropertySet(getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(text::WritingMode2::RL_TB), getProperty<sal_Int32>(xPropertySet, writingMode)); - } - // check: "Standard" master-style has RTL { const uno::Reference<beans::XPropertySet> xPropertySet(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 3aadb03618ff..1c9b80383668 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1566,38 +1566,32 @@ CPPUNIT_TEST_FIXTURE(Test, testImportHeaderFooter) //Check if Headers/Footers only contain what they should in this document uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>( - getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), - u"HeaderTextFirst"_ustr); + getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), u"HeaderTextFirst"_ustr); OUString aActual = xHeaderText->getString(); CPPUNIT_ASSERT_EQUAL(u"First Page Header"_ustr, aActual); uno::Reference<text::XText> xHeaderTextLeft = getProperty<uno::Reference<text::XText>>( - getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), - u"HeaderTextLeft"_ustr); + getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), u"HeaderTextLeft"_ustr); aActual = xHeaderTextLeft->getString(); CPPUNIT_ASSERT_EQUAL(u"Header even"_ustr, aActual); uno::Reference<text::XText> xHeaderTextRight = getProperty<uno::Reference<text::XText>>( - getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), - u"HeaderTextRight"_ustr); + getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), u"HeaderTextRight"_ustr); aActual = xHeaderTextRight->getString(); CPPUNIT_ASSERT_EQUAL(u"Header uneven"_ustr, aActual); uno::Reference<text::XText> xFooterText = getProperty<uno::Reference<text::XText>>( - getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), - u"FooterTextFirst"_ustr); + getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), u"FooterTextFirst"_ustr); aActual = xFooterText->getString(); CPPUNIT_ASSERT_EQUAL(u"First Page Footer"_ustr, aActual); uno::Reference<text::XText> xFooterTextLeft = getProperty<uno::Reference<text::XText>>( - getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), - u"FooterTextLeft"_ustr); + getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), u"FooterTextLeft"_ustr); aActual = xFooterTextLeft->getString(); CPPUNIT_ASSERT_EQUAL(u"Footer even"_ustr, aActual); uno::Reference<text::XText> xFooterTextRight = getProperty<uno::Reference<text::XText>>( - getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), - u"FooterTextRight"_ustr); + getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), u"FooterTextRight"_ustr); aActual = xFooterTextRight->getString(); CPPUNIT_ASSERT_EQUAL(u"Footer uneven"_ustr, aActual); } @@ -1607,16 +1601,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108947) createSwDoc("tdf108947.rtf"); //Check if Headers/Footers contain what they should in this document uno::Reference<text::XText> xHeaderTextRight = getProperty<uno::Reference<text::XText>>( - getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), - u"HeaderTextRight"_ustr); + getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), u"HeaderTextRight"_ustr); OUString aActual = xHeaderTextRight->getString(); CPPUNIT_ASSERT_EQUAL(u""_ustr, aActual); //Document is very fragile, hence we need this guard. #if HAVE_MORE_FONTS uno::Reference<text::XText> xHeaderTextLeft = getProperty<uno::Reference<text::XText>>( - getStyles(u"PageStyles"_ustr)->getByName(u"Default Page Style"_ustr), - u"HeaderTextLeft"_ustr); + getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), u"HeaderTextLeft"_ustr); aActual = xHeaderTextLeft->getString(); CPPUNIT_ASSERT_EQUAL(u"" SAL_NEWLINE_STRING "Header Page 2 ?"_ustr, aActual); #endif diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index a8263d7fd73c..3e1c5497b25f 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -334,7 +334,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf138302_restartNumbering) DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc") { uno::Reference<container::XNameAccess> pageStyles = getStyles(u"PageStyles"_ustr); - uno::Reference<style::XStyle> pageStyle(pageStyles->getByName(u"Default Page Style"_ustr), uno::UNO_QUERY); + uno::Reference<style::XStyle> pageStyle(pageStyles->getByName(u"Standard"_ustr), uno::UNO_QUERY); bool headerIsOn = getProperty<bool>(pageStyle, u"HeaderIsOn"_ustr); CPPUNIT_ASSERT(headerIsOn); } @@ -344,7 +344,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122460_header) loadAndReload("tdf122460_header.odt"); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<container::XNameAccess> pageStyles = getStyles(u"PageStyles"_ustr); - uno::Reference<style::XStyle> pageStyle(pageStyles->getByName(u"Default Page Style"_ustr), uno::UNO_QUERY); + uno::Reference<style::XStyle> pageStyle(pageStyles->getByName(u"Standard"_ustr), uno::UNO_QUERY); bool headerIsOn = getProperty<bool>(pageStyle, u"HeaderIsOn"_ustr); CPPUNIT_ASSERT(headerIsOn); } diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx index 62d9f440e986..9bf3ae40f050 100644 --- a/sw/source/core/doc/SwStyleNameMapper.cxx +++ b/sw/source/core/doc/SwStyleNameMapper.cxx @@ -263,7 +263,7 @@ void SwStyleNameMapper::FillProgName( rFillName = rName; if (nId == USHRT_MAX ) { - if (eFlags == SwGetPoolIdFromName::TxtColl) + if (eFlags == SwGetPoolIdFromName::TxtColl || eFlags == SwGetPoolIdFromName::PageDesc) { // check if it has a " (user)" suffix, if so remove it lcl_CheckSuffixAndDelete(rFillName); @@ -305,7 +305,7 @@ void SwStyleNameMapper::FillUIName( if ( nId == USHRT_MAX ) { rFillName = aName; - if (eFlags != SwGetPoolIdFromName::TxtColl || // FIXME do it for all ids + if ((eFlags != SwGetPoolIdFromName::TxtColl && eFlags != SwGetPoolIdFromName::PageDesc) || // FIXME do it for all ids GetPoolIdFromUIName(aName, eFlags) == USHRT_MAX) { // aName isn't in our Prog name table...check if it has a " (user)" suffix, if so remove it diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 64b990b4a4c4..08bf9a624fd8 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -88,6 +88,7 @@ #include <rdfhelper.hxx> #include <sfx2/watermarkitem.hxx> +#include <SwStyleNameMapper.hxx> #include <unoparagraph.hxx> #include <strings.hrc> #include <undobj.hxx> @@ -131,7 +132,11 @@ std::vector<OUString> lcl_getUsedPageStyles(SwViewShell const * pShell) { SwPageFrame* pPage = static_cast<SwPageFrame*>(pFrame); if (const SwPageDesc *pDesc = pPage->FindPageDesc()) - aReturn.push_back(pDesc->GetName()); + { + OUString sStyleName; + SwStyleNameMapper::FillUIName(pDesc->GetName(), sStyleName, SwGetPoolIdFromName::PageDesc); + aReturn.push_back(sStyleName); + } } return aReturn;