summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-08-01 13:50:45 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-08-02 10:36:07 +0200
commit13fac4894f752e922727c6f22c6303712e06ba12 (patch)
tree5689829e917927bb13461d91988ec99e461f1831 /basic
parent13cadf3fe38daa0b4cfddcfa68ec8631bc85f44a (diff)
normalize resource locale ctor construction mechanisms
make them all the same and share std::locales more various OModuleClient, etc, classes go away Change-Id: I7e3ff01a69332eeacd22e3078f66a60318de62d5 Reviewed-on: https://gerrit.libreoffice.org/40634 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/inc/basrid.hxx27
-rw-r--r--basic/source/classes/sb.cxx1
-rw-r--r--basic/source/runtime/basrdll.cxx9
-rw-r--r--basic/source/sbx/sbxscan.cxx27
4 files changed, 13 insertions, 51 deletions
diff --git a/basic/inc/basrid.hxx b/basic/inc/basrid.hxx
deleted file mode 100644
index e6fd817afb23..000000000000
--- a/basic/inc/basrid.hxx
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_BASIC_INC_BASRID_HXX
-#define INCLUDED_BASIC_INC_BASRID_HXX
-
-OUString BasResId(const char* pId);
-
-#endif // INCLUDED_BASIC_INC_BASRID_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 45b85dc6b83a..b810eb0c87ce 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -35,7 +35,6 @@
#include "stdobj.hxx"
#include "filefmt.hxx"
#include "basic.hrc"
-#include <basrid.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/util/XCloseBroadcaster.hpp>
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index da830b4e9e6c..a8fadaa5a1af 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -35,13 +35,11 @@ struct BasicDLL::Impl
bool bDebugMode;
bool bBreakEnabled;
- std::locale aBasResLocale;
std::unique_ptr<SbxAppData> xSbxAppData;
Impl()
: bDebugMode(false)
, bBreakEnabled(true)
- , aBasResLocale(Translate::Create("sb"))
, xSbxAppData(new SbxAppData)
{ }
};
@@ -52,11 +50,6 @@ BasicDLL * BASIC_DLL;
}
-OUString BasResId(const char* pId)
-{
- return Translate::get(pId, BASIC_DLL->GetBasResLocale());
-}
-
BasicDLL::BasicDLL()
: m_xImpl(new Impl)
{
@@ -67,8 +60,6 @@ BasicDLL::~BasicDLL()
{
}
-const std::locale& BasicDLL::GetBasResLocale() const { return m_xImpl->aBasResLocale; }
-
void BasicDLL::EnableBreak( bool bEnable )
{
BasicDLL* pThis = BASIC_DLL;
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index a2cb4f871621..59b1c7b61e29 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -579,21 +579,20 @@ bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen )
}
}
-
-namespace
-{
-
-const std::locale& implGetResLocale()
+const std::locale& BasResLocale()
{
static std::locale loc(Translate::Create("sb"));
return loc;
}
-OUString SbxValueFormatResId(const char *pId)
+OUString BasResId(const char *pId)
{
- return Translate::get(pId, implGetResLocale());
+ return Translate::get(pId, BasResLocale());
}
+namespace
+{
+
enum class VbaFormatType
{
Offset, // standard number format
@@ -820,13 +819,13 @@ void SbxValue::Format( OUString& rRes, const OUString* pFmt ) const
// initialize the Basic-formater help object:
// get resources for predefined output
// of the Format()-command, e. g. for "On/Off"
- OUString aOnStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_ON);
- OUString aOffStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_OFF);
- OUString aYesStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_YES);
- OUString aNoStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_NO);
- OUString aTrueStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_TRUE);
- OUString aFalseStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_FALSE);
- OUString aCurrencyFormatStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_CURRENCY);
+ OUString aOnStrg = BasResId(STR_BASICKEY_FORMAT_ON);
+ OUString aOffStrg = BasResId(STR_BASICKEY_FORMAT_OFF);
+ OUString aYesStrg = BasResId(STR_BASICKEY_FORMAT_YES);
+ OUString aNoStrg = BasResId(STR_BASICKEY_FORMAT_NO);
+ OUString aTrueStrg = BasResId(STR_BASICKEY_FORMAT_TRUE);
+ OUString aFalseStrg = BasResId(STR_BASICKEY_FORMAT_FALSE);
+ OUString aCurrencyFormatStrg = BasResId(STR_BASICKEY_FORMAT_CURRENCY);
rAppData.pBasicFormater = o3tl::make_unique<SbxBasicFormater>(
cComma,c1000,aOnStrg,aOffStrg,