tdf#161534 Add a Help button in FD & FW to open respective Help documentation
Change-Id: I35f5965401e970e02fa196f767bbd08d00de424f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170181 Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Tested-by: Jenkins
This commit is contained in:
committed by
Andreas Heinisch
parent
f8e7da23b6
commit
f5685bdfff
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <vcl/event.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/help.hxx>
|
||||
#include <formula/IFunctionDescription.hxx>
|
||||
|
||||
#include "funcpage.hxx"
|
||||
@@ -46,6 +47,7 @@ FuncPage::FuncPage(weld::Container* pParent, const IFunctionManager* _pFunctionM
|
||||
, m_xLbCategory(m_xBuilder->weld_combo_box(u"category"_ustr))
|
||||
, m_xLbFunction(m_xBuilder->weld_tree_view(u"function"_ustr))
|
||||
, m_xLbFunctionSearchString(m_xBuilder->weld_entry(u"search"_ustr))
|
||||
, m_xHelpButton(m_xBuilder->weld_button(u"help"_ustr))
|
||||
, m_pFunctionManager(_pFunctionManager)
|
||||
{
|
||||
m_xLbFunction->make_sorted();
|
||||
@@ -73,7 +75,9 @@ FuncPage::FuncPage(weld::Container* pParent, const IFunctionManager* _pFunctionM
|
||||
m_xLbFunction->connect_row_activated(LINK(this, FuncPage, DblClkHdl));
|
||||
m_xLbFunction->connect_key_press(LINK(this, FuncPage, KeyInputHdl));
|
||||
m_xLbFunctionSearchString->connect_changed(LINK(this, FuncPage, ModifyHdl));
|
||||
m_xHelpButton->connect_clicked(LINK(this, FuncPage, SelHelpClickHdl));
|
||||
|
||||
m_xHelpButton->set_sensitive(false);
|
||||
m_xLbFunctionSearchString->grab_focus();
|
||||
}
|
||||
|
||||
@@ -193,6 +197,7 @@ IMPL_LINK_NOARG(FuncPage, SelComboBoxHdl, weld::ComboBox&, void)
|
||||
OUString searchStr = m_xLbFunctionSearchString->get_text();
|
||||
m_xLbFunction->set_help_id(m_aHelpId);
|
||||
UpdateFunctionList(searchStr);
|
||||
m_xHelpButton->set_sensitive(false);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(FuncPage, SelTreeViewHdl, weld::TreeView&, void)
|
||||
@@ -204,6 +209,8 @@ IMPL_LINK_NOARG(FuncPage, SelTreeViewHdl, weld::TreeView&, void)
|
||||
if (!sHelpId.isEmpty())
|
||||
m_xLbFunction->set_help_id(sHelpId);
|
||||
}
|
||||
bool bSensitivity = weld::fromId<const IFunctionDescription*>(m_xLbFunction->get_selected_id());
|
||||
m_xHelpButton->set_sensitive(bSensitivity);
|
||||
aSelectionLink.Call(*this);
|
||||
}
|
||||
|
||||
@@ -221,6 +228,22 @@ IMPL_LINK_NOARG(FuncPage, ModifyHdl, weld::Entry&, void)
|
||||
UpdateFunctionList(searchStr);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(FuncPage, SelHelpClickHdl, weld::Button&, void)
|
||||
{
|
||||
if (const auto pDesc
|
||||
= weld::fromId<const IFunctionDescription*>(m_xLbFunction->get_selected_id()))
|
||||
{
|
||||
if (Help* pHelp = Application::GetHelp())
|
||||
{
|
||||
const OUString& sHelpId = pDesc->getHelpId();
|
||||
if (!sHelpId.isEmpty())
|
||||
{
|
||||
pHelp->Start(sHelpId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FuncPage::SetCategory(sal_Int32 nCat)
|
||||
{
|
||||
// tdf#104487 - remember last used function category
|
||||
|
||||
@@ -40,6 +40,7 @@ private:
|
||||
std::unique_ptr<weld::ComboBox> m_xLbCategory;
|
||||
std::unique_ptr<weld::TreeView> m_xLbFunction;
|
||||
std::unique_ptr<weld::Entry> m_xLbFunctionSearchString;
|
||||
std::unique_ptr<weld::Button> m_xHelpButton;
|
||||
|
||||
Link<FuncPage&,void> aDoubleClickLink;
|
||||
Link<FuncPage&,void> aSelectionLink;
|
||||
@@ -58,6 +59,7 @@ private:
|
||||
DECL_LINK(DblClkHdl, weld::TreeView&, bool);
|
||||
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
|
||||
DECL_LINK(ModifyHdl, weld::Entry&, void);
|
||||
DECL_LINK(SelHelpClickHdl, weld::Button&, void);
|
||||
|
||||
void UpdateFunctionList(const OUString&);
|
||||
|
||||
|
||||
@@ -150,6 +150,21 @@
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="help">
|
||||
<property name="label">Help</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="can-default">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes" context="functionpage|help|tooltip_text">Go to Function's Help Page</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="FunctionPage-atkobject">
|
||||
<property name="AtkObject::accessible-description" translatable="yes" context="functionpage|extended_tip|FunctionPage">Opens the Function Wizard, which helps you to interactively create formulas.</property>
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <sfx2/viewsh.hxx>
|
||||
#include <formula/funcvarargs.h>
|
||||
#include <unotools/charclass.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/help.hxx>
|
||||
|
||||
#include <global.hxx>
|
||||
#include <scmod.hxx>
|
||||
@@ -50,6 +52,7 @@ ScFunctionWin::ScFunctionWin(weld::Widget* pParent)
|
||||
, xCatBox(m_xBuilder->weld_combo_box(u"category"_ustr))
|
||||
, xFuncList(m_xBuilder->weld_tree_view(u"funclist"_ustr))
|
||||
, xInsertButton(m_xBuilder->weld_button(u"insert"_ustr))
|
||||
, xHelpButton(m_xBuilder->weld_button(u"help"_ustr))
|
||||
, xFiFuncDesc(m_xBuilder->weld_text_view(u"funcdesc"_ustr))
|
||||
, m_xSearchString(m_xBuilder->weld_entry(u"search"_ustr))
|
||||
, xConfigListener(new comphelper::ConfigurationListener(u"/org.openoffice.Office.Calc/Formula/Syntax"_ustr))
|
||||
@@ -73,6 +76,7 @@ ScFunctionWin::ScFunctionWin(weld::Widget* pParent)
|
||||
|
||||
xFuncList->connect_row_activated(LINK( this, ScFunctionWin, SetRowActivatedHdl));
|
||||
xInsertButton->connect_clicked(LINK( this, ScFunctionWin, SetSelectionClickHdl));
|
||||
xHelpButton->connect_clicked(LINK( this, ScFunctionWin, SetHelpClickHdl));
|
||||
|
||||
xCatBox->set_active(0);
|
||||
|
||||
@@ -102,6 +106,7 @@ ScFunctionWin::~ScFunctionWin()
|
||||
xCatBox.reset();
|
||||
xFuncList.reset();
|
||||
xInsertButton.reset();
|
||||
xHelpButton.reset();
|
||||
xFiFuncDesc.reset();
|
||||
}
|
||||
|
||||
@@ -527,6 +532,35 @@ IMPL_LINK_NOARG( ScFunctionWin, SetSelectionClickHdl, weld::Button&, void )
|
||||
DoEnter(); // saves the input
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
#* Handle: SetHelpClickHdl
|
||||
#*------------------------------------------------------------------------
|
||||
#*
|
||||
#* Class: ScFunctionWin
|
||||
#*
|
||||
#* Function: Get selected function's offical help.
|
||||
#*
|
||||
#* Input: ---
|
||||
#*
|
||||
#* Output: ---
|
||||
#*
|
||||
#************************************************************************/
|
||||
|
||||
IMPL_LINK_NOARG( ScFunctionWin, SetHelpClickHdl, weld::Button&, void )
|
||||
{
|
||||
if (const auto pDesc = weld::fromId<const ScFuncDesc*>(xFuncList->get_selected_id()))
|
||||
{
|
||||
if (Help* pHelp = Application::GetHelp())
|
||||
{
|
||||
const OUString& sHelpId = pDesc->getHelpId();
|
||||
if (!sHelpId.isEmpty())
|
||||
{
|
||||
pHelp->Start(sHelpId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG( ScFunctionWin, SetRowActivatedHdl, weld::TreeView&, bool )
|
||||
{
|
||||
DoEnter(); // saves the input
|
||||
|
||||
@@ -46,6 +46,7 @@ private:
|
||||
std::unique_ptr<weld::ComboBox> xCatBox;
|
||||
std::unique_ptr<weld::TreeView> xFuncList;
|
||||
std::unique_ptr<weld::Button> xInsertButton;
|
||||
std::unique_ptr<weld::Button> xHelpButton;
|
||||
std::unique_ptr<weld::TextView> xFiFuncDesc;
|
||||
std::unique_ptr<weld::Entry> m_xSearchString;
|
||||
|
||||
@@ -64,6 +65,7 @@ private:
|
||||
|
||||
DECL_LINK( SetRowActivatedHdl, weld::TreeView&, bool );
|
||||
DECL_LINK( SetSelectionClickHdl, weld::Button&, void );
|
||||
DECL_LINK( SetHelpClickHdl, weld::Button&, void );
|
||||
DECL_LINK( SelComboHdl, weld::ComboBox&, void );
|
||||
DECL_LINK( SelTreeHdl, weld::TreeView&, void );
|
||||
DECL_LINK( ModifyHdl, weld::Entry&, void );
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<property name="vexpand">True</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=1 -->
|
||||
<!-- n-columns=3 n-rows=1 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
@@ -199,6 +199,21 @@
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="help">
|
||||
<property name="label">Help</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="can-default">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes" context="functionpanel|help|tooltip_text">Go to Function's Help Page</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
|
||||
Reference in New Issue
Block a user