Resolves: tdf#120209 reload names if setting for their language changes
Change-Id: I386a598ae680c90e7d31bf821e7fb58391e5d45c
Reviewed-on: https://gerrit.libreoffice.org/80130
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index bc99704..76edb39 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -47,6 +47,8 @@
ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame> &rFrame)
: PanelLayout(pParent, "FunctionPanel", "modules/scalc/ui/functionpanel.ui", rFrame)
, xConfigListener(new comphelper::ConfigurationListener("/org.openoffice.Office.Calc/Formula/Syntax"))
, xConfigChange(std::make_unique<EnglishFunctionNameChange>(xConfigListener, this))
, pFuncDesc(nullptr)
{
get(aCatBox, "category");
@@ -99,6 +101,12 @@ ScFunctionWin::~ScFunctionWin()
void ScFunctionWin::dispose()
{
if (xConfigChange)
{
xConfigChange.reset();
xConfigListener->dispose();
xConfigListener.clear();
}
aCatBox.clear();
aFuncList.clear();
aInsertButton.clear();
@@ -412,9 +420,17 @@ IMPL_LINK_NOARG( ScFunctionWin, SetSelectionClickHdl, Button*, void )
{
DoEnter(); // saves the input
}
IMPL_LINK_NOARG( ScFunctionWin, SetSelectionHdl, ListBox&, void )
{
DoEnter(); // saves the input
}
void EnglishFunctionNameChange::setProperty(const css::uno::Any &rProperty)
{
ConfigurationListenerProperty::setProperty(rProperty);
m_xFunctionWin->InitLRUList();
m_xFunctionWin->UpdateFunctionList();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx
index 2be013f..3bf7158 100644
--- a/sc/source/ui/inc/dwfunctr.hxx
+++ b/sc/source/ui/inc/dwfunctr.hxx
@@ -19,6 +19,7 @@
#ifndef INCLUDED_SC_SOURCE_UI_INC_DWFUNCTR_HXX
#define INCLUDED_SC_SOURCE_UI_INC_DWFUNCTR_HXX
#include <comphelper/configurationlistener.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/button.hxx>
#include <svx/sidebar/PanelLayout.hxx>
@@ -26,6 +27,21 @@
class ScFuncDesc;
namespace formula { class IFunctionDescription; }
class ScFunctionWin;
class EnglishFunctionNameChange : public comphelper::ConfigurationListenerProperty<bool>
{
VclPtr<ScFunctionWin> m_xFunctionWin;
protected:
virtual void setProperty(const css::uno::Any &rProperty) override;
public:
EnglishFunctionNameChange(const rtl::Reference<comphelper::ConfigurationListener> &rListener, ScFunctionWin* pFunctionWin)
: ConfigurationListenerProperty(rListener, "EnglishFunctionName")
, m_xFunctionWin(pFunctionWin)
{
}
};
class ScFunctionWin : public PanelLayout
{
@@ -35,12 +51,13 @@ private:
VclPtr<PushButton> aInsertButton;
VclPtr<FixedText> aFiFuncDesc;
rtl::Reference<comphelper::ConfigurationListener> xConfigListener;
std::unique_ptr<EnglishFunctionNameChange> xConfigChange;
const ScFuncDesc* pFuncDesc;
sal_uInt16 nArgs;
::std::vector< const formula::IFunctionDescription*> aLRUList;
void UpdateFunctionList();
void UpdateLRUList();
void DoEnter();
void SetDescription();
@@ -56,6 +73,7 @@ public:
virtual void dispose() override;
void InitLRUList();
void UpdateFunctionList();
};
#endif