summaryrefslogtreecommitdiff
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
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>
-rw-r--r--accessibility/inc/helper/accresmgr.hxx36
-rw-r--r--accessibility/source/extended/accessibleeditbrowseboxcell.cxx4
-rw-r--r--accessibility/source/extended/accessiblelistboxentry.cxx4
-rw-r--r--accessibility/source/helper/accresmgr.cxx36
-rw-r--r--accessibility/source/standard/vclxaccessiblebutton.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessiblecheckbox.cxx4
-rw-r--r--accessibility/source/standard/vclxaccessiblescrollbar.cxx4
-rw-r--r--accessibility/source/standard/vclxaccessibletoolboxitem.cxx2
-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
-rw-r--r--compilerplugins/clang/constantparam.booleans.results4
-rw-r--r--connectivity/source/commontools/sqlerror.cxx35
-rw-r--r--cui/source/options/optdict.cxx2
-rw-r--r--cui/source/tabpages/backgrnd.cxx2
-rw-r--r--dbaccess/inc/core_resource.hxx21
-rw-r--r--dbaccess/source/core/api/RowSetBase.hxx1
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.hxx1
-rw-r--r--dbaccess/source/core/resource/core_resource.cxx37
-rw-r--r--dbaccess/source/ui/app/AppController.hxx1
-rw-r--r--dbaccess/source/ui/inc/FieldControls.hxx2
-rw-r--r--dbaccess/source/ui/inc/GeneralUndo.hxx2
-rw-r--r--dbaccess/source/ui/inc/JoinController.hxx1
-rw-r--r--dbaccess/source/ui/inc/RelationDlg.hxx1
-rw-r--r--dbaccess/source/ui/inc/TableController.hxx1
-rw-r--r--dbaccess/source/ui/inc/TableGrantCtrl.hxx2
-rw-r--r--dbaccess/source/ui/inc/TokenWriter.hxx1
-rw-r--r--dbaccess/source/ui/inc/UserAdminDlg.hxx3
-rw-r--r--dbaccess/source/ui/inc/advancedsettingsdlg.hxx1
-rw-r--r--dbaccess/source/ui/inc/brwctrlr.hxx1
-rw-r--r--dbaccess/source/ui/inc/dbtreelistbox.hxx1
-rw-r--r--dbaccess/source/ui/inc/dbwiz.hxx3
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx3
-rw-r--r--dbaccess/source/ui/inc/directsql.hxx1
-rw-r--r--dbaccess/source/ui/inc/formadapter.hxx1
-rw-r--r--dbaccess/source/ui/inc/indexfieldscontrol.hxx1
-rw-r--r--dbaccess/source/ui/inc/unoadmin.hxx1
-rw-r--r--dbaccess/source/ui/inc/unosqlmessage.hxx1
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx1
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.hxx1
-rw-r--r--dbaccess/source/ui/uno/dbinteraction.hxx1
-rw-r--r--dbaccess/source/ui/uno/textconnectionsettings_uno.cxx1
-rw-r--r--dbaccess/source/ui/uno/unoDirectSql.hxx1
-rw-r--r--filter/source/t602/t602filter.cxx29
-rw-r--r--filter/source/t602/t602filter.hxx7
-rw-r--r--filter/source/xsltdialog/xmlfiltercommon.hxx1
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx36
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.hxx10
-rw-r--r--filter/source/xsltdialog/xmlfiltertabdialog.cxx5
-rw-r--r--filter/source/xsltdialog/xmlfiltertabdialog.hxx4
-rw-r--r--formula/Library_for.mk1
-rw-r--r--formula/Library_forui.mk3
-rw-r--r--formula/inc/core_resource.hxx (renamed from svl/source/misc/getstringresource.hxx)13
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx4
-rw-r--r--formula/source/core/inc/core_resource.hxx72
-rw-r--r--formula/source/core/resource/core_resource.cxx60
-rw-r--r--formula/source/ui/dlg/formula.cxx6
-rw-r--r--formula/source/ui/dlg/funcpage.cxx1
-rw-r--r--formula/source/ui/dlg/funcpage.hxx2
-rw-r--r--formula/source/ui/dlg/funcutl.cxx6
-rw-r--r--formula/source/ui/dlg/omoduleclient.cxx34
-rw-r--r--formula/source/ui/dlg/parawin.cxx6
-rw-r--r--formula/source/ui/dlg/parawin.hxx2
-rw-r--r--formula/source/ui/dlg/structpg.cxx1
-rw-r--r--formula/source/ui/dlg/structpg.hxx3
-rw-r--r--formula/source/ui/inc/ModuleHelper.hxx66
-rw-r--r--formula/source/ui/resource/ModuleHelper.cxx123
-rw-r--r--fpicker/Library_fps_aqua.mk1
-rw-r--r--fpicker/inc/fpsofficeResMgr.hxx26
-rw-r--r--fpicker/source/office/iodlg.cxx1
-rw-r--r--fpicker/source/office/iodlgimp.cxx4
-rw-r--r--include/basic/basrdll.hxx2
-rw-r--r--include/basic/sbdef.hxx2
-rw-r--r--include/formula/formula.hxx3
-rw-r--r--include/formula/omoduleclient.hxx44
-rw-r--r--include/sfx2/sfxresid.hxx6
-rw-r--r--include/svl/svlresid.hxx21
-rw-r--r--include/svtools/ehdl.hxx13
-rw-r--r--include/svtools/svtresid.hxx10
-rw-r--r--sc/source/ui/app/scmod.cxx2
-rw-r--r--scaddins/source/analysis/analysis.cxx2
-rw-r--r--sd/source/ui/app/sdmod.cxx2
-rw-r--r--sd/source/ui/func/futhes.cxx2
-rw-r--r--sfx2/source/appl/appinit.cxx9
-rw-r--r--sfx2/source/appl/appquit.cxx2
-rw-r--r--sfx2/source/appl/shutdownicon.cxx8
-rw-r--r--sfx2/source/bastyp/sfxresid.cxx21
-rw-r--r--sfx2/source/inc/appdata.hxx4
-rw-r--r--svl/source/misc/getstringresource.cxx3
-rw-r--r--svl/source/misc/inettype.cxx3
-rw-r--r--svtools/source/misc/ehdl.cxx66
-rw-r--r--svtools/source/misc/svtresid.cxx17
-rw-r--r--svx/source/items/svxerr.cxx2
-rw-r--r--sw/source/uibase/app/swmodule.cxx2
-rw-r--r--sw/source/uibase/uiview/viewling.cxx4
96 files changed, 163 insertions, 906 deletions
diff --git a/accessibility/inc/helper/accresmgr.hxx b/accessibility/inc/helper/accresmgr.hxx
index 24fa1cfa4721..a9aac50a141b 100644
--- a/accessibility/inc/helper/accresmgr.hxx
+++ b/accessibility/inc/helper/accresmgr.hxx
@@ -22,41 +22,7 @@
#include <rtl/ustring.hxx>
-#define TK_RES_STRING(id) ::accessibility::TkResMgr::loadString(id)
-
-// TkResMgr
-
-namespace accessibility
-{
-
-class TkResMgr
-{
- static std::locale* m_pImpl;
-
-private:
- // no instantiation allowed
- TkResMgr() = delete;
- ~TkResMgr() { }
-
- // we'll instantiate one static member of the following class,
- // which in its dtor ensures that m_pImpl will be deleted
- class EnsureDelete
- {
- public:
- EnsureDelete() { }
- ~EnsureDelete();
- };
- friend class EnsureDelete;
-
-protected:
- static void ensureImplExists();
-
-public:
- // loads the string with the specified resource id
- static OUString loadString(const char *pResId);
-};
-
-}
+OUString AccResId(const char* pId);
#endif // INCLUDED_ACCESSIBILITY_INC_HELPER_ACCRESMGR_HXX
diff --git a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
index b2741e246df1..221dd742b3d3 100644
--- a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
+++ b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
@@ -113,8 +113,8 @@ namespace accessibility
SolarMethodGuard aGuard(getMutex());
ensureIsAlive();
- return TK_RES_STRING(RID_STR_ACC_COLUMN_NUM).replaceAll("%COLUMNNUMBER", OUString::number(getColumnPos()-1)) + ", "
- + TK_RES_STRING(RID_STR_ACC_ROW_NUM).replaceAll("%ROWNUMBER", OUString::number(getRowPos()));
+ return AccResId(RID_STR_ACC_COLUMN_NUM).replaceAll("%COLUMNNUMBER", OUString::number(getColumnPos()-1)) + ", "
+ + AccResId(RID_STR_ACC_ROW_NUM).replaceAll("%ROWNUMBER", OUString::number(getRowPos()));
}
css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleRelationSet()
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx
index 2eef354aa240..bd996fded674 100644
--- a/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -822,8 +822,8 @@ namespace accessibility
{
if( pEntry->HasChildren() || pEntry->HasChildrenOnDemand() )
return getListBox()->IsExpanded( pEntry ) ?
- TK_RES_STRING(STR_SVT_ACC_ACTION_COLLAPSE) :
- TK_RES_STRING(STR_SVT_ACC_ACTION_EXPAND);
+ AccResId(STR_SVT_ACC_ACTION_COLLAPSE) :
+ AccResId(STR_SVT_ACC_ACTION_EXPAND);
return OUString();
}
diff --git a/accessibility/source/helper/accresmgr.cxx b/accessibility/source/helper/accresmgr.cxx
index 7ffcafb3080f..7bf55e120737 100644
--- a/accessibility/source/helper/accresmgr.cxx
+++ b/accessibility/source/helper/accresmgr.cxx
@@ -20,40 +20,10 @@
#include <helper/accresmgr.hxx>
#include <unotools/resmgr.hxx>
-using namespace accessibility;
-
-// TkResMgr
-
-std::locale* TkResMgr::m_pImpl = nullptr;
-
-TkResMgr::EnsureDelete::~EnsureDelete()
+OUString AccResId(const char* pId)
{
- delete TkResMgr::m_pImpl;
-}
-
-void TkResMgr::ensureImplExists()
-{
- if (m_pImpl)
- return;
-
- m_pImpl = new std::locale(Translate::Create("acc"));
-
- if (m_pImpl)
- {
- // now that we have a impl class, make sure it's deleted on unloading the library
- static TkResMgr::EnsureDelete s_aDeleteTheImplClass;
- }
-}
-
-OUString TkResMgr::loadString(const char *pResId)
-{
- OUString sReturn;
-
- ensureImplExists();
- if (m_pImpl)
- sReturn = Translate::get(pResId, *m_pImpl);
-
- return sReturn;
+ static std::locale loc = Translate::Create("acc");
+ return Translate::get(pId, loc);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
index f26e56d972cb..c95004327f86 100644
--- a/accessibility/source/standard/vclxaccessiblebutton.cxx
+++ b/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -149,7 +149,7 @@ OUString VCLXAccessibleButton::getAccessibleName( )
if ( nLength == 3 )
{
// it's a browse button
- aName = TK_RES_STRING( RID_STR_ACC_NAME_BROWSEBUTTON );
+ aName = AccResId( RID_STR_ACC_NAME_BROWSEBUTTON );
}
else
{
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index 0e01a6680e82..f8243bfc7254 100644
--- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -218,9 +218,9 @@ OUString VCLXAccessibleCheckBox::getAccessibleActionDescription ( sal_Int32 nInd
throw IndexOutOfBoundsException();
if(IsChecked())
- return TK_RES_STRING( RID_STR_ACC_ACTION_UNCHECK );
+ return AccResId( RID_STR_ACC_ACTION_UNCHECK );
else
- return TK_RES_STRING( RID_STR_ACC_ACTION_CHECK );
+ return AccResId( RID_STR_ACC_ACTION_CHECK );
}
diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
index 8624de5b6c4d..bb83d7ac832d 100644
--- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx
+++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
@@ -265,9 +265,9 @@ OUString VCLXAccessibleScrollBar::getAccessibleName( )
if ( pVCLXScrollBar )
{
if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::HORIZONTAL )
- aName = TK_RES_STRING( RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL );
+ aName = AccResId( RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL );
else if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::VERTICAL )
- aName = TK_RES_STRING( RID_STR_ACC_SCROLLBAR_NAME_VERTICAL );
+ aName = AccResId( RID_STR_ACC_SCROLLBAR_NAME_VERTICAL );
}
return aName;
}
diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
index 2a575760dd12..5dbc3b4d1050 100644
--- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
@@ -359,7 +359,7 @@ OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleDescription( )
if (m_nRole == AccessibleRole::PANEL && getAccessibleChildCount() > 0)
{
- return TK_RES_STRING( RID_STR_ACC_PANEL_DESCRIPTION );
+ return AccResId( RID_STR_ACC_PANEL_DESCRIPTION );
}
else
{
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,
diff --git a/compilerplugins/clang/constantparam.booleans.results b/compilerplugins/clang/constantparam.booleans.results
index 1a2dd6fc110f..494984d75268 100644
--- a/compilerplugins/clang/constantparam.booleans.results
+++ b/compilerplugins/clang/constantparam.booleans.results
@@ -794,10 +794,6 @@ include/svtools/editsyntaxhighlighter.hxx:42
void MultiLineEditSyntaxHighlight::MultiLineEditSyntaxHighlight(class vcl::Window *,long,enum HighlighterLanguage)
enum HighlighterLanguage aLanguage
1
-include/svtools/ehdl.hxx:36
- void SfxErrorContext::SfxErrorContext(unsigned short,class vcl::Window *,unsigned short,class ResMgr *)
- class ResMgr * pMgrP
- 0
include/svtools/fileview.hxx:176
void SvtFileView::EnableDelete(_Bool)
_Bool bEnable
diff --git a/connectivity/source/commontools/sqlerror.cxx b/connectivity/source/commontools/sqlerror.cxx
index a2fcf1103683..066719eb9963 100644
--- a/connectivity/source/commontools/sqlerror.cxx
+++ b/connectivity/source/commontools/sqlerror.cxx
@@ -78,28 +78,22 @@ namespace connectivity
SQLException
impl_buildSQLException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext,
const ParamValue& _rParamValue1, const ParamValue& _rParamValue2, const ParamValue& _rParamValue3 );
-
- /// initializes our resource bundle
- bool impl_initResources();
-
private:
::osl::Mutex m_aMutex;
- std::unique_ptr<std::locale> m_xResources;
- bool m_bAttemptedInit;
+ std::locale m_aResources;
};
- SQLError_Impl::SQLError_Impl() : m_bAttemptedInit( false )
+ SQLError_Impl::SQLError_Impl()
+ : m_aResources(Translate::Create("cnr"))
{
}
-
const OUString& SQLError_Impl::getMessagePrefix()
{
static const OUString s_sMessagePrefix( "[OOoBase]" );
return s_sMessagePrefix;
}
-
namespace
{
@@ -239,12 +233,9 @@ namespace connectivity
{
OUStringBuffer aMessage;
- if ( impl_initResources() )
- {
- OUString sResMessage(Translate::get(lcl_getResourceErrorID(_eCondition), *m_xResources));
- OSL_ENSURE( !sResMessage.isEmpty(), "SQLError_Impl::impl_getErrorMessage: illegal error condition, or invalid resource!" );
- aMessage.append( getMessagePrefix() ).append( " " ).append( sResMessage );
- }
+ OUString sResMessage(Translate::get(lcl_getResourceErrorID(_eCondition), m_aResources));
+ OSL_ENSURE( !sResMessage.isEmpty(), "SQLError_Impl::impl_getErrorMessage: illegal error condition, or invalid resource!" );
+ aMessage.append( getMessagePrefix() ).append( " " ).append( sResMessage );
return aMessage.makeStringAndClear();
}
@@ -257,20 +248,6 @@ namespace connectivity
return sState;
}
- bool SQLError_Impl::impl_initResources()
- {
- if (m_xResources.get())
- return true;
- if (m_bAttemptedInit)
- return false;
-
- ::osl::MutexGuard aGuard( m_aMutex );
- m_bAttemptedInit = true;
-
- m_xResources.reset(new std::locale(Translate::Create("cnr")));
- return m_xResources.get() != nullptr;
- }
-
SQLError::SQLError()
:m_pImpl( new SQLError_Impl )
{
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index c6ae57d78673..9f2c1707e152 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -177,7 +177,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, Button*, void)
xNewDic = nullptr;
// error: couldn't create new dictionary
SfxErrorContext aContext( ERRCTX_SVX_LINGU_DICTIONARY, OUString(),
- this, getRID_SVXERRCTX(), &SvxResLocale() );
+ this, getRID_SVXERRCTX(), SvxResLocale() );
ErrorHandler::HandleError( *new StringErrorInfo(
ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE, sDict ) );
EndDialog();
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index a338057e7a1a..87aa1afad9f1 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -822,7 +822,7 @@ void SvxBackgroundTabPage::RaiseLoadError_Impl()
OUString(),
this,
getRID_SVXERRCTX(),
- &SvxResLocale() );
+ SvxResLocale() );
ErrorHandler::HandleError(
*new StringErrorInfo( ERRCODE_SVX_GRAPHIC_NOTREADABLE,
diff --git a/dbaccess/inc/core_resource.hxx b/dbaccess/inc/core_resource.hxx
index ecbdcdde5bf4..91ddb2df347c 100644
--- a/dbaccess/inc/core_resource.hxx
+++ b/dbaccess/inc/core_resource.hxx
@@ -32,22 +32,11 @@ namespace dbaccess
// handling resources within the DBA-Core library
class OOO_DLLPUBLIC_DBA ResourceManager
{
- friend class OModuleClient;
- static sal_Int32 s_nClients; /// number of registered clients
- static std::locale* m_pImpl;
-
private:
// no instantiation allowed
ResourceManager() = delete;
~ResourceManager() { }
- protected:
- static void ensureImplExists();
- /// register a client for the module
- static void registerClient();
- /// revoke a client for the module
- static void revokeClient();
-
public:
/** loads the string with the specified resource id
*/
@@ -89,16 +78,6 @@ namespace dbaccess
const OUString& _rReplace2
);
};
-
- // OModuleClient
- /** base class for objects which uses any global module-specific resources
- */
- class OModuleClient
- {
- public:
- OModuleClient() { ResourceManager::registerClient(); }
- ~OModuleClient() { ResourceManager::revokeClient(); }
- };
}
#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CORE_RESOURCE_HXX
diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx
index 4f1334277fb1..c998404cfffa 100644
--- a/dbaccess/source/core/api/RowSetBase.hxx
+++ b/dbaccess/source/core/api/RowSetBase.hxx
@@ -73,7 +73,6 @@ namespace dbaccess
public ::comphelper::OPropertyStateContainer,
public ::comphelper::OPropertyArrayUsageHelper<ORowSetBase> // this class hold the static property info
{
- OModuleClient m_aModuleClient;
protected:
typedef std::vector<ORowSetDataColumn*> TDataColumns;
::osl::Mutex* m_pMutex; // this the mutex form the rowset itself
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index 3a9f2c750db0..0a19884d568c 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -165,7 +165,6 @@ public:
};
private:
- OModuleClient m_aModuleClient;
css::uno::WeakReference< css::frame::XModel > m_xModel;
css::uno::WeakReference< css::sdbc::XDataSource > m_xDataSource;
diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx
index a82f56fec58d..3553c4283ad2 100644
--- a/dbaccess/source/core/resource/core_resource.cxx
+++ b/dbaccess/source/core/resource/core_resource.cxx
@@ -27,7 +27,6 @@
namespace dbaccess
{
-
// ResourceManager
namespace
{
@@ -35,26 +34,10 @@ namespace dbaccess
struct theResourceManagerMutex : public rtl::Static< osl::Mutex, theResourceManagerMutex > {};
}
- sal_Int32 ResourceManager::s_nClients = 0;
- std::locale* ResourceManager::m_pImpl = nullptr;
-
- void ResourceManager::ensureImplExists()
- {
- if (m_pImpl)
- return;
-
- m_pImpl = new std::locale(Translate::Create("dba"));
- }
-
OUString ResourceManager::loadString(const char* pResId)
{
- OUString sReturn;
-
- ensureImplExists();
- if (m_pImpl)
- sReturn = Translate::get(pResId, *m_pImpl);
-
- return sReturn;
+ static std::locale loc = Translate::Create("dba");
+ return Translate::get(pResId, loc);
}
OUString ResourceManager::loadString(const char* pResId, const sal_Char* _pPlaceholderAscii, const OUString& _rReplace)
@@ -71,22 +54,6 @@ namespace dbaccess
sString = sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii2), _rReplace2 );
return sString;
}
-
- void ResourceManager::registerClient()
- {
- ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
- ++s_nClients;
- }
-
- void ResourceManager::revokeClient()
- {
- ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
- if (!--s_nClients && m_pImpl)
- {
- delete m_pImpl;
- m_pImpl = nullptr;
- }
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx
index d20375179298..8c54c9f44f5c 100644
--- a/dbaccess/source/ui/app/AppController.hxx
+++ b/dbaccess/source/ui/app/AppController.hxx
@@ -94,7 +94,6 @@ namespace dbaui
css::uno::Reference< css::sdbc::XDatabaseMetaData >
m_xMetaData;
- dbaccess::OModuleClient m_aModuleClient;
TransferableDataHelper m_aSystemClipboard; // content of the clipboard
css::uno::Reference< css::beans::XPropertySet >
m_xDataSource;
diff --git a/dbaccess/source/ui/inc/FieldControls.hxx b/dbaccess/source/ui/inc/FieldControls.hxx
index 225f6ef3bd99..50c924fca599 100644
--- a/dbaccess/source/ui/inc/FieldControls.hxx
+++ b/dbaccess/source/ui/inc/FieldControls.hxx
@@ -30,7 +30,6 @@ namespace dbaui
class OPropColumnEditCtrl : public OSQLNameEdit
{
- dbaccess::OModuleClient m_aModuleClient;
short m_nPos;
OUString m_strHelpText;
public:
@@ -44,7 +43,6 @@ namespace dbaui
class OPropEditCtrl : public Edit
{
- dbaccess::OModuleClient m_aModuleClient;
short m_nPos;
OUString m_strHelpText;
diff --git a/dbaccess/source/ui/inc/GeneralUndo.hxx b/dbaccess/source/ui/inc/GeneralUndo.hxx
index cbea8346b2b0..cb0d6abb2f97 100644
--- a/dbaccess/source/ui/inc/GeneralUndo.hxx
+++ b/dbaccess/source/ui/inc/GeneralUndo.hxx
@@ -29,8 +29,6 @@ namespace dbaui
class OCommentUndoAction : public SfxUndoAction
{
- dbaccess::OModuleClient m_aModuleClient;
-
protected:
OUString m_strComment; // undo, redo comment
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx
index b03e5f6bfa52..1fedfdcedc0c 100644
--- a/dbaccess/source/ui/inc/JoinController.hxx
+++ b/dbaccess/source/ui/inc/JoinController.hxx
@@ -43,7 +43,6 @@ namespace dbaui
class OJoinController : public OJoinController_BASE
{
- dbaccess::OModuleClient m_aModuleClient;
protected:
TTableConnectionData m_vTableConnectionData;
TTableWindowData m_vTableData;
diff --git a/dbaccess/source/ui/inc/RelationDlg.hxx b/dbaccess/source/ui/inc/RelationDlg.hxx
index 46749fc1e3ec..3227ea0dbc11 100644
--- a/dbaccess/source/ui/inc/RelationDlg.hxx
+++ b/dbaccess/source/ui/inc/RelationDlg.hxx
@@ -35,7 +35,6 @@ namespace dbaui
class ORelationDialog : public ModalDialog
,public IRelationControlInterface
{
- dbaccess::OModuleClient m_aModuleClient;
std::unique_ptr<OTableListBoxControl> m_xTableControl;
OJoinTableView::OTableWindowMap* m_pTableMap;
diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx
index e229483c9c27..2b76d4acce70 100644
--- a/dbaccess/source/ui/inc/TableController.hxx
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -38,7 +38,6 @@ namespace dbaui
class OTableController : public OTableController_BASE
{
private:
- dbaccess::OModuleClient m_aModuleClient;
std::vector< std::shared_ptr<OTableRow> > m_vRowList;
OTypeInfoMap m_aTypeInfo;
std::vector<OTypeInfoMap::iterator> m_aTypeInfoIndex;
diff --git a/dbaccess/source/ui/inc/TableGrantCtrl.hxx b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
index ee4850107f43..e11040d92703 100644
--- a/dbaccess/source/ui/inc/TableGrantCtrl.hxx
+++ b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
@@ -43,8 +43,6 @@ class OTableGrantControl : public ::svt::EditBrowseBox
typedef std::map<OUString, TPrivileges> TTablePrivilegeMap;
- dbaccess::OModuleClient m_aModuleClient;
-
css::uno::Reference< css::container::XNameAccess > m_xUsers;
css::uno::Reference< css::container::XNameAccess > m_xTables;
css::uno::Reference< css::uno::XComponentContext> m_xContext;
diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx
index 3d8540ba9214..8dfaa504781b 100644
--- a/dbaccess/source/ui/inc/TokenWriter.hxx
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -183,7 +183,6 @@ namespace dbaui
class ORowSetImportExport : public ODatabaseImportExport
{
- dbaccess::OModuleClient m_aModuleClient;
std::vector<sal_Int32> m_aColumnMapping;
std::vector<sal_Int32> m_aColumnTypes;
css::uno::Reference< css::sdbc::XResultSetUpdate > m_xTargetResultSetUpdate;
diff --git a/dbaccess/source/ui/inc/UserAdminDlg.hxx b/dbaccess/source/ui/inc/UserAdminDlg.hxx
index 5c1ced4d136a..cc43e2d2b3d5 100644
--- a/dbaccess/source/ui/inc/UserAdminDlg.hxx
+++ b/dbaccess/source/ui/inc/UserAdminDlg.hxx
@@ -43,9 +43,8 @@ namespace dbaui
/** implements the user admin dialog
*/
- class OUserAdminDlg : public SfxTabDialog, public IItemSetHelper, public IDatabaseSettingsDialog, public dbaccess::OModuleClient
+ class OUserAdminDlg : public SfxTabDialog, public IItemSetHelper, public IDatabaseSettingsDialog
{
- dbaccess::OModuleClient m_aModuleClient;
std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
SfxItemSet* m_pItemSet;
css::uno::Reference< css::sdbc::XConnection> m_xConnection;
diff --git a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
index 5ac918089a28..2f5650690b28 100644
--- a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
+++ b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
@@ -38,7 +38,6 @@ namespace dbaui
,public IItemSetHelper
,public IDatabaseSettingsDialog
{
- dbaccess::OModuleClient m_aModuleClient;
std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
protected:
diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx
index f0f5160ae75b..a2269f1c3971 100644
--- a/dbaccess/source/ui/inc/brwctrlr.hxx
+++ b/dbaccess/source/ui/inc/brwctrlr.hxx
@@ -76,7 +76,6 @@ namespace dbaui
// for implementing the XFormController
class FormControllerImpl;
friend class FormControllerImpl;
- dbaccess::OModuleClient m_aModuleClient;
css::uno::Reference< css::sdbc::XRowSet > m_xRowSet; // our rowset
css::uno::Reference< css::sdbcx::XColumnsSupplier > m_xColumnsSupplier; // queried from the rowset member
diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx
index 695a6a3e2734..23600ade0adf 100644
--- a/dbaccess/source/ui/inc/dbtreelistbox.hxx
+++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx
@@ -51,7 +51,6 @@ namespace dbaui
class IContextMenuProvider;
class DBTreeListBox :public SvTreeListBox
{
- dbaccess::OModuleClient m_aModuleClient;
OScrollHelper m_aScrollHelper;
Timer m_aTimer; // is needed for table updates
Point m_aMousePos;
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
index 6d43a639dcee..5c10a924dbe4 100644
--- a/dbaccess/source/ui/inc/dbwiz.hxx
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -52,10 +52,9 @@ class OGeneralPage;
class ODbDataSourceAdministrationHelper;
/** tab dialog for administrating the office wide registered data sources
*/
-class ODbTypeWizDialog : public svt::OWizardMachine , public IItemSetHelper, public IDatabaseSettingsDialog, public dbaccess::OModuleClient
+class ODbTypeWizDialog : public svt::OWizardMachine , public IItemSetHelper, public IDatabaseSettingsDialog
{
private:
- dbaccess::OModuleClient m_aModuleClient;
std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
SfxItemSet* m_pOutSet;
::dbaccess::ODsnTypeCollection*
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index 952ce5e29492..5a4dece458e2 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -56,10 +56,9 @@ class ODbDataSourceAdministrationHelper;
class OMySQLIntroPageSetup;
class OFinalDBPageSetup;
-class ODbTypeWizDialogSetup : public svt::RoadmapWizard , public IItemSetHelper, public IDatabaseSettingsDialog, public dbaccess::OModuleClient
+class ODbTypeWizDialogSetup : public svt::RoadmapWizard , public IItemSetHelper, public IDatabaseSettingsDialog
{
private:
- dbaccess::OModuleClient m_aModuleClient;
std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
SfxItemSet* m_pOutSet;
OUString m_sURL;
diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx
index 88cf84be00c0..422ccba494ce 100644
--- a/dbaccess/source/ui/inc/directsql.hxx
+++ b/dbaccess/source/ui/inc/directsql.hxx
@@ -46,7 +46,6 @@ namespace dbaui
,public ::utl::OEventListenerAdapter
{
protected:
- dbaccess::OModuleClient m_aModuleClient;
::osl::Mutex m_aMutex;
VclPtr<MultiLineEditSyntaxHighlight> m_pSQL;
diff --git a/dbaccess/source/ui/inc/formadapter.hxx b/dbaccess/source/ui/inc/formadapter.hxx
index 2ceea1f294e6..b4c16b7cad23 100644
--- a/dbaccess/source/ui/inc/formadapter.hxx
+++ b/dbaccess/source/ui/inc/formadapter.hxx
@@ -120,7 +120,6 @@ namespace dbaui
,public SbaXFormAdapter_BASE3
{
private:
- dbaccess::OModuleClient m_aModuleClient;
css::uno::Reference< css::sdbc::XRowSet > m_xMainForm;
::osl::Mutex m_aMutex;
diff --git a/dbaccess/source/ui/inc/indexfieldscontrol.hxx b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
index 034e28bb0856..e8d893a91186 100644
--- a/dbaccess/source/ui/inc/indexfieldscontrol.hxx
+++ b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
@@ -33,7 +33,6 @@ namespace dbaui
// IndexFieldsControl
class IndexFieldsControl : public ::svt::EditBrowseBox
{
- dbaccess::OModuleClient m_aModuleClient;
protected:
IndexFields m_aSavedValue;
diff --git a/dbaccess/source/ui/inc/unoadmin.hxx b/dbaccess/source/ui/inc/unoadmin.hxx
index d4d75f32b720..00ad6a2cff93 100644
--- a/dbaccess/source/ui/inc/unoadmin.hxx
+++ b/dbaccess/source/ui/inc/unoadmin.hxx
@@ -37,7 +37,6 @@ typedef ::svt::OGenericUnoDialog ODatabaseAdministrationDialogBase;
class ODatabaseAdministrationDialog
:public ODatabaseAdministrationDialogBase
{
- dbaccess::OModuleClient m_aModuleClient;
protected:
SfxItemSet* m_pDatasourceItems; // item set for the dialog
SfxItemPool* m_pItemPool; // item pool for the item set for the dialog
diff --git a/dbaccess/source/ui/inc/unosqlmessage.hxx b/dbaccess/source/ui/inc/unosqlmessage.hxx
index 0731c1405b43..c1d72366f44c 100644
--- a/dbaccess/source/ui/inc/unosqlmessage.hxx
+++ b/dbaccess/source/ui/inc/unosqlmessage.hxx
@@ -32,7 +32,6 @@ class OSQLMessageDialog
:public OSQLMessageDialogBase
,public ::comphelper::OPropertyArrayUsageHelper< OSQLMessageDialog >
{
- dbaccess::OModuleClient m_aModuleClient;
protected:
// <properties>
css::uno::Any m_aException;
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index a6f1baa4f9ad..1a53fe752eae 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -125,7 +125,6 @@ namespace dbaui
::boost::optional< bool > m_aDocScriptSupport;
public:
- dbaccess::OModuleClient m_aModuleClient;
::dbtools::SQLExceptionInfo m_aCurrentError;
::comphelper::OInterfaceContainerHelper2
diff --git a/dbaccess/source/ui/uno/composerdialogs.hxx b/dbaccess/source/ui/uno/composerdialogs.hxx
index c274edca67b7..bee53ea5b8e2 100644
--- a/dbaccess/source/ui/uno/composerdialogs.hxx
+++ b/dbaccess/source/ui/uno/composerdialogs.hxx
@@ -41,7 +41,6 @@ namespace dbaui
:public svt::OGenericUnoDialog
,public ComposerDialog_PBASE
{
- dbaccess::OModuleClient m_aModuleClient;
protected:
// <properties>
css::uno::Reference< css::sdb::XSingleSelectQueryComposer >
diff --git a/dbaccess/source/ui/uno/dbinteraction.hxx b/dbaccess/source/ui/uno/dbinteraction.hxx
index a3ebfeb8100b..f45b3cb6059b 100644
--- a/dbaccess/source/ui/uno/dbinteraction.hxx
+++ b/dbaccess/source/ui/uno/dbinteraction.hxx
@@ -62,7 +62,6 @@ namespace dbaui
class BasicInteractionHandler
:public BasicInteractionHandler_Base
{
- const dbaccess::OModuleClient m_aModuleClient;
const css::uno::Reference< css::uno::XComponentContext >
m_xContext;
const bool m_bFallbackToGeneric;
diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
index 7ad3241312f1..742ac1ab37c2 100644
--- a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
+++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
@@ -63,7 +63,6 @@ namespace dbaui
,public OTextConnectionSettingsDialog_PBASE
,public ::cppu::WeakImplHelper< css::sdb::XTextConnectionSettings >
{
- dbaccess::OModuleClient m_aModuleClient;
PropertyValues m_aPropertyValues;
protected:
diff --git a/dbaccess/source/ui/uno/unoDirectSql.hxx b/dbaccess/source/ui/uno/unoDirectSql.hxx
index 5b1e9d126ff0..4a1756ac3ced 100644
--- a/dbaccess/source/ui/uno/unoDirectSql.hxx
+++ b/dbaccess/source/ui/uno/unoDirectSql.hxx
@@ -40,7 +40,6 @@ namespace dbaui
:public ODirectSQLDialog_BASE
,public ODirectSQLDialog_PBASE
{
- dbaccess::OModuleClient m_aModuleClient;
OUString m_sInitialSelection;
css::uno::Reference< css::sdbc::XConnection > m_xActiveConnection;
protected:
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx
index 476d3b59cdae..902edf23e8bc 100644
--- a/filter/source/t602/t602filter.cxx
+++ b/filter/source/t602/t602filter.cxx
@@ -886,7 +886,8 @@ Reference< XInterface > SAL_CALL T602ImportFilter_createInstance( const Referenc
}
T602ImportFilterDialog::T602ImportFilterDialog()
- : mpResLocale(nullptr)
+ : maLocale(SvtSysLocale().GetUILanguageTag())
+ , maResLocale(Translate::Create("flt"))
{
}
@@ -896,15 +897,19 @@ T602ImportFilterDialog::~T602ImportFilterDialog()
// XLocalizable
-void SAL_CALL T602ImportFilterDialog::setLocale( const Locale& eLocale )
+void SAL_CALL T602ImportFilterDialog::setLocale(const Locale& rLocale)
{
- meLocale = eLocale;
- initLocale();
+ LanguageTag aLocale(rLocale);
+ if (maLocale != aLocale)
+ {
+ maLocale = aLocale;
+ maResLocale = Translate::Create("flt", maLocale);
+ }
}
Locale SAL_CALL T602ImportFilterDialog::getLocale()
{
- return meLocale;
+ return maLocale.getLocale(false);
}
bool T602ImportFilterDialog::OptionsDlg()
@@ -1088,18 +1093,6 @@ bool T602ImportFilterDialog::OptionsDlg()
return ret;
}
-void T602ImportFilterDialog::initLocale()
-{
- mpResLocale.reset(new std::locale(Translate::Create("flt", LanguageTag(meLocale))));
-}
-
-const std::locale* T602ImportFilterDialog::getResLocale()
-{
- if (!mpResLocale)
- initLocale();
- return mpResLocale.get();
-}
-
void SAL_CALL T602ImportFilterDialog::setTitle( const OUString& )
{
}
@@ -1114,7 +1107,7 @@ sal_Int16 SAL_CALL T602ImportFilterDialog::execute()
OUString T602ImportFilterDialog::getResStr(const char* resid)
{
- return Translate::get(resid, *getResLocale());
+ return Translate::get(resid, maResLocale);
}
uno::Sequence<beans::PropertyValue> SAL_CALL T602ImportFilterDialog::getPropertyValues()
diff --git a/filter/source/t602/t602filter.hxx b/filter/source/t602/t602filter.hxx
index 8d81fb1b476a..1b407ed996e9 100644
--- a/filter/source/t602/t602filter.hxx
+++ b/filter/source/t602/t602filter.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <cppuhelper/implbase.hxx>
#include <xmloff/attrlist.hxx>
+#include <i18nlangtag/languagetag.hxx>
namespace T602ImportFilter {
@@ -82,12 +83,10 @@ class T602ImportFilterDialog : public cppu::WeakImplHelper <
css::beans::XPropertyAccess
>
{
- css::lang::Locale meLocale;
- std::unique_ptr<std::locale> mpResLocale;
+ LanguageTag maLocale;
+ std::locale maResLocale;
bool OptionsDlg();
- const std::locale* getResLocale();
OUString getResStr(const char* resid);
- void initLocale();
virtual ~T602ImportFilterDialog() override;
diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx
index cb56b7b8ab83..4089993bb905 100644
--- a/filter/source/xsltdialog/xmlfiltercommon.hxx
+++ b/filter/source/xsltdialog/xmlfiltercommon.hxx
@@ -82,6 +82,7 @@ struct application_info_impl
extern std::vector< application_info_impl* >& getApplicationInfos();
extern OUString getApplicationUIName( const OUString& rServiceName );
extern const application_info_impl* getApplicationInfo( const OUString& rServiceName );
+OUString XsltResId(const char* pId);
#endif
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 7d6c81f6edae..7f913ad6f9fd 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -58,36 +58,10 @@ using namespace com::sun::star::util;
using ::rtl::Uri;
-namespace {
- static std::locale* pXSLTResLocale = nullptr;
-
- const std::locale* getXSLTDialogResLocale()
- {
- return pXSLTResLocale;
- }
-}
-
-EnsureResLocale::EnsureResLocale()
+OUString XsltResId(const char* pId)
{
- if (!pXSLTResLocale)
- {
- m_xResLocale.reset(new std::locale(Translate::Create("flt")));
- pXSLTResLocale = m_xResLocale.get();
- }
-}
-
-EnsureResLocale::~EnsureResLocale()
-{
- if (m_xResLocale)
- pXSLTResLocale = nullptr;
-}
-
-namespace
-{
- OUString XsltResId(const char* pId)
- {
- return Translate::get(pId, *getXSLTDialogResLocale());
- }
+ static std::locale loc = Translate::Create("flt");
+ return Translate::get(pId, loc);
}
XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent,
@@ -263,7 +237,7 @@ void XMLFilterSettingsDialog::onNew()
aTempInfo.maDocumentService = "com.sun.star.text.TextDocument";
// execute XML Filter Dialog
- ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResLocale(), mxContext, &aTempInfo );
+ ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, mxContext, &aTempInfo );
if ( aDlg->Execute() == RET_OK )
{
// insert the new filter
@@ -282,7 +256,7 @@ void XMLFilterSettingsDialog::onEdit()
filter_info_impl* pOldInfo = static_cast<filter_info_impl*>(pEntry->GetUserData());
// execute XML Filter Dialog
- ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResLocale(), mxContext, pOldInfo );
+ ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, mxContext, pOldInfo );
if ( aDlg->Execute() == RET_OK )
{
filter_info_impl* pNewInfo = aDlg->getNewFilterInfo();
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
index 7dfc307ce057..072c5d4542a5 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
@@ -55,20 +55,11 @@ public:
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
};
-class EnsureResLocale
-{
- std::unique_ptr<std::locale> m_xResLocale;
-public:
- EnsureResLocale();
- ~EnsureResLocale();
-};
-
class HeaderBar;
class XMLFilterListBox : public SvTabListBox
{
private:
- EnsureResLocale m_aEnsureResLocale;
VclPtr<HeaderBar> m_pHeaderBar;
DECL_LINK( TabBoxScrollHdl_Impl, SvTreeListBox*, void );
@@ -127,7 +118,6 @@ private:
OUString createUniqueInterfaceName( const OUString& rInterfaceName );
private:
- EnsureResLocale maEnsureResLocale;
css::uno::Reference< css::uno::XComponentContext > mxContext;
css::uno::Reference< css::container::XNameContainer > mxFilterContainer;
css::uno::Reference< css::container::XNameContainer > mxTypeDetection;
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
index 624fed6ef3a1..5cdc8ad82bc0 100644
--- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
@@ -36,11 +36,10 @@ using namespace com::sun::star::container;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
-XMLFilterTabDialog::XMLFilterTabDialog(vcl::Window *pParent, const std::locale& rResLocale,
+XMLFilterTabDialog::XMLFilterTabDialog(vcl::Window *pParent,
const Reference< XComponentContext >& rxContext, const filter_info_impl* pInfo)
: TabDialog(pParent, "XSLTFilterDialog","filter/ui/xsltfilterdialog.ui")
, mxContext(rxContext)
- , mrResLocale(rResLocale)
{
get(m_pOKBtn, "ok");
get(m_pTabCtrl, "tabcontrol");
@@ -250,7 +249,7 @@ bool XMLFilterTabDialog::onOk()
m_pTabCtrl->SetCurPageId(nErrorPage);
ActivatePageHdl(nullptr, m_pTabCtrl);
- OUString aMessage(Translate::get(pErrorId, mrResLocale));
+ OUString aMessage(XsltResId(pErrorId));
if( aReplace2.getLength() )
{
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.hxx b/filter/source/xsltdialog/xmlfiltertabdialog.hxx
index c51656b84742..0e9b02ac2bff 100644
--- a/filter/source/xsltdialog/xmlfiltertabdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.hxx
@@ -33,7 +33,7 @@ class XMLFilterTabPageXSLT;
class XMLFilterTabDialog: public TabDialog
{
public:
- XMLFilterTabDialog(vcl::Window *pParent, const std::locale& rResLocale, const css::uno::Reference< css::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo);
+ XMLFilterTabDialog(vcl::Window *pParent, const css::uno::Reference< css::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo);
virtual ~XMLFilterTabDialog() override;
virtual void dispose() override;
@@ -47,8 +47,6 @@ private:
DECL_STATIC_LINK( XMLFilterTabDialog, ActivatePageHdl, TabControl*, void );
DECL_LINK(OkHdl, Button*, void);
- const std::locale& mrResLocale;
-
const filter_info_impl* mpOldInfo;
filter_info_impl* mpNewInfo;
diff --git a/formula/Library_for.mk b/formula/Library_for.mk
index 297a6dc2ca3a..d3d86a4494b5 100644
--- a/formula/Library_for.mk
+++ b/formula/Library_for.mk
@@ -12,7 +12,6 @@ $(eval $(call gb_Library_Library,for))
$(eval $(call gb_Library_set_include,for,\
$$(INCLUDE) \
-I$(SRCDIR)/formula/inc \
- -I$(SRCDIR)/formula/source/core/inc \
))
$(eval $(call gb_Library_add_defs,for,\
diff --git a/formula/Library_forui.mk b/formula/Library_forui.mk
index 1e9d1e4eb175..729eceaaa369 100644
--- a/formula/Library_forui.mk
+++ b/formula/Library_forui.mk
@@ -12,7 +12,6 @@ $(eval $(call gb_Library_Library,forui))
$(eval $(call gb_Library_set_include,forui,\
$$(INCLUDE) \
-I$(SRCDIR)/formula/inc \
- -I$(SRCDIR)/formula/source/ui/inc \
))
$(eval $(call gb_Library_add_defs,forui,\
@@ -43,10 +42,8 @@ $(eval $(call gb_Library_add_exception_objects,forui,\
formula/source/ui/dlg/FormulaHelper \
formula/source/ui/dlg/funcpage \
formula/source/ui/dlg/funcutl \
- formula/source/ui/dlg/omoduleclient \
formula/source/ui/dlg/parawin \
formula/source/ui/dlg/structpg \
- formula/source/ui/resource/ModuleHelper \
))
# vim: set noet sw=4 ts=4:
diff --git a/svl/source/misc/getstringresource.hxx b/formula/inc/core_resource.hxx
index b04553bc13e5..1990a36c14e3 100644
--- a/svl/source/misc/getstringresource.hxx
+++ b/formula/inc/core_resource.hxx
@@ -17,15 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_SVL_SOURCE_MISC_GETSTRINGRESOURCE_HXX
-#define INCLUDED_SVL_SOURCE_MISC_GETSTRINGRESOURCE_HXX
+#ifndef INCLUDED_FORMULA_SOURCE_CORE_INC_CORE_RESOURCE_HXX
+#define INCLUDED_FORMULA_SOURCE_CORE_INC_CORE_RESOURCE_HXX
-#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <formula/formuladllapi.h>
-#include <sal/types.h>
+FORMULA_DLLPUBLIC OUString ForResId(const char *pId);
-OUString SvlResId(const char* id);
-
-#endif
+#endif // INCLUDED_FORMULA_SOURCE_CORE_INC_CORE_RESOURCE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 5ff5067505c6..0377fd761df3 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -235,7 +235,7 @@ void OpCodeList::putDefaultOpCode( const FormulaCompiler::NonConstOpCodeMapPtr&
}
if (!pKey)
return;
- OUString sKey = !mbLocalized ? OUString::createFromAscii(pKey) : Translate::get(pKey, ResourceManager::getResLocale());
+ OUString sKey = !mbLocalized ? OUString::createFromAscii(pKey) : ForResId(pKey);
xMap->putOpCode(sKey, OpCode(nOp), pCharClass);
}
@@ -853,7 +853,6 @@ void lcl_fillNativeSymbols( FormulaCompiler::NonConstOpCodeMapPtr& xMap, bool bD
aSymbolMap.mxSymbolMap.reset(
new FormulaCompiler::OpCodeMap(
SC_OPCODE_LAST_OPCODE_ID + 1, true, FormulaGrammar::GRAM_NATIVE_UI));
- OModuleClient aModuleClient;
OpCodeList aOpCodeListSymbols(false, RID_STRLIST_FUNCTION_NAMES_SYMBOLS, aSymbolMap.mxSymbolMap);
OpCodeList aOpCodeListNative(true, RID_STRLIST_FUNCTION_NAMES, aSymbolMap.mxSymbolMap);
// No AddInMap for native core mapping.
@@ -949,7 +948,6 @@ void FormulaCompiler::loadSymbols(const std::pair<const char*, int>* pSymbols, F
{
// not Core
rxMap.reset( new OpCodeMap( SC_OPCODE_LAST_OPCODE_ID + 1, eGrammar != FormulaGrammar::GRAM_ODFF, eGrammar ));
- OModuleClient aModuleClient;
OpCodeList aOpCodeList(false, pSymbols, rxMap, eSepType);
fillFromAddInMap( rxMap, eGrammar);
diff --git a/formula/source/core/inc/core_resource.hxx b/formula/source/core/inc/core_resource.hxx
deleted file mode 100644
index 3dc321b57834..000000000000
--- a/formula/source/core/inc/core_resource.hxx
+++ /dev/null
@@ -1,72 +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_FORMULA_SOURCE_CORE_INC_CORE_RESOURCE_HXX
-#define INCLUDED_FORMULA_SOURCE_CORE_INC_CORE_RESOURCE_HXX
-
-#include <rtl/ustring.hxx>
-
-namespace formula
-{
-
- //= ResourceManager
- //= handling resources within the FORMULA-Core library
-
- class ResourceManager
- {
- friend class OModuleClient;
- static sal_Int32 s_nClients; /// number of registered clients
- static std::locale* m_pImpl;
-
- private:
- // no instantiation allowed
- ResourceManager() = delete;
- ~ResourceManager() { }
-
- protected:
- static void ensureImplExists();
- /// register a client for the module
- static void registerClient();
- /// revoke a client for the module
- static void revokeClient();
-
- public:
-
- static const std::locale& getResLocale();
- };
-
-
- //= OModuleClient
-
- /** base class for objects which uses any global module-specific resources
- */
- class OModuleClient
- {
- public:
- OModuleClient() { ResourceManager::registerClient(); }
- ~OModuleClient() { ResourceManager::revokeClient(); }
- };
-
-
-} // formula
-
-
-#endif // INCLUDED_FORMULA_SOURCE_CORE_INC_CORE_RESOURCE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/source/core/resource/core_resource.cxx b/formula/source/core/resource/core_resource.cxx
index 5163d41b5ae7..d68ab6b193a8 100644
--- a/formula/source/core/resource/core_resource.cxx
+++ b/formula/source/core/resource/core_resource.cxx
@@ -16,63 +16,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-#include "core_resource.hxx"
-
#include <unotools/resmgr.hxx>
+#include "core_resource.hxx"
-// ---- needed as long as we have no contexts for components ---
-#include <rtl/instance.hxx>
-#include <svl/solar.hrc>
-
-
-namespace formula
+OUString ForResId(const char *pId)
{
-
-
- //= ResourceManager
-
- namespace
- {
- // access safety
- struct theResourceManagerMutex : public rtl::Static< osl::Mutex, theResourceManagerMutex > {};
- }
-
- sal_Int32 ResourceManager::s_nClients = 0;
- std::locale* ResourceManager::m_pImpl = nullptr;
-
- void ResourceManager::ensureImplExists()
- {
- if (m_pImpl)
- return;
-
- m_pImpl = new std::locale(Translate::Create("for"));
- }
-
- void ResourceManager::registerClient()
- {
- ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
- ++s_nClients;
- }
-
- void ResourceManager::revokeClient()
- {
- ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
- if (!--s_nClients && m_pImpl)
- {
- delete m_pImpl;
- m_pImpl = nullptr;
- }
- }
-
- const std::locale& ResourceManager::getResLocale()
- {
- ensureImplExists();
- return *m_pImpl;
- }
-
-
-} // formula
-
+ static std::locale loc = Translate::Create("for");
+ return Translate::get(pId, loc);
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 2290a98ac4a4..814184cbb628 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -50,8 +50,8 @@
#include "formula/formulahelper.hxx"
#include "structpg.hxx"
#include "parawin.hxx"
-#include "ModuleHelper.hxx"
#include "strings.hrc"
+#include "core_resource.hxx"
#include <com/sun/star/sheet/FormulaToken.hpp>
#include <com/sun/star/sheet/FormulaLanguage.hpp>
#include <com/sun/star/sheet/FormulaMapGroup.hpp>
@@ -236,8 +236,8 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
m_pTheRefButton (nullptr),
m_pMEdit (nullptr),
m_bUserMatrixFlag(false),
- m_aTitle1 ( ModuleRes( STR_TITLE1 ) ),
- m_aTitle2 ( ModuleRes( STR_TITLE2 ) ),
+ m_aTitle1 ( ForResId( STR_TITLE1 ) ),
+ m_aTitle2 ( ForResId( STR_TITLE2 ) ),
m_aFormulaHelper(_pFunctionMgr),
m_bIsShutDown (false),
m_bMakingTree (false),
diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx
index e017a9a6c543..8a12f389a73c 100644
--- a/formula/source/ui/dlg/funcpage.cxx
+++ b/formula/source/ui/dlg/funcpage.cxx
@@ -25,7 +25,6 @@
#include "formula/IFunctionDescription.hxx"
#include "funcpage.hxx"
-#include "ModuleHelper.hxx"
#include <unotools/syslocale.hxx>
#include <unotools/charclass.hxx>
diff --git a/formula/source/ui/dlg/funcpage.hxx b/formula/source/ui/dlg/funcpage.hxx
index efdd45b4f9bd..020f962a12cb 100644
--- a/formula/source/ui/dlg/funcpage.hxx
+++ b/formula/source/ui/dlg/funcpage.hxx
@@ -30,7 +30,6 @@
#include <svtools/treelistbox.hxx>
#include <vector>
-#include "formula/omoduleclient.hxx"
namespace formula
{
@@ -58,7 +57,6 @@ typedef const IFunctionDescription* TFunctionDesc;
class FuncPage : public TabPage
{
private:
- OModuleClient m_aModuleClient;
Link<FuncPage&,void> aDoubleClickLink;
Link<FuncPage&,void> aSelectionLink;
VclPtr<ListBox> m_pLbCategory;
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index e52628d867e6..0271e87956d0 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -26,9 +26,9 @@
#include "formula/funcutl.hxx"
#include "formula/IControlReferenceHandler.hxx"
#include "ControlHelper.hxx"
-#include "ModuleHelper.hxx"
#include "strings.hrc"
#include "bitmaps.hlst"
+#include "core_resource.hxx"
#include "com/sun/star/accessibility/AccessibleRole.hpp"
namespace formula
@@ -521,8 +521,8 @@ RefButton::RefButton( vcl::Window* _pParent, WinBits nStyle ) :
ImageButton(_pParent, nStyle),
aImgRefStart(BitmapEx(RID_BMP_REFBTN1)),
aImgRefDone(BitmapEx(RID_BMP_REFBTN2)),
- aShrinkQuickHelp( ModuleRes( RID_STR_SHRINK ) ),
- aExpandQuickHelp( ModuleRes( RID_STR_EXPAND ) ),
+ aShrinkQuickHelp( ForResId( RID_STR_SHRINK ) ),
+ aExpandQuickHelp( ForResId( RID_STR_EXPAND ) ),
pAnyRefDlg( nullptr ),
pRefEdit( nullptr )
{
diff --git a/formula/source/ui/dlg/omoduleclient.cxx b/formula/source/ui/dlg/omoduleclient.cxx
deleted file mode 100644
index 328287e1b4db..000000000000
--- a/formula/source/ui/dlg/omoduleclient.cxx
+++ /dev/null
@@ -1,34 +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 .
- */
-
-#include "sal/config.h"
-
-#include "formula/omoduleclient.hxx"
-
-#include "ModuleHelper.hxx"
-
-formula::OModuleClient::OModuleClient() {
- OModule::registerClient();
-}
-
-formula::OModuleClient::~OModuleClient() {
- OModule::revokeClient();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx
index f066b40e82a5..128f81d9c475 100644
--- a/formula/source/ui/dlg/parawin.cxx
+++ b/formula/source/ui/dlg/parawin.cxx
@@ -26,9 +26,9 @@
#include "formula/formdata.hxx"
#include "formula/IFunctionDescription.hxx"
#include <formula/funcvarargs.h>
-#include "ModuleHelper.hxx"
#include "strings.hrc"
#include "bitmaps.hlst"
+#include "core_resource.hxx"
namespace formula
{
@@ -38,8 +38,8 @@ ParaWin::ParaWin(vcl::Window* pParent,IControlReferenceHandler* _pDlg):
TabPage (pParent, "ParameterPage", "formula/ui/parameter.ui"),
pFuncDesc ( nullptr ),
pMyParent (_pDlg),
- m_sOptional ( ModuleRes( STR_OPTIONAL ) ),
- m_sRequired ( ModuleRes( STR_REQUIRED ) )
+ m_sOptional ( ForResId( STR_OPTIONAL ) ),
+ m_sRequired ( ForResId( STR_REQUIRED ) )
{
get(m_pFtEditDesc, "editdesc");
get(m_pFtArgName, "parname");
diff --git a/formula/source/ui/dlg/parawin.hxx b/formula/source/ui/dlg/parawin.hxx
index 6884b93a08a3..526b571bdc01 100644
--- a/formula/source/ui/dlg/parawin.hxx
+++ b/formula/source/ui/dlg/parawin.hxx
@@ -30,7 +30,6 @@
#include <vector>
#include "formula/funcutl.hxx"
-#include "formula/omoduleclient.hxx"
#include "ControlHelper.hxx"
namespace formula
@@ -44,7 +43,6 @@ class IControlReferenceHandler;
class ParaWin : public TabPage
{
private:
- OModuleClient m_aModuleClient;
Link<ParaWin&,void> aFxLink;
Link<ParaWin&,void> aArgModifiedLink;
diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx
index afebc0cba5c8..da566d673687 100644
--- a/formula/source/ui/dlg/structpg.cxx
+++ b/formula/source/ui/dlg/structpg.cxx
@@ -25,7 +25,6 @@
#include "structpg.hxx"
#include "formula/formdata.hxx"
#include "formula/formula.hxx"
-#include "ModuleHelper.hxx"
#include "formula/IFunctionDescription.hxx"
#include "bitmaps.hlst"
diff --git a/formula/source/ui/dlg/structpg.hxx b/formula/source/ui/dlg/structpg.hxx
index b20fa265051d..c1ade7a5741a 100644
--- a/formula/source/ui/dlg/structpg.hxx
+++ b/formula/source/ui/dlg/structpg.hxx
@@ -27,8 +27,6 @@
#include <vcl/tabctrl.hxx>
#include <svtools/treelistbox.hxx>
#include "formula/IFunctionDescription.hxx"
-#include "formula/omoduleclient.hxx"
-
namespace formula
{
@@ -65,7 +63,6 @@ public:
class StructPage : public TabPage
{
private:
- OModuleClient m_aModuleClient;
Link<StructPage&,void> aSelLink;
VclPtr<StructListBox> m_pTlbStruct;
diff --git a/formula/source/ui/inc/ModuleHelper.hxx b/formula/source/ui/inc/ModuleHelper.hxx
deleted file mode 100644
index 91cbb88a0b29..000000000000
--- a/formula/source/ui/inc/ModuleHelper.hxx
+++ /dev/null
@@ -1,66 +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_FORMULA_SOURCE_UI_INC_MODULEHELPER_HXX
-#define INCLUDED_FORMULA_SOURCE_UI_INC_MODULEHELPER_HXX
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <unotools/resmgr.hxx>
-
-namespace formula
-{
- //= OModule
-
- class OModuleClient;
- class OModuleImpl;
- class OModule
- {
- friend class OModuleClient;
-
- private:
- OModule() = delete; //TODO: get rid of this class
-
- protected:
- static sal_Int32 s_nClients; /// number of registered clients
- static OModuleImpl* s_pImpl; /// impl class. lives as long as at least one client for the module is registered
-
- public:
- /// get the vcl res manager of the module
- static const std::locale& getResLocale();
- protected:
- /// register a client for the module
- static void registerClient();
- /// revoke a client for the module
- static void revokeClient();
-
- private:
- /** ensure that the impl class exists
- @precond m_aMutex is guarded when this method gets called
- */
- static void ensureImpl();
- };
-
- //= ModuleRes
- OUString ModuleRes(const char *pId);
-} // namespace formula
-
-#endif // INCLUDED_FORMULA_SOURCE_UI_INC_MODULEHELPER_HXX
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/source/ui/resource/ModuleHelper.cxx b/formula/source/ui/resource/ModuleHelper.cxx
deleted file mode 100644
index 0b0ff18403b7..000000000000
--- a/formula/source/ui/resource/ModuleHelper.cxx
+++ /dev/null
@@ -1,123 +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 .
- */
-#include <memory>
-#include "ModuleHelper.hxx"
-#include <comphelper/processfactory.hxx>
-#include <osl/thread.h>
-#include <com/sun/star/util/XMacroExpander.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <rtl/instance.hxx>
-#include <rtl/uri.hxx>
-#include <svl/solar.hrc>
-#include <vcl/settings.hxx>
-#include <vcl/svapp.hxx>
-
-#define ENTER_MOD_METHOD() \
- ::osl::MutexGuard aGuard(theOModuleMutex::get()); \
- ensureImpl()
-
-
-namespace formula
-{
-
- using namespace ::com::sun::star;
-
-//= OModuleImpl
-
-/** implementation for <type>OModule</type>. not threadsafe, has to be guarded by its owner
-*/
-class OModuleImpl
-{
- std::unique_ptr<std::locale> m_xResources;
-
-public:
- /// ctor
- OModuleImpl();
-
- /// get the manager for the resources of the module
- const std::locale& getResLocale();
-};
-
-OModuleImpl::OModuleImpl()
-{
-}
-
-const std::locale& OModuleImpl::getResLocale()
-{
- // note that this method is not threadsafe, which counts for the whole class !
-
- if (!m_xResources)
- {
- // create a manager with a fixed prefix
- m_xResources.reset(new std::locale(Translate::Create("for")));
- }
- return *m_xResources;
-}
-
-//= OModule
-
-namespace
-{
- // access safety
- struct theOModuleMutex : public rtl::Static< osl::Mutex, theOModuleMutex > {};
-}
-sal_Int32 OModule::s_nClients = 0;
-OModuleImpl* OModule::s_pImpl = nullptr;
-
-const std::locale& OModule::getResLocale()
-{
- ENTER_MOD_METHOD();
- return s_pImpl->getResLocale();
-}
-
-void OModule::registerClient()
-{
- ::osl::MutexGuard aGuard(theOModuleMutex::get());
- ++s_nClients;
-}
-
-
-void OModule::revokeClient()
-{
- ::osl::MutexGuard aGuard(theOModuleMutex::get());
- if (!--s_nClients && s_pImpl)
- {
- delete s_pImpl;
- s_pImpl = nullptr;
- }
-}
-
-
-void OModule::ensureImpl()
-{
- if (s_pImpl)
- return;
- s_pImpl = new OModuleImpl();
-}
-
-OUString ModuleRes(const char *pId)
-{
- return Translate::get(pId, OModule::getResLocale());
-};
-
-} // namespace formula
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/Library_fps_aqua.mk b/fpicker/Library_fps_aqua.mk
index 84caa24dd31a..5a2c6e13cfc8 100644
--- a/fpicker/Library_fps_aqua.mk
+++ b/fpicker/Library_fps_aqua.mk
@@ -32,7 +32,6 @@ $(eval $(call gb_Library_use_libraries,fps_aqua,\
i18nlangtag \
sal \
utl \
- tl \
vcl \
))
diff --git a/fpicker/inc/fpsofficeResMgr.hxx b/fpicker/inc/fpsofficeResMgr.hxx
index 1d38ae7d4fa7..3d3b92de8465 100644
--- a/fpicker/inc/fpsofficeResMgr.hxx
+++ b/fpicker/inc/fpsofficeResMgr.hxx
@@ -9,34 +9,12 @@
#ifndef INCLUDED_FPICKER_SOURCE_OFFICE_FPSOFFICERESMGR_HXX
#define INCLUDED_FPICKER_SOURCE_OFFICE_FPSOFFICERESMGR_HXX
-#include <rtl/instance.hxx>
-#include <osl/getglobalmutex.hxx>
#include <unotools/resmgr.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/svapp.hxx>
-
-namespace fpicker
-{
- struct ResLocaleHolder
- {
- std::locale* operator ()()
- {
- return new std::locale(Translate::Create("fps"));
- }
-
- static std::locale* getOrCreate()
- {
- return rtl_Instance<
- std::locale, ResLocaleHolder,
- osl::MutexGuard, osl::GetGlobalMutex >::create (
- ResLocaleHolder(), osl::GetGlobalMutex());
- }
- };
-}
inline OUString FpsResId(const char* pId)
{
- return Translate::get(pId, *fpicker::ResLocaleHolder::getOrCreate());
+ static std::locale loc = Translate::Create("fps");
+ return Translate::get(pId, loc);
};
#endif
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index d77dc47fae30..fc0eb2e1aff8 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -98,7 +98,6 @@ using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::sdbc;
-using namespace ::fpicker;
using namespace ::utl;
using namespace ::svt;
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index 03bbfa2ab03a..b06677614784 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -37,6 +37,7 @@
#include "svtools/imagemgr.hxx"
#include <unotools/localfilehelper.hxx>
#include "unotools/useroptions.hxx"
+#include <svl/svlresid.hxx>
#include <svl/svl.hrc>
using namespace ::com::sun::star::uno;
@@ -144,8 +145,7 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
if ( nCount == 1 )
{
// adjust the title of the top level entry (the workspace)
- std::locale loc = Translate::Create("svl");
- _pMenu->SetItemText(--nItemId, Translate::get(STR_SVT_MIMETYPE_CNT_FSYSBOX, loc));
+ _pMenu->SetItemText(--nItemId, SvlResId(STR_SVT_MIMETYPE_CNT_FSYSBOX));
}
--nCount;
}
diff --git a/include/basic/basrdll.hxx b/include/basic/basrdll.hxx
index 6c2fc4655122..e4e97ae65dbc 100644
--- a/include/basic/basrdll.hxx
+++ b/include/basic/basrdll.hxx
@@ -33,8 +33,6 @@ public:
BasicDLL();
~BasicDLL();
- const std::locale& GetBasResLocale() const;
-
static void BasicBreak();
static void EnableBreak( bool bEnable );
diff --git a/include/basic/sbdef.hxx b/include/basic/sbdef.hxx
index 8df50e07678a..80513323f308 100644
--- a/include/basic/sbdef.hxx
+++ b/include/basic/sbdef.hxx
@@ -69,6 +69,8 @@ enum class PropertyMode
};
BASIC_DLLPUBLIC const ErrMsgCode* getRID_BASIC_START();
+BASIC_DLLPUBLIC const std::locale& BasResLocale();
+BASIC_DLLPUBLIC OUString BasResId(const char* pId);
#endif
diff --git a/include/formula/formula.hxx b/include/formula/formula.hxx
index 199056ea7b99..82e8246bc9b0 100644
--- a/include/formula/formula.hxx
+++ b/include/formula/formula.hxx
@@ -24,7 +24,6 @@
#include <utility>
#include <formula/formuladllapi.h>
-#include <formula/omoduleclient.hxx>
#include <formula/IFunctionDescription.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
@@ -88,7 +87,7 @@ protected:
};
class FORMULA_DLLPUBLIC FormulaDlg:
- private OModuleClient, public SfxModelessDialog, public IFormulaEditorHelper
+ public SfxModelessDialog, public IFormulaEditorHelper
{
friend class FormulaDlg_Impl;
public:
diff --git a/include/formula/omoduleclient.hxx b/include/formula/omoduleclient.hxx
deleted file mode 100644
index 3af3399bed8d..000000000000
--- a/include/formula/omoduleclient.hxx
+++ /dev/null
@@ -1,44 +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_FORMULA_OMODULECLIENT_HXX
-#define INCLUDED_FORMULA_OMODULECLIENT_HXX
-
-#include <sal/config.h>
-
-#include <formula/formuladllapi.h>
-
-namespace formula {
-
-/** Base class for objects which use any global module-specific resources.
-*/
-class FORMULA_DLLPUBLIC OModuleClient
-{
- OModuleClient(const OModuleClient&) = delete;
- OModuleClient& operator=( const OModuleClient& ) = delete;
-public:
- OModuleClient();
- ~OModuleClient();
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxresid.hxx b/include/sfx2/sfxresid.hxx
index b7b7f553c4ef..5557f652c57b 100644
--- a/include/sfx2/sfxresid.hxx
+++ b/include/sfx2/sfxresid.hxx
@@ -23,12 +23,6 @@
#include <rtl/ustring.hxx>
#include <locale>
-struct SFX2_DLLPUBLIC SfxResLocale
-{
- static std::locale* GetResLocale();
- static void DeleteResLocale();
-};
-
SFX2_DLLPUBLIC OUString SfxResId(const char* pId);
#endif
diff --git a/include/svl/svlresid.hxx b/include/svl/svlresid.hxx
new file mode 100644
index 000000000000..bc62e3cb7241
--- /dev/null
+++ b/include/svl/svlresid.hxx
@@ -0,0 +1,21 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_SVL_SVTRESID_HXX
+#define INCLUDED_SVL_SVTRESID_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+#include <locale>
+
+SVL_DLLPUBLIC OUString SvlResId(const char* pId);
+
+#endif // INCLUDED_SVL_SVTRESID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx
index b858f2b31d37..102bf115d4ab 100644
--- a/include/svtools/ehdl.hxx
+++ b/include/svtools/ehdl.hxx
@@ -22,7 +22,7 @@
#include <memory>
#include <svtools/svtdllapi.h>
-
+#include <svtools/svtresid.hxx>
#include <vcl/errinf.hxx>
typedef std::pair<const char*, ErrCode> ErrMsgCode;
@@ -36,23 +36,23 @@ class SVT_DLLPUBLIC SfxErrorContext : private ErrorContext
public:
SfxErrorContext(
sal_uInt16 nCtxIdP, vcl::Window *pWin=nullptr,
- const ErrMsgCode* pIds = nullptr, const std::locale* pResLocaleP = nullptr);
+ const ErrMsgCode* pIds = nullptr, const std::locale& rResLocaleP = SvtResLocale());
SfxErrorContext(
sal_uInt16 nCtxIdP, const OUString &aArg1, vcl::Window *pWin=nullptr,
- const ErrMsgCode* pIds = nullptr, const std::locale* pResLocaleP = nullptr);
+ const ErrMsgCode* pIds = nullptr, const std::locale& rResLocaleP = SvtResLocale());
bool GetString(ErrCode nErrId, OUString &rStr) override;
private:
sal_uInt16 nCtxId;
const ErrMsgCode* pIds;
- const std::locale *pResLocale;
+ const std::locale& rResLocale;
OUString aArg1;
};
class SVT_DLLPUBLIC SfxErrorHandler : private ErrorHandler
{
public:
- SfxErrorHandler(const ErrMsgCode* pIds, ErrCode lStart, ErrCode lEnd, const std::locale* pResLocale = nullptr);
+ SfxErrorHandler(const ErrMsgCode* pIds, ErrCode lStart, ErrCode lEnd, const std::locale& rResLocale = SvtResLocale());
virtual ~SfxErrorHandler() override;
protected:
@@ -63,8 +63,7 @@ private:
ErrCode lStart;
ErrCode lEnd;
const ErrMsgCode* pIds;
- const std::locale* pResLocale;
- std::unique_ptr<std::locale> xFreeLocale;
+ const std::locale& rResLocale;
SVT_DLLPRIVATE static void GetClassString(sal_uLong lErrId, OUString &);
virtual bool CreateString(const ErrorInfo *, OUString &) const override;
diff --git a/include/svtools/svtresid.hxx b/include/svtools/svtresid.hxx
index 8f6cfc8b43f0..cae5861a4df9 100644
--- a/include/svtools/svtresid.hxx
+++ b/include/svtools/svtresid.hxx
@@ -21,14 +21,10 @@
#define INCLUDED_SVTOOLS_SVTRESID_HXX
#include <svtools/svtdllapi.h>
-#include <com/sun/star/lang/Locale.hpp>
-
-struct SVT_DLLPUBLIC SvtResLocale
-{
- static std::locale* GetResLocale();
- static void DeleteResLocale();
-};
+#include <rtl/ustring.hxx>
+#include <locale>
+SVT_DLLPUBLIC const std::locale& SvtResLocale();
SVT_DLLPUBLIC OUString SvtResId(const char* pId);
#endif // INCLUDED_SVTOOLS_SVTRESID_HXX
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index a92e1a86a610..26e34ce0910f 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -182,7 +182,7 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
pErrorHdl = new SfxErrorHandler(RID_ERRHDLSC,
ErrCode(ERRCODE_AREA_SC),
ErrCode(ERRCODE_AREA_APP2-1),
- &GetResLocale());
+ GetResLocale());
aSpellIdle.SetInvokeHandler( LINK( this, ScModule, SpellTimerHdl ) );
aSpellIdle.SetDebugName( "sc::ScModule aSpellIdle" );
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx
index b0f55f5af779..c137d7ac2080 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -71,7 +71,7 @@ OUString AnalysisAddIn::GetFuncDescrStr(const char** pResId, sal_uInt16 nStrInde
void AnalysisAddIn::InitData()
{
- aResLocale = Translate::Create("analysis", LanguageTag(aFuncLoc));
+ aResLocale = Translate::Create("sca", LanguageTag(aFuncLoc));
delete pFD;
pFD = new FuncDataList;
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index aef1dddaebea..cbe92e563b29 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -82,7 +82,7 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
pSearchItem->SetAppFlag(SvxSearchApp::DRAW);
StartListening( *SfxGetpApp() );
SvxErrorHandler::ensure();
- mpErrorHdl = new SfxErrorHandler(RID_SD_ERRHDL, ErrCode(ERRCODE_AREA_SD), ErrCode(ERRCODE_AREA_SD_END), &GetResLocale());
+ mpErrorHdl = new SfxErrorHandler(RID_SD_ERRHDL, ErrCode(ERRCODE_AREA_SD), ErrCode(ERRCODE_AREA_SD_END), GetResLocale());
// Create a new ref device and (by calling SetReferenceDevice())
// set its resolution to 600 DPI. This leads to a visually better
diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx
index 7675f474b3e3..bbab4b53ffb1 100644
--- a/sd/source/ui/func/futhes.cxx
+++ b/sd/source/ui/func/futhes.cxx
@@ -67,7 +67,7 @@ rtl::Reference<FuPoor> FuThesaurus::Create( ViewShell* pViewSh, ::sd::Window* pW
void FuThesaurus::DoExecute( SfxRequest& )
{
SfxErrorContext aContext(ERRCTX_SVX_LINGU_THESAURUS, OUString(),
- mpWindow, getRID_SVXERRCTX(), &SvxResLocale());
+ mpWindow, getRID_SVXERRCTX(), SvxResLocale());
if (mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr)
{
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index d163e80226dc..6551c4d3e39b 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -214,16 +214,11 @@ void SfxApplication::Initialize_Impl()
pImpl->m_pToolsErrorHdl = new SfxErrorHandler(
getRID_ERRHDL(), ErrCode(ERRCODE_AREA_IO), ErrCode(ERRCODE_AREA_SVX));
-#if HAVE_FEATURE_SCRIPTING
- pImpl->aBasicResLocale = Translate::Create("sb");
-#endif
- pImpl->aSvtResLocale = Translate::Create("svt");
-
pImpl->m_pSoErrorHdl = new SfxErrorHandler(
- getRID_SO_ERROR_HANDLER(), ErrCode(ERRCODE_AREA_SO), ErrCode(ERRCODE_AREA_SO_END), &(pImpl->aSvtResLocale));
+ getRID_SO_ERROR_HANDLER(), ErrCode(ERRCODE_AREA_SO), ErrCode(ERRCODE_AREA_SO_END), SvtResLocale());
#if HAVE_FEATURE_SCRIPTING
pImpl->m_pSbxErrorHdl = new SfxErrorHandler(
- getRID_BASIC_START(), ErrCode(ERRCODE_AREA_SBX), ErrCode(ERRCODE_AREA_SBX_END), &(pImpl->aBasicResLocale));
+ getRID_BASIC_START(), ErrCode(ERRCODE_AREA_SBX), ErrCode(ERRCODE_AREA_SBX_END), BasResLocale());
#endif
if (!utl::ConfigManager::IsAvoidConfig())
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index 741b5d7287ce..c07016047e57 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -101,8 +101,6 @@ void SfxApplication::Deinitialize()
// free administration managers
DELETEZ(pImpl->pAppDispat);
- SfxResLocale::DeleteResLocale();
- SvtResLocale::DeleteResLocale();
// from here no SvObjects have to exists
DELETEZ(pImpl->pMatcher);
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index 80b8c2bf94dd..6d5204809ad3 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -696,13 +696,7 @@ OUString ShutdownIcon::getShortcutName()
#else
#ifdef _WIN32
- OUString aShortcutName( "StarOffice 6.0" );
- std::locale* pResLocale = SfxResLocale::GetResLocale();
- if (pResLocale)
- {
- ::SolarMutexGuard aGuard;
- aShortcutName = SfxResId(STR_QUICKSTART_LNKNAME);
- }
+ OUString aShortcutName(SfxResId(STR_QUICKSTART_LNKNAME));
aShortcutName += ".lnk";
OUString aShortcut(GetAutostartFolderNameW32());
diff --git a/sfx2/source/bastyp/sfxresid.cxx b/sfx2/source/bastyp/sfxresid.cxx
index 3aa36da218f9..9189ec73558e 100644
--- a/sfx2/source/bastyp/sfxresid.cxx
+++ b/sfx2/source/bastyp/sfxresid.cxx
@@ -19,29 +19,12 @@
#include <sfx2/sfxresid.hxx>
-#include <tools/solar.h>
#include "unotools/resmgr.hxx"
-static std::locale* pResLocale = nullptr;
-
-std::locale* SfxResLocale::GetResLocale()
-{
- if (!pResLocale)
- {
- pResLocale = new std::locale(Translate::Create("sfx"));
- }
-
- return pResLocale;
-}
-
-void SfxResLocale::DeleteResLocale()
-{
- DELETEZ(pResLocale);
-}
-
OUString SfxResId(const char* pId)
{
- return Translate::get(pId, *SfxResLocale::GetResLocale());
+ static std::locale loc = Translate::Create("sfx");
+ return Translate::get(pId, loc);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 406888d2ba3e..4c9f16e36a3c 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -82,10 +82,6 @@ public:
// application members
SfxFilterMatcher* pMatcher;
-#if HAVE_FEATURE_SCRIPTING
- std::locale aBasicResLocale;
-#endif
- std::locale aSvtResLocale;
SfxErrorHandler *m_pToolsErrorHdl;
SfxErrorHandler *m_pSoErrorHdl;
#if HAVE_FEATURE_SCRIPTING
diff --git a/svl/source/misc/getstringresource.cxx b/svl/source/misc/getstringresource.cxx
index ff95e7d2c22c..c452b6612651 100644
--- a/svl/source/misc/getstringresource.cxx
+++ b/svl/source/misc/getstringresource.cxx
@@ -23,10 +23,9 @@
#include <i18nlangtag/languagetag.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
+#include <svl/svlresid.hxx>
#include <unotools/resmgr.hxx>
-#include "getstringresource.hxx"
-
OUString SvlResId(const char* id)
{
static std::locale loc = Translate::Create("svl");
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index e34d41051588..58532eb08a5c 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -27,10 +27,9 @@
#include <rtl/instance.hxx>
#include <osl/diagnose.h>
#include <svl/inettype.hxx>
+#include <svl/svlresid.hxx>
#include <svl/svl.hrc>
-#include "getstringresource.hxx"
-
namespace
{
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 47a5689ec031..01498bb6ece5 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -139,15 +139,10 @@ static DialogMask aWndFunc(
return nRet;
}
-SfxErrorHandler::SfxErrorHandler(const ErrMsgCode* pIdPs, ErrCode lStartP, ErrCode lEndP, const std::locale* pLocale)
- : lStart(lStartP), lEnd(lEndP), pIds(pIdPs), pResLocale(pLocale)
+SfxErrorHandler::SfxErrorHandler(const ErrMsgCode* pIdPs, ErrCode lStartP, ErrCode lEndP, const std::locale& rLocale)
+ : lStart(lStartP), lEnd(lEndP), pIds(pIdPs), rResLocale(rLocale)
{
ErrorRegistry::RegisterDisplay(&aWndFunc);
- if (!pResLocale)
- {
- xFreeLocale.reset(new std::locale(Translate::Create("svt")));
- pResLocale = xFreeLocale.get();
- }
}
SfxErrorHandler::~SfxErrorHandler()
@@ -197,12 +192,11 @@ void SfxErrorHandler::GetClassString(sal_uLong lClassId, OUString &rStr)
*/
{
- std::locale loc(Translate::Create("svt"));
for (const ErrMsgCode* pItem = getRID_ERRHDL(); pItem->second; ++pItem)
{
if (sal_uInt32(pItem->second) == lClassId)
{
- rStr = Translate::get(pItem->first, loc);
+ rStr = SvtResId(pItem->first);
break;
}
}
@@ -227,7 +221,7 @@ bool SfxErrorHandler::GetErrorString(ErrCode lErrId, OUString &rStr) const
{
if (pItem->second == nErrId)
{
- rStr = rStr.replaceAll("$(ERROR)", Translate::get(pItem->first, *pResLocale));
+ rStr = rStr.replaceAll("$(ERROR)", Translate::get(pItem->first, rResLocale));
bRet = true;
break;
}
@@ -247,8 +241,8 @@ bool SfxErrorHandler::GetErrorString(ErrCode lErrId, OUString &rStr) const
}
SfxErrorContext::SfxErrorContext(
- sal_uInt16 nCtxIdP, vcl::Window *pWindow, const ErrMsgCode* pIdsP, const std::locale* pResLocaleP)
-: ErrorContext(pWindow), nCtxId(nCtxIdP), pIds(pIdsP), pResLocale(pResLocaleP)
+ sal_uInt16 nCtxIdP, vcl::Window *pWindow, const ErrMsgCode* pIdsP, const std::locale& rResLocaleP)
+: ErrorContext(pWindow), nCtxId(nCtxIdP), pIds(pIdsP), rResLocale(rResLocaleP)
{
if (!pIds)
pIds = getRID_ERRCTX();
@@ -257,8 +251,8 @@ SfxErrorContext::SfxErrorContext(
SfxErrorContext::SfxErrorContext(
sal_uInt16 nCtxIdP, const OUString &aArg1P, vcl::Window *pWindow,
- const ErrMsgCode* pIdsP, const std::locale* pResLocaleP)
-: ErrorContext(pWindow), nCtxId(nCtxIdP), pIds(pIdsP), pResLocale(pResLocaleP),
+ const ErrMsgCode* pIdsP, const std::locale& rResLocaleP)
+: ErrorContext(pWindow), nCtxId(nCtxIdP), pIds(pIdsP), rResLocale(rResLocaleP),
aArg1(aArg1P)
{
if (!pIds)
@@ -274,46 +268,32 @@ bool SfxErrorContext::GetString(ErrCode nErrId, OUString &rStr)
{
bool bRet = false;
- std::locale* pFreeLocale = nullptr;
- if (!pResLocale)
- {
- pFreeLocale = new std::locale(Translate::Create("svt"));
- pResLocale = pFreeLocale;
- }
- if (pResLocale)
+ for (const ErrMsgCode* pItem = pIds; pItem->second; ++pItem)
{
- for (const ErrMsgCode* pItem = pIds; pItem->second; ++pItem)
+ if (sal_uInt32(pItem->second) == nCtxId)
{
- if (sal_uInt32(pItem->second) == nCtxId)
- {
- rStr = Translate::get(pItem->first, *pResLocale);
- rStr = rStr.replaceAll("$(ARG1)", aArg1);
- bRet = true;
- break;
- }
+ rStr = Translate::get(pItem->first, rResLocale);
+ rStr = rStr.replaceAll("$(ARG1)", aArg1);
+ bRet = true;
+ break;
}
+ }
- SAL_WARN_IF(!bRet, "svtools.misc", "ErrorContext cannot find the resource");
+ SAL_WARN_IF(!bRet, "svtools.misc", "ErrorContext cannot find the resource");
- if ( bRet )
+ if ( bRet )
+ {
+ sal_uInt16 nId = nErrId.IsWarning() ? ERRCTX_WARNING : ERRCTX_ERROR;
+ for (const ErrMsgCode* pItem = getRID_ERRCTX(); pItem->second; ++pItem)
{
- sal_uInt16 nId = nErrId.IsWarning() ? ERRCTX_WARNING : ERRCTX_ERROR;
- for (const ErrMsgCode* pItem = getRID_ERRCTX(); pItem->second; ++pItem)
+ if (sal_uInt32(pItem->second) == nId)
{
- if (sal_uInt32(pItem->second) == nId)
- {
- rStr = rStr.replaceAll("$(ERR)", Translate::get(pItem->first, *pResLocale));
- break;
- }
+ rStr = rStr.replaceAll("$(ERR)", Translate::get(pItem->first, rResLocale));
+ break;
}
}
}
- if (pFreeLocale)
- {
- delete pFreeLocale;
- pResLocale = nullptr;
- }
return bRet;
}
diff --git a/svtools/source/misc/svtresid.cxx b/svtools/source/misc/svtresid.cxx
index e6cac0b9b981..f7cfdf8ba0f3 100644
--- a/svtools/source/misc/svtresid.cxx
+++ b/svtools/source/misc/svtresid.cxx
@@ -18,26 +18,17 @@
*/
#include <unotools/resmgr.hxx>
-#include <tools/solar.h>
#include <svtools/svtresid.hxx>
-static std::locale* pResLocale=nullptr;
-
-std::locale* SvtResLocale::GetResLocale()
-{
- if (!pResLocale)
- pResLocale = new std::locale(Translate::Create("svt"));
- return pResLocale;
-}
-
-void SvtResLocale::DeleteResLocale()
+const std::locale& SvtResLocale()
{
- DELETEZ(pResLocale);
+ static std::locale loc = Translate::Create("svt");
+ return loc;
}
OUString SvtResId(const char* pId)
{
- return Translate::get(pId, *SvtResLocale::GetResLocale());
+ return Translate::get(pId, SvtResLocale());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/svxerr.cxx b/svx/source/items/svxerr.cxx
index e3266825c30a..3c6b509369f4 100644
--- a/svx/source/items/svxerr.cxx
+++ b/svx/source/items/svxerr.cxx
@@ -25,7 +25,7 @@
SvxErrorHandler::SvxErrorHandler() :
SfxErrorHandler(
- getRID_SVXERRCODE(), ErrCode(ERRCODE_AREA_SVX), ErrCode(ERRCODE_AREA_SVX_END), &SvxResLocale())
+ getRID_SVXERRCODE(), ErrCode(ERRCODE_AREA_SVX), ErrCode(ERRCODE_AREA_SVX_END), SvxResLocale())
{
}
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index dfd1f6aa1912..636098cbd202 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -174,7 +174,7 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
m_pErrorHandler = new SfxErrorHandler( RID_SW_ERRHDL,
ErrCode(ERRCODE_AREA_SW),
ErrCode(ERRCODE_AREA_SW_END),
- &GetResLocale() );
+ GetResLocale() );
m_pModuleConfig = new SwModuleOptions;
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index be812b0deb51..91ef3bb2c383 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -423,7 +423,7 @@ void SwView::HyphenateDocument()
}
SfxErrorContext aContext( ERRCTX_SVX_LINGU_HYPHENATION, OUString(), m_pEditWin,
- getRID_SVXERRCTX(), &SvxResLocale() );
+ getRID_SVXERRCTX(), SvxResLocale() );
Reference< XHyphenator > xHyph( ::GetHyphenator() );
if (!xHyph.is())
@@ -545,7 +545,7 @@ void SwView::StartThesaurus()
return;
SfxErrorContext aContext( ERRCTX_SVX_LINGU_THESAURUS, OUString(), m_pEditWin,
- getRID_SVXERRCTX(), &SvxResLocale() );
+ getRID_SVXERRCTX(), SvxResLocale() );
// Determine language
LanguageType eLang = m_pWrtShell->GetCurLang();