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.k...@collabora.com> AuthorDate: Mon Aug 31 12:49:46 2020 +0200 Commit: Szymon Kłos <szymon.k...@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 <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits