diff options
-rw-r--r-- | cui/source/inc/autocdlg.hxx | 1 | ||||
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 362 | ||||
-rw-r--r-- | cui/source/options/optaboutconfig.hxx | 52 | ||||
-rw-r--r-- | cui/source/options/optjava.cxx | 14 | ||||
-rw-r--r-- | cui/source/options/optjava.hxx | 2 | ||||
-rw-r--r-- | cui/uiconfig/ui/aboutconfigdialog.ui | 317 | ||||
-rw-r--r-- | solenv/sanitizers/ui/cui.suppr | 5 |
7 files changed, 398 insertions, 355 deletions
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx index 3def561b87d0..dbf437dfbe5a 100644 --- a/cui/source/inc/autocdlg.hxx +++ b/cui/source/inc/autocdlg.hxx @@ -177,6 +177,7 @@ private: std::unique_ptr<weld::Button> m_xNewReplacePB; std::unique_ptr<weld::Button> m_xReplacePB; std::unique_ptr<weld::Button> m_xDeleteReplacePB; + std::unique_ptr<weld::Container> m_xButtonBox; DECL_LINK(SelectHdl, weld::TreeView&, void); DECL_LINK(NewDelButtonHdl, weld::Button&, void); diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 66f3f1cde343..03594de79947 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -28,6 +28,7 @@ #include <unotools/textsearch.hxx> #include <sal/log.hxx> #include <tools/diagnose_ex.h> +#include <tools/debug.hxx> #include <memory> #include <vector> @@ -132,99 +133,112 @@ IMPL_LINK(CuiAboutConfigValueDialog, KeyInputHdl, const KeyEvent&, rKeyEvent, bo return !bValid; } -CuiAboutConfigTabPage::CuiAboutConfigTabPage( vcl::Window* pParent/*, const SfxItemSet& rItemSet*/ ) : - ModalDialog( pParent, "AboutConfig", "cui/ui/aboutconfigdialog.ui"), - m_pPrefCtrl( get<SvSimpleTableContainer>("preferences") ), - m_pResetBtn( get<PushButton>("reset") ), - m_pEditBtn( get<PushButton>("edit") ), - m_pSearchBtn( get<PushButton>("searchButton") ), - m_pSearchEdit( get<Edit>("searchEntry") ), - m_vectorOfModified(), - m_pPrefBox( VclPtr<SvSimpleTable>::Create(*m_pPrefCtrl, WB_SCROLL | WB_HSCROLL | WB_VSCROLL ) ) +CuiAboutConfigTabPage::CuiAboutConfigTabPage(weld::Window* pParent) + : GenericDialogController(pParent, "cui/ui/aboutconfigdialog.ui", "AboutConfig") + , m_xResetBtn(m_xBuilder->weld_button("reset")) + , m_xEditBtn(m_xBuilder->weld_button("edit")) + , m_xSearchBtn(m_xBuilder->weld_button("searchButton")) + , m_xSearchEdit(m_xBuilder->weld_entry("searchEntry")) + , m_xPrefBox(m_xBuilder->weld_tree_view("preferences")) + , m_xScratchIter(m_xPrefBox->make_iterator()) + , m_vectorOfModified() + , m_bSorted(false) { - Size aControlSize(LogicToPixel(Size(385, 230), MapMode(MapUnit::MapAppFont))); - m_pPrefCtrl->set_width_request(aControlSize.Width()); - m_pPrefCtrl->set_height_request(aControlSize.Height()); + m_xPrefBox->set_size_request(m_xPrefBox->get_approximate_digit_width() * 100, + m_xPrefBox->get_height_rows(28)); + m_xPrefBox->connect_column_clicked(LINK(this, CuiAboutConfigTabPage, HeaderBarClick)); - m_pEditBtn->SetClickHdl( LINK( this, CuiAboutConfigTabPage, StandardHdl_Impl ) ); - m_pResetBtn->SetClickHdl( LINK( this, CuiAboutConfigTabPage, ResetBtnHdl_Impl ) ); - m_pPrefBox->SetDoubleClickHdl( LINK(this, CuiAboutConfigTabPage, DoubleClickHdl_Impl) ); - m_pPrefBox->SetExpandingHdl( LINK(this, CuiAboutConfigTabPage, ExpandingHdl_Impl) ); - m_pSearchBtn->SetClickHdl( LINK(this, CuiAboutConfigTabPage, SearchHdl_Impl) ); - - m_pPrefBox->InsertHeaderEntry(get<FixedText>("preference")->GetText()); - m_pPrefBox->InsertHeaderEntry(get<FixedText>("property")->GetText()); - m_pPrefBox->InsertHeaderEntry(get<FixedText>("type")->GetText()); - m_pPrefBox->InsertHeaderEntry(get<FixedText>("value")->GetText()); - - float fWidth = approximate_char_width(); - - long aTabs[] = {0,0,0,0}; - aTabs[1] = fWidth * 65; - aTabs[2] = aTabs[1] + fWidth * 20; - aTabs[3] = aTabs[2] + fWidth * 8; + m_xEditBtn->connect_clicked(LINK( this, CuiAboutConfigTabPage, StandardHdl_Impl)); + m_xResetBtn->connect_clicked(LINK( this, CuiAboutConfigTabPage, ResetBtnHdl_Impl)); + m_xPrefBox->connect_row_activated(LINK(this, CuiAboutConfigTabPage, DoubleClickHdl_Impl)); + m_xPrefBox->connect_expanding(LINK(this, CuiAboutConfigTabPage, ExpandingHdl_Impl)); + m_xSearchBtn->connect_clicked(LINK(this, CuiAboutConfigTabPage, SearchHdl_Impl)); m_options.AlgorithmType2 = util::SearchAlgorithms2::ABSOLUTE; m_options.transliterateFlags |= TransliterationFlags::IGNORE_CASE; m_options.searchFlag |= (util::SearchFlags::REG_NOT_BEGINOFLINE | util::SearchFlags::REG_NOT_ENDOFLINE); - m_pPrefBox->SetTabs(SAL_N_ELEMENTS(aTabs), aTabs, MapUnit::MapPixel); - m_pPrefBox->SetAlternatingRowColors( true ); + float fWidth = m_xPrefBox->get_approximate_digit_width(); + std::vector<int> aWidths; + aWidths.push_back(fWidth * 65); + aWidths.push_back(fWidth * 20); + aWidths.push_back(fWidth * 8); + m_xPrefBox->set_column_fixed_widths(aWidths); } -CuiAboutConfigTabPage::~CuiAboutConfigTabPage() +IMPL_LINK(CuiAboutConfigTabPage, HeaderBarClick, int, nColumn, void) { - disposeOnce(); + if (!m_bSorted) + { + m_xPrefBox->make_sorted(); + m_bSorted = true; + } + + bool bSortAtoZ = m_xPrefBox->get_sort_order(); + + //set new arrow positions in headerbar + if (nColumn == m_xPrefBox->get_sort_column()) + { + bSortAtoZ = !bSortAtoZ; + m_xPrefBox->set_sort_order(bSortAtoZ); + } + else + { + m_xPrefBox->set_sort_indicator(TRISTATE_INDET, m_xPrefBox->get_sort_column()); + m_xPrefBox->set_sort_column(nColumn); + } + + if (nColumn != -1) + { + //sort lists + m_xPrefBox->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn); + } } -void CuiAboutConfigTabPage::dispose() +CuiAboutConfigTabPage::~CuiAboutConfigTabPage() { - m_pPrefBox.disposeAndClear(); - m_pPrefCtrl.clear(); - m_pResetBtn.clear(); - m_pEditBtn.clear(); - m_pSearchBtn.clear(); - m_pSearchEdit.clear(); - ModalDialog::dispose(); } void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUString& rProp, const OUString& rStatus, - const OUString& rType, const OUString& rValue, SvTreeListEntry *pParentEntry, + const OUString& rType, const OUString& rValue, const weld::TreeIter* pParentEntry, bool bInsertToPrefBox) { - SvTreeListEntry* pEntry = new SvTreeListEntry; - pEntry->AddItem(std::make_unique<SvLBoxContextBmp>( - Image(), Image(), false)); //It is needed, otherwise causes crash - pEntry->AddItem(std::make_unique<SvLBoxString>(rProp)); - pEntry->AddItem(std::make_unique<SvLBoxString>(rStatus)); - pEntry->AddItem(std::make_unique<SvLBoxString>(rType)); - pEntry->AddItem(std::make_unique<SvLBoxString>(rValue)); m_vectorUserData.push_back(std::make_unique<UserData>(rPropertyPath)); - pEntry->SetUserData(m_vectorUserData.back().get()); - - if(bInsertToPrefBox) - m_pPrefBox->Insert( pEntry, pParentEntry ); + 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->set_text(*m_xScratchIter, rStatus, 1); + m_xPrefBox->set_text(*m_xScratchIter, rType, 2); + m_xPrefBox->set_text(*m_xScratchIter, rValue, 3); + } else - m_prefBoxEntries.push_back(std::unique_ptr<SvTreeListEntry>(pEntry)); + { + m_prefBoxEntries.push_back({rProp, rStatus, rType, rValue, m_vectorUserData.back().get()}); + } } void CuiAboutConfigTabPage::Reset() { - m_pPrefBox->Clear(); - + m_xPrefBox->clear(); m_vectorOfModified.clear(); - m_pPrefBox->GetModel()->SetSortMode( SortNone ); + if (m_bSorted) + { + m_xPrefBox->set_sort_indicator(TRISTATE_INDET, m_xPrefBox->get_sort_column()); + m_xPrefBox->make_unsorted(); + m_bSorted = false; + } m_prefBoxEntries.clear(); m_modifiedPrefBoxEntries.clear(); - m_pPrefBox->SetUpdateMode(false); + m_xPrefBox->freeze(); Reference< XNameAccess > xConfigAccess = getConfigAccess( "/", false ); //Load all XNameAccess to m_prefBoxEntries FillItems( xConfigAccess, nullptr, 0, true ); //Load xConfigAccess' children to m_prefBox FillItems( xConfigAccess ); - m_pPrefBox->SetUpdateMode(true); + m_xPrefBox->thaw(); } void CuiAboutConfigTabPage::FillItemSet() @@ -242,7 +256,7 @@ void CuiAboutConfigTabPage::FillItemSet() } } -void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAccess, SvTreeListEntry *pParentEntry, +void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAccess, const weld::TreeIter* pParentEntry, int lineage, bool bLoadAll) { OUString sPath = Reference< XHierarchicalName >( @@ -272,31 +286,25 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces else { // not leaf node - SvTreeListEntry* pEntry = new SvTreeListEntry; - pEntry->AddItem(std::make_unique<SvLBoxContextBmp>( - SvTreeListBox::GetDefaultExpandedNodeImage(), - SvTreeListBox::GetDefaultCollapsedNodeImage(), false)); - pEntry->AddItem(std::make_unique<SvLBoxString>(seqItems[i])); - //It is needed, without this the selection line will be truncated. - pEntry->AddItem(std::make_unique<SvLBoxString>("")); - pEntry->AddItem(std::make_unique<SvLBoxString>("")); - pEntry->AddItem(std::make_unique<SvLBoxString>("")); - m_vectorUserData.push_back(std::make_unique<UserData>(xNextNameAccess, lineage + 1)); - pEntry->SetUserData(m_vectorUserData.back().get()); - pEntry->EnableChildrenOnDemand(); - m_pPrefBox->Insert( pEntry, pParentEntry ); + OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_vectorUserData.back().get()))); + + m_xPrefBox->insert(pParentEntry, -1, &seqItems[i], &sId, nullptr, 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); + m_xPrefBox->set_text(*m_xScratchIter, "", 3); } } else { // leaf node OUString sPropertyName = seqItems[i]; - SvTreeListEntries::iterator it = std::find_if(m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(), - [&sPath, &sPropertyName](std::unique_ptr<SvTreeListEntry> const& pEntry) -> bool + auto it = std::find_if(m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(), + [&sPath, &sPropertyName](const prefBoxEntry& rEntry) -> bool { - return static_cast<UserData*>(pEntry->GetUserData())->sPropertyPath == sPath - && static_cast<SvLBoxString&>(pEntry->GetItem(2)).GetText() == sPropertyName; + return rEntry.pUserData->sPropertyPath == sPath + && rEntry.sStatus == sPropertyName; } ); @@ -304,7 +312,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces OUStringBuffer sValue; if (it != m_modifiedPrefBoxEntries.end()) - sValue = static_cast< SvLBoxString& >( (*it)->GetItem(4) ).GetText(); + sValue = it->sValue; else { switch( aNode.getValueType().getTypeClass() ) @@ -548,30 +556,28 @@ CuiAboutConfigValueDialog::~CuiAboutConfigValueDialog() { } -IMPL_LINK_NOARG( CuiAboutConfigTabPage, ResetBtnHdl_Impl, Button*, void ) +IMPL_LINK_NOARG( CuiAboutConfigTabPage, ResetBtnHdl_Impl, weld::Button&, void ) { Reset(); } -IMPL_LINK_NOARG( CuiAboutConfigTabPage, DoubleClickHdl_Impl, SvTreeListBox*, bool ) +IMPL_LINK_NOARG(CuiAboutConfigTabPage, DoubleClickHdl_Impl, weld::TreeView&, void) { - StandardHdl_Impl(nullptr); - return true; + StandardHdl_Impl(*m_xEditBtn); } -IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, Button*, void ) +IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void ) { - SvTreeListEntry* pEntry = m_pPrefBox->GetHdlEntry(); - if(pEntry == nullptr) + if (!m_xPrefBox->get_selected(m_xScratchIter.get())) return; - UserData *pUserData = static_cast<UserData*>(pEntry->GetUserData()); - if(pUserData && pUserData->bIsPropertyPath) + UserData *pUserData = reinterpret_cast<UserData*>(m_xPrefBox->get_id(*m_xScratchIter).toInt64()); + if (pUserData && pUserData->bIsPropertyPath) { //if selection is a node - OUString sPropertyName = SvTabListBox::GetEntryText( pEntry, 1 ); - OUString sPropertyType = SvTabListBox::GetEntryText( pEntry, 2 ); - OUString sPropertyValue = SvTabListBox::GetEntryText( pEntry, 3 ); + OUString sPropertyName = m_xPrefBox->get_text(*m_xScratchIter, 1); + OUString sPropertyType = m_xPrefBox->get_text(*m_xScratchIter, 2); + OUString sPropertyValue = m_xPrefBox->get_text(*m_xScratchIter, 3); std::shared_ptr< Prop_Impl > pProperty (new Prop_Impl( pUserData->sPropertyPath, sPropertyName, Any( sPropertyValue ) ) ); bool bSaveChanges = false; @@ -621,7 +627,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, Button*, void ) else if( sPropertyType == "hyper" ) limit = HYPER_LEN_LIMIT; - CuiAboutConfigValueDialog aValueDialog(GetFrameWeld(), sDialogValue, limit); + CuiAboutConfigValueDialog aValueDialog(m_xDialog.get(), sDialogValue, limit); if (aValueDialog.run() == RET_OK ) { @@ -742,38 +748,35 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, Button*, void ) AddToModifiedVector( pProperty ); //update listbox value. - m_pPrefBox->SetEntryText( sDialogValue, pEntry, 3 ); + m_xPrefBox->set_text(*m_xScratchIter, sDialogValue, 3); //update m_prefBoxEntries - SvTreeListEntries::iterator it = std::find_if(m_prefBoxEntries.begin(), m_prefBoxEntries.end(), - [&pUserData, &sPropertyName](std::unique_ptr<SvTreeListEntry> const& rpEntry) -> bool + auto it = std::find_if(m_prefBoxEntries.begin(), m_prefBoxEntries.end(), + [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool { - return static_cast<UserData*>(rpEntry->GetUserData())->sPropertyPath == pUserData->sPropertyPath - && static_cast<SvLBoxString&>(rpEntry->GetItem(2)).GetText() == sPropertyName; + return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath + && rEntry.sStatus == sPropertyName; } ); if (it != m_prefBoxEntries.end()) { - (*it)->ReplaceItem(std::make_unique<SvLBoxString>(sDialogValue), 4); + it->sValue = sDialogValue; - SvTreeListEntries::iterator modifiedIt = std::find_if( + auto modifiedIt = std::find_if( m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(), - [&pUserData, &sPropertyName](std::unique_ptr<SvTreeListEntry> const& rpEntry) -> bool + [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool { - return static_cast<UserData*>(rpEntry->GetUserData())->sPropertyPath == pUserData->sPropertyPath - && static_cast<SvLBoxString&>(rpEntry->GetItem(2)).GetText() == sPropertyName; + return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath + && rEntry.sStatus == sPropertyName; } ); - if( modifiedIt != m_modifiedPrefBoxEntries.end()) + if (modifiedIt != m_modifiedPrefBoxEntries.end()) { - (*modifiedIt)->ReplaceItem(std::make_unique<SvLBoxString>(sDialogValue), 4); + modifiedIt->sValue = sDialogValue; } else { - std::unique_ptr<SvTreeListEntry> pCloneEntry( - new SvTreeListEntry); - pCloneEntry->Clone((*it).get()); - m_modifiedPrefBoxEntries.push_back(std::move(pCloneEntry)); + m_modifiedPrefBoxEntries.push_back(*it); } } } @@ -784,64 +787,71 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, Button*, void ) } } -IMPL_LINK_NOARG( CuiAboutConfigTabPage, SearchHdl_Impl, Button*, void) +IMPL_LINK_NOARG( CuiAboutConfigTabPage, SearchHdl_Impl, weld::Button&, void) { - m_pPrefBox->Clear(); - m_pPrefBox->SetUpdateMode( false ); + m_xPrefBox->clear(); + m_xPrefBox->freeze(); - SvSortMode sortMode = m_pPrefBox->GetModel()->GetSortMode(); - sal_uInt16 sortedCol = m_pPrefBox->GetSortedCol(); + if (m_bSorted) + m_xPrefBox->make_unsorted(); - if( sortMode != SortNone ) - m_pPrefBox->SortByCol( 0xFFFF ); - - if( m_pSearchEdit->GetText().isEmpty() ) + if (m_xSearchEdit->get_text().isEmpty()) { - m_pPrefBox->Clear(); + m_xPrefBox->clear(); Reference< XNameAccess > xConfigAccess = getConfigAccess( "/", false ); FillItems( xConfigAccess ); } else { - m_options.searchString = m_pSearchEdit->GetText(); + m_options.searchString = m_xSearchEdit->get_text(); utl::TextSearch textSearch( m_options ); for (auto const& it : m_prefBoxEntries) { sal_Int32 endPos, startPos = 0; - for(size_t i = 1; i < it->ItemCount(); ++i) + for(size_t i = 0; i < 5; ++i) { OUString scrTxt; - if(i == 1) - scrTxt = static_cast< UserData* >( it->GetUserData() )->sPropertyPath; - else - scrTxt = static_cast< SvLBoxString& >( it->GetItem(i) ).GetText(); + + if (i == 0) + scrTxt = it.pUserData->sPropertyPath; + else if (i == 1) + scrTxt = it.sProp; + else if (i == 2) + scrTxt = it.sStatus; + else if (i == 3) + scrTxt = it.sType; + else if (i == 4) + scrTxt = it.sValue; + endPos = scrTxt.getLength(); - if( textSearch.SearchForward( scrTxt, &startPos, &endPos ) ) + if (textSearch.SearchForward(scrTxt, &startPos, &endPos)) { - SvTreeListEntry* pEntry = new SvTreeListEntry; - pEntry->Clone( it.get() ); - InsertEntry( pEntry ); + InsertEntry(it); break; } } } } - if( sortMode != SortNone ) - m_pPrefBox->SortByCol(sortedCol, sortMode == SortAscending); + m_xPrefBox->thaw(); + if (m_bSorted) + m_xPrefBox->make_sorted(); - m_pPrefBox->SetUpdateMode( true ); + m_xPrefBox->all_foreach([this](weld::TreeIter& rEntry) { + m_xPrefBox->expand_row(rEntry); + return false; + }); } -void CuiAboutConfigTabPage::InsertEntry( SvTreeListEntry *pEntry) +void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& rEntry) { - OUString sPathWithProperty = static_cast< UserData* >(pEntry->GetUserData())->sPropertyPath; - sal_Int32 index = sPathWithProperty.lastIndexOf(static_cast< SvLBoxString& >(pEntry->GetItem(1)).GetText()); + OUString sPathWithProperty = rEntry.pUserData->sPropertyPath; + sal_Int32 index = sPathWithProperty.lastIndexOf(rEntry.sProp); OUString sPath = sPathWithProperty.copy(0, index); index = 0; - SvTreeListEntry* pParentEntry; - SvTreeListEntry* pGrandParentEntry = nullptr; + std::unique_ptr<weld::TreeIter> xParentEntry(m_xPrefBox->make_iterator()); + std::unique_ptr<weld::TreeIter> xGrandParentEntry; do { @@ -850,62 +860,68 @@ void CuiAboutConfigTabPage::InsertEntry( SvTreeListEntry *pEntry) // deal with no parent case (tdf#107811) if (index < 0) { - m_pPrefBox->Insert( pEntry, nullptr); + 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->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); return; } OUString sParentName = sPath.copy(prevIndex+1, index - prevIndex - 1); bool hasEntry = false; - for(pParentEntry = m_pPrefBox->FirstChild(pGrandParentEntry); pParentEntry != nullptr; pParentEntry = pParentEntry->NextSibling()) - if(static_cast< SvLBoxString& >(pParentEntry->GetItem(1)).GetText() == sParentName) + bool bStartOk; + + if (!xGrandParentEntry) + bStartOk = m_xPrefBox->get_iter_first(*xParentEntry); + else + { + m_xPrefBox->copy_iterator(*xGrandParentEntry, *xParentEntry); + bStartOk = m_xPrefBox->iter_children(*xParentEntry); + } + + if (bStartOk) + { + do { - hasEntry = true; - break; - } + if (m_xPrefBox->get_text(*xParentEntry, 0) == sParentName) + { + hasEntry = true; + break; + } + } while (m_xPrefBox->iter_next_sibling(*xParentEntry)); + } - if(!hasEntry) + if (!hasEntry) { - pParentEntry = new SvTreeListEntry; - pParentEntry->AddItem(std::make_unique<SvLBoxContextBmp>( - SvTreeListBox::GetDefaultExpandedNodeImage(), - SvTreeListBox::GetDefaultCollapsedNodeImage(), false)); - pParentEntry->AddItem(std::make_unique<SvLBoxString>(sParentName)); + m_xPrefBox->insert(xGrandParentEntry.get(), -1, &sParentName, nullptr, nullptr, nullptr, nullptr, false, xParentEntry.get()); //It is needed, without this the selection line will be truncated. - pParentEntry->AddItem(std::make_unique<SvLBoxString>("")); - pParentEntry->AddItem(std::make_unique<SvLBoxString>("")); - pParentEntry->AddItem(std::make_unique<SvLBoxString>("")); - pParentEntry->EnableChildrenOnDemand(false); - m_pPrefBox->Insert( pParentEntry, pGrandParentEntry ); + m_xPrefBox->set_text(*xParentEntry, "", 1); + m_xPrefBox->set_text(*xParentEntry, "", 2); + m_xPrefBox->set_text(*xParentEntry, "", 3); } - if(pGrandParentEntry) - m_pPrefBox->Expand( pGrandParentEntry ); - pGrandParentEntry = pParentEntry; + xGrandParentEntry = m_xPrefBox->make_iterator(xParentEntry.get()); } while(index < sPath.getLength() - 1); - m_pPrefBox->Insert( pEntry, pParentEntry ); - m_pPrefBox->Expand( pParentEntry ); + 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->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); } -IMPL_LINK_NOARG( CuiAboutConfigTabPage, ExpandingHdl_Impl, SvTreeListBox*, bool ) +IMPL_LINK(CuiAboutConfigTabPage, ExpandingHdl_Impl, const weld::TreeIter&, rEntry, bool) { - SvTreeListEntry* pEntry = m_pPrefBox->GetHdlEntry(); - - if(pEntry != nullptr && pEntry->HasChildrenOnDemand()) + if (m_xPrefBox->iter_has_child(rEntry)) + return true; + UserData *pUserData = reinterpret_cast<UserData*>(m_xPrefBox->get_id(rEntry).toInt64()); + if (pUserData && !pUserData->bIsPropertyPath) { - 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, pUserData->aLineage ); - } + assert(pUserData->aXNameAccess.is()); + FillItems(pUserData->aXNameAccess, &rEntry, pUserData->aLineage); } - - return pEntry && pEntry->HasChildren(); + return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx index 989fbef6f0ad..008d8009f7dd 100644 --- a/cui/source/options/optaboutconfig.hxx +++ b/cui/source/options/optaboutconfig.hxx @@ -13,8 +13,6 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <i18nutil/searchopt.hxx> -#include <svtools/simptabl.hxx> -#include <vcl/dialog.hxx> #include <vcl/weld.hxx> #include <vector> @@ -24,43 +22,55 @@ class CuiAboutConfigValueDialog; struct Prop_Impl; struct UserData; -class CuiAboutConfigTabPage : public ModalDialog +struct prefBoxEntry +{ + OUString sProp; + OUString sStatus; + OUString sType; + OUString sValue; + UserData* pUserData; +}; + +class CuiAboutConfigTabPage : public weld::GenericDialogController { private: - VclPtr<SvSimpleTableContainer> m_pPrefCtrl; - VclPtr<PushButton> m_pResetBtn; - VclPtr<PushButton> m_pEditBtn; - VclPtr<PushButton> m_pSearchBtn; - VclPtr<Edit> m_pSearchEdit; + std::unique_ptr<weld::Button> m_xResetBtn; + std::unique_ptr<weld::Button> m_xEditBtn; + std::unique_ptr<weld::Button> m_xSearchBtn; + std::unique_ptr<weld::Entry> m_xSearchEdit; + std::unique_ptr<weld::TreeView> m_xPrefBox; + std::unique_ptr<weld::TreeIter> m_xScratchIter; + std::vector < std::unique_ptr<UserData> > m_vectorUserData; - SvTreeListEntries m_modifiedPrefBoxEntries; + std::vector<prefBoxEntry> m_modifiedPrefBoxEntries; std::vector< std::shared_ptr< Prop_Impl > > m_vectorOfModified; - VclPtr< SvSimpleTable > m_pPrefBox; //for search i18nutil::SearchOptions2 m_options; - SvTreeListEntries m_prefBoxEntries; + std::vector<prefBoxEntry> m_prefBoxEntries; + + bool m_bSorted; void AddToModifiedVector( const std::shared_ptr< Prop_Impl >& rProp ); static std::vector< OUString > commaStringToSequence( const OUString& rCommaSepString ); - void InsertEntry( SvTreeListEntry *pEntry); + void InsertEntry(const prefBoxEntry& rEntry); - DECL_LINK( StandardHdl_Impl, Button*, void ); - DECL_LINK( DoubleClickHdl_Impl, SvTreeListBox*, bool ); - DECL_LINK( ResetBtnHdl_Impl, Button*, void ); - DECL_LINK( SearchHdl_Impl, Button*, void ); - DECL_LINK( ExpandingHdl_Impl, SvTreeListBox*, bool ); + DECL_LINK(StandardHdl_Impl, weld::Button&, void); + DECL_LINK(DoubleClickHdl_Impl, weld::TreeView&, void); + DECL_LINK(ResetBtnHdl_Impl, weld::Button&, void); + DECL_LINK(SearchHdl_Impl, weld::Button&, void); + DECL_LINK(ExpandingHdl_Impl, const weld::TreeIter&, bool); + DECL_LINK(HeaderBarClick, int, void); public: - explicit CuiAboutConfigTabPage(vcl::Window* pParent); + explicit CuiAboutConfigTabPage(weld::Window* pParent); virtual ~CuiAboutConfigTabPage() override; - virtual void dispose() override; void InsertEntry(const OUString &rPropertyPath, const OUString& rProp, const OUString& rStatus, const OUString& rType, const OUString& rValue, - SvTreeListEntry *pParentEntry, bool bInsertToPrefBox); + const weld::TreeIter* pParentEntry, bool bInsertToPrefBox); void Reset(); void FillItems(const css::uno::Reference<css::container::XNameAccess>& xNameAccess, - SvTreeListEntry *pParentEntry = nullptr, int lineage = 0, bool bLoadAll = false); + const weld::TreeIter* pParentEntry = nullptr, int lineage = 0, bool bLoadAll = false); static css::uno::Reference< css::container::XNameAccess > getConfigAccess( const OUString& sNodePath, bool bUpdate ); void FillItemSet(); }; diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 3f58be565ee7..8fc6da8dd1db 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -36,6 +36,7 @@ #include <strings.hrc> #include <vcl/svapp.hxx> +#include <tools/debug.hxx> #include <tools/urlobj.hxx> #include <vcl/weld.hxx> #include <unotools/pathoptions.hxx> @@ -292,18 +293,15 @@ IMPL_LINK( SvxJavaOptionsPage, DialogClosedHdl, DialogClosedEvent*, pEvt, void ) } } -IMPL_STATIC_LINK_NOARG(SvxJavaOptionsPage, ExpertConfigHdl_Impl, weld::Button&, void) +IMPL_LINK_NOARG(SvxJavaOptionsPage, ExpertConfigHdl_Impl, weld::Button&, void) { - //TODO weld this one too - ScopedVclPtrInstance<CuiAboutConfigTabPage> pExpertConfigDlg(nullptr); - pExpertConfigDlg->Reset();//initialize and reset function + CuiAboutConfigTabPage aExpertConfigDlg(GetFrameWeld()); + aExpertConfigDlg.Reset();//initialize and reset function - if( RET_OK == pExpertConfigDlg->Execute() ) + if (RET_OK == aExpertConfigDlg.run()) { - pExpertConfigDlg->FillItemSet();//save changes if there are any + aExpertConfigDlg.FillItemSet();//save changes if there are any } - - pExpertConfigDlg.disposeAndClear(); } void SvxJavaOptionsPage::ClearJavaInfo() diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx index 4375b2079e8d..2000145d0b4e 100644 --- a/cui/source/options/optjava.hxx +++ b/cui/source/options/optjava.hxx @@ -95,7 +95,7 @@ private: DECL_LINK(StartFolderPickerHdl, void *, void); DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void); - DECL_STATIC_LINK(SvxJavaOptionsPage, ExpertConfigHdl_Impl, weld::Button&, void); + DECL_LINK(ExpertConfigHdl_Impl, weld::Button&, void); void ClearJavaInfo(); void ClearJavaList(); diff --git a/cui/uiconfig/ui/aboutconfigdialog.ui b/cui/uiconfig/ui/aboutconfigdialog.ui index 1e8af443ffe9..203d6f41bbcb 100644 --- a/cui/uiconfig/ui/aboutconfigdialog.ui +++ b/cui/uiconfig/ui/aboutconfigdialog.ui @@ -1,8 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> + <object class="GtkTreeStore" id="liststore1"> + <columns> + <!-- column-name expander --> + <column type="GdkPixbuf"/> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name text1 --> + <column type="gchararray"/> + <!-- column-name text2 --> + <column type="gchararray"/> + <!-- column-name text3 --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkDialog" id="AboutConfig"> <property name="can_focus">False</property> <property name="border_width">6</property> @@ -10,157 +25,15 @@ <property name="modal">True</property> <property name="type_hint">normal</property> <property name="skip_taskbar_hint">True</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> - <child> - <object class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child> - <object class="GtkBox" id="box1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkBox" id="box2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkEntry" id="searchEntry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="searchButton"> - <property name="label" translatable="yes" context="aboutconfigdialog|searchButton">_Search</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkGrid" id="grid1"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - <property name="column_homogeneous">True</property> - <child> - <object class="GtkLabel" id="preference"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="yalign">0.49000000953674316</property> - <property name="label" translatable="yes" context="aboutconfigdialog|preference">Preference Name</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="property"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0.51999998092651367</property> - <property name="yalign">0.50999999046325684</property> - <property name="label" translatable="yes" context="aboutconfigdialog|property">Property</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="type"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="aboutconfigdialog|type">Type</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="value"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="aboutconfigdialog|value">Value</property> - </object> - <packing> - <property name="left_attach">3</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="svtlo-SvSimpleTableContainer" id="preferences"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="Simple Table Container-selection"/> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> @@ -242,6 +115,156 @@ <property name="position">2</property> </packing> </child> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkEntry" id="searchEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="searchButton"> + <property name="label" translatable="yes" context="aboutconfigdialog|searchButton">_Search</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="preferences"> + <property name="width_request">-1</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="model">liststore1</property> + <property name="headers_clickable">True</property> + <property name="search_column">1</property> + <property name="enable_tree_lines">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Macro Library List-selection1"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn2"> + <property name="spacing">6</property> + <property name="title" translatable="yes" context="aboutconfigdialog|preference">Preference Name</property> + <property name="clickable">True</property> + <child> + <object class="GtkCellRendererPixbuf" id="cellrenderertext4"/> + <attributes> + <attribute name="pixbuf">0</attribute> + </attributes> + </child> + <child> + <object class="GtkCellRendererText" id="cellrenderertext2"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn3"> + <property name="spacing">6</property> + <property name="title" translatable="yes" context="aboutconfigdialog|property">Property</property> + <property name="clickable">True</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext3"/> + <attributes> + <attribute name="text">2</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn4"> + <property name="spacing">6</property> + <property name="title" translatable="yes" context="aboutconfigdialog|type">Type</property> + <property name="clickable">True</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">3</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn5"> + <property name="spacing">6</property> + <property name="title" translatable="yes" context="aboutconfigdialog|value">Value</property> + <property name="clickable">True</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext5"/> + <attributes> + <attribute name="text">4</attribute> + </attributes> + </child> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> </child> <action-widgets> diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr index 0e99cd7071d4..1fb9cf484716 100644 --- a/solenv/sanitizers/ui/cui.suppr +++ b/solenv/sanitizers/ui/cui.suppr @@ -1,9 +1,4 @@ cui/uiconfig/ui/aboutconfigdialog.ui://GtkEntry[@id='searchEntry'] no-labelled-by -cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='preference'] orphan-label -cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='property'] orphan-label -cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='type'] orphan-label -cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='value'] orphan-label -cui/uiconfig/ui/aboutconfigdialog.ui://svtlo-SvSimpleTableContainer[@id='preferences'] no-labelled-by cui/uiconfig/ui/acorexceptpage.ui://GtkEntry[@id='abbrev'] no-labelled-by cui/uiconfig/ui/acorexceptpage.ui://GtkEntry[@id='double'] no-labelled-by cui/uiconfig/ui/applyautofmtpage.ui://GtkLabel[@id='label1'] orphan-label |