cool#11885 lok: sc: translate TabPrefix by user
In LOKit different users can have different locales on the same file, so when creating a new sheet with the default name, we must ensure that the proper localized name is used. Otherwise the language with which the module is first loaded is always used. A test cannot be added since to test this multiple languages have to be enabled and in Jenkins right now only English is enabled. Change-Id: I6aa4caacc7d079fbf9b14ddf9e27428d77411adf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185055 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 76a02119f39ffdf9dde8f6122707da95490f2253) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185094 Tested-by: Jenkins Reviewed-by: Jaume Pujantell <jaume.pujantell@collabora.com>
This commit is contained in:
@@ -21,6 +21,7 @@ private:
|
||||
SCTAB nInitTabCount; // number of Tabs for new Spreadsheet doc
|
||||
OUString aInitTabPrefix; // The Tab prefix name in new Spreadsheet doc
|
||||
bool bJumboSheets;
|
||||
bool bInitTabPrefixChanged;
|
||||
|
||||
public:
|
||||
ScDefaultsOptions();
|
||||
@@ -29,8 +30,8 @@ public:
|
||||
|
||||
SCTAB GetInitTabCount() const { return nInitTabCount; }
|
||||
void SetInitTabCount( SCTAB nTabs) { nInitTabCount = nTabs; }
|
||||
void SetInitTabPrefix(const OUString& aPrefix) { aInitTabPrefix = aPrefix; }
|
||||
const OUString& GetInitTabPrefix() const { return aInitTabPrefix; }
|
||||
void SetInitTabPrefix(const OUString& aPrefix);
|
||||
OUString GetInitTabPrefix() const;
|
||||
bool GetInitJumboSheets() const { return bJumboSheets; }
|
||||
#if HAVE_FEATURE_JUMBO_SHEETS
|
||||
void SetInitJumboSheets( bool b) { bJumboSheets = b; }
|
||||
|
||||
@@ -386,7 +386,7 @@ void ScDocument::CreateValidTabName(OUString& rName) const
|
||||
|
||||
// Get Custom prefix
|
||||
const ScDefaultsOptions& rOpt = ScModule::get()->GetDefaultsOptions();
|
||||
const OUString& aStrTable = rOpt.GetInitTabPrefix();
|
||||
const OUString aStrTable = rOpt.GetInitTabPrefix();
|
||||
|
||||
bool bOk = false;
|
||||
|
||||
@@ -429,7 +429,7 @@ void ScDocument::CreateValidTabNames(std::vector<OUString>& aNames, SCTAB nCount
|
||||
|
||||
// Get Custom prefix
|
||||
const ScDefaultsOptions& rOpt = ScModule::get()->GetDefaultsOptions();
|
||||
const OUString& aStrTable = rOpt.GetInitTabPrefix();
|
||||
const OUString aStrTable = rOpt.GetInitTabPrefix();
|
||||
|
||||
OUStringBuffer rName;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <scresid.hxx>
|
||||
#include <sc.hrc>
|
||||
#include <utility>
|
||||
#include <comphelper/lok.hxx>
|
||||
|
||||
using namespace utl;
|
||||
using namespace com::sun::star::uno;
|
||||
@@ -30,6 +31,27 @@ void ScDefaultsOptions::SetDefaults()
|
||||
nInitTabCount = 1;
|
||||
aInitTabPrefix = ScResId(STR_TABLE_DEF); // Default Prefix "Sheet"
|
||||
bJumboSheets = false;
|
||||
bInitTabPrefixChanged = false;
|
||||
}
|
||||
|
||||
void ScDefaultsOptions::SetInitTabPrefix(const OUString& aPrefix)
|
||||
{
|
||||
if (aInitTabPrefix != aPrefix)
|
||||
{
|
||||
bInitTabPrefixChanged = true;
|
||||
aInitTabPrefix = aPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
OUString ScDefaultsOptions::GetInitTabPrefix() const
|
||||
{
|
||||
if (comphelper::LibreOfficeKit::isActive() && !bInitTabPrefixChanged)
|
||||
{
|
||||
// LOKit may have different users with different locales, so the proper
|
||||
// translation of the defualt TabPrefix has to be fetched each time
|
||||
return ScResId(STR_TABLE_DEF);
|
||||
}
|
||||
return aInitTabPrefix;
|
||||
}
|
||||
|
||||
bool ScDefaultsOptions::operator==( const ScDefaultsOptions& rOpt ) const
|
||||
|
||||
Reference in New Issue
Block a user