Kaydet (Commit) e9b06dd9 authored tarafından Muhammet Kara's avatar Muhammet Kara Kaydeden (comit) Noel Grandin

tdf#112614: Include all labels in the search in Customize dialog

For uno commands

Change-Id: Ide7a30387b0ec354cd0d42ba11c78e115ec94989
Reviewed-on: https://gerrit.libreoffice.org/62693
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 53bc3b61
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <com/sun/star/script/browse/theBrowseNodeFactory.hpp> #include <com/sun/star/script/browse/theBrowseNodeFactory.hpp>
#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp> #include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
#include <vcl/builderfactory.hxx> #include <vcl/builderfactory.hxx>
#include <vcl/commandinfoprovider.hxx>
// include search util // include search util
#include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/util/SearchFlags.hpp>
...@@ -215,13 +216,19 @@ void CommandCategoryListBox::FillFunctionsList( ...@@ -215,13 +216,19 @@ void CommandCategoryListBox::FillFunctionsList(
for (const auto & rInfo : xCommands) for (const auto & rInfo : xCommands)
{ {
OUString sUIName = MapCommand2UIName(rInfo.Command); OUString sUIName = getCommandName(rInfo.Command);
sal_Int32 aStartPos = 0; OUString sLabel = vcl::CommandInfoProvider::GetLabelForCommand(rInfo.Command, m_sModuleLongName);
sal_Int32 aEndPos = sUIName.getLength(); OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand( rInfo.Command, m_xFrame);
OUString sPopupLabel =
(vcl::CommandInfoProvider::GetPopupLabelForCommand(rInfo.Command, m_sModuleLongName))
.replaceFirst("~", "");
// Apply the search filter // Apply the search filter
if (!filterTerm.isEmpty() if (!filterTerm.isEmpty()
&& !textSearch.SearchForward( sUIName, &aStartPos, &aEndPos ) ) && !textSearch.searchForward( sUIName )
&& !textSearch.searchForward( sLabel )
&& !textSearch.searchForward( sTooltipLabel )
&& !textSearch.searchForward( sPopupLabel ) )
{ {
continue; continue;
} }
...@@ -240,7 +247,7 @@ void CommandCategoryListBox::FillFunctionsList( ...@@ -240,7 +247,7 @@ void CommandCategoryListBox::FillFunctionsList(
} }
} }
OUString CommandCategoryListBox::MapCommand2UIName(const OUString& sCommand) OUString CommandCategoryListBox::getCommandName(const OUString& sCommand)
{ {
OUString sUIName; OUString sUIName;
try try
......
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox, const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
const OUString& filterTerm, const OUString& filterTerm,
SaveInData *pCurrentSaveInData ); SaveInData *pCurrentSaveInData );
OUString MapCommand2UIName(const OUString& sCommand); OUString getCommandName(const OUString& sCommand);
/** /**
Signals that a command category has been selected. Signals that a command category has been selected.
......
...@@ -202,6 +202,13 @@ public: ...@@ -202,6 +202,13 @@ public:
bool SearchForward( const OUString &rStr, bool SearchForward( const OUString &rStr,
sal_Int32* pStart, sal_Int32* pEnd, sal_Int32* pStart, sal_Int32* pEnd,
css::util::SearchResult* pRes = nullptr ); css::util::SearchResult* pRes = nullptr );
/**
* @brief searchForward Search forward beginning from the start to the end
* of the given text
* @param rStr The text in wich we search
* @return True if the search term is found in the text
*/
bool searchForward( const OUString &rStr );
bool SearchBackward( const OUString &rStr, bool SearchBackward( const OUString &rStr,
sal_Int32* pStart, sal_Int32* pEnd, sal_Int32* pStart, sal_Int32* pEnd,
css::util::SearchResult* pRes = nullptr ); css::util::SearchResult* pRes = nullptr );
......
...@@ -263,6 +263,16 @@ bool TextSearch::SearchForward( const OUString &rStr, ...@@ -263,6 +263,16 @@ bool TextSearch::SearchForward( const OUString &rStr,
return bRet; return bRet;
} }
bool TextSearch::searchForward( const OUString &rStr )
{
sal_Int32 pStart = 0;
sal_Int32 pEnd = rStr.getLength();
bool bResult = SearchForward(rStr, &pStart, &pEnd);
return bResult;
}
bool TextSearch::SearchBackward( const OUString & rStr, sal_Int32* pStart, bool TextSearch::SearchBackward( const OUString & rStr, sal_Int32* pStart,
sal_Int32* pEnde, SearchResult* pRes ) sal_Int32* pEnde, SearchResult* pRes )
{ {
......
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