diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-28 12:37:19 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-29 07:17:14 +0200 |
commit | b6ab5914d8b2fc7041430796890f086f8e3e6369 (patch) | |
tree | b4aae0f0352d8e1c61edaae53b354cc2cc2fcef2 /include/cui | |
parent | b27de500b1412bacefc7144b5222c307ca1ae0fe (diff) |
tdf#135997: make sure that the two lists are same length
This fixes the strange assumption that when searching the two
lists (character names and font names) independently, the two
found positions will necessarily correspond to each other.
Instead, the positions of the match must be the same, which is
implemented now. Also the input from configuration is sanitized.
Change-Id: I920de7414387e181e11183b8a22776a72b6be419
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114722
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/cui')
-rw-r--r-- | include/cui/cuicharmap.hxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/include/cui/cuicharmap.hxx b/include/cui/cuicharmap.hxx index 4548f7013e87..11e464912a8d 100644 --- a/include/cui/cuicharmap.hxx +++ b/include/cui/cuicharmap.hxx @@ -31,6 +31,10 @@ #include <cui/cuidllapi.h> #include <com/sun/star/frame/XFrame.hpp> +#include <deque> +#include <memory> +#include <utility> + using namespace ::com::sun::star; class SubsetMap; @@ -165,18 +169,25 @@ public: void getFavCharacterList(); //gets both Fav char and Fav char font list void updateFavCharacterList(const OUString& rChar, const OUString& rFont); - void deleteFavCharacterFromList(const OUString& rChar, const OUString& rFont); - bool isFavChar(const OUString& sTitle, const OUString& rFont); + void deleteFavCharacterFromList(std::u16string_view rChar, std::u16string_view rFont); + bool isFavChar(std::u16string_view sTitle, std::u16string_view rFont); void updateRecentCharControl(); void insertCharToDoc(const OUString& sChar); void updateFavCharControl(); - void setFavButtonState(const OUString& sTitle, const OUString& rFont); + void setFavButtonState(std::u16string_view sTitle, std::u16string_view rFont); void setCharName(sal_UCS4 nDecimalValue); void toggleSearchView(bool state); + +private: + std::pair<std::deque<OUString>::const_iterator, std::deque<OUString>::const_iterator> + getRecentChar(std::u16string_view sTitle, std::u16string_view rFont) const; + + std::pair<std::deque<OUString>::const_iterator, std::deque<OUString>::const_iterator> + getFavChar(std::u16string_view sTitle, std::u16string_view rFont) const; }; #endif |