Kaydet (Commit) 8b690f22 authored tarafından Michael Stahl's avatar Michael Stahl

vcl: [loplugin:badstatics] xCharClass

There's even 2 of these; move them to struct ImplSVData
which is deleted on shutdown.

Change-Id: I8040cd6f9f31c0a1ab48987a490395f316d52220
Reviewed-on: https://gerrit.libreoffice.org/42630Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst c75a3ffd
......@@ -28,6 +28,7 @@
#include <vcl/window.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/i18n/XCharacterClassification.hpp>
#include "vcleventlisteners.hxx"
#include "impfontcache.hxx"
......@@ -361,9 +362,13 @@ struct ImplSVData
std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList = nullptr;
std::unordered_map< int, OUString >* mpPaperNames = nullptr;
css::uno::Reference<css::i18n::XCharacterClassification> m_xCharClass;
Link<LinkParamNone*,void> maDeInitHook;
};
css::uno::Reference<css::i18n::XCharacterClassification> const& ImplGetCharClass();
void ImplDeInitSVData();
VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultWindow();
VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultContextWindow();
......
......@@ -58,11 +58,15 @@ using namespace ::comphelper;
uno::Reference< i18n::XCharacterClassification > const & ImplGetCharClass()
{
static uno::Reference< i18n::XCharacterClassification > xCharClass;
if ( !xCharClass.is() )
xCharClass = vcl::unohelper::CreateCharacterClassification();
ImplSVData *const pSVData = ImplGetSVData();
assert(pSVData);
return xCharClass;
if (!pSVData->m_xCharClass.is())
{
pSVData->m_xCharClass = vcl::unohelper::CreateCharacterClassification();
}
return pSVData->m_xCharClass;
}
static sal_Unicode* ImplAddString( sal_Unicode* pBuf, const OUString& rStr )
......
......@@ -390,10 +390,7 @@ vcl::Window* ImplFindAccelWindow( vcl::Window* pParent, sal_uInt16& rIndex, sal_
sal_uInt16 i = rIndex;
vcl::Window* pWindow;
// MT: Where can we keep the CharClass?!
static uno::Reference< i18n::XCharacterClassification > xCharClass;
if ( !xCharClass.is() )
xCharClass = vcl::unohelper::CreateCharacterClassification();
uno::Reference<i18n::XCharacterClassification> const xCharClass(ImplGetCharClass());
const css::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale();
cCharCode = xCharClass->toUpper( OUString(cCharCode), 0, 1, rLocale )[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment