diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-08-31 12:49:46 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-09-08 11:21:36 +0200 |
commit | ca435be45f316120b9df6c9d547b781ed975817d (patch) | |
tree | 4f69e07c4266fb904269a39930ef2d5b70f1e03c /sw | |
parent | 8ddd66a36e5e54291e56c1a5804d5db3b1ba16bb (diff) |
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@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/DocumentStylePoolManager.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 13 |
2 files changed, 24 insertions, 0 deletions
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); |