[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/sfx2 offapi/com sfx2/source svx/source sw/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed May 5 12:27:00 UTC 2021


 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 df9ea33934e8069d1789d4e25844a60abb0ec96d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue May 4 13:32:51 2021 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed May 5 14:26:26 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 <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/include/sfx2/tplpitem.hxx b/include/sfx2/tplpitem.hxx
index 9276ab5524ad..ff4a1c99e21f 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 SfxPoolItem*    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 60156ad6d4f3..af761bd99de4 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 );
 }
 
 
@@ -58,6 +61,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;
@@ -72,6 +76,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 0520f5c99a24..a48ae29d91f3 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -69,7 +69,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 580aee5ad8bd..c23d894fd4fd 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -163,11 +163,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))


More information about the Libreoffice-commits mailing list