diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-08-01 15:37:09 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-08-01 22:17:30 +0200 |
commit | aee3aa2610971936d6f402365ebf34c14847ab44 (patch) | |
tree | a78b322aff9e2e80e753a17c59a8cea4de2133ad /basctl | |
parent | 68bab1db3b0eaedd315ce7cea32a614f47607b9b (diff) |
no point in using a map anymore
seeing as we want alphabetical sort now, there's no point in
calling GetLineRange and using a map
and only need to set the widget as sorted in the ctor, it remains
always sorted
Change-Id: Ieb5e5c8d9e36375a723376b0009062d6313c8779
Reviewed-on: https://gerrit.libreoffice.org/76810
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/macrodlg.cxx | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index ac93f0bbb01c..ff5422490527 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -42,13 +42,9 @@ #include <vcl/weld.hxx> #include <osl/diagnose.h> -#include <map> - namespace basctl { -using std::map; - using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -79,6 +75,8 @@ MacroChooser::MacroChooser(weld::Window* pParnt, const Reference< frame::XFrame { m_xBasicBox->set_size_request(m_xBasicBox->get_approximate_digit_width() * 30, m_xBasicBox->get_height_rows(18)); m_xMacroBox->set_size_request(m_xMacroBox->get_approximate_digit_width() * 30, m_xMacroBox->get_height_rows(18)); + // tdf#70813 The macros should be listed alphabetically + m_xMacroBox->make_sorted(); m_aMacrosInTxtBaseStr = m_xMacrosInTxt->get_label(); @@ -474,27 +472,19 @@ IMPL_LINK_NOARG(MacroChooser, BasicSelectHdl, weld::TreeView&, void) { m_xMacrosInTxt->set_label(m_aMacrosInTxtBaseStr + " " + pModule->GetName()); - // The macros should be called in the same order that they - // are written down in the module. + m_xMacroBox->freeze(); - map< sal_uInt16, SbMethod* > aMacros; size_t nMacroCount = pModule->GetMethods()->Count(); for ( size_t iMeth = 0; iMeth < nMacroCount; iMeth++ ) { SbMethod* pMethod = static_cast<SbMethod*>(pModule->GetMethods()->Get( iMeth )); - if( pMethod->IsHidden() ) + assert(pMethod && "Method not found!"); + if (pMethod->IsHidden()) continue; - DBG_ASSERT( pMethod, "Method not found! (NULL)" ); - sal_uInt16 nStart, nEnd; - pMethod->GetLineRange( nStart, nEnd ); - aMacros.emplace( nStart, pMethod ); + m_xMacroBox->append_text(pMethod->GetName()); } - m_xMacroBox->freeze(); - for (auto const& macro : aMacros) - m_xMacroBox->append_text(macro.second->GetName()); m_xMacroBox->thaw(); - m_xMacroBox->make_sorted(); if (m_xMacroBox->get_iter_first(*m_xMacroBoxIter)) m_xMacroBox->set_cursor(*m_xMacroBoxIter); |