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 /cui | |
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 'cui')
-rw-r--r-- | cui/source/customize/cfgutil.cxx | 10 | ||||
-rw-r--r-- | cui/source/dialogs/DiagramDialog.cxx | 7 | ||||
-rw-r--r-- | cui/source/dialogs/hlmarkwn.cxx | 2 | ||||
-rw-r--r-- | cui/source/dialogs/scriptdlg.cxx | 13 | ||||
-rw-r--r-- | cui/source/inc/cfg.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/cfgutil.hxx | 10 | ||||
-rw-r--r-- | cui/source/inc/scriptdlg.hxx | 1 | ||||
-rw-r--r-- | cui/source/options/dbregister.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 10 | ||||
-rw-r--r-- | cui/source/options/optchart.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/treeopt.cxx | 2 |
11 files changed, 32 insertions, 29 deletions
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; } |