summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-06-05 16:11:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-06-08 20:21:35 +0200
commitcd384e2d31f74223948ea70d8aa3c318d3ceeb50 (patch)
tree49ae5191c2bd4b13c3cd547951933fbc37cda0fa /dbaccess
parentc3669c8bd62ecf5eaa6b5e95289825bc11b2688a (diff)
rework treeview initial toggle button col to be like expander col
cause this assumption is baked into the vcl one making it hard to adapt remaining cases Change-Id: I75dd5264c65b1ffbf4d26c9a86f6d4d08b400d90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95622 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/control/tabletree.cxx46
-rw-r--r--dbaccess/source/ui/dlg/tablespage.cxx6
-rw-r--r--dbaccess/source/ui/inc/tabletree.hxx1
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx14
4 files changed, 33 insertions, 34 deletions
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index f608f850ceb4..2ec45c9b756a 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -68,9 +68,9 @@ TableTreeListBox::TableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView)
, m_bVirtualRoot(false)
, m_bNoEmptyFolders(false)
, m_bShowToggles(true)
- , m_nTextColumn(1)
, m_xTreeView(std::move(xTreeView))
{
+ m_xTreeView->enable_toggle_buttons(weld::ColumnToggleType::Check);
}
void OTableTreeListBox::implSetDefaultImages()
@@ -359,7 +359,6 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
void TableTreeListBox::DisableCheckButtons()
{
m_bShowToggles = false;
- m_nTextColumn = 0;
}
void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConnection, const TNames& _rTables )
@@ -389,8 +388,9 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne
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);
- m_xTreeView->set_text(*xRet, sRootEntryText, m_nTextColumn);
+ m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE);
+ m_xTreeView->set_text(*xRet, sRootEntryText, 0);
+ m_xTreeView->set_text_emphasis(*xRet, false, 0);
}
if ( _rTables.empty() )
@@ -434,8 +434,9 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne
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);
- m_xTreeView->set_text(*xRet, folderName, m_nTextColumn);
+ m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE);
+ m_xTreeView->set_text(*xRet, folderName, 0);
+ m_xTreeView->set_text_emphasis(*xRet, false, 0);
}
}
}
@@ -451,14 +452,14 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne
bool TableTreeListBox::isWildcardChecked(const weld::TreeIter& rEntry)
{
- return m_xTreeView->get_text_emphasis(rEntry, m_nTextColumn);
+ return m_xTreeView->get_text_emphasis(rEntry, 0);
}
void TableTreeListBox::checkWildcard(weld::TreeIter& rEntry)
{
if (!m_bShowToggles)
return;
- m_xTreeView->set_toggle(rEntry, TRISTATE_TRUE, 0);
+ m_xTreeView->set_toggle(rEntry, TRISTATE_TRUE);
checkedButton_noBroadcast(rEntry);
}
@@ -489,7 +490,7 @@ void TableTreeListBox::checkedButton_noBroadcast(const weld::TreeIter& rEntry)
{
if (!m_bShowToggles)
return;
- TriState eState = m_xTreeView->get_toggle(rEntry, 0);
+ TriState eState = m_xTreeView->get_toggle(rEntry);
OSL_ENSURE(TRISTATE_INDET != eState, "OTableTreeListBox::CheckButtonHdl: user action which lead to TRISTATE?");
if (m_xTreeView->iter_has_child(rEntry)) // if it has children, check those too
@@ -500,7 +501,7 @@ void TableTreeListBox::checkedButton_noBroadcast(const weld::TreeIter& rEntry)
bool bSiblingEntry = m_xTreeView->iter_next_sibling(*xSiblingEntry);
while (bChildEntry && (!bSiblingEntry || !xChildEntry->equal(*xSiblingEntry)))
{
- m_xTreeView->set_toggle(*xChildEntry, eState, 0);
+ m_xTreeView->set_toggle(*xChildEntry, eState);
bChildEntry = m_xTreeView->iter_next(*xChildEntry);
}
}
@@ -508,7 +509,7 @@ void TableTreeListBox::checkedButton_noBroadcast(const weld::TreeIter& rEntry)
if (m_xTreeView->is_selected(rEntry))
{
m_xTreeView->selected_foreach([this, eState](weld::TreeIter& rSelected){
- m_xTreeView->set_toggle(rSelected, eState, 0);
+ m_xTreeView->set_toggle(rSelected, eState);
if (m_xTreeView->iter_has_child(rSelected)) // if it has children, check those too
{
std::unique_ptr<weld::TreeIter> xChildEntry(m_xTreeView->make_iterator(&rSelected));
@@ -517,7 +518,7 @@ void TableTreeListBox::checkedButton_noBroadcast(const weld::TreeIter& rEntry)
bool bSiblingEntry = m_xTreeView->iter_next_sibling(*xSiblingEntry);
while (bChildEntry && (!bSiblingEntry || !xChildEntry->equal(*xSiblingEntry)))
{
- m_xTreeView->set_toggle(*xChildEntry, eState, 0);
+ m_xTreeView->set_toggle(*xChildEntry, eState);
bChildEntry = m_xTreeView->iter_next(*xChildEntry);
}
}
@@ -572,7 +573,7 @@ void TableTreeListBox::implEmphasize(const weld::TreeIter& rEntry, bool _bChecke
|| bAllObjectsEntryAffected // or it is the "all objects" entry
)
{
- m_xTreeView->set_text_emphasis(rEntry, _bChecked, m_nTextColumn);
+ m_xTreeView->set_text_emphasis(rEntry, _bChecked, 0);
}
if (_bUpdateDescendants)
@@ -710,8 +711,9 @@ void TableTreeListBox::implAddEntry(
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);
- m_xTreeView->set_text(*xFolder, rFirstName, m_nTextColumn);
+ m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE);
+ m_xTreeView->set_text(*xFolder, rFirstName, 0);
+ m_xTreeView->set_text_emphasis(*xFolder, false, 0);
}
xParentEntry = std::move(xFolder);
}
@@ -727,8 +729,9 @@ void TableTreeListBox::implAddEntry(
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);
- m_xTreeView->set_text(*xFolder, rSecondName, m_nTextColumn);
+ m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE);
+ m_xTreeView->set_text(*xFolder, rSecondName, 0);
+ m_xTreeView->set_text_emphasis(*xFolder, false, 0);
}
xParentEntry = std::move(xFolder);
}
@@ -745,8 +748,9 @@ void TableTreeListBox::implAddEntry(
m_xTreeView->set_image(*xEntry, sImageId, -1);
}
if (m_bShowToggles)
- m_xTreeView->set_toggle(*xEntry, TRISTATE_FALSE, 0);
- m_xTreeView->set_text(*xEntry, sName, m_nTextColumn);
+ m_xTreeView->set_toggle(*xEntry, TRISTATE_FALSE);
+ m_xTreeView->set_text(*xEntry, sName, 0);
+ m_xTreeView->set_text_emphasis(*xEntry, false, 0);
}
NamedDatabaseObject OTableTreeListBox::describeObject( SvTreeListEntry* _pEntry )
@@ -935,7 +939,7 @@ TriState TableTreeListBox::implDetermineState(weld::TreeIter& rEntry)
if (!m_bShowToggles)
return TRISTATE_FALSE;
- TriState eState = m_xTreeView->get_toggle(rEntry, 0);
+ TriState eState = m_xTreeView->get_toggle(rEntry);
if (!m_xTreeView->iter_has_child(rEntry))
// nothing to do in this bottom-up routine if there are no children ...
return eState;
@@ -996,7 +1000,7 @@ TriState TableTreeListBox::implDetermineState(weld::TreeIter& rEntry)
}
// finally set the entry to the state we just determined
- m_xTreeView->set_toggle(rEntry, eState, 0);
+ m_xTreeView->set_toggle(rEntry, eState);
return eState;
}
diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx
index 8b91b354be37..2fa719517a91 100644
--- a/dbaccess/source/ui/dlg/tablespage.cxx
+++ b/dbaccess/source/ui/dlg/tablespage.cxx
@@ -138,7 +138,7 @@ namespace dbaui
std::unique_ptr<weld::TreeIter> xEntry(m_xTablesList->GetEntryPosByName(sName, xSchema ? xSchema.get() : (xCatalog ? xCatalog.get() : xRootEntry.get())));
if (xEntry)
- m_xTablesList->GetWidget().set_toggle(*xEntry, TRISTATE_TRUE, 0);
+ m_xTablesList->GetWidget().set_toggle(*xEntry, TRISTATE_TRUE);
}
m_xTablesList->CheckButtons();
}
@@ -299,7 +299,7 @@ namespace dbaui
{
do
{
- m_xTablesList->GetWidget().set_toggle(*xEntry, _bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
+ m_xTablesList->GetWidget().set_toggle(*xEntry, _bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
}
while (m_xTablesList->GetWidget().iter_next(*xEntry));
}
@@ -350,7 +350,7 @@ namespace dbaui
std::unique_ptr<weld::TreeIter> xSchema;
std::unique_ptr<weld::TreeIter> xCatalog;
- if (m_xTablesList->GetWidget().get_toggle(*xEntry, 0) == TRISTATE_TRUE && !m_xTablesList->GetWidget().iter_has_child(*xEntry))
+ if (m_xTablesList->GetWidget().get_toggle(*xEntry) == TRISTATE_TRUE && !m_xTablesList->GetWidget().iter_has_child(*xEntry))
{ // checked and a leaf, which means it's no catalog, no schema, but a real table
OUStringBuffer sComposedName;
OUString sCatalog;
diff --git a/dbaccess/source/ui/inc/tabletree.hxx b/dbaccess/source/ui/inc/tabletree.hxx
index 58a6bba4322e..30b3f742f591 100644
--- a/dbaccess/source/ui/inc/tabletree.hxx
+++ b/dbaccess/source/ui/inc/tabletree.hxx
@@ -143,7 +143,6 @@ class TableTreeListBox
bool m_bVirtualRoot; // should the first entry be visible
bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed?
bool m_bShowToggles; // show toggle buttons
- int m_nTextColumn; // column text is in, depends on if toggles are shown
std::unique_ptr<weld::TreeView> m_xTreeView;
public:
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 83ad642d887a..75ff6e3372f1 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -58,9 +58,7 @@ OWizNameMatching::OWizNameMatching(weld::Container* pPage, OCopyTableWizard* pWi
m_xAll->connect_clicked(LINK(this,OWizNameMatching,AllNoneClickHdl));
m_xNone->connect_clicked(LINK(this,OWizNameMatching,AllNoneClickHdl));
- std::vector<int> aWidths;
- aWidths.push_back(m_xCTRL_LEFT->get_checkbox_column_width());
- m_xCTRL_LEFT->set_column_fixed_widths(aWidths);
+ m_xCTRL_LEFT->enable_toggle_buttons(weld::ColumnToggleType::Check);
m_xCTRL_LEFT->connect_changed(LINK(this,OWizNameMatching,TableListClickHdl));
m_xCTRL_RIGHT->connect_changed(LINK(this,OWizNameMatching,TableListRightSelectHdl));
@@ -132,7 +130,7 @@ bool OWizNameMatching::LeavePage()
++nPos;
}
- if (m_xCTRL_LEFT->get_toggle(*xLeftEntry, 0) == TRISTATE_TRUE)
+ if (m_xCTRL_LEFT->get_toggle(*xLeftEntry) == TRISTATE_TRUE)
{
OFieldDescription* pDestField = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(*xRightEntry).toInt64());
OSL_ENSURE(pDestField,"OWizNameMatching: OColumn can not be null!");
@@ -301,7 +299,7 @@ IMPL_LINK(OWizNameMatching, AllNoneClickHdl, weld::Button&, rButton, void)
{
bool bAll = &rButton == m_xAll.get();
m_xCTRL_LEFT->all_foreach([this, bAll](weld::TreeIter& rEntry){
- m_xCTRL_LEFT->set_toggle(rEntry, bAll ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
+ m_xCTRL_LEFT->set_toggle(rEntry, bAll ? TRISTATE_TRUE : TRISTATE_FALSE);
return false;
});
}
@@ -312,17 +310,15 @@ void OWizNameMatching::FillListBox(weld::TreeView& rTreeView, const ODatabaseExp
int nRow(0);
- const int nTextCol = bCheckButtons ? 1 : 0;
-
for (auto const& elem : rList)
{
rTreeView.append();
if (bCheckButtons)
{
bool bChecked = !elem->second->IsAutoIncrement();
- rTreeView.set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
+ rTreeView.set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE);
}
- rTreeView.set_text(nRow, elem->first, nTextCol);
+ rTreeView.set_text(nRow, elem->first, 0);
rTreeView.set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(elem->second)));
++nRow;
}