diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-06-05 10:57:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-06-05 20:33:28 +0200 |
commit | 68db2d42c1518fdb777faeff891155f350da538c (patch) | |
tree | 5a07696b7e09451541ae1215a96863ac14aadfc9 /sd | |
parent | 638f2642769cc73ad6dfa75d33145f03fa408d7f (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 'sd')
-rw-r--r-- | sd/source/ui/animations/CustomAnimationList.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/dlg/sdtreelb.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/inc/sdtreelb.hxx | 9 |
3 files changed, 21 insertions, 10 deletions
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 |