tdf#93476 Sort Macro library list after creating/importing a macro

Only set the widget as sorted in the ctor, it remains sorted

Change-Id: I96897cf5512e91192c69874ca857a967b09a1490
Reviewed-on: https://gerrit.libreoffice.org/76866
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Andreas Heinisch
2019-08-02 14:57:49 +02:00
committed by Samuel Mehrbrodt
parent 47aa9324e3
commit e8b3df5b9b
2 changed files with 9 additions and 8 deletions

View File

@@ -217,6 +217,9 @@ LibPage::LibPage(weld::Container* pParent, OrganizeDialog* pDialog)
m_xLibBox->get_height_rows(10));
m_xLibBox->set_size_request(aSize.Width(), aSize.Height());
// tdf#93476 The libraries should be listed alphabetically
m_xLibBox->make_sorted();
m_xEditButton->connect_clicked( LINK( this, LibPage, ButtonHdl ) );
m_xNewLibButton->connect_clicked( LINK( this, LibPage, ButtonHdl ) );
m_xPasswordButton->connect_clicked( LINK( this, LibPage, ButtonHdl ) );
@@ -648,7 +651,6 @@ void LibPage::InsertLib()
const int nRow = rView.n_children() - 1;
rView.set_toggle(nRow, TRISTATE_TRUE, 0);
rView.set_text(nRow, aLibName, 1);
rView.make_sorted();
rView.set_cursor(rView.find_text(aLibName));
}
}
@@ -675,7 +677,6 @@ void LibPage::InsertLib()
return;
bool bChanges = false;
int nNewPos = m_xLibBox->n_children();
bool bRemove = false;
bool bReplace = xLibDlg->IsReplace();
bool bReference = xLibDlg->IsReference();
@@ -894,13 +895,11 @@ void LibPage::InsertLib()
// insert listbox entry
ImpInsertLibEntry( aLibName, m_xLibBox->n_children() );
m_xLibBox->set_cursor( m_xLibBox->find_text(aLibName) );
bChanges = true;
}
}
if (nNewPos < m_xLibBox->n_children())
m_xLibBox->set_cursor(nNewPos);
if ( bChanges )
MarkDocumentModified( m_aCurDocument );
});
@@ -1323,7 +1322,6 @@ void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
if( pLibBox )
{
pLibBox->append_text(aLibName);
pLibBox->make_sorted();
pLibBox->set_cursor(pLibBox->find_text(aLibName));
}

View File

@@ -537,6 +537,9 @@ ObjectPage::ObjectPage(weld::Container* pParent, const OString &rName, BrowseMod
m_xBasicBox->get_height_rows(14));
m_xBasicBox->set_size_request(aSize.Width(), aSize.Height());
// tdf#93476 The dialogs should be listed alphabetically
m_xBasicBox->make_sorted();
m_xEditButton->connect_clicked( LINK( this, ObjectPage, ButtonHdl ) );
m_xDelButton->connect_clicked( LINK( this, ObjectPage, ButtonHdl ) );
m_xBasicBox->connect_changed( LINK( this, ObjectPage, BasicBoxHighlightHdl ) );
@@ -817,7 +820,6 @@ void ObjectPage::NewDialog()
m_xBasicBox->AddEntry(aDlgName, RID_BMP_DIALOG, xSubRootEntry.get(), false,
std::make_unique<Entry>(OBJ_TYPE_DIALOG), xIter.get());
assert(xIter.get() && "Insert entry failed!");
m_xBasicBox->make_sorted();
}
m_xBasicBox->set_cursor(*xIter);
m_xBasicBox->select(*xIter);
@@ -888,6 +890,8 @@ LibDialog::LibDialog(weld::Window* pParent)
{
m_xLibBox->set_size_request(m_xLibBox->get_approximate_digit_width() * 28,
m_xLibBox->get_height_rows(8));
// tdf#93476 The libraries should be listed alphabetically
m_xLibBox->make_sorted();
}
LibDialog::~LibDialog()
@@ -976,7 +980,6 @@ SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument,
{
rBasicBox.AddEntry(aModName, RID_BMP_MODULE, xSubRootEntry.get(), false,
std::make_unique<Entry>(OBJ_TYPE_MODULE), xEntry.get());
rBasicBox.make_sorted();
}
rBasicBox.set_cursor(*xEntry);
rBasicBox.select(*xEntry);