include/sfx2/tplpitem.hxx | 5 ++++- offapi/com/sun/star/frame/status/Template.idl | 7 +++++++ sfx2/source/dialog/tplpitem.cxx | 11 ++++++++--- svx/source/tbxctrls/StylesPreviewWindow.cxx | 7 ++++++- sw/source/uibase/app/docst.cxx | 7 ++++++- 5 files changed, 31 insertions(+), 6 deletions(-)
New commits: commit 44784c7428503a5a6588ce23b52fe62404cc2f51 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue May 4 13:32:51 2021 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Mon May 10 10:01:17 2021 +0200 Fix style previews widget with multiple languages Broadcast also universal name (English identifier) for styles on change. This allows to select correct style without knowledge about all languages that other users use in other views. Fixes style previews widget in online with multiple sessions in different languages Change-Id: I9b9bcc92d96b5a5482a97a5947f148a638f257d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115093 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115300 Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/include/sfx2/tplpitem.hxx b/include/sfx2/tplpitem.hxx index 927d67e89625..647e2b8e72bf 100644 --- a/include/sfx2/tplpitem.hxx +++ b/include/sfx2/tplpitem.hxx @@ -28,13 +28,16 @@ class SFX2_DLLPUBLIC SfxTemplateItem final : public SfxFlagItem { OUString aStyle; + OUString aStyleIdentifier; public: static SfxPoolItem* CreateDefault(); SfxTemplateItem(); SfxTemplateItem( sal_uInt16 nWhich, - const OUString &rStyle ); + const OUString &rStyle, + const OUString &rStyleIdentifier = "" ); const OUString& GetStyleName() const { return aStyle; } + const OUString& GetStyleIdentifier() const { return aStyleIdentifier; } virtual SfxTemplateItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual bool operator==( const SfxPoolItem& ) const override; diff --git a/offapi/com/sun/star/frame/status/Template.idl b/offapi/com/sun/star/frame/status/Template.idl index e9e688eb1363..9bb9402cef89 100644 --- a/offapi/com/sun/star/frame/status/Template.idl +++ b/offapi/com/sun/star/frame/status/Template.idl @@ -39,6 +39,13 @@ struct Template /** specifies a value that is bound to the style name. */ long Value; + + + /** specifies an identifier name in English (only for standard style). + + @since LO 7.2 + */ + string StyleNameIdentifier; }; diff --git a/sfx2/source/dialog/tplpitem.cxx b/sfx2/source/dialog/tplpitem.cxx index 66f378620acb..11d48584d304 100644 --- a/sfx2/source/dialog/tplpitem.cxx +++ b/sfx2/source/dialog/tplpitem.cxx @@ -31,9 +31,11 @@ SfxTemplateItem::SfxTemplateItem() : SfxTemplateItem::SfxTemplateItem ( sal_uInt16 nWhichId, // Slot-ID - const OUString& rStyle // Name of the current Styles + const OUString& rStyle, // Name of the current Styles + const OUString& rStyleIdentifier // Prog Name of current Style ) : SfxFlagItem( nWhichId, static_cast<sal_uInt16>(SfxStyleSearchBits::All) ), - aStyle( rStyle ) + aStyle( rStyle ), + aStyleIdentifier( rStyleIdentifier ) { } @@ -42,7 +44,8 @@ SfxTemplateItem::SfxTemplateItem bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const { return ( SfxFlagItem::operator==( rCmp ) && - aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle ); + aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle && + aStyleIdentifier == static_cast<const SfxTemplateItem&>(rCmp).aStyleIdentifier ); } SfxTemplateItem* SfxTemplateItem::Clone( SfxItemPool *) const @@ -56,6 +59,7 @@ bool SfxTemplateItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) aTemplate.Value = static_cast<sal_uInt16>(GetValue()); aTemplate.StyleName = aStyle; + aTemplate.StyleNameIdentifier = aStyleIdentifier; rVal <<= aTemplate; return true; @@ -70,6 +74,7 @@ bool SfxTemplateItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId { SetValue( static_cast<SfxStyleSearchBits>(aTemplate.Value) ); aStyle = aTemplate.StyleName; + aStyleIdentifier = aTemplate.StyleNameIdentifier; return true; } diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index a4b937eb6790..b557aade7ce3 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -71,7 +71,12 @@ void StyleStatusListener::StateChanged(SfxItemState /*eState*/, const SfxPoolIte { const SfxTemplateItem* pStateItem = dynamic_cast<const SfxTemplateItem*>(pState); if (pStateItem) - m_pPreviewControl->Select(pStateItem->GetStyleName()); + { + if (pStateItem->GetStyleIdentifier().isEmpty()) + m_pPreviewControl->Select(pStateItem->GetStyleName()); + else + m_pPreviewControl->Select(pStateItem->GetStyleIdentifier()); + } } StylePoolChangeListener::StylePoolChangeListener(StylesPreviewWindow_Base* pPreviewControl) diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 2907b54e6a9e..f2db30a82c98 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -149,11 +149,16 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) case SID_STYLE_FAMILY2: if(!pShell->IsFrameSelected()) { + OUString aProgName; SwTextFormatColl* pColl = pShell->GetCurTextFormatColl(); if(pColl) + { aName = pColl->GetName(); + sal_uInt16 nId = pColl->GetPoolFormatId(); + SwStyleNameMapper::FillProgName(nId, aProgName); + } - SfxTemplateItem aItem(nWhich, aName); + SfxTemplateItem aItem(nWhich, aName, aProgName); SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto; if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits