summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-06-05 10:57:25 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-06-05 20:33:28 +0200
commit68db2d42c1518fdb777faeff891155f350da538c (patch)
tree5a07696b7e09451541ae1215a96863ac14aadfc9 /basctl
parent638f2642769cc73ad6dfa75d33145f03fa408d7f (diff)
have just one way to set expander image
Change-Id: Ic07709a864620c6146616c8e0a1417343c0937de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95590 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2b.cxx6
-rw-r--r--basctl/source/basicide/bastype2.cxx65
-rw-r--r--basctl/source/basicide/moduldlg.cxx2
-rw-r--r--basctl/source/inc/bastype2.hxx2
4 files changed, 39 insertions, 36 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index a1efc0bcd93c..e4ac9b790633 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1740,7 +1740,7 @@ void WatchWindow::AddWatch( const OUString& rVName )
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pWatchItem)));
std::unique_ptr<weld::TreeIter> xRet = m_xTreeListBox->make_iterator();
- m_xTreeListBox->insert(nullptr, -1, &aVar, &sId, nullptr, nullptr, nullptr, false, xRet.get());
+ m_xTreeListBox->insert(nullptr, -1, &aVar, &sId, nullptr, nullptr, false, xRet.get());
m_xTreeListBox->set_text(*xRet, "", 1);
m_xTreeListBox->set_text(*xRet, "", 2);
@@ -2110,7 +2110,7 @@ IMPL_LINK(WatchWindow, RequestingChildrenHdl, const weld::TreeIter&, rParent, bo
WatchItem* pWatchItem = new WatchItem(rName);
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pWatchItem)));
- m_xTreeListBox->insert(&rParent, -1, &rName, &sId, nullptr, nullptr, nullptr, false, xRet.get());
+ m_xTreeListBox->insert(&rParent, -1, &rName, &sId, nullptr, nullptr, false, xRet.get());
m_xTreeListBox->set_text(*xRet, "", 1);
m_xTreeListBox->set_text(*xRet, "", 2);
}
@@ -2160,7 +2160,7 @@ IMPL_LINK(WatchWindow, RequestingChildrenHdl, const weld::TreeIter&, rParent, bo
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pChildItem)));
- m_xTreeListBox->insert(&rParent, -1, &aDisplayName, &sId, nullptr, nullptr, nullptr, false, xRet.get());
+ m_xTreeListBox->insert(&rParent, -1, &aDisplayName, &sId, nullptr, nullptr, false, xRet.get());
m_xTreeListBox->set_text(*xRet, "", 1);
m_xTreeListBox->set_text(*xRet, "", 2);
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index f120f41e0577..23c4d8cc411e 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -160,7 +160,7 @@ EntryDescriptor::EntryDescriptor (
SbTreeListBox::SbTreeListBox(std::unique_ptr<weld::TreeView> xControl, weld::Window* pTopLevel)
: m_xControl(std::move(xControl))
- , m_xIter(m_xControl->make_iterator())
+ , m_xScratchIter(m_xControl->make_iterator())
, m_pTopLevel(pTopLevel)
, m_bFreezeOnFirstAddRemove(false)
, m_aNotifier(*this)
@@ -174,12 +174,12 @@ SbTreeListBox::~SbTreeListBox()
{
m_aNotifier.dispose();
- bool bValidIter = m_xControl->get_iter_first(*m_xIter);
+ bool bValidIter = m_xControl->get_iter_first(*m_xScratchIter);
while (bValidIter)
{
- Entry* pBasicEntry = reinterpret_cast<Entry*>(m_xControl->get_id(*m_xIter).toInt64());
+ Entry* pBasicEntry = reinterpret_cast<Entry*>(m_xControl->get_id(*m_xScratchIter).toInt64());
delete pBasicEntry;
- bValidIter = m_xControl->iter_next(*m_xIter);
+ bValidIter = m_xControl->iter_next(*m_xScratchIter);
}
}
@@ -193,9 +193,9 @@ void SbTreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation
// actually test if basic's in the tree already?!
// level 1: BasicManager (application, document, ...)
- bool bDocumentRootEntry = FindRootEntry(rDocument, eLocation, *m_xIter);
- if (bDocumentRootEntry && m_xControl->get_row_expanded(*m_xIter))
- ImpCreateLibEntries(*m_xIter, rDocument, eLocation);
+ bool bDocumentRootEntry = FindRootEntry(rDocument, eLocation, *m_xScratchIter);
+ if (bDocumentRootEntry && m_xControl->get_row_expanded(*m_xScratchIter))
+ ImpCreateLibEntries(*m_xScratchIter, rDocument, eLocation);
if (!bDocumentRootEntry)
{
OUString aRootName(GetRootEntryName(rDocument, eLocation));
@@ -538,29 +538,29 @@ void SbTreeListBox::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/
void SbTreeListBox::UpdateEntries()
{
- bool bValidIter = m_xControl->get_selected(m_xIter.get());
- EntryDescriptor aCurDesc(GetEntryDescriptor(bValidIter ? m_xIter.get() : nullptr));
+ bool bValidIter = m_xControl->get_selected(m_xScratchIter.get());
+ EntryDescriptor aCurDesc(GetEntryDescriptor(bValidIter ? m_xScratchIter.get() : nullptr));
// removing the invalid entries
std::unique_ptr<weld::TreeIter> xLastValid(m_xControl->make_iterator(nullptr));
bool bLastValid = false;
- bValidIter = m_xControl->get_iter_first(*m_xIter);
+ bValidIter = m_xControl->get_iter_first(*m_xScratchIter);
while (bValidIter)
{
- if (IsValidEntry(*m_xIter))
+ if (IsValidEntry(*m_xScratchIter))
{
- m_xControl->copy_iterator(*m_xIter, *xLastValid);
+ m_xControl->copy_iterator(*m_xScratchIter, *xLastValid);
bLastValid = true;
}
else
- RemoveEntry(*m_xIter);
+ RemoveEntry(*m_xScratchIter);
if (bLastValid)
{
- m_xControl->copy_iterator(*xLastValid, *m_xIter);
- bValidIter = m_xControl->iter_next(*m_xIter);
+ m_xControl->copy_iterator(*xLastValid, *m_xScratchIter);
+ bValidIter = m_xControl->iter_next(*m_xScratchIter);
}
else
- bValidIter = m_xControl->get_iter_first(*m_xIter);
+ bValidIter = m_xControl->get_iter_first(*m_xScratchIter);
}
ScanAllEntries();
@@ -588,15 +588,15 @@ void SbTreeListBox::RemoveEntry(const weld::TreeIter& rIter)
void SbTreeListBox::RemoveEntry (ScriptDocument const& rDocument)
{
// finding the entry of rDocument
- bool bValidIter = m_xControl->get_iter_first(*m_xIter);
+ bool bValidIter = m_xControl->get_iter_first(*m_xScratchIter);
while (bValidIter)
{
- if (rDocument == GetEntryDescriptor(m_xIter.get()).GetDocument())
+ if (rDocument == GetEntryDescriptor(m_xScratchIter.get()).GetDocument())
{
- RemoveEntry(*m_xIter);
+ RemoveEntry(*m_xScratchIter);
break;
}
- bValidIter = m_xControl->iter_next(*m_xIter);
+ bValidIter = m_xControl->iter_next(*m_xScratchIter);
}
}
@@ -653,7 +653,10 @@ void SbTreeListBox::AddEntry(
m_bFreezeOnFirstAddRemove= false;
}
OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(rUserData.release())));
- m_xControl->insert(pParent, -1, &rText, &sId, nullptr, nullptr, &rImage, bChildrenOnDemand, pRet);
+ m_xControl->insert(pParent, -1, &rText, &sId, nullptr, nullptr, bChildrenOnDemand, m_xScratchIter.get());
+ m_xControl->set_image(*m_xScratchIter, rImage);
+ if (pRet)
+ m_xControl->copy_iterator(*m_xScratchIter, *pRet);
}
void SbTreeListBox::SetEntryBitmaps(const weld::TreeIter& rIter, const OUString& rImage)
@@ -737,16 +740,16 @@ void SbTreeListBox::SetCurrentEntry (EntryDescriptor const & rDesc)
ScriptDocument aDocument = aDesc.GetDocument();
OSL_ENSURE( aDocument.isValid(), "TreeListBox::SetCurrentEntry: invalid document!" );
LibraryLocation eLocation = aDesc.GetLocation();
- bool bRootEntry = FindRootEntry(aDocument, eLocation, *m_xIter);
+ bool bRootEntry = FindRootEntry(aDocument, eLocation, *m_xScratchIter);
if (bRootEntry)
{
- m_xControl->copy_iterator(*m_xIter, *xCurIter);
+ m_xControl->copy_iterator(*m_xScratchIter, *xCurIter);
bCurEntry = true;
const OUString& aLibName( aDesc.GetLibName() );
if ( !aLibName.isEmpty() )
{
- m_xControl->expand_row(*m_xIter);
- auto xLibIter = m_xControl->make_iterator(m_xIter.get());
+ m_xControl->expand_row(*m_xScratchIter);
+ auto xLibIter = m_xControl->make_iterator(m_xScratchIter.get());
bool bLibEntry = FindEntry(aLibName, OBJ_TYPE_LIBRARY, *xLibIter);
if (bLibEntry)
{
@@ -802,7 +805,7 @@ void SbTreeListBox::SetCurrentEntry (EntryDescriptor const & rDesc)
}
else
{
- auto xSubLibIter = m_xControl->make_iterator(m_xIter.get());
+ auto xSubLibIter = m_xControl->make_iterator(m_xScratchIter.get());
if (m_xControl->iter_children(*xSubLibIter))
m_xControl->copy_iterator(*xLibIter, *xCurIter);
}
@@ -821,15 +824,15 @@ void SbTreeListBox::SetCurrentEntry (EntryDescriptor const & rDesc)
IMPL_LINK_NOARG(SbTreeListBox, OpenCurrentHdl, weld::TreeView&, bool)
{
- bool bValidIter = m_xControl->get_cursor(m_xIter.get());
+ bool bValidIter = m_xControl->get_cursor(m_xScratchIter.get());
if (!bValidIter)
return true;
- if (!m_xControl->get_row_expanded(*m_xIter))
- m_xControl->expand_row(*m_xIter);
+ if (!m_xControl->get_row_expanded(*m_xScratchIter))
+ m_xControl->expand_row(*m_xScratchIter);
else
- m_xControl->collapse_row(*m_xIter);
+ m_xControl->collapse_row(*m_xScratchIter);
- EntryDescriptor aDesc = GetEntryDescriptor(m_xIter.get());
+ EntryDescriptor aDesc = GetEntryDescriptor(m_xScratchIter.get());
switch (aDesc.GetType())
{
case OBJ_TYPE_METHOD:
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index b9600216eb0e..3b650078fa4d 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -497,7 +497,7 @@ private:
OUString sText(m_rTreeView.get_text(*xSelected));
OUString sId(m_rTreeView.get_id(*xSelected));
std::unique_ptr<weld::TreeIter> xRet(m_rTreeView.make_iterator());
- m_rTreeView.get_widget().insert(xNewParent.get(), nNewChildPos, &sText, &sId, nullptr, nullptr, nullptr, false, xRet.get());
+ m_rTreeView.get_widget().insert(xNewParent.get(), nNewChildPos, &sText, &sId, nullptr, nullptr, false, xRet.get());
if (eType == OBJ_TYPE_MODULE)
m_rTreeView.get_widget().set_image(*xRet, RID_BMP_MODULE);
else if (eType == OBJ_TYPE_DIALOG)
diff --git a/basctl/source/inc/bastype2.hxx b/basctl/source/inc/bastype2.hxx
index 92d593e3f475..61c630855171 100644
--- a/basctl/source/inc/bastype2.hxx
+++ b/basctl/source/inc/bastype2.hxx
@@ -176,7 +176,7 @@ class SbTreeListBox : public DocumentEventListener
{
private:
std::unique_ptr<weld::TreeView> m_xControl;
- std::unique_ptr<weld::TreeIter> m_xIter;
+ std::unique_ptr<weld::TreeIter> m_xScratchIter;
weld::Window* m_pTopLevel;
bool m_bFreezeOnFirstAddRemove;
BrowseMode nMode;