[Libreoffice-commits] core.git: cui/source include/unotools unotools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 1 07:35:19 UTC 2018


 cui/source/customize/CommandCategoryListBox.cxx |   17 ++++++++++++-----
 cui/source/inc/CommandCategoryListBox.hxx       |    2 +-
 include/unotools/textsearch.hxx                 |    7 +++++++
 unotools/source/i18n/textsearch.cxx             |   10 ++++++++++
 4 files changed, 30 insertions(+), 6 deletions(-)

New commits:
commit e9b06dd9458074af36b0fc97ff41ed4c79e5de32
Author:     Muhammet Kara <muhammet.kara at pardus.org.tr>
AuthorDate: Wed Oct 31 15:48:38 2018 +0300
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 1 08:34:50 2018 +0100

    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: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 523008fb8287..fe05b2c5a33a 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/script/browse/theBrowseNodeFactory.hpp>
 #include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
 #include <vcl/builderfactory.hxx>
+#include <vcl/commandinfoprovider.hxx>
 
 // include search util
 #include <com/sun/star/util/SearchFlags.hpp>
@@ -215,13 +216,19 @@ void CommandCategoryListBox::FillFunctionsList(
 
     for (const auto & rInfo : xCommands)
     {
-        OUString sUIName    = MapCommand2UIName(rInfo.Command);
-        sal_Int32 aStartPos = 0;
-        sal_Int32 aEndPos   = sUIName.getLength();
+        OUString sUIName    = getCommandName(rInfo.Command);
+        OUString sLabel     = vcl::CommandInfoProvider::GetLabelForCommand(rInfo.Command, m_sModuleLongName);
+        OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand( rInfo.Command, m_xFrame);
+        OUString sPopupLabel =
+                (vcl::CommandInfoProvider::GetPopupLabelForCommand(rInfo.Command, m_sModuleLongName))
+                .replaceFirst("~", "");
 
         // Apply the search filter
         if (!filterTerm.isEmpty()
-            && !textSearch.SearchForward( sUIName, &aStartPos, &aEndPos ) )
+            && !textSearch.searchForward( sUIName )
+            && !textSearch.searchForward( sLabel )
+            && !textSearch.searchForward( sTooltipLabel )
+            && !textSearch.searchForward( sPopupLabel ) )
         {
             continue;
         }
@@ -240,7 +247,7 @@ void CommandCategoryListBox::FillFunctionsList(
     }
 }
 
-OUString CommandCategoryListBox::MapCommand2UIName(const OUString& sCommand)
+OUString CommandCategoryListBox::getCommandName(const OUString& sCommand)
 {
     OUString sUIName;
     try
diff --git a/cui/source/inc/CommandCategoryListBox.hxx b/cui/source/inc/CommandCategoryListBox.hxx
index 8d85169ed0d5..f49ff2c999e6 100644
--- a/cui/source/inc/CommandCategoryListBox.hxx
+++ b/cui/source/inc/CommandCategoryListBox.hxx
@@ -54,7 +54,7 @@ public:
                     const VclPtr<SfxConfigFunctionListBox>&  pFunctionListBox,
                     const OUString& filterTerm,
                     SaveInData *pCurrentSaveInData );
-    OUString    MapCommand2UIName(const OUString& sCommand);
+    OUString    getCommandName(const OUString& sCommand);
 
     /**
         Signals that a command category has been selected.
diff --git a/include/unotools/textsearch.hxx b/include/unotools/textsearch.hxx
index 2d609fe99ec0..396ecf294b38 100644
--- a/include/unotools/textsearch.hxx
+++ b/include/unotools/textsearch.hxx
@@ -202,6 +202,13 @@ public:
     bool SearchForward( const OUString &rStr,
                         sal_Int32* pStart, sal_Int32* pEnd,
                         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,
                         sal_Int32* pStart, sal_Int32* pEnd,
                         css::util::SearchResult* pRes = nullptr );
diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
index 12504ccf0882..81768e9d021e 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -263,6 +263,16 @@ bool TextSearch::SearchForward( const OUString &rStr,
     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,
                                 sal_Int32* pEnde, SearchResult* pRes )
 {


More information about the Libreoffice-commits mailing list