include/sfx2/charmapcontainer.hxx | 4 ++-- include/svx/charmap.hxx | 24 ++++++++++++------------ include/svx/cuicharmap.hxx | 16 ++++++++-------- sfx2/source/control/charmapcontainer.cxx | 28 ++++++++++++++-------------- starmath/inc/dialog.hxx | 2 +- starmath/source/dialog.cxx | 2 +- svx/source/dialog/charmap.cxx | 20 ++++++++++---------- svx/source/dialog/cuicharmap.cxx | 28 +++++++++++++--------------- svx/source/dialog/searchcharmap.cxx | 10 +++++----- 9 files changed, 66 insertions(+), 68 deletions(-)
New commits: commit 640c2a12c641b62f4e333099979ee177a8b70e6a Author: Michael Weghorn <[email protected]> AuthorDate: Wed Dec 10 16:02:15 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Dec 12 13:25:05 2025 +0100 svx: Pass SvxShowCharSet by ref in handlers Switch the param for the handlers from SvxShowCharSet* to SvxShowCharSet&. This also allows to drop 2 asserts. Change-Id: Icbec3beef9b48614ca542b2c81f0f5ffb38383f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195399 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx index 7ecdce3af61d..b8529fca4474 100644 --- a/include/svx/charmap.hxx +++ b/include/svx/charmap.hxx @@ -67,12 +67,12 @@ public: virtual sal_UCS4 GetCharFromIndex(int index) const; void createContextMenu(const Point& rPosition); - void SetDoubleClickHdl( const Link<SvxShowCharSet*,void>& rLink ) { maDoubleClkHdl = rLink; } - void SetReturnKeyPressHdl( const Link<SvxShowCharSet*,void>& rLink ) { m_aReturnKeypressHdl = rLink; } - void SetSelectHdl( const Link<SvxShowCharSet*,void>& rHdl ) { maSelectHdl = rHdl; } - void SetHighlightHdl( const Link<SvxShowCharSet*,void>& rHdl ) { maHighHdl = rHdl; } - void SetPreSelectHdl( const Link<SvxShowCharSet*,void>& rHdl ) { maPreSelectHdl = rHdl; } - void SetFavClickHdl( const Link<SvxShowCharSet*,void>& rHdl ) { maFavClickHdl = rHdl; } + void SetDoubleClickHdl(const Link<SvxShowCharSet&, void>& rLink) { maDoubleClkHdl = rLink; } + void SetReturnKeyPressHdl(const Link<SvxShowCharSet&, void>& rLink ) { m_aReturnKeypressHdl = rLink; } + void SetSelectHdl(const Link<SvxShowCharSet&, void>& rHdl ) { maSelectHdl = rHdl; } + void SetHighlightHdl(const Link<SvxShowCharSet&, void>& rHdl) { maHighHdl = rHdl; } + void SetPreSelectHdl(const Link<SvxShowCharSet&, void>& rHdl) { maPreSelectHdl = rHdl; } + void SetFavClickHdl(const Link<SvxShowCharSet&, void>& rHdl) { maFavClickHdl = rHdl; } static sal_uInt32& getSelectedChar(); SVX_DLLPUBLIC void SetFont( const vcl::Font& rFont ); vcl::Font const & GetFont() const { return maFont; } @@ -118,12 +118,12 @@ private: protected: typedef std::map<sal_Int32, std::shared_ptr<svx::SvxShowCharSetItem> > ItemsMap; ItemsMap m_aItems; - Link<SvxShowCharSet*,void> maDoubleClkHdl; - Link<SvxShowCharSet*,void> m_aReturnKeypressHdl; - Link<SvxShowCharSet*,void> maSelectHdl; - Link<SvxShowCharSet*,void> maFavClickHdl; - Link<SvxShowCharSet*,void> maHighHdl; - Link<SvxShowCharSet*,void> maPreSelectHdl; + Link<SvxShowCharSet&, void> maDoubleClkHdl; + Link<SvxShowCharSet&, void> m_aReturnKeypressHdl; + Link<SvxShowCharSet&, void> maSelectHdl; + Link<SvxShowCharSet&, void> maFavClickHdl; + Link<SvxShowCharSet&, void> maHighHdl; + Link<SvxShowCharSet&, void> maPreSelectHdl; std::deque<OUString> maFavCharList; std::deque<OUString> maFavCharFontList; diff --git a/include/svx/cuicharmap.hxx b/include/svx/cuicharmap.hxx index 9f8ea01d3f7f..47c463a389bf 100644 --- a/include/svx/cuicharmap.hxx +++ b/include/svx/cuicharmap.hxx @@ -93,7 +93,7 @@ private: }; // inserts the character that is currently selected in the given SvxShowCharSet - void insertSelectedCharacter(const SvxShowCharSet* pCharSet); + void insertSelectedCharacter(const SvxShowCharSet& rCharSet); static void fillAllSubsets(weld::ComboBox& rListBox); @@ -109,13 +109,13 @@ private: DECL_DLLPRIVATE_LINK(FontSelectHdl, weld::ComboBox&, void); DECL_DLLPRIVATE_LINK(SubsetSelectHdl, weld::ComboBox&, void); - DECL_DLLPRIVATE_LINK(CharDoubleClickHdl, SvxShowCharSet*, void); - DECL_DLLPRIVATE_LINK(CharSelectHdl, SvxShowCharSet*, void); - DECL_DLLPRIVATE_LINK(CharHighlightHdl, SvxShowCharSet*, void); - DECL_DLLPRIVATE_LINK(CharPreSelectHdl, SvxShowCharSet*, void); - DECL_DLLPRIVATE_LINK(ReturnKeypressOnCharHdl, SvxShowCharSet*, void); - DECL_DLLPRIVATE_LINK(FavClickHdl, SvxShowCharSet*, void); - DECL_DLLPRIVATE_LINK(SearchCharHighlightHdl, SvxShowCharSet*, void); + DECL_DLLPRIVATE_LINK(CharDoubleClickHdl, SvxShowCharSet&, void); + DECL_DLLPRIVATE_LINK(CharSelectHdl, SvxShowCharSet&, void); + DECL_DLLPRIVATE_LINK(CharHighlightHdl, SvxShowCharSet&, void); + DECL_DLLPRIVATE_LINK(CharPreSelectHdl, SvxShowCharSet&, void); + DECL_DLLPRIVATE_LINK(ReturnKeypressOnCharHdl, SvxShowCharSet&, void); + DECL_DLLPRIVATE_LINK(FavClickHdl, SvxShowCharSet&, void); + DECL_DLLPRIVATE_LINK(SearchCharHighlightHdl, SvxShowCharSet&, void); DECL_DLLPRIVATE_LINK(DecimalCodeChangeHdl, weld::Entry&, void); DECL_DLLPRIVATE_LINK(HexCodeChangeHdl, weld::Entry&, void); DECL_DLLPRIVATE_LINK(CharClickHdl, SvxCharView*, void); diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 521b6fe93dfd..e4d0320f869c 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -436,7 +436,7 @@ class SmSymDefineDialog final : public weld::GenericDialogController DECL_LINK(FontChangeHdl, weld::ComboBox&, void); DECL_LINK(SubsetChangeHdl, weld::ComboBox&, void); DECL_LINK(StyleChangeHdl, weld::ComboBox&, void); - DECL_LINK(CharHighlightHdl, SvxShowCharSet*, void); + DECL_LINK(CharHighlightHdl, SvxShowCharSet&, void); DECL_LINK(AddClickHdl, weld::Button&, void); DECL_LINK(ChangeClickHdl, weld::Button&, void); DECL_LINK(DeleteClickHdl, weld::Button&, void); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index a8882ab7fb41..ddd729c2c396 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -1715,7 +1715,7 @@ IMPL_LINK( SmSymDefineDialog, StyleChangeHdl, weld::ComboBox&, rComboBox, void ) SelectStyle(m_xStyles->get_active_text()); } -IMPL_LINK_NOARG(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet*, void) +IMPL_LINK_NOARG(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet&, void) { sal_UCS4 cChar = m_xCharsetDisplay->GetSelectCharacter(); diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index d82f465de835..cfa6ee3742a8 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -136,7 +136,7 @@ bool SvxShowCharSet::MouseButtonDown(const MouseEvent& rMEvt) } if ( !(rMEvt.GetClicks() % 2) ) - maDoubleClkHdl.Call( this ); + maDoubleClkHdl.Call(*this); return true; } @@ -150,7 +150,7 @@ bool SvxShowCharSet::MouseButtonUp(const MouseEvent& rMEvt) { // released mouse over character map if ( tools::Rectangle(Point(), GetOutputSizePixel()).Contains(rMEvt.GetPosPixel())) - maSelectHdl.Call( this ); + maSelectHdl.Call(*this); ReleaseMouse(); mbDrag = false; } @@ -263,11 +263,11 @@ void SvxShowCharSet::ContextMenuSelect(std::u16string_view rIdent) OUString aOUStr(&cChar, 1); if (rIdent == u"insert") - maDoubleClkHdl.Call(this); + maDoubleClkHdl.Call(*this); else if (rIdent == u"add" || rIdent == u"remove") { updateFavCharacterList(aOUStr, mxVirDev->GetFont().GetFamilyName()); - maFavClickHdl.Call(this); + maFavClickHdl.Call(*this); } else if (rIdent == u"copy") CopyToClipboard(aOUStr); @@ -395,10 +395,10 @@ bool SvxShowCharSet::KeyInput(const KeyEvent& rKEvt) switch (aCode.GetCode()) { case KEY_RETURN: - m_aReturnKeypressHdl.Call(this); + m_aReturnKeypressHdl.Call(*this); return true; case KEY_SPACE: - maDoubleClkHdl.Call(this); + maDoubleClkHdl.Call(*this); return true; case KEY_LEFT: --tmpSelected; @@ -446,7 +446,7 @@ bool SvxShowCharSet::KeyInput(const KeyEvent& rKEvt) if ( tmpSelected >= 0 ) { SelectIndex( tmpSelected, true ); - maPreSelectHdl.Call( this ); + maPreSelectHdl.Call(*this); } return bRet; @@ -795,16 +795,16 @@ void SvxShowCharSet::SelectIndex(int nNewIndex, bool bFocus) aNewAny <<= AccessibleStateType::SELECTED; pItem->m_xItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); } - maSelectHdl.Call(this); + maSelectHdl.Call(*this); #endif } - maHighHdl.Call( this ); + maHighHdl.Call(*this); } void SvxShowCharSet::OutputIndex( int nNewIndex ) { SelectIndex( nNewIndex, true ); - maSelectHdl.Call( this ); + maSelectHdl.Call(*this); } diff --git a/svx/source/dialog/cuicharmap.cxx b/svx/source/dialog/cuicharmap.cxx index faa7e0fdfb54..e3959aa64884 100644 --- a/svx/source/dialog/cuicharmap.cxx +++ b/svx/source/dialog/cuicharmap.cxx @@ -405,7 +405,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, weld::ComboBox&, void) // tdf#137294 do this after modifying m_xSubsetLB sensitivity to // restore insensitive for the search case SearchUpdateHdl(*m_xSearchText); - SearchCharHighlightHdl(m_xSearchSet.get()); + SearchCharHighlightHdl(*m_xSearchSet); } // tdf#118304 reselect current glyph to see if it's still there in new font @@ -554,29 +554,28 @@ IMPL_LINK(SvxCharacterMap, CharClickHdl, SvxCharView*, rView, void) m_xOKBtn->set_sensitive(true); } -void SvxCharacterMap::insertSelectedCharacter(const SvxShowCharSet* pCharSet) +void SvxCharacterMap::insertSelectedCharacter(const SvxShowCharSet& rCharSet) { - assert(pCharSet); - sal_UCS4 cChar = pCharSet->GetSelectCharacter(); + sal_UCS4 cChar = rCharSet.GetSelectCharacter(); // using the new UCS4 constructor OUString aOUStr( &cChar, 1 ); setFavButtonState(aOUStr, m_aFont.GetFamilyName()); insertCharToDoc(aOUStr); } -IMPL_LINK(SvxCharacterMap, CharDoubleClickHdl, SvxShowCharSet*, pCharSet, void) +IMPL_LINK(SvxCharacterMap, CharDoubleClickHdl, SvxShowCharSet&, rCharSet, void) { - insertSelectedCharacter(pCharSet); + insertSelectedCharacter(rCharSet); } -IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl, SvxShowCharSet*, void) +IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl, SvxShowCharSet&, void) { m_xOKBtn->set_sensitive(true); } -IMPL_LINK(SvxCharacterMap, ReturnKeypressOnCharHdl, SvxShowCharSet*, pCharSet, void) +IMPL_LINK(SvxCharacterMap, ReturnKeypressOnCharHdl, SvxShowCharSet&, rCharSet, void) { - insertSelectedCharacter(pCharSet); + insertSelectedCharacter(rCharSet); m_xDialog->response(RET_OK); } @@ -607,13 +606,13 @@ IMPL_LINK_NOARG(SvxCharacterMap, FavSelectHdl, weld::Button&, void) m_aCharmapContents.updateFavCharControl(); } -IMPL_LINK_NOARG(SvxCharacterMap, FavClickHdl, SvxShowCharSet*, void) +IMPL_LINK_NOARG(SvxCharacterMap, FavClickHdl, SvxShowCharSet&, void) { m_aCharmapContents.getFavCharacterList(); m_aCharmapContents.updateFavCharControl(); } -IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void) +IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet&, void) { OUString aText; sal_UCS4 cChar = m_xShowSet->GetSelectCharacter(); @@ -652,7 +651,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void) setFavButtonState(aText, m_aFont.GetFamilyName()); } -IMPL_LINK_NOARG(SvxCharacterMap, SearchCharHighlightHdl, SvxShowCharSet*, void) +IMPL_LINK_NOARG(SvxCharacterMap, SearchCharHighlightHdl, SvxShowCharSet&, void) { OUString aText; sal_UCS4 cChar = m_xSearchSet->GetSelectCharacter(); @@ -737,13 +736,12 @@ IMPL_LINK_NOARG(SvxCharacterMap, HexCodeChangeHdl, weld::Entry&, void) selectCharByCode(Radix::hexadecimal); } -IMPL_LINK(SvxCharacterMap, CharPreSelectHdl, SvxShowCharSet*, pCharSet, void) +IMPL_LINK(SvxCharacterMap, CharPreSelectHdl, SvxShowCharSet&, rCharSet, void) { - assert(pCharSet); // adjust subset selection if( m_pSubsetMap ) { - sal_UCS4 cChar = pCharSet->GetSelectCharacter(); + sal_UCS4 cChar = rCharSet.GetSelectCharacter(); setFavButtonState(OUString(&cChar, 1), m_aFont.GetFamilyName()); const Subset* pSubset = m_pSubsetMap->GetSubsetByUnicode( cChar ); diff --git a/svx/source/dialog/searchcharmap.cxx b/svx/source/dialog/searchcharmap.cxx index d395a53bdd08..27974c8c75d9 100644 --- a/svx/source/dialog/searchcharmap.cxx +++ b/svx/source/dialog/searchcharmap.cxx @@ -62,7 +62,7 @@ bool SvxSearchCharSet::KeyInput(const KeyEvent& rKEvt) case KEY_RETURN: return SvxShowCharSet::KeyInput(rKEvt); case KEY_SPACE: - maDoubleClkHdl.Call(this); + maDoubleClkHdl.Call(*this); return true; case KEY_LEFT: --tmpSelected; @@ -102,7 +102,7 @@ bool SvxSearchCharSet::KeyInput(const KeyEvent& rKEvt) if ( tmpSelected >= 0 ) { SelectIndex( tmpSelected, true ); - maPreSelectHdl.Call( this ); + maPreSelectHdl.Call(*this); } return bRet; @@ -130,7 +130,7 @@ void SvxSearchCharSet::SelectCharacter( const Subset* sub ) SelectIndex( 0 ); else SelectIndex( nMapIndex ); - maHighHdl.Call(this); + maHighHdl.Call(*this); // move selected item to top row if not in focus //TO.DO aVscrollSB->SetThumbPos( nMapIndex / COLUMN_COUNT ); Invalidate(); @@ -269,9 +269,9 @@ void SvxSearchCharSet::SelectIndex(int nNewIndex, bool bFocus) pItem->m_xItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); } #endif - maSelectHdl.Call(this); + maSelectHdl.Call(*this); } - maHighHdl.Call( this ); + maHighHdl.Call(*this); } SvxSearchCharSet::~SvxSearchCharSet() commit 86a40267adbd3d92c1915433ef87bf2cfffda983 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Dec 10 15:26:01 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Dec 12 13:24:58 2025 +0100 SfxCharmapContainer: Adhere to var name prefix conventions Use `r` prefix for references, but not for non-references. Change-Id: If3063ab13cfe2c5a9a6798c933492858107591a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195398 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/sfx2/charmapcontainer.hxx b/include/sfx2/charmapcontainer.hxx index 65a3787aa1dd..5ca5ecc070df 100644 --- a/include/sfx2/charmapcontainer.hxx +++ b/include/sfx2/charmapcontainer.hxx @@ -75,8 +75,8 @@ public: 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 updateRecentCharacterList(const OUString& rTitle, const OUString& rFont); + void updateFavCharacterList(const OUString& rTitle, const OUString& rFont); void deleteFavCharacterFromList(const OUString& rTitle, const OUString& rFont); bool isFavChar(const OUString& rTitle, const OUString& rFont); diff --git a/sfx2/source/control/charmapcontainer.cxx b/sfx2/source/control/charmapcontainer.cxx index 05e134b32522..7a310f45a944 100644 --- a/sfx2/source/control/charmapcontainer.cxx +++ b/sfx2/source/control/charmapcontainer.cxx @@ -136,14 +136,14 @@ void SfxCharmapContainer::getFavCharacterList() m_aFavChars.clear(); //retrieve recent character list - const css::uno::Sequence< OUString > rFavCharList( officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::get() ); + const css::uno::Sequence<OUString> aFavCharList(officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::get()); //retrieve recent character font list - const css::uno::Sequence< OUString > rFavCharFontList( officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::get() ); + const css::uno::Sequence<OUString> aFavCharFontList(officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::get()); - const auto nCommonLength = std::min(rFavCharList.size(), rFavCharFontList.size()); + const auto nCommonLength = std::min(aFavCharList.size(), aFavCharFontList.size()); for (sal_uInt32 i = 0; i < nCommonLength; i++) - m_aFavChars.emplace_back(rFavCharList[i], rFavCharFontList[i]); + m_aFavChars.emplace_back(aFavCharList[i], aFavCharFontList[i]); } void SfxCharmapContainer::updateFavCharControl() @@ -172,14 +172,14 @@ void SfxCharmapContainer::getRecentCharacterList() m_aRecentChars.clear(); //retrieve recent character list - const css::uno::Sequence< OUString > rRecentCharList( officecfg::Office::Common::RecentCharacters::RecentCharacterList::get() ); + const css::uno::Sequence<OUString> aRecentCharList(officecfg::Office::Common::RecentCharacters::RecentCharacterList::get()); //retrieve recent character font list - const css::uno::Sequence< OUString > rRecentCharFontList( officecfg::Office::Common::RecentCharacters::RecentCharacterFontList::get() ); + const css::uno::Sequence<OUString> aRecentCharFontList(officecfg::Office::Common::RecentCharacters::RecentCharacterFontList::get()); - const sal_uInt32 nCommonLength = std::min(rRecentCharList.size(), rRecentCharFontList.size()); + const sal_uInt32 nCommonLength = std::min(aRecentCharList.size(), aRecentCharFontList.size()); for (sal_uInt32 i = 0; i < nCommonLength; i++) - m_aRecentChars.emplace_back(rRecentCharList[i], rRecentCharFontList[i]); + m_aRecentChars.emplace_back(aRecentCharList[i], aRecentCharFontList[i]); } void SfxCharmapContainer::GrabFocusToFirstFavorite() @@ -208,17 +208,17 @@ void SfxCharmapContainer::updateRecentCharControl() m_aUpdateRecentHdl.Call(nullptr); } -void SfxCharmapContainer::updateRecentCharacterList(const OUString& sTitle, const OUString& rFont) +void SfxCharmapContainer::updateRecentCharacterList(const OUString& rTitle, const OUString& rFont) { // if recent char to be added is already in list, remove it - auto itChar = std::ranges::find(m_aRecentChars, CharAndFont(sTitle, rFont)); + auto itChar = std::ranges::find(m_aRecentChars, CharAndFont(rTitle, rFont)); if (itChar != m_aRecentChars.end()) m_aRecentChars.erase(itChar); if (m_aRecentChars.size() == 16) m_aRecentChars.pop_back(); - m_aRecentChars.emplace_front(sTitle, rFont); + m_aRecentChars.emplace_front(rTitle, rFont); css::uno::Sequence<OUString> aRecentCharList(m_aRecentChars.size()); auto aRecentCharListRange = asNonConstRange(aRecentCharList); @@ -239,17 +239,17 @@ void SfxCharmapContainer::updateRecentCharacterList(const OUString& sTitle, cons updateRecentCharControl(); } -void SfxCharmapContainer::updateFavCharacterList(const OUString& sTitle, const OUString& rFont) +void SfxCharmapContainer::updateFavCharacterList(const OUString& rTitle, const OUString& rFont) { // if Fav char to be added is already in list, remove it - auto itChar = std::ranges::find(m_aFavChars, CharAndFont(sTitle, rFont)); + auto itChar = std::ranges::find(m_aFavChars, CharAndFont(rTitle, rFont)); if (itChar != m_aFavChars.end()) m_aFavChars.erase(itChar); if (m_aFavChars.size() == 16) m_aFavChars.pop_back(); - m_aFavChars.emplace_back(sTitle, rFont); + m_aFavChars.emplace_back(rTitle, rFont); css::uno::Sequence<OUString> aFavCharList(m_aFavChars.size()); auto aFavCharListRange = asNonConstRange(aFavCharList);
