diff options
53 files changed, 229 insertions, 187 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; diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index d8ec5d79c765..3d8116f4ad02 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -418,6 +418,7 @@ CuiConfigGroupListBox::CuiConfigGroupListBox(std::unique_ptr<weld::TreeView> xTr , m_pFunctionListBox(nullptr) , m_pStylesInfo(nullptr) , m_xTreeView(std::move(xTreeView)) + , m_xScratchIter(m_xTreeView->make_iterator()) { m_xTreeView->connect_expanding(LINK(this, CuiConfigGroupListBox, ExpandingHdl)); m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 35, m_xTreeView->get_height_rows(9)); @@ -583,7 +584,8 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip 0, static_cast<void *>( theChild.get()))); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get()))); - m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, nullptr, nullptr, &aImage, bChildOnDemand, nullptr); + m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, nullptr, nullptr, bChildOnDemand, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, aImage); } } } @@ -658,7 +660,7 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent static_cast<void *>(rootNode.get()))); OUString aTitle(xImp->m_sDlgMacros); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get()))); - m_xTreeView->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, nullptr, true, nullptr); + m_xTreeView->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, true, nullptr); } else { @@ -674,7 +676,7 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data OUString sStyle(xImp->m_aStrGroupStyles); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get()))); - m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, nullptr, true, nullptr); + m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, true, nullptr); } m_xTreeView->thaw(); @@ -966,7 +968,7 @@ IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, boo SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(lStyleFamily); aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, pFamily )); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get()))); - m_xTreeView->insert(&rIter, -1, &pFamily->sLabel, &sId, nullptr, nullptr, nullptr, false, nullptr); + m_xTreeView->insert(&rIter, -1, &pFamily->sLabel, &sId, nullptr, nullptr, false, nullptr); } } break; diff --git a/cui/source/dialogs/DiagramDialog.cxx b/cui/source/dialogs/DiagramDialog.cxx index f3a4a069a19c..97ae0ca3d80d 100644 --- a/cui/source/dialogs/DiagramDialog.cxx +++ b/cui/source/dialogs/DiagramDialog.cxx @@ -44,8 +44,7 @@ IMPL_LINK_NOARG(DiagramDialog, OnAddClick, weld::Button&, void) { OUString sNodeId = mpDiagramData->addNode(sText); std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator()); - mpTreeDiagram->insert(nullptr, -1, &sText, &sNodeId, nullptr, nullptr, nullptr, false, - pEntry.get()); + mpTreeDiagram->insert(nullptr, -1, &sText, &sNodeId, nullptr, nullptr, false, pEntry.get()); mpTreeDiagram->select(*pEntry); comphelper::dispatchCommand(".uno:RegenerateDiagram", {}); } @@ -70,8 +69,8 @@ void DiagramDialog::populateTree(const weld::TreeIter* pParent, const OUString& for (auto& aItem : aItems) { std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator()); - mpTreeDiagram->insert(pParent, -1, &aItem.second, &aItem.first, nullptr, nullptr, nullptr, - false, pEntry.get()); + mpTreeDiagram->insert(pParent, -1, &aItem.second, &aItem.first, nullptr, nullptr, false, + pEntry.get()); populateTree(pEntry.get(), aItem.first); } } diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index 3b985b2b0d40..bac63d088f73 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -331,7 +331,7 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess > OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData))); std::unique_ptr<weld::TreeIter> xEntry(mxLbTree->make_iterator()); - mxLbTree->insert(pParentEntry, -1, &aStrDisplayname, &sId, nullptr, nullptr, nullptr, false, xEntry.get()); + mxLbTree->insert(pParentEntry, -1, &aStrDisplayname, &sId, nullptr, nullptr, false, xEntry.get()); try { diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 2c1a9326a9fd..3ce12bccf290 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -317,16 +317,14 @@ void SvxScriptOrgDialog::insertEntry( const OUString& rText, const OUString& rBitmap, const weld::TreeIter* pParent, bool bChildrenOnDemand, std::unique_ptr<SFEntry> && aUserData, bool bSelect) { - std::unique_ptr<weld::TreeIter> xRetIter; - if (bSelect) - xRetIter = m_xScriptsBox->make_iterator(); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aUserData.release()))); // XXX possible leak - m_xScriptsBox->insert(pParent, -1, &rText, &sId, nullptr, nullptr, &rBitmap, - bChildrenOnDemand, xRetIter.get()); + m_xScriptsBox->insert(pParent, -1, &rText, &sId, nullptr, nullptr, + bChildrenOnDemand, m_xScratchIter.get()); + m_xScriptsBox->set_image(*m_xScratchIter, rBitmap); if (bSelect) { - m_xScriptsBox->set_cursor(*xRetIter); - m_xScriptsBox->select(*xRetIter); + m_xScriptsBox->set_cursor(*m_xScratchIter); + m_xScriptsBox->select(*m_xScratchIter); } } @@ -391,6 +389,7 @@ SvxScriptOrgDialog::SvxScriptOrgDialog(weld::Window* pParent, const OUString& la , m_sMyMacros(CuiResId(RID_SVXSTR_MYMACROS)) , m_sProdMacros(CuiResId(RID_SVXSTR_PRODMACROS)) , m_xScriptsBox(m_xBuilder->weld_tree_view("scripts")) + , m_xScratchIter(m_xScriptsBox->make_iterator()) , m_xRunButton(m_xBuilder->weld_button("ok")) , m_xCloseButton(m_xBuilder->weld_button("close")) , m_xCreateButton(m_xBuilder->weld_button("create")) diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index f413495a17ff..7b9fe841620a 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -347,7 +347,7 @@ public: void insert(int pos, const OUString& rId) { m_xControl->insert(nullptr, pos, nullptr, &rId, - nullptr, nullptr, nullptr, false, nullptr); + nullptr, nullptr, false, nullptr); } DECL_LINK(KeyInputHdl, const KeyEvent&, bool); diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx index 944ab68e871f..b3b7d091b61a 100644 --- a/cui/source/inc/cfgutil.hxx +++ b/cui/source/inc/cfgutil.hxx @@ -117,21 +117,22 @@ public: void thaw() { m_xTreeView->thaw(); } void append(const OUString& rId, const OUString& rStr, const weld::TreeIter* pParent = nullptr) { - m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, nullptr, false, nullptr); + m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, false, nullptr); } std::unique_ptr<weld::TreeIter> tree_append(const OUString& rId, const OUString& rStr, const weld::TreeIter* pParent = nullptr) { std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator()); - m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, nullptr, false, xIter.get()); + m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, false, xIter.get()); return xIter; } void append(const OUString& rId, const OUString& rStr, const OUString& rImage, const weld::TreeIter* pParent = nullptr) { - m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, &rImage, false, nullptr); + m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, rImage); } void append(const OUString& rId, const OUString& rStr, const css::uno::Reference<css::graphic::XGraphic>& rImage, const weld::TreeIter* pParent = nullptr) { - m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, false, m_xScratchIter.get()); m_xTreeView->set_image(*m_xScratchIter, rImage, -1); } void remove(int nPos) { m_xTreeView->remove(nPos); } @@ -194,6 +195,7 @@ class CuiConfigGroupListBox css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription; SfxStylesInfo_Impl* m_pStylesInfo; std::unique_ptr<weld::TreeView> m_xTreeView; + std::unique_ptr<weld::TreeIter> m_xScratchIter; static OUString GetImage( const css::uno::Reference< css::script::browse::XBrowseNode >& node, diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx index 7ae0f333563e..dc2e771b9187 100644 --- a/cui/source/inc/scriptdlg.hxx +++ b/cui/source/inc/scriptdlg.hxx @@ -94,6 +94,7 @@ protected: const OUString m_sProdMacros; std::unique_ptr<weld::TreeView> m_xScriptsBox; + std::unique_ptr<weld::TreeIter> m_xScratchIter; std::unique_ptr<weld::Button> m_xRunButton; std::unique_ptr<weld::Button> m_xCloseButton; std::unique_ptr<weld::Button> m_xCreateButton; diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx index 98fd6d19fe15..d3b1ccc90013 100644 --- a/cui/source/options/dbregister.cxx +++ b/cui/source/options/dbregister.cxx @@ -256,7 +256,7 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, PathSelect_Impl, weld::TreeView&, voi void DbRegistrationOptionsPage::insertNewEntry(const OUString& _sName,const OUString& _sLocation, const bool _bReadOnly) { OUString sId(OUString::number(reinterpret_cast<sal_Int64>(new DatabaseRegistration(_sLocation, _bReadOnly)))); - m_xPathBox->insert(nullptr, -1, &_sName, &sId, nullptr, nullptr, nullptr, false, m_xIter.get()); + m_xPathBox->insert(nullptr, -1, &_sName, &sId, nullptr, nullptr, false, m_xIter.get()); if (_bReadOnly) m_xPathBox->set_image(*m_xIter, RID_SVXBMP_LOCK); diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 44bacb1e1195..cd91c4735048 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -204,7 +204,7 @@ void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUS if (bInsertToPrefBox) { OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_vectorUserData.back().get()))); - m_xPrefBox->insert(pParentEntry, -1, &rProp, &sId, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); + m_xPrefBox->insert(pParentEntry, -1, &rProp, &sId, nullptr, nullptr, false, m_xScratchIter.get()); m_xPrefBox->set_text(*m_xScratchIter, rStatus, 1); m_xPrefBox->set_text(*m_xScratchIter, rType, 2); m_xPrefBox->set_text(*m_xScratchIter, rValue, 3); @@ -287,7 +287,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces m_vectorUserData.push_back(std::make_unique<UserData>(xNextNameAccess, lineage + 1)); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_vectorUserData.back().get()))); - m_xPrefBox->insert(pParentEntry, -1, &item, &sId, nullptr, nullptr, nullptr, true, m_xScratchIter.get()); + m_xPrefBox->insert(pParentEntry, -1, &item, &sId, nullptr, nullptr, true, m_xScratchIter.get()); //It is needed, without this the selection line will be truncated. m_xPrefBox->set_text(*m_xScratchIter, "", 1); m_xPrefBox->set_text(*m_xScratchIter, "", 2); @@ -862,7 +862,7 @@ void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& rEntry) if (index < 0) { OUString sId(OUString::number(reinterpret_cast<sal_Int64>(rEntry.pUserData))); - m_xPrefBox->insert(nullptr, -1, &rEntry.sProp, &sId, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); + m_xPrefBox->insert(nullptr, -1, &rEntry.sProp, &sId, nullptr, nullptr, false, m_xScratchIter.get()); m_xPrefBox->set_text(*m_xScratchIter, rEntry.sStatus, 1); m_xPrefBox->set_text(*m_xScratchIter, rEntry.sType, 2); m_xPrefBox->set_text(*m_xScratchIter, rEntry.sValue, 3); @@ -895,7 +895,7 @@ void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& rEntry) if (!hasEntry) { - m_xPrefBox->insert(xGrandParentEntry.get(), -1, &sParentName, nullptr, nullptr, nullptr, nullptr, false, xParentEntry.get()); + m_xPrefBox->insert(xGrandParentEntry.get(), -1, &sParentName, nullptr, nullptr, nullptr, false, xParentEntry.get()); //It is needed, without this the selection line will be truncated. m_xPrefBox->set_text(*xParentEntry, "", 1); m_xPrefBox->set_text(*xParentEntry, "", 2); @@ -906,7 +906,7 @@ void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& rEntry) } while(index < sPath.getLength() - 1); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(rEntry.pUserData))); - m_xPrefBox->insert(xParentEntry.get(), -1, &rEntry.sProp, &sId, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); + m_xPrefBox->insert(xParentEntry.get(), -1, &rEntry.sProp, &sId, nullptr, nullptr, false, m_xScratchIter.get()); m_xPrefBox->set_text(*m_xScratchIter, rEntry.sStatus, 1); m_xPrefBox->set_text(*m_xScratchIter, rEntry.sType, 2); m_xPrefBox->set_text(*m_xScratchIter, rEntry.sValue, 3); diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx index c77f2e4f434b..1df577ee13cd 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -43,7 +43,7 @@ void SvxDefaultColorOptPage::InsertColorEntry(const XColorEntry& rEntry, sal_Int xDevice->DrawRect(aRect); m_xLbChartColors->insert(nullptr, nPos, &rStr, nullptr, - nullptr, xDevice.get(), nullptr, false, nullptr); + nullptr, xDevice.get(), false, nullptr); if (nPos == -1) aColorList.push_back( rColor ); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 2d6b104e1d9b..1eb479681864 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -589,7 +589,7 @@ OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage( OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId ); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pPageInfo))); - xTreeLB->insert(xParent.get(), -1, &rPageName, &sId, nullptr, nullptr, nullptr, false, nullptr); + xTreeLB->insert(xParent.get(), -1, &rPageName, &sId, nullptr, nullptr, false, nullptr); return pPageInfo; } diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx index a1e3d872e840..f608f850ceb4 100644 --- a/dbaccess/source/ui/control/tabletree.cxx +++ b/dbaccess/source/ui/control/tabletree.cxx @@ -386,7 +386,7 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne OUString sId(OUString::number(DatabaseObjectContainer::TABLES)); OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE); std::unique_ptr<weld::TreeIter> xRet(m_xTreeView->make_iterator()); - m_xTreeView->insert(nullptr, -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xRet.get()); + m_xTreeView->insert(nullptr, -1, nullptr, &sId, nullptr, nullptr, false, xRet.get()); m_xTreeView->set_image(*xRet, sImageId, -1); if (m_bShowToggles) m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE, 0); @@ -431,7 +431,7 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne if (!xFolder) { OUString sId(OUString::number(nFolderType)); - m_xTreeView->insert(xRootEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xRet.get()); + m_xTreeView->insert(xRootEntry.get(), -1, nullptr, &sId, nullptr, nullptr, false, xRet.get()); m_xTreeView->set_image(*xRet, sImageId, -1); if (m_bShowToggles) m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE, 0); @@ -707,7 +707,7 @@ void TableTreeListBox::implAddEntry( xFolder = m_xTreeView->make_iterator(); OUString sId(OUString::number(nFirstFolderType)); OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE); - m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xFolder.get()); + m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, false, xFolder.get()); m_xTreeView->set_image(*xFolder, sImageId, -1); if (m_bShowToggles) m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE, 0); @@ -724,7 +724,7 @@ void TableTreeListBox::implAddEntry( xFolder = m_xTreeView->make_iterator(); OUString sId(OUString::number(nSecondFolderType)); OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE); - m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xFolder.get()); + m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, false, xFolder.get()); m_xTreeView->set_image(*xFolder, sImageId, -1); if (m_bShowToggles) m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE, 0); @@ -734,7 +734,7 @@ void TableTreeListBox::implAddEntry( } std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator(); - m_xTreeView->insert(xParentEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, nullptr, false, xEntry.get()); + m_xTreeView->insert(xParentEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, false, xEntry.get()); auto xGraphic = m_xImageProvider->getXGraphic(_rTableName, DatabaseObject::TABLE); if (xGraphic.is()) diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx index 978fa9f36bff..fa24be183a09 100644 --- a/dbaccess/source/ui/dlg/indexdialog.cxx +++ b/dbaccess/source/ui/dlg/indexdialog.cxx @@ -251,7 +251,7 @@ namespace dbaui } std::unique_ptr<weld::TreeIter> xNewEntry(m_xIndexList->make_iterator()); - m_xIndexList->insert(nullptr, -1, &sNewIndexName, nullptr, nullptr, nullptr, nullptr, false, xNewEntry.get()); + m_xIndexList->insert(nullptr, -1, &sNewIndexName, nullptr, nullptr, nullptr, false, xNewEntry.get()); m_xIndexes->insert(sNewIndexName); // update the user data on the entries in the list box: diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx index 785061051683..8941119e9234 100644 --- a/dbaccess/source/ui/misc/WColumnSelect.cxx +++ b/dbaccess/source/ui/misc/WColumnSelect.cxx @@ -334,7 +334,7 @@ void OWizColumnSelect::moveColumn( weld::TreeView* _pRight, OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aSrcIter->second))); const OUString& rStr = (*aIter).first; - _pRight->insert(nullptr, nPos, &rStr, &sId, nullptr, nullptr, nullptr, false, nullptr); + _pRight->insert(nullptr, nPos, &rStr, &sId, nullptr, nullptr, false, nullptr); _rRightColumns.push_back(rStr); m_pParent->removeColumnNameFromNameMap(_sColumnName); } diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index c78b5d930865..478a7b34ab51 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -405,7 +405,7 @@ namespace dbp // insert the entry preserving it's "relative position" entry data OUString sId(OUString::number(nRelativeIndex)); - rMoveTo.insert(nullptr, nInsertPos, &sMovingEntry, &sId, nullptr, nullptr, nullptr, false, nullptr); + rMoveTo.insert(nullptr, nInsertPos, &sMovingEntry, &sId, nullptr, nullptr, false, nullptr); // remove the entry from its old list if (bMoveRight) diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx index 3ff66c82ba97..a1ddce7b10b4 100644 --- a/extensions/source/propctrlr/selectlabeldialog.cxx +++ b/extensions/source/propctrlr/selectlabeldialog.cxx @@ -56,6 +56,7 @@ namespace pcr , m_bHaveAssignableControl(false) , m_xMainDesc(m_xBuilder->weld_label("label")) , m_xControlTree(m_xBuilder->weld_tree_view("control")) + , m_xScratchIter(m_xControlTree->make_iterator()) , m_xNoAssignment(m_xBuilder->weld_check_button("noassignment")) { m_xControlTree->connect_changed(LINK(this, OSelectLabelDialog, OnEntrySelected)); @@ -105,7 +106,8 @@ namespace pcr OUString sRootName(PcrRes(RID_STR_FORMS)); OUString aFormImage(RID_EXTBMP_FORMS); m_xControlTree->insert(nullptr, -1, &sRootName, nullptr, - nullptr, nullptr, &aFormImage, false, nullptr); + nullptr, nullptr, false, m_xScratchIter.get()); + m_xControlTree->set_image(*m_xScratchIter, aFormImage); // build the tree m_xInitialSelection.reset(); @@ -180,7 +182,8 @@ namespace pcr OUString aFormImage(RID_EXTBMP_FORM); m_xControlTree->insert(&rContainerEntry, -1, &sName, nullptr, - nullptr, nullptr, &aFormImage, false, nullptr); + nullptr, nullptr, false, m_xScratchIter.get()); + m_xControlTree->set_image(*m_xScratchIter, aFormImage); auto xIter = m_xControlTree->make_iterator(&rContainerEntry); m_xControlTree->iter_nth_child(*xIter, nChildren); sal_Int32 nContChildren = InsertEntries(xCont, *xIter); @@ -209,7 +212,8 @@ namespace pcr // all requirements met -> insert m_xUserData.emplace_back(new Reference<XPropertySet>(xAsSet)); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_xUserData.back().get()))); - m_xControlTree->insert(&rContainerEntry, -1, &sDisplayName, &sId, nullptr, nullptr, &m_aRequiredControlImage, false, nullptr); + m_xControlTree->insert(&rContainerEntry, -1, &sDisplayName, &sId, nullptr, nullptr, false, m_xScratchIter.get()); + m_xControlTree->set_image(*m_xScratchIter, m_aRequiredControlImage); if (m_xInitialLabelControl == xAsSet) { diff --git a/extensions/source/propctrlr/selectlabeldialog.hxx b/extensions/source/propctrlr/selectlabeldialog.hxx index 2d2fd3188302..217ac30209cd 100644 --- a/extensions/source/propctrlr/selectlabeldialog.hxx +++ b/extensions/source/propctrlr/selectlabeldialog.hxx @@ -43,6 +43,7 @@ namespace pcr std::unique_ptr<weld::Label> m_xMainDesc; std::unique_ptr<weld::TreeView> m_xControlTree; + std::unique_ptr<weld::TreeIter> m_xScratchIter; std::unique_ptr<weld::CheckButton> m_xNoAssignment; public: diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx index 0f5fd9417732..0eed0ff0dfaa 100644 --- a/formula/source/ui/dlg/structpg.cxx +++ b/formula/source/ui/dlg/structpg.cxx @@ -71,19 +71,19 @@ bool StructPage::InsertEntry(const OUString& rText, const weld::TreeIter* pParen { case STRUCT_FOLDER: m_xTlbStruct->insert(pParent, nPos, &rText, &sId, nullptr, nullptr, - nullptr, false, &rRet); + false, &rRet); m_xTlbStruct->set_image(rRet, BMP_STR_OPEN); bEntry = true; break; case STRUCT_END: m_xTlbStruct->insert(pParent, nPos, &rText, &sId, nullptr, nullptr, - nullptr, false, &rRet); + false, &rRet); m_xTlbStruct->set_image(rRet, maImgEnd); bEntry = true; break; case STRUCT_ERROR: m_xTlbStruct->insert(pParent, nPos, &rText, &sId, nullptr, nullptr, - nullptr, false, &rRet); + false, &rRet); m_xTlbStruct->set_image(rRet, maImgError); bEntry = true; break; diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index d10c67dffaef..57269cc72011 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -143,11 +143,13 @@ public: std::unique_ptr<weld::TreeIter> make_iterator() const { return mxTreeView->make_iterator(); } void insert(const OUString &rEntry, const OUString& rId, const OUString& rImage, weld::TreeIter& rIter) { - mxTreeView->insert(nullptr, -1, &rEntry, &rId, nullptr, nullptr, &rImage, false, &rIter); + mxTreeView->insert(nullptr, -1, &rEntry, &rId, nullptr, nullptr, false, &rIter); + mxTreeView->set_image(rIter, rImage); } void append(const OUString& rId, const OUString& rStr, const OUString& rType, const OUString& rSize, const OUString& rDate, const OUString& rImage) { - mxTreeView->insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, &rImage, false, mxScratchIter.get()); + mxTreeView->insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, false, mxScratchIter.get()); + mxTreeView->set_image(*mxScratchIter, rImage); int nCol = 1; if (mbShowType) mxTreeView->set_text(*mxScratchIter, rType, nCol++); diff --git a/fpicker/source/office/foldertree.cxx b/fpicker/source/office/foldertree.cxx index 256335c3702a..c2c9c764a742 100644 --- a/fpicker/source/office/foldertree.cxx +++ b/fpicker/source/office/foldertree.cxx @@ -20,6 +20,7 @@ using namespace ::com::sun::star::task; FolderTree::FolderTree(std::unique_ptr<weld::TreeView> xTreeView, weld::Window* pTopLevel) : m_xTreeView(std::move(xTreeView)) + , m_xScratchIter(m_xTreeView->make_iterator()) , m_pTopLevel(pTopLevel) { m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 24, @@ -44,11 +45,11 @@ IMPL_LINK(FolderTree, RequestingChildrenHdl, const weld::TreeIter&, rEntry, bool void FolderTree::InsertRootEntry(const OUString& rId, const OUString& rRootLabel) { - std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator()); OUString sFolderImage(RID_BMP_FOLDER); m_xTreeView->insert(nullptr, -1, &rRootLabel, &rId, nullptr, nullptr, - &sFolderImage, true, xEntry.get()); - m_xTreeView->set_cursor(*xEntry); + true, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sFolderImage); + m_xTreeView->set_cursor(*m_xScratchIter); } void FolderTree::FillTreeEntry(const weld::TreeIter& rEntry) @@ -83,7 +84,8 @@ void FolderTree::FillTreeEntry(const weld::TreeIter& rEntry) if (!i->mbIsFolder) continue; m_xTreeView->insert(&rEntry, -1, &i->GetTitle(), &i->maTargetURL, - nullptr, nullptr, &sFolderImage, true, nullptr); + nullptr, nullptr, true, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sFolderImage); } } } @@ -116,7 +118,8 @@ void FolderTree::FillTreeEntry( const OUString & rUrl, const ::std::vector< std: for (auto const& folder : rFolders) { m_xTreeView->insert(xParent.get(), -1, &folder.first, &folder.second, - nullptr, nullptr, &sFolderImage, true, nullptr); + nullptr, nullptr, true, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sFolderImage); } m_sLastUpdatedDir = rUrl; diff --git a/fpicker/source/office/foldertree.hxx b/fpicker/source/office/foldertree.hxx index 7e5e85816c48..aaa79bbf2635 100644 --- a/fpicker/source/office/foldertree.hxx +++ b/fpicker/source/office/foldertree.hxx @@ -23,6 +23,7 @@ class FolderTree { private: std::unique_ptr<weld::TreeView> m_xTreeView; + std::unique_ptr<weld::TreeIter> m_xScratchIter; weld::Window* m_pTopLevel; Reference< XCommandEnvironment > m_xEnv; ::osl::Mutex m_aMutex; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index b53bf27c7902..0705c546e69f 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -841,12 +841,12 @@ public: virtual void insert(const TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface, - const OUString* pExpanderName, bool bChildrenOnDemand, TreeIter* pRet) + bool bChildrenOnDemand, TreeIter* pRet) = 0; void insert(int nRow, TreeIter* pRet = nullptr) { - insert(nullptr, nRow, nullptr, nullptr, nullptr, nullptr, nullptr, false, pRet); + insert(nullptr, nRow, nullptr, nullptr, nullptr, nullptr, false, pRet); } void append(TreeIter* pRet = nullptr) { insert(-1, pRet); } @@ -854,36 +854,36 @@ public: void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface) { - insert(nullptr, pos, &rStr, pId, pIconName, pImageSurface, nullptr, false, nullptr); + insert(nullptr, pos, &rStr, pId, pIconName, pImageSurface, false, nullptr); } void insert_text(int pos, const OUString& rStr) { - insert(nullptr, pos, &rStr, nullptr, nullptr, nullptr, nullptr, false, nullptr); + insert(nullptr, pos, &rStr, nullptr, nullptr, nullptr, false, nullptr); } void append_text(const OUString& rStr) { - insert(nullptr, -1, &rStr, nullptr, nullptr, nullptr, nullptr, false, nullptr); + insert(nullptr, -1, &rStr, nullptr, nullptr, nullptr, false, nullptr); } void append(const OUString& rId, const OUString& rStr) { - insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, nullptr, false, nullptr); + insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, false, nullptr); } void append(const OUString& rId, const OUString& rStr, const OUString& rImage) { - insert(nullptr, -1, &rStr, &rId, &rImage, nullptr, nullptr, false, nullptr); + insert(nullptr, -1, &rStr, &rId, &rImage, nullptr, false, nullptr); } void append(const TreeIter* pParent, const OUString& rId, const OUString& rStr, const OUString& rImage) { - insert(pParent, -1, &rStr, &rId, &rImage, nullptr, nullptr, false, nullptr); + insert(pParent, -1, &rStr, &rId, &rImage, nullptr, false, nullptr); } void append(const TreeIter* pParent, const OUString& rStr) { - insert(pParent, -1, &rStr, nullptr, nullptr, nullptr, nullptr, false, nullptr); + insert(pParent, -1, &rStr, nullptr, nullptr, nullptr, false, nullptr); } void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage) { - insert(nullptr, -1, &rStr, &rId, nullptr, &rImage, nullptr, false, nullptr); + insert(nullptr, -1, &rStr, &rId, nullptr, &rImage, false, nullptr); } virtual void insert_separator(int pos, const OUString& rId) = 0; @@ -921,8 +921,11 @@ public: virtual void set_id(int row, const OUString& rId) = 0; virtual void set_toggle(int row, TriState eState, int col) = 0; virtual TriState get_toggle(int row, int col) const = 0; + // col index -1 sets the expander image virtual void set_image(int row, const OUString& rImage, int col = -1) = 0; + // col index -1 sets the expander image virtual void set_image(int row, VirtualDevice& rImage, int col = -1) = 0; + // col index -1 sets the expander image virtual void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col = -1) = 0; @@ -1022,8 +1025,11 @@ public: virtual OUString get_text(const TreeIter& rIter, int col = -1) const = 0; virtual void set_id(const TreeIter& rIter, const OUString& rId) = 0; virtual OUString get_id(const TreeIter& rIter) const = 0; + // col index -1 sets the expander image virtual void set_image(const TreeIter& rIter, const OUString& rImage, int col = -1) = 0; + // col index -1 sets the expander image virtual void set_image(const TreeIter& rIter, VirtualDevice& rImage, int col = -1) = 0; + // col index -1 sets the expander image virtual void set_image(const TreeIter& rIter, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col = -1) = 0; diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index d8f1323ac5b5..8c6a7cf53f0c 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -383,7 +383,7 @@ void NavigatorTree::insertEntry(const OUString& rName, weld::TreeIter* pParent, int nPosition, UserData* pData, weld::TreeIter& rRet) { OUString sId = pData ? OUString::number(reinterpret_cast<sal_Int64>(pData)) : OUString(); - m_xTreeView->insert(pParent, nPosition, &rName, &sId, nullptr, nullptr, nullptr, false, &rRet); + m_xTreeView->insert(pParent, nPosition, &rName, &sId, nullptr, nullptr, false, &rRet); if (!rImageId.isEmpty()) m_xTreeView->set_image(rRet, rImageId); } diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx index ab16ae66c4ba..f886dd555a66 100644 --- a/sc/source/filter/orcus/xmlcontext.cxx +++ b/sc/source/filter/orcus/xmlcontext.cxx @@ -74,7 +74,7 @@ void populateTree( { OUString sEntry(toString(rElemName, rWalker)); std::unique_ptr<weld::TreeIter> xEntry(rTreeCtrl.make_iterator()); - rTreeCtrl.insert(pParent, -1, &sEntry, nullptr, nullptr, nullptr, nullptr, false, xEntry.get()); + rTreeCtrl.insert(pParent, -1, &sEntry, nullptr, nullptr, nullptr, false, xEntry.get()); rTreeCtrl.set_image(*xEntry, rParam.maImgElementDefault, -1); ScOrcusXMLTreeParam::EntryData& rEntryData = setUserDataToEntry(rTreeCtrl, @@ -97,7 +97,7 @@ void populateTree( { OUString sAttr(toString(rAttrName, rWalker)); std::unique_ptr<weld::TreeIter> xAttr(rTreeCtrl.make_iterator()); - rTreeCtrl.insert(xEntry.get(), -1, &sAttr, nullptr, nullptr, nullptr, nullptr, false, xAttr.get()); + rTreeCtrl.insert(xEntry.get(), -1, &sAttr, nullptr, nullptr, nullptr, false, xAttr.get()); ScOrcusXMLTreeParam::EntryData& rAttrData = setUserDataToEntry(rTreeCtrl, *xAttr, rParam.m_UserDataStore, ScOrcusXMLTreeParam::Attribute); diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx index e9a16a33b729..8e59df906f66 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx @@ -101,7 +101,7 @@ void ScPivotLayoutTreeList::InsertEntryForItem(const ScItemValue* pItemValue, in maItemValues.push_back(std::unique_ptr<ScItemValue>(pListItemValue)); OUString sName = pListItemValue->maName; OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pListItemValue))); - mxControl->insert(nullptr, nPosition, &sName, &sId, nullptr, nullptr, nullptr, false, nullptr); + mxControl->insert(nullptr, nPosition, &sName, &sId, nullptr, nullptr, false, nullptr); } IMPL_LINK(ScPivotLayoutTreeList, KeyInputHdl, const KeyEvent&, rKeyEvent, bool) diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx index cde29f02034a..141458507a94 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx @@ -185,7 +185,7 @@ void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(weld::TreeView& rSour OUString sText = mxControl->get_selected_text(); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue))); mxControl->remove_id(sId); - mxControl->insert(nullptr, nTarget, &sText, &sId, nullptr, nullptr, nullptr, false, nullptr); + mxControl->insert(nullptr, nTarget, &sText, &sId, nullptr, nullptr, false, nullptr); } else { @@ -215,7 +215,7 @@ void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, int rFunctionData.mnDupCount); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDataItemValue))); - mxControl->insert(nullptr, nPosition, &sDataName, &sId, nullptr, nullptr, nullptr, false, nullptr); + mxControl->insert(nullptr, nPosition, &sDataName, &sId, nullptr, nullptr, false, nullptr); } void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValue) diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index f9e70deb9e4c..fecbd56db7f5 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -476,7 +476,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction( std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); OUString sString(aBuf.makeStringAndClear()); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release()))); - rTreeView.insert(pParent, -1, &sString, &sId, nullptr, nullptr, nullptr, bCreateOnDemand, xEntry.get()); + rTreeView.insert(pParent, -1, &sString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get()); if (!bFlag && bUseColor && !pParent) { rTreeView.set_font_color(*xEntry, COL_LIGHTBLUE); @@ -594,7 +594,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendFilteredAction( weld::TreeView& rTreeView = pTheView->GetWidget(); xEntry = rTreeView.make_iterator(); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release()))); - rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, nullptr, bCreateOnDemand, xEntry.get()); + rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get()); OUString aRefStr; pScChangeAction->GetRefString(aRefStr, pDoc, true); @@ -723,7 +723,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const weld::TreeView& rTreeView = pTheView->GetWidget(); std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release()))); - rTreeView.insert(&rParent, -1, &aString, &sId, nullptr, nullptr, nullptr, false, xEntry.get()); + rTreeView.insert(&rParent, -1, &aString, &sId, nullptr, nullptr, false, xEntry.get()); if (pTheView->IsValidComment(aComment) && bFlag) bHasFilterEntry=true; else @@ -806,9 +806,9 @@ void ScAcceptChgDlg::UpdateView() pTPView->EnableRejectAll(bTheFlag); if (nAcceptCount>0) - rTreeView.insert(nullptr, -1, &aStrAllAccepted, nullptr, nullptr, nullptr, nullptr, true, nullptr); + rTreeView.insert(nullptr, -1, &aStrAllAccepted, nullptr, nullptr, nullptr, true, nullptr); if (nRejectCount>0) - rTreeView.insert(nullptr, -1, &aStrAllRejected, nullptr, nullptr, nullptr, nullptr, true, nullptr); + rTreeView.insert(nullptr, -1, &aStrAllRejected, nullptr, nullptr, nullptr, true, nullptr); rTreeView.thaw(); m_xDialog->set_busy_cursor(false); std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); @@ -1316,7 +1316,7 @@ IMPL_LINK(ScAcceptChgDlg, ExpandingHandle, const weld::TreeIter&, rEntry, bool) if (bTheTestFlag) { std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); - rTreeView.insert(&rEntry, -1, &aStrNoEntry, nullptr, nullptr, nullptr, nullptr, false, xEntry.get()); + rTreeView.insert(&rEntry, -1, &aStrNoEntry, nullptr, nullptr, nullptr, false, xEntry.get()); rTreeView.set_font_color(*xEntry, COL_GRAY); } } diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index 7a524e3f32e1..f5b1d786443a 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -596,7 +596,7 @@ void ScConflictsDlg::UpdateView() OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pRootUserData.release()))); std::unique_ptr<weld::TreeIter> xRootEntry(rTreeView.make_iterator()); std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); - rTreeView.insert(nullptr, -1, &sString, &sId, nullptr, nullptr, nullptr, false, xRootEntry.get()); + rTreeView.insert(nullptr, -1, &sString, &sId, nullptr, nullptr, false, xRootEntry.get()); for ( const auto& aSharedAction : rConflictEntry.maSharedActions ) { @@ -613,7 +613,7 @@ void ScConflictsDlg::UpdateView() } } - rTreeView.insert(xRootEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, nullptr, false, xEntry.get()); + rTreeView.insert(xRootEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, false, xEntry.get()); SetActionString(pAction, mpSharedDoc, *xEntry); } } @@ -636,7 +636,7 @@ void ScConflictsDlg::UpdateView() std::unique_ptr<RedlinData> pUserData(new RedlinData()); pUserData->pData = static_cast< void* >( pAction ); OUString aId(OUString::number(reinterpret_cast<sal_Int64>(pUserData.release()))); - rTreeView.insert(xRootEntry.get(), -1, nullptr, &aId, nullptr, nullptr, nullptr, false, xEntry.get()); + rTreeView.insert(xRootEntry.get(), -1, nullptr, &aId, nullptr, nullptr, false, xEntry.get()); SetActionString(pAction, mpOwnDoc, *xEntry); } } diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 7675f7c93f6a..35d84f760aaf 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -186,7 +186,8 @@ void ScContentTree::InitRoot( ScContentId nType ) // back to the correct position: sal_uInt16 nPos = nRootType != ScContentId::ROOT ? 0 : pPosList[nType]-1; m_aRootNodes[nType] = m_xTreeView->make_iterator(); - m_xTreeView->insert(nullptr, nPos, &aName, nullptr, nullptr, nullptr, &aImage, false, m_aRootNodes[nType].get()); + m_xTreeView->insert(nullptr, nPos, &aName, nullptr, nullptr, nullptr, false, m_aRootNodes[nType].get()); + m_xTreeView->set_image(*m_aRootNodes[nType], aImage); } void ScContentTree::ClearAll() @@ -227,7 +228,7 @@ void ScContentTree::InsertContent( ScContentId nType, const OUString& rValue ) weld::TreeIter* pParent = m_aRootNodes[nType].get(); if (pParent) { - m_xTreeView->insert(pParent, -1, &rValue, nullptr, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->insert(pParent, -1, &rValue, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); m_xTreeView->set_sensitive(*m_xScratchIter, true); } else @@ -889,7 +890,7 @@ void ScContentTree::GetDrawNames( ScContentId nType ) weld::TreeIter* pParent = m_aRootNodes[nType].get(); if (pParent) { - m_xTreeView->insert(pParent, -1, &aName, nullptr, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->insert(pParent, -1, &aName, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); m_xTreeView->set_sensitive(*m_xScratchIter, true); }//end if parent else diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 8eceb1c0c5a6..0e2762ce762e 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -753,7 +753,7 @@ void CustomAnimationList::update() mxEntries.emplace_back(std::make_unique<CustomAnimationListEntryItem>(aDescription, nullptr)); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(mxEntries.back().get()))); - mxTreeView->insert(nullptr, -1, &aDescription, &sId, nullptr, nullptr, nullptr, false, nullptr); + mxTreeView->insert(nullptr, -1, &aDescription, &sId, nullptr, nullptr, false, nullptr); std::for_each( pIS->getBegin(), pIS->getEnd(), stl_append_effect_func( *this ) ); mxLastParentEntry.reset(); } @@ -894,12 +894,12 @@ void CustomAnimationList::append( CustomAnimationEffectPtr pEffect ) if (xParentEntry) { // add a subentry - mxTreeView->insert(xParentEntry.get(), -1, &aDescription, &sId, nullptr, nullptr, nullptr, false, xEntry.get()); + mxTreeView->insert(xParentEntry.get(), -1, &aDescription, &sId, nullptr, nullptr, false, xEntry.get()); } else { // add a root entry - mxTreeView->insert(nullptr, -1, &aDescription, &sId, nullptr, nullptr, nullptr, false, xEntry.get()); + mxTreeView->insert(nullptr, -1, &aDescription, &sId, nullptr, nullptr, false, xEntry.get()); // and the new root entry becomes the possible next group header mxLastTargetShape = xTargetShape; diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 485c0f48fa30..38772de43da2 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -639,6 +639,7 @@ void SdPageObjsTLV::AddShapeToTransferable ( SdPageObjsTLV::SdPageObjsTLV(std::unique_ptr<weld::TreeView> xTreeView) : m_xTreeView(std::move(xTreeView)) + , m_xScratchIter(m_xTreeView->make_iterator()) , m_xDropTargetHelper(new SdPageObjsTLVDropTarget(*m_xTreeView)) , m_xAccel(::svt::AcceleratorExecute::createAcceleratorHelper()) , m_pDoc(nullptr) @@ -866,7 +867,8 @@ IMPL_LINK(SdPageObjsTLV, RequestingChildrenHdl, const weld::TreeIter&, rFileEntr { OUString sId(OUString::number(1)); m_xTreeView->insert(&rFileEntry, -1, &pPage->GetName(), &sId, - nullptr, nullptr, &sImgPage, false, nullptr); + nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sImgPage); if (!xPageEntry) { @@ -887,17 +889,20 @@ IMPL_LINK(SdPageObjsTLV, RequestingChildrenHdl, const weld::TreeIter&, rFileEntr if( pObj->GetObjInventor() == SdrInventor::Default && pObj->GetObjIdentifier() == OBJ_OLE2 ) { m_xTreeView->insert(xPageEntry.get(), -1, &aStr, nullptr, - nullptr, nullptr, &sImgOle, false, nullptr); + nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sImgOle); } else if( pObj->GetObjInventor() == SdrInventor::Default && pObj->GetObjIdentifier() == OBJ_GRAF ) { m_xTreeView->insert(xPageEntry.get(), -1, &aStr, nullptr, - nullptr, nullptr, &sImgGraphic, false, nullptr); + nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sImgGraphic); } else { m_xTreeView->insert(xPageEntry.get(), -1, &aStr, nullptr, - nullptr, nullptr, &sImgObjects, false, nullptr); + nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sImgObjects); } } } @@ -1125,7 +1130,8 @@ void SdPageObjsTLV::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium, OUString sId(OUString::number(1)); // insert document name - m_xTreeView->insert(nullptr, -1, &m_aDocName, &sId, nullptr, nullptr, &sImgDoc, true, nullptr); + m_xTreeView->insert(nullptr, -1, &m_aDocName, &sId, nullptr, nullptr, true, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sImgDoc); } /** diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index 43bdbffded40..4119ace36a47 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -70,6 +70,7 @@ private: static bool SAL_DLLPRIVATE bIsInDrag; ///< static, in the case the navigator is deleted in ExecuteDrag std::unique_ptr<weld::TreeView> m_xTreeView; + std::unique_ptr<weld::TreeIter> m_xScratchIter; std::unique_ptr<SdPageObjsTLVDropTarget> m_xDropTargetHelper; std::unique_ptr<::svt::AcceleratorExecute> m_xAccel; VclPtr<SdNavigatorWin> m_xNavigator; @@ -319,12 +320,16 @@ public: void InsertEntry(const OUString &rName, const OUString &rExpander) { - m_xTreeView->insert(nullptr, -1, &rName, nullptr, nullptr, nullptr, &rExpander, false, nullptr); + m_xTreeView->insert(nullptr, -1, &rName, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, rExpander); } void InsertEntry(const weld::TreeIter* pParent, const OUString& rId, const OUString &rName, const OUString &rExpander, weld::TreeIter* pEntry = nullptr) { - m_xTreeView->insert(pParent, -1, &rName, &rId, nullptr, nullptr, &rExpander, false, pEntry); + m_xTreeView->insert(pParent, -1, &rName, &rId, nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, rExpander); + if (pEntry) + m_xTreeView->copy_iterator(*m_xScratchIter, *pEntry); } //Mark Current Entry diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 9160c231f7e3..8226c637bef0 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -229,7 +229,8 @@ void ContentTabPage_Impl::InitRoot() OUString sId; if (bIsFolder) sId = OUString::number(reinterpret_cast<sal_Int64>(new ContentEntry_Impl(aURL, true))); - m_xContentBox->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, &aClosedBookImage, true, nullptr); + m_xContentBox->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, true, m_xScratchIter.get()); + m_xContentBox->set_image(*m_xScratchIter, aClosedBookImage); } } @@ -267,7 +268,8 @@ IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool) if ( bIsFolder ) { OUString sId = OUString::number(reinterpret_cast<sal_Int64>(new ContentEntry_Impl(aURL, true))); - m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, &aClosedBookImage, true, nullptr); + m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, true, m_xScratchIter.get()); + m_xContentBox->set_image(*m_xScratchIter, aClosedBookImage); } else { @@ -276,7 +278,8 @@ IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool) OUString aTargetURL; if ( aAny >>= aTargetURL ) sId = OUString::number(reinterpret_cast<sal_Int64>(new ContentEntry_Impl(aTargetURL, false))); - m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, &aDocumentImage, false, nullptr); + m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, false, m_xScratchIter.get()); + m_xContentBox->set_image(*m_xScratchIter, aDocumentImage); } } } @@ -328,6 +331,7 @@ ContentTabPage_Impl::ContentTabPage_Impl(weld::Widget* pParent, SfxHelpIndexWind : HelpTabPage_Impl(pParent, pIdxWin, "HelpContentPage", "sfx/ui/helpcontentpage.ui") , m_xContentBox(m_xBuilder->weld_tree_view("content")) + , m_xScratchIter(m_xContentBox->make_iterator()) , aOpenBookImage(BMP_HELP_CONTENT_BOOK_OPEN) , aClosedBookImage(BMP_HELP_CONTENT_BOOK_CLOSED) , aDocumentImage(BMP_HELP_CONTENT_DOC) diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index 6a78b857081e..973f4c7089cc 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -63,6 +63,7 @@ class ContentTabPage_Impl : public HelpTabPage_Impl { private: std::unique_ptr<weld::TreeView> m_xContentBox; + std::unique_ptr<weld::TreeIter> m_xScratchIter; OUString aOpenBookImage; OUString aClosedBookImage; OUString aDocumentImage; diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 03da396a51b5..a6d88a2ffade 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -491,7 +491,7 @@ static void FillBox_Impl(weld::TreeView& rBox, { std::unique_ptr<weld::TreeIter> xResult = rBox.make_iterator(); const OUString& rName = pEntry->getName(); - rBox.insert(pParent, -1, &rName, &rName, nullptr, nullptr, nullptr, false, xResult.get()); + rBox.insert(pParent, -1, &rName, &rName, nullptr, nullptr, false, xResult.get()); for (size_t i = 0; i < pEntry->getChildren().size(); ++i) FillBox_Impl(rBox, pEntry->getChildren()[i].get(), rEntries, eStyleFamily, xResult.get()); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index ac8c987ea227..c51e2a7fd927 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -462,7 +462,8 @@ void SwEditRegionDlg::RecurseList(const SwSectionFormat* pFormat, const weld::Tr OUString sText(pSect->GetSectionName()); OUString sImage(BuildBitmap(pSect->IsProtect(),pSect->IsHidden())); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pSectRepr))); - m_xTree->insert(nullptr, -1, &sText, &sId, nullptr, nullptr, &sImage, false, xIter.get()); + m_xTree->insert(nullptr, -1, &sText, &sId, nullptr, nullptr, false, xIter.get()); + m_xTree->set_image(*xIter, sImage); RecurseList(pFormat, xIter.get()); if (m_xTree->iter_has_child(*xIter)) @@ -494,7 +495,8 @@ void SwEditRegionDlg::RecurseList(const SwSectionFormat* pFormat, const weld::Tr OUString sText(pSect->GetSectionName()); OUString sImage = BuildBitmap(pSect->IsProtect(), pSect->IsHidden()); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pSectRepr))); - m_xTree->insert(pEntry, -1, &sText, &sId, nullptr, nullptr, &sImage, false, xIter.get()); + m_xTree->insert(pEntry, -1, &sText, &sId, nullptr, nullptr, false, xIter.get()); + m_xTree->set_image(*xIter, sImage); RecurseList(pSect->GetFormat(), xIter.get()); if (m_xTree->iter_has_child(*xIter)) diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index b6fcc8126338..379e0645906d 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -135,16 +135,19 @@ std::unique_ptr<weld::TreeIter> SwChangeDBDlg::Insert(const OUString& rDBName) } } m_xUsedDBTLB->insert(xIter.get(), -1, &sTableName, &sUserData, nullptr, nullptr, - &rToInsert, false, xIter.get()); + false, xIter.get()); + m_xUsedDBTLB->set_image(*xIter, rToInsert); return xIter; } } while (m_xUsedDBTLB->iter_next_sibling(*xIter)); } m_xUsedDBTLB->insert(nullptr, -1, &sDBName, nullptr, nullptr, nullptr, - &aDBImg, false, xIter.get()); + false, xIter.get()); + m_xUsedDBTLB->set_image(*xIter, aDBImg); m_xUsedDBTLB->insert(xIter.get(), -1, &sTableName, &sUserData, nullptr, nullptr, - &rToInsert, false, xIter.get()); + false, xIter.get()); + m_xUsedDBTLB->set_image(*xIter, rToInsert); return xIter; } diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index a1145acb05a5..9bb8e08cf737 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -142,13 +142,13 @@ void SwFieldDokInfPage::Reset(const SfxItemSet* ) OUString sText(SwResId(STR_CUSTOM_FIELD)); OUString sEntryId(OUString::number(USHRT_MAX)); m_xTypeTLB->insert(nullptr, -1, &sText, &sEntryId, nullptr, - nullptr, nullptr, false, xInfo.get()); + nullptr, false, xInfo.get()); for (const auto& rProperty : rProperties) { const OUString sEntry = rProperty.Name; m_xTypeTLB->insert(xInfo.get(), -1, &sEntry, &sId, - nullptr, nullptr, nullptr, false, xEntry.get()); + nullptr, nullptr, false, xEntry.get()); if (m_sOldCustomFieldName == sEntry) { m_xSelEntry = m_xTypeTLB->make_iterator(xEntry.get()); @@ -163,7 +163,7 @@ void SwFieldDokInfPage::Reset(const SfxItemSet* ) if (!(IsFieldDlgHtmlMode() && (i == DI_EDIT || i == DI_SUBJECT || i == DI_PRINT))) { m_xTypeTLB->insert(nullptr, -1, &aLst[i], &sId, - nullptr, nullptr, nullptr, false, xEntry.get()); + nullptr, nullptr, false, xEntry.get()); } } if (static_cast<size_t>(nSelEntryData) == i) diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 916ade14f4b2..8b54fba20473 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -475,7 +475,7 @@ IMPL_LINK(SwGlossaryDlg, MenuHdl, const OString&, rItemIdent, void) else if (m_xCategoryBox->get_iter_depth(*xEntry)) m_xCategoryBox->iter_parent(*xEntry); m_xCategoryBox->insert(xEntry.get(), -1, &aStr, &aShortName, - nullptr, nullptr, nullptr, false, nullptr); + nullptr, nullptr, false, nullptr); m_xNameED->set_text(aStr); m_xShortNameEdit->set_text(aShortName); @@ -515,7 +515,7 @@ IMPL_LINK(SwGlossaryDlg, MenuHdl, const OString&, rItemIdent, void) OUString sName(aNewNameDlg.GetNewName()); m_xCategoryBox->insert(xEntry.get(), -1, &sName, &sId, - nullptr, nullptr, nullptr, false, xNewEntry.get()); + nullptr, nullptr, false, xNewEntry.get()); m_xCategoryBox->remove(*xOldEntry); m_xCategoryBox->select(*xNewEntry); @@ -737,7 +737,7 @@ void SwGlossaryDlg::Init() OUString sEntryName = m_pGlossaryHdl->GetGlossaryName(i); OUString sId = m_pGlossaryHdl->GetGlossaryShortName(i); m_xCategoryBox->insert(xEntry.get(), -1, &sEntryName, &sId, - nullptr, nullptr, nullptr, false, nullptr); + nullptr, nullptr, false, nullptr); } } } diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx index cf31941c31db..cdebbaaed4e1 100644 --- a/sw/source/uibase/dbui/dbtree.cxx +++ b/sw/source/uibase/dbui/dbtree.cxx @@ -132,6 +132,7 @@ SwDBTreeList::SwDBTreeList(std::unique_ptr<weld::TreeView> xTreeView) , bShowColumns(false) , pImpl(new SwDBTreeList_Impl) , m_xTreeView(std::move(xTreeView)) + , m_xScratchIter(m_xTreeView->make_iterator()) { m_xTreeView->connect_expanding(LINK(this, SwDBTreeList, RequestingChildrenHdl)); } @@ -160,7 +161,8 @@ void SwDBTreeList::InitTreeList() Reference<XConnection> xConnection = pImpl->GetConnection(rDBName); if (xConnection.is()) { - m_xTreeView->insert(nullptr, -1, &rDBName, nullptr, nullptr, nullptr, &aImg, true, nullptr); + m_xTreeView->insert(nullptr, -1, &rDBName, nullptr, nullptr, nullptr, true, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, aImg); } } Select(OUString(), OUString(), OUString()); @@ -171,9 +173,9 @@ void SwDBTreeList::InitTreeList() void SwDBTreeList::AddDataSource(const OUString& rSource) { OUString aImg(RID_BMP_DB); - std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator()); - m_xTreeView->insert(nullptr, -1, &rSource, nullptr, nullptr, nullptr, &aImg, true, xIter.get()); - m_xTreeView->select(*xIter); + m_xTreeView->insert(nullptr, -1, &rSource, nullptr, nullptr, nullptr, true, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, aImg); + m_xTreeView->select(*m_xScratchIter); } IMPL_LINK(SwDBTreeList, RequestingChildrenHdl, const weld::TreeIter&, rParent, bool) @@ -266,7 +268,8 @@ IMPL_LINK(SwDBTreeList, RequestingChildrenHdl, const weld::TreeIter&, rParent, b for (const OUString& rTableName : aTableNames) { m_xTreeView->insert(&rParent, -1, &rTableName, nullptr, - nullptr, nullptr, &aImg, bShowColumns, nullptr); + nullptr, nullptr, bShowColumns, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, aImg); } } @@ -281,7 +284,8 @@ IMPL_LINK(SwDBTreeList, RequestingChildrenHdl, const weld::TreeIter&, rParent, b //to discriminate between queries and tables the user data of query entries is set OUString sId(OUString::number(1)); m_xTreeView->insert(&rParent, -1, &rQueryName, &sId, - nullptr, nullptr, &aImg, bShowColumns, nullptr); + nullptr, nullptr, bShowColumns, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, aImg); } } } diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 59df0d51c3ea..0a090a1d18f0 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -84,6 +84,7 @@ public: class SwContentTree final : public SfxListener { std::unique_ptr<weld::TreeView> m_xTreeView; + std::unique_ptr<weld::TreeIter> m_xScratchIter; SwContentTreeDropTarget m_aDropTargetHelper; VclPtr<SwNavigationPI> m_xDialog; OUString m_sSpace; @@ -129,7 +130,7 @@ class SwContentTree final : public SfxListener void FindActiveTypeAndRemoveUserData(); void insert(const weld::TreeIter* pParent, const OUString& rStr, const OUString& rId, - const OUString* pExpanderName, bool bChildrenOnDemand, weld::TreeIter* pRet); + bool bChildrenOnDemand, weld::TreeIter* pRet); void remove(const weld::TreeIter& rIter); diff --git a/sw/source/uibase/inc/dbtree.hxx b/sw/source/uibase/inc/dbtree.hxx index e3c994d44ddb..863ac1a40083 100644 --- a/sw/source/uibase/inc/dbtree.hxx +++ b/sw/source/uibase/inc/dbtree.hxx @@ -34,6 +34,7 @@ class SW_DLLPUBLIC SwDBTreeList rtl::Reference<SwDBTreeList_Impl> pImpl; std::unique_ptr<weld::TreeView> m_xTreeView; + std::unique_ptr<weld::TreeIter> m_xScratchIter; DECL_DLLPRIVATE_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool); SAL_DLLPRIVATE void InitTreeList(); diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 9d510e5fa45c..c366e10c209d 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -576,7 +576,7 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator()); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData.release()))); rTreeView.insert(pParent->xTLBParent.get(), -1, nullptr, &sId, nullptr, nullptr, - nullptr, false, xChild.get()); + false, xChild.get()); rTreeView.set_image(*xChild, sImage, -1); rTreeView.set_text(*xChild, sAuthor, 1); @@ -737,7 +737,7 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pData.release())); std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator()); - rTreeView.insert(nullptr, i, nullptr, &sId, nullptr, nullptr, nullptr, false, xParent.get()); + rTreeView.insert(nullptr, i, nullptr, &sId, nullptr, nullptr, false, xParent.get()); rTreeView.set_image(*xParent, sImage, -1); rTreeView.set_text(*xParent, sAuthor, 1); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 44ce6c197a9e..cf8959e687a8 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -863,6 +863,7 @@ static const char* STR_CONTEXT_ARY[] = SwContentTree::SwContentTree(std::unique_ptr<weld::TreeView> xTreeView, SwNavigationPI* pDialog) : m_xTreeView(std::move(xTreeView)) + , m_xScratchIter(m_xTreeView->make_iterator()) , m_aDropTargetHelper(*this) , m_xDialog(pDialog) , m_sSpace(OUString(" ")) @@ -1406,9 +1407,9 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) } void SwContentTree::insert(const weld::TreeIter* pParent, const OUString& rStr, const OUString& rId, - const OUString* pExpanderName, bool bChildrenOnDemand, weld::TreeIter* pRet) + bool bChildrenOnDemand, weld::TreeIter* pRet) { - m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, pExpanderName, bChildrenOnDemand, pRet); + m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, bChildrenOnDemand, pRet); ++m_nEntryCount; } @@ -1455,7 +1456,7 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent) OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCnt))); if (!bChild || (nLevel == 0)) { - insert(&rParent, sEntry, sId, nullptr, false, xChild.get()); + insert(&rParent, sEntry, sId, false, xChild.get()); m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible()); m_xTreeView->set_extra_row_indent(*xChild, nLevel + 1 - m_xTreeView->get_iter_depth(*xChild)); bChild = true; @@ -1465,7 +1466,7 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent) //back search parent. if(static_cast<const SwOutlineContent*>(pCntType->GetMember(i-1))->GetOutlineLevel() < nLevel) { - insert(xChild.get(), sEntry, sId, nullptr, false, xChild.get()); + insert(xChild.get(), sEntry, sId, false, xChild.get()); m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible()); m_xTreeView->set_extra_row_indent(*xChild, nLevel + 1 - m_xTreeView->get_iter_depth(*xChild)); bChild = true; @@ -1483,7 +1484,7 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent) } if (bChild) { - insert(xChild.get(), sEntry, sId, nullptr, false, xChild.get()); + insert(xChild.get(), sEntry, sId, false, xChild.get()); m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible()); m_xTreeView->set_extra_row_indent(*xChild, nLevel + 1 - m_xTreeView->get_iter_depth(*xChild)); } @@ -1504,7 +1505,7 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent) if (sEntry.isEmpty()) sEntry = m_sSpace; OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCnt))); - insert(&rParent, sEntry, sId, nullptr, false, xChild.get()); + insert(&rParent, sEntry, sId, false, xChild.get()); m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible()); if (bRegion) m_xTreeView->set_extra_row_indent(*xChild, static_cast<const SwRegionContent*>(pCnt)->GetRegionLevel()); @@ -1881,7 +1882,8 @@ void SwContentTree::Display( bool bActive ) OUString aImage(GetImageIdForContentTypeId(nCntType)); bool bChOnDemand = 0 != rpContentT->GetMemberCount(); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(rpContentT.get()))); - insert(nullptr, sEntry, sId, &aImage, bChOnDemand, xEntry.get()); + insert(nullptr, sEntry, sId, bChOnDemand, xEntry.get()); + m_xTreeView->set_image(*xEntry, aImage); m_xTreeView->set_sensitive(*xEntry, bChOnDemand); @@ -1965,7 +1967,8 @@ void SwContentTree::Display( bool bActive ) OUString aImage(GetImageIdForContentTypeId(m_nRootType)); bool bChOnDemand = m_nRootType == ContentTypeId::OUTLINE; OUString sId(OUString::number(reinterpret_cast<sal_Int64>(rpRootContentT.get()))); - insert(nullptr, rpRootContentT->GetName(), sId, &aImage, bChOnDemand, xEntry.get()); + insert(nullptr, rpRootContentT->GetName(), sId, bChOnDemand, xEntry.get()); + m_xTreeView->set_image(*xEntry, aImage); if (!bChOnDemand) { @@ -1981,7 +1984,7 @@ void SwContentTree::Display( bool bActive ) if(sEntry.isEmpty()) sEntry = m_sSpace; OUString sSubId(OUString::number(reinterpret_cast<sal_Int64>(pCnt))); - insert(xEntry.get(), sEntry, sSubId, nullptr, false, xChild.get()); + insert(xEntry.get(), sEntry, sSubId, false, xChild.get()); m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible()); if (bRegion) m_xTreeView->set_extra_row_indent(*xChild, static_cast<const SwRegionContent*>(pCnt)->GetRegionLevel()); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 5125af466f6b..a783ef39be7d 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3261,8 +3261,8 @@ private: void do_insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId, const OUString* pIconName, - VirtualDevice* pImageSurface, const OUString* pExpanderName, - bool bChildrenOnDemand, weld::TreeIter* pRet, bool bIsSeparator) + VirtualDevice* pImageSurface, bool bChildrenOnDemand, + weld::TreeIter* pRet, bool bIsSeparator) { disable_notify_events(); const SalInstanceTreeIter* pVclIter = static_cast<const SalInstanceTreeIter*>(pParent); @@ -3295,13 +3295,6 @@ private: pEntry->SetUserData(pUserData); m_xTreeView->Insert(pEntry, iter, nInsertPos); - if (pExpanderName) - { - Image aImage(createImage(*pExpanderName)); - m_xTreeView->SetExpandedEntryBmp(pEntry, aImage); - m_xTreeView->SetCollapsedEntryBmp(pEntry, aImage); - } - if (pRet) { SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet); @@ -3497,17 +3490,17 @@ public: virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId, const OUString* pIconName, - VirtualDevice* pImageSurface, const OUString* pExpanderName, - bool bChildrenOnDemand, weld::TreeIter* pRet) override + VirtualDevice* pImageSurface, bool bChildrenOnDemand, + weld::TreeIter* pRet) override { - do_insert(pParent, pos, pStr, pId, pIconName, pImageSurface, pExpanderName, + do_insert(pParent, pos, pStr, pId, pIconName, pImageSurface, bChildrenOnDemand, pRet, false); } virtual void insert_separator(int pos, const OUString& /*rId*/) override { OUString sSep(VclResId(STR_SEPARATOR)); - do_insert(nullptr, pos, &sSep, nullptr, nullptr, nullptr, nullptr, + do_insert(nullptr, pos, &sSep, nullptr, nullptr, nullptr, false, nullptr, true); } diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index f48e98c46903..4a9d950ab533 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -9173,7 +9173,7 @@ private: } void insert_row(GtkTreeIter& iter, const GtkTreeIter* parent, int pos, const OUString* pId, const OUString* pText, - const OUString* pIconName, const VirtualDevice* pDevice, const OUString* pExpanderName) + const OUString* pIconName, const VirtualDevice* pDevice) { gtk_tree_store_insert_with_values(m_pTreeStore, &iter, const_cast<GtkTreeIter*>(parent), pos, m_nTextCol, !pText ? nullptr : OUStringToOString(*pText, RTL_TEXTENCODING_UTF8).getStr(), @@ -9204,14 +9204,6 @@ private: gtk_tree_store_set(m_pTreeStore, &iter, m_nImageCol, target, -1); cairo_surface_destroy(target); } - - if (pExpanderName) - { - GdkPixbuf* pixbuf = getPixbuf(*pExpanderName); - gtk_tree_store_set(m_pTreeStore, &iter, m_nExpanderImageCol, pixbuf, -1); - if (pixbuf) - g_object_unref(pixbuf); - } } bool separator_function(GtkTreePath* path) @@ -9401,7 +9393,7 @@ private: { GtkTreeIter subiter; OUString sDummy("<dummy>"); - insert_row(subiter, &iter, -1, nullptr, &sDummy, nullptr, nullptr, nullptr); + insert_row(subiter, &iter, -1, nullptr, &sDummy, nullptr, nullptr); } m_aExpandingPlaceHolderParents.erase(pPlaceHolderPath); gtk_tree_path_free(pPlaceHolderPath); @@ -9984,18 +9976,18 @@ public: } virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pText, const OUString* pId, const OUString* pIconName, - VirtualDevice* pImageSurface, const OUString* pExpanderName, + VirtualDevice* pImageSurface, bool bChildrenOnDemand, weld::TreeIter* pRet) override { disable_notify_events(); GtkTreeIter iter; const GtkInstanceTreeIter* pGtkIter = static_cast<const GtkInstanceTreeIter*>(pParent); - insert_row(iter, pGtkIter ? &pGtkIter->iter : nullptr, pos, pId, pText, pIconName, pImageSurface, pExpanderName); + insert_row(iter, pGtkIter ? &pGtkIter->iter : nullptr, pos, pId, pText, pIconName, pImageSurface); if (bChildrenOnDemand) { GtkTreeIter subiter; OUString sDummy("<dummy>"); - insert_row(subiter, &iter, -1, nullptr, &sDummy, nullptr, nullptr, nullptr); + insert_row(subiter, &iter, -1, nullptr, &sDummy, nullptr, nullptr); } if (pRet) { @@ -10011,7 +10003,7 @@ public: GtkTreeIter iter; if (!gtk_tree_view_get_row_separator_func(m_pTreeView)) gtk_tree_view_set_row_separator_func(m_pTreeView, separatorFunction, this, nullptr); - insert_row(iter, nullptr, pos, &rId, nullptr, nullptr, nullptr, nullptr); + insert_row(iter, nullptr, pos, &rId, nullptr, nullptr, nullptr); GtkTreeModel* pTreeModel = GTK_TREE_MODEL(m_pTreeStore); GtkTreePath* pPath = gtk_tree_model_get_path(pTreeModel, &iter); m_aSeparatorRows.emplace_back(gtk_tree_row_reference_new(pTreeModel, pPath)); @@ -10996,7 +10988,7 @@ public: { GtkTreeIter subiter; OUString sDummy("<dummy>"); - insert_row(subiter, &rGtkIter.iter, -1, nullptr, &sDummy, nullptr, nullptr, nullptr); + insert_row(subiter, &rGtkIter.iter, -1, nullptr, &sDummy, nullptr, nullptr); } else if (!bChildrenOnDemand && bPlaceHolder) remove(aPlaceHolderIter); diff --git a/xmlsecurity/inc/certificateviewer.hxx b/xmlsecurity/inc/certificateviewer.hxx index 719db4764520..e0c42416b8b4 100644 --- a/xmlsecurity/inc/certificateviewer.hxx +++ b/xmlsecurity/inc/certificateviewer.hxx @@ -137,6 +137,7 @@ private: std::vector<std::unique_ptr<CertPath_UserData>> maUserData; std::unique_ptr<weld::TreeView> mxCertPathLB; + std::unique_ptr<weld::TreeIter> mxScratchIter; std::unique_ptr<weld::Button> mxViewCertPB; std::unique_ptr<weld::TextView> mxCertStatusML; std::unique_ptr<weld::Label> mxCertOK; diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index da924838c143..ea87640472c4 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -254,6 +254,7 @@ CertificateViewerCertPathTP::CertificateViewerCertPathTP(weld::Container* pParen , mpParent(pDlg) , mbFirstActivateDone(false) , mxCertPathLB(mxBuilder->weld_tree_view("signatures")) + , mxScratchIter(mxCertPathLB->make_iterator()) , mxViewCertPB(mxBuilder->weld_button("viewcert")) , mxCertStatusML(mxBuilder->weld_text_view("status")) , mxCertOK(mxBuilder->weld_label("certok")) @@ -358,7 +359,8 @@ void CertificateViewerCertPathTP::InsertCert(const weld::TreeIter* pParent, cons OUString sImage = bValid ? OUStringLiteral(BMP_CERT_OK) : OUStringLiteral(BMP_CERT_NOT_OK); maUserData.emplace_back(std::make_unique<CertPath_UserData>(rxCert, bValid)); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(maUserData.back().get()))); - mxCertPathLB->insert(pParent, -1, &rName, &sId, nullptr, nullptr, &sImage, false, nullptr); + mxCertPathLB->insert(pParent, -1, &rName, &sId, nullptr, nullptr, false, mxScratchIter.get()); + mxCertPathLB->set_image(*mxScratchIter, sImage); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index d90bd33f9cfa..3d81083978f5 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -644,7 +644,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() } m_xSignaturesLB->insert(nullptr, n, nullptr, nullptr, - &sImage, nullptr, nullptr, false, nullptr); + &sImage, nullptr, false, nullptr); m_xSignaturesLB->set_text(n, aSubject, 1); m_xSignaturesLB->set_text(n, aIssuer, 2); m_xSignaturesLB->set_text(n, aDateTimeStr, 3); |