diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-06-27 12:35:57 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-06-28 09:41:20 +0200 |
commit | c706fde1c4ecc6974bcf32ce33aacf3093355ae1 (patch) | |
tree | 98866e5b65ca1b72417583aba8b6219105b970f7 /include | |
parent | c58f9dac4ed9123bed2869957f866e409b6db9fe (diff) |
Resolves: tdf#156067 merge special char dialog/popup logic
there was some cut and paste done to create the popup
at some point, so put it back together and reuse the
"delete recent" etc which is missing from the popup case
Change-Id: Idc33d83ea04b46b0255e77bcecf565dc8174e426
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153647
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/cui/cuicharmap.hxx | 34 | ||||
-rw-r--r-- | include/sfx2/charwin.hxx | 58 |
2 files changed, 61 insertions, 31 deletions
diff --git a/include/cui/cuicharmap.hxx b/include/cui/cuicharmap.hxx index 431ce6dc30f5..8b85b1883ea5 100644 --- a/include/cui/cuicharmap.hxx +++ b/include/cui/cuicharmap.hxx @@ -83,13 +83,9 @@ private: std::unique_ptr<const SubsetMap> pSubsetMap; bool isSearchMode; css::uno::Reference<css::frame::XFrame> m_xFrame; - std::deque<OUString> maRecentCharList; - std::deque<OUString> maRecentCharFontList; - std::deque<OUString> maFavCharList; - std::deque<OUString> maFavCharFontList; - SvxCharView m_aRecentCharView[16]; - SvxCharView m_aFavCharView[16]; + SfxCharmapContainer m_aCharmapContents; + SvxShowText m_aShowChar; std::unique_ptr<weld::Button> m_xOKBtn; @@ -102,11 +98,7 @@ private: std::unique_ptr<weld::Entry> m_xDecimalCodeText; std::unique_ptr<weld::Button> m_xFavouritesBtn; std::unique_ptr<weld::Label> m_xCharName; - std::unique_ptr<weld::Widget> m_xRecentGrid; - std::unique_ptr<weld::Widget> m_xFavGrid; std::unique_ptr<weld::CustomWeld> m_xShowChar; - std::unique_ptr<weld::CustomWeld> m_xRecentCharView[16]; - std::unique_ptr<weld::CustomWeld> m_xFavCharView[16]; std::unique_ptr<SvxShowCharSet> m_xShowSet; std::unique_ptr<weld::CustomWeld> m_xShowSetArea; std::unique_ptr<SvxSearchCharSet> m_xSearchSet; @@ -135,14 +127,11 @@ private: DECL_DLLPRIVATE_LINK(DecimalCodeChangeHdl, weld::Entry&, void); DECL_DLLPRIVATE_LINK(HexCodeChangeHdl, weld::Entry&, void); DECL_DLLPRIVATE_LINK(CharClickHdl, SvxCharView*, void); - DECL_DLLPRIVATE_LINK(RecentClearClickHdl, SvxCharView*, void); - DECL_DLLPRIVATE_LINK(FavClearClickHdl, SvxCharView*, void); - DECL_DLLPRIVATE_LINK(RecentClearAllClickHdl, SvxCharView*, void); - DECL_DLLPRIVATE_LINK(FavClearAllClickHdl, SvxCharView*, void); DECL_DLLPRIVATE_LINK(InsertClickHdl, weld::Button&, void); DECL_DLLPRIVATE_LINK(FavSelectHdl, weld::Button&, void); DECL_DLLPRIVATE_LINK(SearchUpdateHdl, weld::Entry&, void); DECL_DLLPRIVATE_LINK(SearchFieldGetFocusHdl, weld::Widget&, void); + DECL_DLLPRIVATE_LINK(UpdateFavHdl, void*, void); static void fillAllSubsets(weld::ComboBox& rListBox); void selectCharByCode(Radix radix); @@ -164,30 +153,13 @@ public: void SetChar(sal_UCS4); sal_UCS4 GetChar() const; - void getRecentCharacterList(); //gets both recent char and recent char font list - void updateRecentCharacterList(const OUString& rChar, const OUString& rFont); - - void getFavCharacterList(); //gets both Fav char and Fav char font list - void updateFavCharacterList(const OUString& rChar, 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(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 diff --git a/include/sfx2/charwin.hxx b/include/sfx2/charwin.hxx index a2beabc5b2df..515aa64a4acb 100644 --- a/include/sfx2/charwin.hxx +++ b/include/sfx2/charwin.hxx @@ -24,6 +24,7 @@ #include <vcl/customweld.hxx> #include <vcl/virdev.hxx> #include <vcl/weld.hxx> +#include <deque> class SFX2_DLLPUBLIC SvxCharView final : public weld::CustomWidgetController { @@ -67,6 +68,63 @@ public: void ContextMenuSelect(std::u16string_view rIdent); }; +class SFX2_DLLPUBLIC SfxCharmapContainer +{ + std::deque<OUString> m_aRecentCharList; + std::deque<OUString> m_aRecentCharFontList; + std::deque<OUString> m_aFavCharList; + std::deque<OUString> m_aFavCharFontList; + + SvxCharView m_aRecentCharView[16]; + SvxCharView m_aFavCharView[16]; + std::unique_ptr<weld::CustomWeld> m_xRecentCharView[16]; + std::unique_ptr<weld::CustomWeld> m_xFavCharView[16]; + + std::unique_ptr<weld::Widget> m_xRecentGrid; + std::unique_ptr<weld::Widget> m_xFavGrid; + + Link<SvxCharView*, void> m_aMouseClickHdl; + Link<void*, void> m_aUpdateFavHdl; + Link<void*, void> m_aUpdateRecentHdl; + + DECL_DLLPRIVATE_LINK(CharClickHdl, SvxCharView*, void); + DECL_DLLPRIVATE_LINK(RecentClearClickHdl, SvxCharView*, void); + DECL_DLLPRIVATE_LINK(FavClearClickHdl, SvxCharView*, void); + DECL_DLLPRIVATE_LINK(RecentClearAllClickHdl, SvxCharView*, void); + DECL_DLLPRIVATE_LINK(FavClearAllClickHdl, SvxCharView*, void); + +public: + SfxCharmapContainer(weld::Builder& rBuilder, const VclPtr<VirtualDevice>& rVirDev); + + void init(bool bHasInsert, const Link<SvxCharView*,void> &rMouseClickHdl, + const Link<void*,void> &rUpdateFavHdl, + const Link<void*,void> &rUpdateRecentHdl); + + void getFavCharacterList(); + void updateFavCharControl(); + + void getRecentCharacterList(); //gets both recent char and recent char font list + void updateRecentCharControl(); + + void updateRecentCharacterList(const OUString& sTitle, const OUString& rFont); + void updateFavCharacterList(const OUString& sTitle, const OUString& rFont); + void deleteFavCharacterFromList(std::u16string_view sTitle, std::u16string_view rFont); + + bool isFavChar(std::u16string_view sTitle, std::u16string_view rFont); + bool hasRecentChars() const; + + bool FavCharListIsFull() const; + + void GrabFocusToFirstFavorite(); + +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 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |