[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sw/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 8 09:22:12 UTC 2020


 sw/source/core/doc/DocumentStylePoolManager.cxx |   11 +++++++++++
 sw/source/core/edit/edfcol.cxx                  |   13 +++++++++++++
 2 files changed, 24 insertions(+)

New commits:
commit ca435be45f316120b9df6c9d547b781ed975817d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Aug 31 12:49:46 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Sep 8 11:21:36 2020 +0200

    writer: handle styles in multiple languages for online
    
    Use translated name when style is applied and broadcasted.
    Avoid using style names created by the first view.
    
    Change-Id: I18abf3388e69f76ec99eda94e0b67782a52ab23f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101831
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 23529c16ff9e..f13c55f72dc2 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -69,6 +69,7 @@
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <unotools/syslocale.hxx>
 #include <i18nlangtag/languagetag.hxx>
+#include <comphelper/lok.hxx>
 
 using namespace ::editeng;
 using namespace ::com::sun::star;
@@ -583,10 +584,20 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
 
     SwTextFormatColl* pNewColl;
     sal_uInt16 nOutLvlBits = 0;
+
     for (size_t n = 0, nSize = m_rDoc.GetTextFormatColls()->size(); n < nSize; ++n)
     {
         if( nId == ( pNewColl = (*m_rDoc.GetTextFormatColls())[ n ] )->GetPoolFormatId() )
         {
+            // in online we can have multiple languages, use translated name
+            if (comphelper::LibreOfficeKit::isActive())
+            {
+                OUString aName;
+                SwStyleNameMapper::GetUIName(nId, aName);
+                if (!aName.isEmpty())
+                    pNewColl->SetName(aName);
+            }
+
             return pNewColl;
         }
 
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 2b49ee16ecc8..830402d2d60c 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -100,6 +100,8 @@
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <tools/diagnose_ex.h>
 #include <IDocumentRedlineAccess.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <comphelper/lok.hxx>
 
 #define WATERMARK_NAME "PowerPlusWaterMarkObject"
 #define WATERMARK_AUTO_SIZE sal_uInt32(1)
@@ -2196,6 +2198,17 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat,
     RedlineFlags eRedlMode = GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags(), eOldMode = eRedlMode;
 
     SwRewriter aRewriter;
+
+    // in online we can have multiple languages, use universal name then
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        OUString aName;
+        sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(pLocal->GetName(), SwGetPoolIdFromName::TxtColl);
+        SwStyleNameMapper::FillProgName(nId, aName);
+        if (!aName.isEmpty())
+            pLocal->SetName(aName);
+    }
+
     aRewriter.AddRule(UndoArg1, pLocal->GetName());
 
     GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::SETFMTCOLL, &aRewriter);


More information about the Libreoffice-commits mailing list