diff options
author | Mihály Palenik <palenik.mihaly@gmail.com> | 2015-06-30 23:13:53 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-07-07 09:40:22 +0000 |
commit | ac34ba072756efd92febdb1a9d59b4d789424a25 (patch) | |
tree | 6a861da85abd38ae84b70a7211bd03839cca371a | |
parent | 0c8dd8f50368dad6512d27a531af833217b7b861 (diff) |
Use expanding handler in Expert Configuration dialog
Expert Configuration dialog use expanding handler instead of double click
handler when expanding tree node.
Change-Id: Ia35c289db46796ca61ef8898e669af6c5a0bd24d
Reviewed-on: https://gerrit.libreoffice.org/16674
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 35 | ||||
-rw-r--r-- | cui/source/options/optaboutconfig.hxx | 1 |
2 files changed, 28 insertions, 8 deletions
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 02acd7043583..204f1e6804eb 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -153,6 +153,7 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage( vcl::Window* pParent/*, const SfxI m_pEditBtn->SetClickHdl( LINK( this, CuiAboutConfigTabPage, StandardHdl_Impl ) ); m_pResetBtn->SetClickHdl( LINK( this, CuiAboutConfigTabPage, ResetBtnHdl_Impl ) ); m_pPrefBox->SetDoubleClickHdl( LINK(this, CuiAboutConfigTabPage, StandardHdl_Impl) ); + m_pPrefBox->SetExpandingHdl( LINK(this, CuiAboutConfigTabPage, ExpandingHdl_Impl) ); m_pSearchBtn->SetClickHdl( LINK(this, CuiAboutConfigTabPage, SearchHdl_Impl) ); m_pPrefBox->InsertHeaderEntry(get<FixedText>("preference")->GetText()); @@ -279,6 +280,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces pEntry->AddItem( new SvLBoxString( pEntry, 0, "")); pEntry->SetUserData( new UserData(xNextNameAccess) ); + pEntry->EnableChildrenOnDemand(); m_pPrefBox->Insert( pEntry, pParentEntry ); } else @@ -547,16 +549,12 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, ResetBtnHdl_Impl ) IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl ) { - SvTreeListEntry* pEntry = m_pPrefBox->FirstSelected(); + SvTreeListEntry* pEntry = m_pPrefBox->GetHdlEntry(); + if(pEntry == nullptr) + return 0; UserData *pUserData = static_cast<UserData*>(pEntry->GetUserData()); - if(!pUserData->bIsPropertyPath) - { - //if selection is not node - if(!pEntry->HasChildren()) - FillItems( pUserData->aXNameAccess, pEntry ); - } - else + if(pUserData->bIsPropertyPath) { //if selection is a node OUString sPropertyName = SvTabListBox::GetEntryText( pEntry, 1 ); @@ -814,4 +812,25 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, SearchHdl_Impl) return 0; } +IMPL_LINK_NOARG( CuiAboutConfigTabPage, ExpandingHdl_Impl ) +{ + SvTreeListEntry* pEntry = m_pPrefBox->GetHdlEntry(); + + if(pEntry != nullptr && pEntry->HasChildrenOnDemand()) + { + pEntry->EnableChildrenOnDemand(false); + SvTreeListEntry *pFirstChild = m_pPrefBox->FirstChild(pEntry); + if(pFirstChild) + m_pPrefBox->RemoveEntry(pFirstChild); + + if(pEntry->GetUserData() != nullptr) + { + UserData *pUserData = static_cast<UserData*>(pEntry->GetUserData()); + FillItems( pUserData->aXNameAccess, pEntry ); + } + } + + return true; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx index 48f97e3acbb7..e085f5a99373 100644 --- a/cui/source/options/optaboutconfig.hxx +++ b/cui/source/options/optaboutconfig.hxx @@ -62,6 +62,7 @@ private: DECL_LINK( StandardHdl_Impl, void * ); DECL_LINK( ResetBtnHdl_Impl, void * ); DECL_LINK( SearchHdl_Impl, void* ); + DECL_LINK( ExpandingHdl_Impl, void* ); public: explicit CuiAboutConfigTabPage(vcl::Window* pParent); |