basctl/source/basicide/moduldl2.cxx | 4 basctl/source/dlged/managelang.cxx | 4 basctl/uiconfig/basicide/ui/defaultlanguage.ui | 2 basctl/uiconfig/basicide/ui/importlibdialog.ui | 2 cui/source/customize/SvxToolbarConfigPage.cxx | 14 cui/source/dialogs/hangulhanjadlg.cxx | 4 cui/source/dialogs/multipat.cxx | 14 cui/source/dialogs/srchxtra.cxx | 4 cui/source/inc/cfg.hxx | 2 cui/source/options/certpath.cxx | 12 cui/source/options/optlingu.cxx | 28 - cui/source/tabpages/autocdlg.cxx | 174 +++---- cui/uiconfig/ui/accelconfigpage.ui | 8 cui/uiconfig/ui/acoroptionspage.ui | 2 cui/uiconfig/ui/applyautofmtpage.ui | 4 cui/uiconfig/ui/applylocalizedpage.ui | 6 cui/uiconfig/ui/certdialog.ui | 2 cui/uiconfig/ui/hangulhanjaoptdialog.ui | 2 cui/uiconfig/ui/menuassignpage.ui | 2 cui/uiconfig/ui/multipathdialog.ui | 2 cui/uiconfig/ui/optlingupage.ui | 6 cui/uiconfig/ui/searchattrdialog.ui | 2 cui/uiconfig/ui/smarttagoptionspage.ui | 2 dbaccess/source/ui/browser/unodatbr.cxx | 6 dbaccess/source/ui/control/dbtreelistbox.cxx | 2 dbaccess/source/ui/control/tabletree.cxx | 446 ++++++++++++++++++ dbaccess/source/ui/dlg/tablespage.cxx | 254 ++++------ dbaccess/source/ui/dlg/tablespage.hxx | 18 dbaccess/source/ui/inc/dbtreelistbox.hxx | 3 dbaccess/source/ui/inc/imageprovider.hxx | 13 dbaccess/source/ui/inc/tabletree.hxx | 123 ++++ dbaccess/source/ui/misc/imageprovider.cxx | 53 ++ dbaccess/uiconfig/ui/tablesfilterpage.ui | 75 ++- desktop/source/deployment/gui/dp_gui_updatedialog.cxx | 8 desktop/uiconfig/ui/updatedialog.ui | 2 include/vcl/svimpbox.hxx | 1 include/vcl/svlbitm.hxx | 5 include/vcl/treelistbox.hxx | 4 include/vcl/weld.hxx | 29 - sc/source/ui/dbgui/dpgroupdlg.cxx | 6 sc/source/ui/dbgui/pvfundlg.cxx | 6 sc/source/ui/dbgui/tpsubt.cxx | 12 sc/source/ui/miscdlgs/protectiondlg.cxx | 10 sc/source/ui/miscdlgs/solveroptions.cxx | 4 sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui | 2 sc/uiconfig/scalc/ui/groupbydate.ui | 2 sc/uiconfig/scalc/ui/protectsheetdlg.ui | 2 sc/uiconfig/scalc/ui/solveroptionsdialog.ui | 2 sc/uiconfig/scalc/ui/subtotalgrppage.ui | 2 sw/source/ui/config/optload.cxx | 19 sw/source/ui/index/cnttab.cxx | 29 - sw/uiconfig/swriter/ui/assignstylesdialog.ui | 22 sw/uiconfig/swriter/ui/optcaptionpage.ui | 2 sw/uiconfig/swriter/ui/tocindexpage.ui | 2 vcl/source/app/salvtables.cxx | 145 +++++ vcl/source/treelist/svlbitm.cxx | 28 + vcl/source/treelist/treelistbox.cxx | 27 - vcl/unx/gtk3/gtk3gtkinst.cxx | 116 ++++ 58 files changed, 1376 insertions(+), 406 deletions(-)
New commits: commit 5c32ba63163d9556ff89782a8074924cdf9dc554 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Apr 4 14:30:03 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Apr 6 19:53:00 2019 +0200 weld OTableSubscriptionPage Change-Id: I55c23448480384c9a7d78cd55550bb4812ebde72 Reviewed-on: https://gerrit.libreoffice.org/70314 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 7494d288266b..9356357aa55f 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -795,7 +795,7 @@ void LibPage::InsertLib() weld::TreeView& rView = xLibDlg->GetLibBox(); rView.append(); const int nRow = rView.n_children() - 1; - rView.set_toggle(nRow, true, 0); + rView.set_toggle(nRow, TRISTATE_TRUE, 0); rView.set_text(nRow, aLibName, 1); } } @@ -829,7 +829,7 @@ void LibPage::InsertLib() weld::TreeView& rView = xLibDlg->GetLibBox(); for (int nLib = 0, nChildren = rView.n_children(); nLib < nChildren; ++nLib) { - if (rView.get_toggle(nLib, 0)) + if (rView.get_toggle(nLib, 0) == TRISTATE_TRUE) { OUString aLibName(rView.get_text(nLib, 1)); Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index 33380b1cedec..d23563714196 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -275,7 +275,7 @@ void SetDefaultLanguageDialog::FillLanguageBox() LanguageType eLang = m_xLanguageCB->get_id(j); m_xCheckLangLB->append(); const int nRow = m_xCheckLangLB->n_children() - 1; - m_xCheckLangLB->set_toggle(nRow, false, 0); + m_xCheckLangLB->set_toggle(nRow, TRISTATE_FALSE, 0); m_xCheckLangLB->set_text(nRow, m_xLanguageCB->get_text(j), 1); m_xCheckLangLB->set_id(nRow, OUString::number(eLang.get())); } @@ -311,7 +311,7 @@ Sequence< Locale > SetDefaultLanguageDialog::GetLocales() const const sal_Int32 nCount = m_xCheckLangLB->n_children(); for (sal_Int32 i = 0; i < nCount; ++i) { - if (m_xCheckLangLB->get_toggle(i, 0)) + if (m_xCheckLangLB->get_toggle(i, 0) == TRISTATE_TRUE) { LanguageType eType = LanguageType(m_xCheckLangLB->get_id(i).toUInt32()); aLocaleSeq.push_back(LanguageTag::convertToLocale(eType)); diff --git a/basctl/uiconfig/basicide/ui/defaultlanguage.ui b/basctl/uiconfig/basicide/ui/defaultlanguage.ui index 59215e56e48b..9d6f90420613 100644 --- a/basctl/uiconfig/basicide/ui/defaultlanguage.ui +++ b/basctl/uiconfig/basicide/ui/defaultlanguage.ui @@ -12,6 +12,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkTreeStore" id="liststore2"> diff --git a/basctl/uiconfig/basicide/ui/importlibdialog.ui b/basctl/uiconfig/basicide/ui/importlibdialog.ui index 6bde14b65152..a4480c52ac55 100644 --- a/basctl/uiconfig/basicide/ui/importlibdialog.ui +++ b/basctl/uiconfig/basicide/ui/importlibdialog.ui @@ -12,6 +12,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkDialog" id="ImportLibDialog"> diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx index 66a4d7278264..bd7a3333a4e7 100644 --- a/cui/source/customize/SvxToolbarConfigPage.cxx +++ b/cui/source/customize/SvxToolbarConfigPage.cxx @@ -605,7 +605,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void) OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry))); m_xContentsListBox->insert(nActEntry, sId); - m_xContentsListBox->set_toggle(nActEntry, pEntry->IsVisible(), 0); + m_xContentsListBox->set_toggle(nActEntry, pEntry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE, 0); InsertEntryIntoUI(pEntry, nActEntry, 1); m_xContentsListBox->select(nActEntry); @@ -645,7 +645,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void) OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry))); m_xContentsListBox->insert(nActEntry, sId); - m_xContentsListBox->set_toggle(nActEntry, pEntry->IsVisible(), 0); + m_xContentsListBox->set_toggle(nActEntry, pEntry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE, 0); InsertEntryIntoUI(pEntry, nActEntry, 1); m_xContentsListBox->select(nActEntry); @@ -702,7 +702,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void) OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry))); m_xContentsListBox->insert(nActEntry, sId); m_xContentsListBox->set_toggle(nActEntry, - pEntry->IsVisible(), 0); + pEntry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE, 0); InsertEntryIntoUI(pEntry, nActEntry, 1); m_xContentsListBox->select(nActEntry); @@ -834,7 +834,7 @@ void SvxToolbarConfigPage::SelectElement() OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entry))); m_xContentsListBox->insert(i, sId); if (entry->IsBinding() && !entry->IsSeparator()) - m_xContentsListBox->set_toggle(i, entry->IsVisible(), 0); + m_xContentsListBox->set_toggle(i, entry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE, 0); InsertEntryIntoUI(entry, i, 1); ++i; } @@ -861,7 +861,7 @@ void SvxToolbarConfigPage::AddFunction(int nTarget, bool bFront) if ( pEntry->IsBinding() ) //TODO sep ? { pEntry->SetVisible(true); - m_xContentsListBox->set_toggle(nNewLBEntry, true, 0); + m_xContentsListBox->set_toggle(nNewLBEntry, TRISTATE_TRUE, 0); } InsertEntryIntoUI(pEntry, nNewLBEntry, 1); @@ -895,7 +895,7 @@ void SvxToolbarEntriesListBox::ChangedVisibility(int nRow) if (pEntryData->IsBinding()) { - pEntryData->SetVisible(m_xControl->get_toggle(nRow, 0)); + pEntryData->SetVisible(m_xControl->get_toggle(nRow, 0) == TRISTATE_TRUE); SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection(); @@ -920,7 +920,7 @@ IMPL_LINK(SvxToolbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, boo SvxConfigEntry* pEntryData = reinterpret_cast<SvxConfigEntry*>(m_xControl->get_id(nRow).toInt64()); if (pEntryData->IsBinding() && !pEntryData->IsSeparator()) { - m_xControl->set_toggle(nRow, !m_xControl->get_toggle(nRow, 0), 0); + m_xControl->set_toggle(nRow, m_xControl->get_toggle(nRow, 0) == TRISTATE_TRUE ? TRISTATE_FALSE : TRISTATE_TRUE, 0); ChangedVisibility(nRow); } return true; diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx index 0ff836f6d4f9..342b35352782 100644 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ b/cui/source/dialogs/hangulhanjadlg.cxx @@ -782,7 +782,7 @@ namespace svx DBG_ASSERT( xDict.is(), "-HangulHanjaOptionsDialog::OkHdl(): someone is evaporated..." ); - bool bActive = m_xDictsLB->get_toggle(n, 0); + bool bActive = m_xDictsLB->get_toggle(n, 0) == TRISTATE_TRUE; xDict->setActive( bActive ); Reference< util::XFlushable > xFlush( xDict, uno::UNO_QUERY ); if( xFlush.is() ) @@ -948,7 +948,7 @@ namespace svx { m_xDictsLB->append(); int nRow = m_xDictsLB->n_children() - 1; - m_xDictsLB->set_toggle(nRow, bChecked, 0); + m_xDictsLB->set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xDictsLB->set_text(nRow, rName, 1); m_xDictsLB->set_id(nRow, rName); } diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index 6adbb9464a84..45fe4cf4bec7 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -60,7 +60,7 @@ IMPL_LINK_NOARG(SvxPathSelectDialog, SelectHdl_Impl, weld::TreeView&, void) void SvxMultiPathDialog::HandleEntryChecked(int nRow) { m_xRadioLB->select(nRow); - bool bChecked = m_xRadioLB->get_toggle(nRow, 0); + bool bChecked = m_xRadioLB->get_toggle(nRow, 0) == TRISTATE_TRUE; if (bChecked) { // we have radio button behavior -> so uncheck the other entries @@ -68,7 +68,7 @@ void SvxMultiPathDialog::HandleEntryChecked(int nRow) for (int i = 0; i < nCount; ++i) { if (i != nRow) - m_xRadioLB->set_toggle(i, false, 0); + m_xRadioLB->set_toggle(i, TRISTATE_TRUE, 0); } } } @@ -82,7 +82,7 @@ void SvxMultiPathDialog::AppendEntry(const OUString& rText, const OUString& rId) { m_xRadioLB->append(); const int nRow = m_xRadioLB->n_children() - 1; - m_xRadioLB->set_toggle(nRow, false, 0); + m_xRadioLB->set_toggle(nRow, TRISTATE_FALSE, 0); m_xRadioLB->set_text(nRow, rText, 1); m_xRadioLB->set_id(nRow, rId); } @@ -150,7 +150,7 @@ IMPL_LINK_NOARG(SvxPathSelectDialog, AddHdl_Impl, weld::Button&, void) IMPL_LINK_NOARG(SvxMultiPathDialog, DelHdl_Impl, weld::Button&, void) { int nPos = m_xRadioLB->get_selected_index(); - bool bChecked = m_xRadioLB->get_toggle(nPos, 0); + bool bChecked = m_xRadioLB->get_toggle(nPos, 0) == TRISTATE_TRUE; m_xRadioLB->remove(nPos); int nCnt = m_xRadioLB->n_children(); if (nCnt) @@ -161,7 +161,7 @@ IMPL_LINK_NOARG(SvxMultiPathDialog, DelHdl_Impl, weld::Button&, void) nPos = nCnt; if (bChecked) { - m_xRadioLB->set_toggle(nPos, true, 0); + m_xRadioLB->set_toggle(nPos, TRISTATE_TRUE, 0); HandleEntryChecked(nPos); } m_xRadioLB->select(nPos); @@ -240,7 +240,7 @@ OUString SvxMultiPathDialog::GetPath() const OUString sWritable; for (int i = 0, nCount = m_xRadioLB->n_children(); i < nCount; ++i) { - if (m_xRadioLB->get_toggle(i, 0)) + if (m_xRadioLB->get_toggle(i, 0) == TRISTATE_TRUE) sWritable = m_xRadioLB->get_id(i); else { @@ -292,7 +292,7 @@ void SvxMultiPathDialog::SetPath( const OUString& rPath ) if (nCount) { - m_xRadioLB->set_toggle(nCount - 1, true, 0); + m_xRadioLB->set_toggle(nCount - 1, TRISTATE_TRUE, 0); HandleEntryChecked(nCount - 1); } } diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx index e1f0a869096d..ac6b4f1e711b 100644 --- a/cui/source/dialogs/srchxtra.cxx +++ b/cui/source/dialogs/srchxtra.cxx @@ -148,7 +148,7 @@ SvxSearchAttributeDialog::SvxSearchAttributeDialog(weld::Window* pParent, { m_xAttrLB->append(); const int nRow = m_xAttrLB->n_children() - 1; - m_xAttrLB->set_toggle(nRow, bChecked, 0); + m_xAttrLB->set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xAttrLB->set_text(nRow, SvxAttrNameTable::GetString(nId), 1); m_xAttrLB->set_id(nRow, OUString::number(nSlot)); } @@ -174,7 +174,7 @@ IMPL_LINK_NOARG(SvxSearchAttributeDialog, OKHdl, weld::Button&, void) for (int i = 0, nCount = m_xAttrLB->n_children(); i < nCount; ++i) { sal_uInt16 nSlot = m_xAttrLB->get_id(i).toUInt32(); - bool bChecked = m_xAttrLB->get_toggle(i, 0); + bool bChecked = m_xAttrLB->get_toggle(i, 0) == TRISTATE_TRUE; sal_uInt16 j; for ( j = rList.Count(); j; ) diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index fbbd96214145..c82512187a29 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -343,7 +343,7 @@ public: void set_dropdown(int row, int col) { m_xControl->set_image(row, *m_xDropDown, col); } void set_id(int row, const OUString& rId) { m_xControl->set_id(row, rId); } void clear() { m_xControl->clear(); } //need frees ? - void set_toggle(int row, bool bOn, int col) { m_xControl->set_toggle(row, bOn, col); } + void set_toggle(int row, TriState eState, int col) { m_xControl->set_toggle(row, eState, col); } void scroll_to_row(int pos) { m_xControl->scroll_to_row(pos); } void select(int pos) { m_xControl->select(pos); } diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx index 2eff6841eb60..c830b6e68631 100644 --- a/cui/source/options/certpath.cxx +++ b/cui/source/options/certpath.cxx @@ -71,7 +71,7 @@ CertPathDialog::CertPathDialog(weld::Window* pParent) { m_xCertPathList->append(); const int nRow = m_xCertPathList->n_children() - 1; - m_xCertPathList->set_toggle(nRow, false, 0); + m_xCertPathList->set_toggle(nRow, TRISTATE_FALSE, 0); OUString sEntry = OUString::createFromAscii(productNames[i]) + ":" + profile; m_xCertPathList->set_text(nRow, sEntry, 1); OUString sProfilePath = xMozillaBootstrap->getProfilePath( productTypes[i], profile ); @@ -103,7 +103,7 @@ CertPathDialog::CertPathDialog(weld::Window* pParent) if (m_xCertPathList->n_children()) { - m_xCertPathList->set_toggle(0, true, 0); + m_xCertPathList->set_toggle(0, TRISTATE_TRUE, 0); HandleEntryChecked(0); } } @@ -146,7 +146,7 @@ IMPL_LINK(CertPathDialog, CheckHdl_Impl, const row_col&, rRowCol, void) void CertPathDialog::HandleEntryChecked(int nRow) { m_xCertPathList->select(nRow); - bool bChecked = m_xCertPathList->get_toggle(nRow, 0); + bool bChecked = m_xCertPathList->get_toggle(nRow, 0) == TRISTATE_TRUE; if (bChecked) { // we have radio button behavior -> so uncheck the other entries @@ -154,7 +154,7 @@ void CertPathDialog::HandleEntryChecked(int nRow) for (int i = 0; i < nCount; ++i) { if (i != nRow) - m_xCertPathList->set_toggle(i, false, 0); + m_xCertPathList->set_toggle(i, TRISTATE_FALSE, 0); } } } @@ -167,7 +167,7 @@ void CertPathDialog::AddCertPath(const OUString &rProfile, const OUString &rPath //already exists, just select the original one if (sCertPath == rPath) { - m_xCertPathList->set_toggle(i, true, 0); + m_xCertPathList->set_toggle(i, TRISTATE_TRUE, 0); HandleEntryChecked(i); return; } @@ -175,7 +175,7 @@ void CertPathDialog::AddCertPath(const OUString &rProfile, const OUString &rPath m_xCertPathList->append(); const int nRow = m_xCertPathList->n_children() - 1; - m_xCertPathList->set_toggle(nRow, true, 0); + m_xCertPathList->set_toggle(nRow, TRISTATE_TRUE, 0); m_xCertPathList->set_text(nRow, rProfile, 1); m_xCertPathList->set_text(nRow, rPath, 2); m_xCertPathList->set_id(nRow, rPath); diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index ce46b3c4f1d7..e9134ef81e2b 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -1069,7 +1069,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet ) DicUserData aData(m_xLinguDicsCLB->get_id(i).toUInt32()); if (aData.GetEntryId() < nDics) { - bool bChecked = m_xLinguDicsCLB->get_toggle(i, 0); + bool bChecked = m_xLinguDicsCLB->get_toggle(i, 0) == TRISTATE_TRUE; uno::Reference< XDictionary > xDic( aDics.getConstArray()[ i ] ); if (xDic.is()) { @@ -1102,7 +1102,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet ) Any aAny; if (aData.IsCheckable()) { - bool bChecked = m_xLinguOptionsCLB->get_toggle(j, 0); + bool bChecked = m_xLinguOptionsCLB->get_toggle(j, 0) == TRISTATE_TRUE; aAny <<= bChecked; } else if (aData.HasNumericValue()) @@ -1127,7 +1127,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet ) } // automatic spell checking - bool bNewAutoCheck = m_xLinguOptionsCLB->get_toggle(EID_SPELL_AUTO, 0); + bool bNewAutoCheck = m_xLinguOptionsCLB->get_toggle(EID_SPELL_AUTO, 0) == TRISTATE_TRUE; const SfxPoolItem* pOld = GetOldItem( *rCoreSet, SID_AUTOSPELL_CHECK ); if ( !pOld || static_cast<const SfxBoolItem*>(pOld)->GetValue() != bNewAutoCheck ) { @@ -1171,7 +1171,7 @@ void SvxLinguTabPage::AddDicBoxEntry( int nEntry = m_xLinguDicsCLB->n_children() - 1; DicUserData aData( GetDicUserData( rxDic, nIdx ) ); m_xLinguDicsCLB->set_id(nEntry, OUString::number(aData.GetUserData())); - m_xLinguDicsCLB->set_toggle(nEntry, aData.IsChecked(), 0); + m_xLinguDicsCLB->set_toggle(nEntry, aData.IsChecked() ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xLinguDicsCLB->set_text(nEntry, aTxt, 1); // append at end m_xLinguDicsCLB->thaw(); @@ -1213,7 +1213,7 @@ void SvxLinguTabPage::UpdateModulesBox_Impl() const ServiceInfo_Impl &rInfo = rAllDispSrvcArr[i]; m_xLinguModulesCLB->append(); m_xLinguModulesCLB->set_id(i, OUString::number(reinterpret_cast<sal_Int64>(&rInfo))); - m_xLinguModulesCLB->set_toggle(i, rInfo.bConfigured, 0); + m_xLinguModulesCLB->set_toggle(i, rInfo.bConfigured ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xLinguModulesCLB->set_text(i, rInfo.sDisplayName, 1); } if (nDispSrvcCount) @@ -1254,7 +1254,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) if (pItem) bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue(); nUserData = OptionsUserData( EID_SPELL_AUTO, false, 0, true, bVal).GetUserData(); - m_xLinguOptionsCLB->set_toggle(nEntry, bVal, 0); + m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xLinguOptionsCLB->set_text(nEntry, sSpellAuto, 1); m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData)); @@ -1263,7 +1263,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) aLngCfg.GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bVal; nUserData = OptionsUserData( EID_GRAMMAR_AUTO, false, 0, true, bVal).GetUserData(); - m_xLinguOptionsCLB->set_toggle(nEntry, bVal, 0); + m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xLinguOptionsCLB->set_text(nEntry, sGrammarAuto, 1); m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData)); @@ -1272,7 +1272,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) aLngCfg.GetProperty( UPN_IS_SPELL_UPPER_CASE ) >>= bVal; nUserData = OptionsUserData( EID_CAPITAL_WORDS, false, 0, true, bVal).GetUserData(); - m_xLinguOptionsCLB->set_toggle(nEntry, bVal, 0); + m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xLinguOptionsCLB->set_text(nEntry, sCapitalWords, 1); m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData)); @@ -1281,7 +1281,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) aLngCfg.GetProperty( UPN_IS_SPELL_WITH_DIGITS ) >>= bVal; nUserData = OptionsUserData( EID_WORDS_WITH_DIGITS, false, 0, true, bVal).GetUserData(); - m_xLinguOptionsCLB->set_toggle(nEntry, bVal, 0); + m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xLinguOptionsCLB->set_text(nEntry, sWordsWithDigits, 1); m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData)); @@ -1290,7 +1290,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) aLngCfg.GetProperty( UPN_IS_SPELL_SPECIAL ) >>= bVal; nUserData = OptionsUserData( EID_SPELL_SPECIAL, false, 0, true, bVal).GetUserData(); - m_xLinguOptionsCLB->set_toggle(nEntry, bVal, 0); + m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xLinguOptionsCLB->set_text(nEntry, sSpellSpecial, 1); m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData)); @@ -1335,7 +1335,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) aLngCfg.GetProperty( UPN_IS_HYPH_AUTO ) >>= bVal; nUserData = OptionsUserData( EID_HYPH_AUTO, false, 0, true, bVal).GetUserData(); - m_xLinguOptionsCLB->set_toggle(nEntry, bVal, 0); + m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xLinguOptionsCLB->set_text(nEntry, sHyphAuto, 1); m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData)); @@ -1344,7 +1344,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) aLngCfg.GetProperty( UPN_IS_HYPH_SPECIAL ) >>= bVal; nUserData = OptionsUserData( EID_HYPH_SPECIAL, false, 0, true, bVal).GetUserData(); - m_xLinguOptionsCLB->set_toggle(nEntry, bVal, 0); + m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0); m_xLinguOptionsCLB->set_text(nEntry, sHyphSpecial, 1); m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData)); @@ -1388,7 +1388,7 @@ IMPL_LINK(SvxLinguTabPage, ModulesBoxCheckButtonHdl_Impl, const row_col&, rRowCo return; auto nPos = rRowCol.first; pLinguData->Reconfigure(m_xLinguModulesCLB->get_text(nPos, 1), - m_xLinguModulesCLB->get_toggle(nPos, 0)); + m_xLinguModulesCLB->get_toggle(nPos, 0) == TRISTATE_TRUE); } IMPL_LINK(SvxLinguTabPage, DicsBoxCheckButtonHdl_Impl, const row_col&, rRowCol, void) @@ -1396,7 +1396,7 @@ IMPL_LINK(SvxLinguTabPage, DicsBoxCheckButtonHdl_Impl, const row_col&, rRowCol, auto nPos = rRowCol.first; const uno::Reference<XDictionary> &rDic = aDics.getConstArray()[ nPos ]; if (LinguMgr::GetIgnoreAllList() == rDic) - m_xLinguDicsCLB->set_toggle(nPos, true, 0); + m_xLinguDicsCLB->set_toggle(nPos, TRISTATE_TRUE, 0); } IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void) diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 0438cdadddfe..e8d23d237f69 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -216,14 +216,14 @@ bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet* ) ACFlags nFlags = pAutoCorrect->GetFlags(); int nPos = 0; - pAutoCorrect->SetAutoCorrFlag(ACFlags::Autocorrect, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); - pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartWord, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); - pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); - pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); - pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); - pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); - pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); - pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); + pAutoCorrect->SetAutoCorrFlag(ACFlags::Autocorrect, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); + pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartWord, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); + pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); + pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); + pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); + pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); + pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); + pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); bool bReturn = nFlags != pAutoCorrect->GetFlags(); if(bReturn ) @@ -244,7 +244,7 @@ void OfaAutocorrOptionsPage::InsertEntry(const OUString& rTxt) { m_xCheckLB->append(); const int nRow = m_xCheckLB->n_children() - 1; - m_xCheckLB->set_toggle(nRow, false, CBCOL_FIRST); + m_xCheckLB->set_toggle(nRow, TRISTATE_FALSE, CBCOL_FIRST); m_xCheckLB->set_text(nRow, rTxt, 1); } @@ -266,14 +266,14 @@ void OfaAutocorrOptionsPage::Reset( const SfxItemSet* ) InsertEntry(m_sAccidentalCaps); int nPos = 0; - m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::Autocorrect), CBCOL_FIRST ); - m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartWord), CBCOL_FIRST ); - m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartSentence), CBCOL_FIRST ); - m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgWeightUnderl), CBCOL_FIRST ); - m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::SetINetAttr), CBCOL_FIRST ); - m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgToEnEmDash), CBCOL_FIRST ); - m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::IgnoreDoubleSpace), CBCOL_FIRST ); - m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CorrectCapsLock), CBCOL_FIRST ); + m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::Autocorrect) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST ); + m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartWord) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST ); + m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartSentence) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST ); + m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgWeightUnderl) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST ); + m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::SetINetAttr) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST ); + m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgToEnEmDash) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST ); + m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::IgnoreDoubleSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST ); + m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CorrectCapsLock) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST ); m_xCheckLB->thaw(); } @@ -385,9 +385,9 @@ void OfaSwAutoFmtOptionsPage::CreateEntry(const OUString& rTxt, sal_uInt16 nCol) m_xCheckLB->append(); const int nRow = m_xCheckLB->n_children() - 1; if (nCol == CBCOL_FIRST || nCol == CBCOL_BOTH) - m_xCheckLB->set_toggle(nRow, false, CBCOL_FIRST); + m_xCheckLB->set_toggle(nRow, TRISTATE_FALSE, CBCOL_FIRST); if (nCol == CBCOL_SECOND || nCol == CBCOL_BOTH) - m_xCheckLB->set_toggle(nRow, false, CBCOL_SECOND); + m_xCheckLB->set_toggle(nRow, TRISTATE_FALSE, CBCOL_SECOND); m_xCheckLB->set_text(nRow, rTxt, 2); } @@ -409,51 +409,51 @@ bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet* ) SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags(); ACFlags nFlags = pAutoCorrect->GetFlags(); - bool bCheck = m_xCheckLB->get_toggle(USE_REPLACE_TABLE, CBCOL_FIRST); + bool bCheck = m_xCheckLB->get_toggle(USE_REPLACE_TABLE, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bAutoCorrect != bCheck; pOpt->bAutoCorrect = bCheck; pAutoCorrect->SetAutoCorrFlag(ACFlags::Autocorrect, - m_xCheckLB->get_toggle(USE_REPLACE_TABLE, CBCOL_SECOND)); + m_xCheckLB->get_toggle(USE_REPLACE_TABLE, CBCOL_SECOND) == TRISTATE_TRUE); - bCheck = m_xCheckLB->get_toggle(CORR_UPPER, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(CORR_UPPER, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bCapitalStartWord != bCheck; pOpt->bCapitalStartWord = bCheck; pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartWord, - m_xCheckLB->get_toggle(CORR_UPPER, CBCOL_SECOND)); + m_xCheckLB->get_toggle(CORR_UPPER, CBCOL_SECOND) == TRISTATE_TRUE); - bCheck = m_xCheckLB->get_toggle(BEGIN_UPPER, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(BEGIN_UPPER, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bCapitalStartSentence != bCheck; pOpt->bCapitalStartSentence = bCheck; pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence, - m_xCheckLB->get_toggle(BEGIN_UPPER, CBCOL_SECOND)); + m_xCheckLB->get_toggle(BEGIN_UPPER, CBCOL_SECOND) == TRISTATE_TRUE); - bCheck = m_xCheckLB->get_toggle(BOLD_UNDERLINE, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(BOLD_UNDERLINE, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bChgWeightUnderl != bCheck; pOpt->bChgWeightUnderl = bCheck; pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl, - m_xCheckLB->get_toggle(BOLD_UNDERLINE, CBCOL_SECOND)); + m_xCheckLB->get_toggle(BOLD_UNDERLINE, CBCOL_SECOND) == TRISTATE_TRUE); pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace, - m_xCheckLB->get_toggle(IGNORE_DBLSPACE, CBCOL_SECOND)); + m_xCheckLB->get_toggle(IGNORE_DBLSPACE, CBCOL_SECOND) == TRISTATE_TRUE); pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock, - m_xCheckLB->get_toggle(CORRECT_CAPS_LOCK, CBCOL_SECOND)); + m_xCheckLB->get_toggle(CORRECT_CAPS_LOCK, CBCOL_SECOND) == TRISTATE_TRUE); - bCheck = m_xCheckLB->get_toggle(DETECT_URL, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(DETECT_URL, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bSetINetAttr != bCheck; pOpt->bSetINetAttr = bCheck; pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr, - m_xCheckLB->get_toggle(DETECT_URL, CBCOL_SECOND)); + m_xCheckLB->get_toggle(DETECT_URL, CBCOL_SECOND) == TRISTATE_TRUE); - bCheck = m_xCheckLB->get_toggle(DEL_EMPTY_NODE, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(DEL_EMPTY_NODE, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bDelEmptyNode != bCheck; pOpt->bDelEmptyNode = bCheck; - bCheck = m_xCheckLB->get_toggle(REPLACE_USER_COLL, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(REPLACE_USER_COLL, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bChgUserColl != bCheck; pOpt->bChgUserColl = bCheck; - bCheck = m_xCheckLB->get_toggle(REPLACE_BULLETS, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(REPLACE_BULLETS, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bChgEnumNum != bCheck; pOpt->bChgEnumNum = bCheck; bModified |= aBulletFont != pOpt->aBulletFont; @@ -466,45 +466,45 @@ bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet* ) pOpt->aByInputBulletFont = aByInputBulletFont; pOpt->cByInputBullet = sByInputBulletChar[0]; - bCheck = m_xCheckLB->get_toggle(MERGE_SINGLE_LINE_PARA, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(MERGE_SINGLE_LINE_PARA, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bRightMargin != bCheck; pOpt->bRightMargin = bCheck; bModified |= nPercent != pOpt->nRightMargin; pOpt->nRightMargin = static_cast<sal_uInt8>(nPercent); - bCheck = m_xCheckLB->get_toggle(APPLY_NUMBERING, CBCOL_SECOND); + bCheck = m_xCheckLB->get_toggle(APPLY_NUMBERING, CBCOL_SECOND) == TRISTATE_TRUE; bModified |= pOpt->bSetNumRule != bCheck; pOpt->bSetNumRule = bCheck; - bCheck = m_xCheckLB->get_toggle(INSERT_BORDER, CBCOL_SECOND); + bCheck = m_xCheckLB->get_toggle(INSERT_BORDER, CBCOL_SECOND) == TRISTATE_TRUE; bModified |= pOpt->bSetBorder != bCheck; pOpt->bSetBorder = bCheck; - bCheck = m_xCheckLB->get_toggle(CREATE_TABLE, CBCOL_SECOND); + bCheck = m_xCheckLB->get_toggle(CREATE_TABLE, CBCOL_SECOND) == TRISTATE_TRUE; bModified |= pOpt->bCreateTable != bCheck; pOpt->bCreateTable = bCheck; - bCheck = m_xCheckLB->get_toggle(REPLACE_STYLES, CBCOL_SECOND); + bCheck = m_xCheckLB->get_toggle(REPLACE_STYLES, CBCOL_SECOND) == TRISTATE_TRUE; bModified |= pOpt->bReplaceStyles != bCheck; pOpt->bReplaceStyles = bCheck; - bCheck = m_xCheckLB->get_toggle(REPLACE_DASHES, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(REPLACE_DASHES, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bChgToEnEmDash != bCheck; pOpt->bChgToEnEmDash = bCheck; pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash, - m_xCheckLB->get_toggle(REPLACE_DASHES, CBCOL_SECOND)); + m_xCheckLB->get_toggle(REPLACE_DASHES, CBCOL_SECOND) == TRISTATE_TRUE); - bCheck = m_xCheckLB->get_toggle(DEL_SPACES_AT_STT_END, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(DEL_SPACES_AT_STT_END, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bAFormatDelSpacesAtSttEnd != bCheck; pOpt->bAFormatDelSpacesAtSttEnd = bCheck; - bCheck = m_xCheckLB->get_toggle(DEL_SPACES_AT_STT_END, CBCOL_SECOND); + bCheck = m_xCheckLB->get_toggle(DEL_SPACES_AT_STT_END, CBCOL_SECOND) == TRISTATE_TRUE; bModified |= pOpt->bAFormatByInpDelSpacesAtSttEnd != bCheck; pOpt->bAFormatByInpDelSpacesAtSttEnd = bCheck; - bCheck = m_xCheckLB->get_toggle(DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST); + bCheck = m_xCheckLB->get_toggle(DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bAFormatDelSpacesBetweenLines != bCheck; pOpt->bAFormatDelSpacesBetweenLines = bCheck; - bCheck = m_xCheckLB->get_toggle(DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND); + bCheck = m_xCheckLB->get_toggle(DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND) == TRISTATE_TRUE; bModified |= pOpt->bAFormatByInpDelSpacesBetweenLines != bCheck; pOpt->bAFormatByInpDelSpacesBetweenLines = bCheck; @@ -563,32 +563,32 @@ void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* ) CreateEntry(sBullet.replaceFirst("%1", sByInputBulletChar), CBCOL_FIRST); CreateEntry(sRightMargin.replaceFirst("%1", sMargin), CBCOL_FIRST); - m_xCheckLB->set_toggle(USE_REPLACE_TABLE, pOpt->bAutoCorrect, CBCOL_FIRST); - m_xCheckLB->set_toggle(USE_REPLACE_TABLE, bool(nFlags & ACFlags::Autocorrect), CBCOL_SECOND); - m_xCheckLB->set_toggle(CORR_UPPER, pOpt->bCapitalStartWord, CBCOL_FIRST); - m_xCheckLB->set_toggle(CORR_UPPER, bool(nFlags & ACFlags::CapitalStartWord), CBCOL_SECOND); - m_xCheckLB->set_toggle(BEGIN_UPPER, pOpt->bCapitalStartSentence, CBCOL_FIRST); - m_xCheckLB->set_toggle(BEGIN_UPPER, bool(nFlags & ACFlags::CapitalStartSentence), CBCOL_SECOND); - m_xCheckLB->set_toggle(BOLD_UNDERLINE, pOpt->bChgWeightUnderl, CBCOL_FIRST); - m_xCheckLB->set_toggle(BOLD_UNDERLINE, bool(nFlags & ACFlags::ChgWeightUnderl), CBCOL_SECOND); - m_xCheckLB->set_toggle(DETECT_URL, pOpt->bSetINetAttr, CBCOL_FIRST); - m_xCheckLB->set_toggle(DETECT_URL, bool(nFlags & ACFlags::SetINetAttr), CBCOL_SECOND); - m_xCheckLB->set_toggle(REPLACE_DASHES, pOpt->bChgToEnEmDash, CBCOL_FIRST); - m_xCheckLB->set_toggle(REPLACE_DASHES, bool(nFlags & ACFlags::ChgToEnEmDash), CBCOL_SECOND); - m_xCheckLB->set_toggle(DEL_SPACES_AT_STT_END, pOpt->bAFormatDelSpacesAtSttEnd, CBCOL_FIRST); - m_xCheckLB->set_toggle(DEL_SPACES_AT_STT_END, pOpt->bAFormatByInpDelSpacesAtSttEnd, CBCOL_SECOND); - m_xCheckLB->set_toggle(DEL_SPACES_BETWEEN_LINES, pOpt->bAFormatDelSpacesBetweenLines, CBCOL_FIRST); - m_xCheckLB->set_toggle(DEL_SPACES_BETWEEN_LINES, pOpt->bAFormatByInpDelSpacesBetweenLines, CBCOL_SECOND); - m_xCheckLB->set_toggle(IGNORE_DBLSPACE, bool(nFlags & ACFlags::IgnoreDoubleSpace), CBCOL_SECOND); - m_xCheckLB->set_toggle(CORRECT_CAPS_LOCK, bool(nFlags & ACFlags::CorrectCapsLock), CBCOL_SECOND); - m_xCheckLB->set_toggle(APPLY_NUMBERING, pOpt->bSetNumRule, CBCOL_SECOND); - m_xCheckLB->set_toggle(INSERT_BORDER, pOpt->bSetBorder, CBCOL_SECOND); - m_xCheckLB->set_toggle(CREATE_TABLE, pOpt->bCreateTable, CBCOL_SECOND); - m_xCheckLB->set_toggle(REPLACE_STYLES, pOpt->bReplaceStyles, CBCOL_SECOND); - m_xCheckLB->set_toggle(DEL_EMPTY_NODE, pOpt->bDelEmptyNode, CBCOL_FIRST); - m_xCheckLB->set_toggle(REPLACE_USER_COLL, pOpt->bChgUserColl, CBCOL_FIRST); - m_xCheckLB->set_toggle(REPLACE_BULLETS, pOpt->bChgEnumNum, CBCOL_FIRST); - m_xCheckLB->set_toggle(MERGE_SINGLE_LINE_PARA, pOpt->bRightMargin, CBCOL_FIRST); + m_xCheckLB->set_toggle(USE_REPLACE_TABLE, pOpt->bAutoCorrect ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(USE_REPLACE_TABLE, bool(nFlags & ACFlags::Autocorrect) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(CORR_UPPER, pOpt->bCapitalStartWord ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(CORR_UPPER, bool(nFlags & ACFlags::CapitalStartWord) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(BEGIN_UPPER, pOpt->bCapitalStartSentence ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(BEGIN_UPPER, bool(nFlags & ACFlags::CapitalStartSentence) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(BOLD_UNDERLINE, pOpt->bChgWeightUnderl ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(BOLD_UNDERLINE, bool(nFlags & ACFlags::ChgWeightUnderl) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(DETECT_URL, pOpt->bSetINetAttr ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(DETECT_URL, bool(nFlags & ACFlags::SetINetAttr) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(REPLACE_DASHES, pOpt->bChgToEnEmDash ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(REPLACE_DASHES, bool(nFlags & ACFlags::ChgToEnEmDash) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(DEL_SPACES_AT_STT_END, pOpt->bAFormatDelSpacesAtSttEnd ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(DEL_SPACES_AT_STT_END, pOpt->bAFormatByInpDelSpacesAtSttEnd ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(DEL_SPACES_BETWEEN_LINES, pOpt->bAFormatDelSpacesBetweenLines ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(DEL_SPACES_BETWEEN_LINES, pOpt->bAFormatByInpDelSpacesBetweenLines ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(IGNORE_DBLSPACE, bool(nFlags & ACFlags::IgnoreDoubleSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(CORRECT_CAPS_LOCK, bool(nFlags & ACFlags::CorrectCapsLock) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(APPLY_NUMBERING, pOpt->bSetNumRule ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(INSERT_BORDER, pOpt->bSetBorder ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(CREATE_TABLE, pOpt->bCreateTable ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(REPLACE_STYLES, pOpt->bReplaceStyles ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xCheckLB->set_toggle(DEL_EMPTY_NODE, pOpt->bDelEmptyNode ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(REPLACE_USER_COLL, pOpt->bChgUserColl ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(REPLACE_BULLETS, pOpt->bChgEnumNum ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(MERGE_SINGLE_LINE_PARA, pOpt->bRightMargin ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); ImpUserData* pUserData = new ImpUserData(&sBulletChar, &aBulletFont); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pUserData))); @@ -1532,9 +1532,9 @@ void OfaQuoteTabPage::CreateEntry(weld::TreeView& rCheckLB, const OUString& rTxt rCheckLB.append(); const int nRow = rCheckLB.n_children() - 1; if (nCol == CBCOL_FIRST || nCol == CBCOL_BOTH) - rCheckLB.set_toggle(nRow, false, CBCOL_FIRST); + rCheckLB.set_toggle(nRow, TRISTATE_FALSE, CBCOL_FIRST); if (nCol == CBCOL_SECOND || nCol == CBCOL_BOTH) - rCheckLB.set_toggle(nRow, false, CBCOL_SECOND); + rCheckLB.set_toggle(nRow, TRISTATE_FALSE, CBCOL_SECOND); rCheckLB.set_text(nRow, rTxt, nTextCol); } @@ -1615,8 +1615,8 @@ bool OfaQuoteTabPage::FillItemSet( SfxItemSet* ) if (m_xCheckLB->get_visible()) { int nPos = 0; - pAutoCorrect->SetAutoCorrFlag(ACFlags::AddNonBrkSpace, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); - pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgOrdinalNumber, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST)); + pAutoCorrect->SetAutoCorrFlag(ACFlags::AddNonBrkSpace, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); + pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgOrdinalNumber, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); } bool bModified = false; @@ -1624,17 +1624,17 @@ bool OfaQuoteTabPage::FillItemSet( SfxItemSet* ) { SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags(); - bool bCheck = m_xSwCheckLB->get_toggle(ADD_NONBRK_SPACE, CBCOL_FIRST); + bool bCheck = m_xSwCheckLB->get_toggle(ADD_NONBRK_SPACE, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bAddNonBrkSpace != bCheck; pOpt->bAddNonBrkSpace = bCheck; pAutoCorrect->SetAutoCorrFlag(ACFlags::AddNonBrkSpace, - m_xSwCheckLB->get_toggle(ADD_NONBRK_SPACE, CBCOL_SECOND)); + m_xSwCheckLB->get_toggle(ADD_NONBRK_SPACE, CBCOL_SECOND) == TRISTATE_TRUE); - bCheck = m_xSwCheckLB->get_toggle(REPLACE_1ST, CBCOL_FIRST); + bCheck = m_xSwCheckLB->get_toggle(REPLACE_1ST, CBCOL_FIRST) == TRISTATE_TRUE; bModified |= pOpt->bChgOrdinalNumber != bCheck; pOpt->bChgOrdinalNumber = bCheck; pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgOrdinalNumber, - m_xSwCheckLB->get_toggle(REPLACE_1ST, CBCOL_SECOND)); + m_xSwCheckLB->get_toggle(REPLACE_1ST, CBCOL_SECOND) == TRISTATE_TRUE); } pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgQuotes, m_xDoubleTypoCB->get_active()); @@ -1695,10 +1695,10 @@ void OfaQuoteTabPage::Reset( const SfxItemSet* ) CreateEntry(*m_xSwCheckLB, sNonBrkSpace, CBCOL_BOTH, 2); CreateEntry(*m_xSwCheckLB, sOrdinal, CBCOL_BOTH, 2); - m_xSwCheckLB->set_toggle(ADD_NONBRK_SPACE, pOpt->bAddNonBrkSpace, CBCOL_FIRST); - m_xSwCheckLB->set_toggle(ADD_NONBRK_SPACE, bool(nFlags & ACFlags::AddNonBrkSpace), CBCOL_SECOND); - m_xSwCheckLB->set_toggle(REPLACE_1ST, pOpt->bChgOrdinalNumber, CBCOL_FIRST); - m_xSwCheckLB->set_toggle(REPLACE_1ST, bool(nFlags & ACFlags::ChgOrdinalNumber), CBCOL_SECOND); + m_xSwCheckLB->set_toggle(ADD_NONBRK_SPACE, pOpt->bAddNonBrkSpace ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xSwCheckLB->set_toggle(ADD_NONBRK_SPACE, bool(nFlags & ACFlags::AddNonBrkSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); + m_xSwCheckLB->set_toggle(REPLACE_1ST, pOpt->bChgOrdinalNumber ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xSwCheckLB->set_toggle(REPLACE_1ST, bool(nFlags & ACFlags::ChgOrdinalNumber) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); m_xSwCheckLB->thaw(); } @@ -1713,8 +1713,8 @@ void OfaQuoteTabPage::Reset( const SfxItemSet* ) CreateEntry(*m_xCheckLB, sOrdinal, CBCOL_FIRST, 1); int nPos = 0; - m_xCheckLB->set_toggle(nPos++, bool(nFlags & ACFlags::AddNonBrkSpace), CBCOL_FIRST); - m_xCheckLB->set_toggle(nPos++, bool(nFlags & ACFlags::ChgOrdinalNumber), CBCOL_FIRST); + m_xCheckLB->set_toggle(nPos++, bool(nFlags & ACFlags::AddNonBrkSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xCheckLB->set_toggle(nPos++, bool(nFlags & ACFlags::ChgOrdinalNumber) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); m_xCheckLB->thaw(); } @@ -2208,7 +2208,7 @@ void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr ) m_xSmartTagTypesLB->append(); const int nRow = m_xSmartTagTypesLB->n_children() - 1; const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType ); - m_xSmartTagTypesLB->set_toggle(nRow, bCheck, CBCOL_FIRST); + m_xSmartTagTypesLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); m_xSmartTagTypesLB->set_text(nRow, aLBEntry, 1); m_xSmartTagTypesLB->set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(new ImplSmartTagLBUserData(aSmartTagType, xRec, j)))); } @@ -2283,7 +2283,7 @@ bool OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet* ) for (int i = 0; i < nCount; ++i) { const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i).toInt64()); - const bool bChecked = m_xSmartTagTypesLB->get_toggle(i, CBCOL_FIRST); + const bool bChecked = m_xSmartTagTypesLB->get_toggle(i, CBCOL_FIRST) == TRISTATE_TRUE; const bool bIsCurrentlyEnabled = pSmartTagMgr->IsSmartTagTypeEnabled( pUserData->maSmartTagType ); bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled ); diff --git a/cui/uiconfig/ui/accelconfigpage.ui b/cui/uiconfig/ui/accelconfigpage.ui index 6f248588023a..8d058c61bfda 100644 --- a/cui/uiconfig/ui/accelconfigpage.ui +++ b/cui/uiconfig/ui/accelconfigpage.ui @@ -26,7 +26,11 @@ <column type="gchararray"/> <!-- column-name id --> <column type="gchararray"/> - <!-- column-name sensitive --> + <!-- column-name weight1 --> + <column type="gint"/> + <!-- column-name weight1 --> + <column type="gint"/> + <!-- column-name sensitive1 --> <column type="gboolean"/> </columns> </object> @@ -97,7 +101,7 @@ <child> <object class="GtkCellRendererText" id="cellrenderer1"/> <attributes> - <attribute name="sensitive">3</attribute> + <attribute name="sensitive">5</attribute> <attribute name="text">0</attribute> </attributes> </child> diff --git a/cui/uiconfig/ui/acoroptionspage.ui b/cui/uiconfig/ui/acoroptionspage.ui index 2bdc0bf3492d..045f394b16d3 100644 --- a/cui/uiconfig/ui/acoroptionspage.ui +++ b/cui/uiconfig/ui/acoroptionspage.ui @@ -12,6 +12,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkBox" id="AutocorrectOptionsPage"> diff --git a/cui/uiconfig/ui/applyautofmtpage.ui b/cui/uiconfig/ui/applyautofmtpage.ui index 98528c5d13c1..45ca15dd7788 100644 --- a/cui/uiconfig/ui/applyautofmtpage.ui +++ b/cui/uiconfig/ui/applyautofmtpage.ui @@ -16,6 +16,10 @@ <column type="gboolean"/> <!-- column-name checkvis2 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> + <!-- column-name checktri2 --> + <column type="gboolean"/> </columns> </object> <object class="GtkBox" id="ApplyAutoFmtPage"> diff --git a/cui/uiconfig/ui/applylocalizedpage.ui b/cui/uiconfig/ui/applylocalizedpage.ui index 705a810f58db..6fec332aee47 100644 --- a/cui/uiconfig/ui/applylocalizedpage.ui +++ b/cui/uiconfig/ui/applylocalizedpage.ui @@ -16,6 +16,10 @@ <column type="gboolean"/> <!-- column-name checkvis2 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> + <!-- column-name checktri2 --> + <column type="gboolean"/> </columns> </object> <object class="GtkTreeStore" id="liststore2"> @@ -28,6 +32,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkBox" id="ApplyLocalizedPage"> diff --git a/cui/uiconfig/ui/certdialog.ui b/cui/uiconfig/ui/certdialog.ui index 8a90f1d32862..348e346856b5 100644 --- a/cui/uiconfig/ui/certdialog.ui +++ b/cui/uiconfig/ui/certdialog.ui @@ -14,6 +14,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkDialog" id="CertDialog"> diff --git a/cui/uiconfig/ui/hangulhanjaoptdialog.ui b/cui/uiconfig/ui/hangulhanjaoptdialog.ui index 1fef474a30c1..c771f050903a 100644 --- a/cui/uiconfig/ui/hangulhanjaoptdialog.ui +++ b/cui/uiconfig/ui/hangulhanjaoptdialog.ui @@ -12,6 +12,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkDialog" id="HangulHanjaOptDialog"> diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui index 63c74abab271..e69080d09fe4 100644 --- a/cui/uiconfig/ui/menuassignpage.ui +++ b/cui/uiconfig/ui/menuassignpage.ui @@ -76,6 +76,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkTreeStore" id="liststore3"> diff --git a/cui/uiconfig/ui/multipathdialog.ui b/cui/uiconfig/ui/multipathdialog.ui index 9275c13e4a34..0f1e73094e20 100644 --- a/cui/uiconfig/ui/multipathdialog.ui +++ b/cui/uiconfig/ui/multipathdialog.ui @@ -12,6 +12,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkDialog" id="MultiPathDialog"> diff --git a/cui/uiconfig/ui/optlingupage.ui b/cui/uiconfig/ui/optlingupage.ui index f2331ecb58d9..215c8f67549c 100644 --- a/cui/uiconfig/ui/optlingupage.ui +++ b/cui/uiconfig/ui/optlingupage.ui @@ -12,6 +12,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkTreeStore" id="liststore3"> @@ -24,6 +26,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkTreeStore" id="liststore4"> @@ -36,6 +40,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkGrid" id="OptLinguPage"> diff --git a/cui/uiconfig/ui/searchattrdialog.ui b/cui/uiconfig/ui/searchattrdialog.ui index f543ba732c8e..d67f41fe008b 100644 --- a/cui/uiconfig/ui/searchattrdialog.ui +++ b/cui/uiconfig/ui/searchattrdialog.ui @@ -12,6 +12,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkDialog" id="SearchAttrDialog"> diff --git a/cui/uiconfig/ui/smarttagoptionspage.ui b/cui/uiconfig/ui/smarttagoptionspage.ui index b4e00e16a8a7..08cbb87ae8e6 100644 --- a/cui/uiconfig/ui/smarttagoptionspage.ui +++ b/cui/uiconfig/ui/smarttagoptionspage.ui @@ -12,6 +12,8 @@ <column type="gchararray"/> <!-- column-name checkvis1 --> <column type="gboolean"/> + <!-- column-name checktri1 --> + <column type="gboolean"/> </columns> </object> <object class="GtkGrid" id="SmartTagOptionsPage"> diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index ee49f5b1f3e6..31251082622e 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1077,12 +1077,12 @@ namespace virtual ~FilterByEntryDataId() {} - virtual bool includeEntry( SvTreeListEntry* _pEntry ) const override; + virtual bool includeEntry(const void* pEntry) const override; }; - bool FilterByEntryDataId::includeEntry( SvTreeListEntry* _pEntry ) const + bool FilterByEntryDataId::includeEntry(const void* pUserData) const { - DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( _pEntry->GetUserData() ); + const DBTreeListUserData* pData = static_cast<const DBTreeListUserData*>(pUserData); return ( !pData || ( pData->sAccessor == sId ) ); } } diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index 921130037653..0d8912d92bcb 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -117,7 +117,7 @@ SvTreeListEntry* DBTreeListBox::GetEntryPosByName( const OUString& aName, SvTree if (pItem && pItem->GetText() == aName) { - if (!_pFilter || _pFilter->includeEntry(pEntry)) + if (!_pFilter || _pFilter->includeEntry(pEntry->GetUserData())) // found break; } diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx index 9e8b7de36fb5..b89fa02bbe60 100644 --- a/dbaccess/source/ui/control/tabletree.cxx +++ b/dbaccess/source/ui/control/tabletree.cxx @@ -74,6 +74,15 @@ OTableTreeListBox::OTableTreeListBox(vcl::Window* pParent, WinBits nWinStyle) implSetDefaultImages(); } +TableTreeListBox::TableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView) + : m_xImageProvider(new ImageProvider) + , m_bVirtualRoot(false) + , m_bNoEmptyFolders(false) + , m_xTreeView(std::move(xTreeView)) +{ + m_xTreeView->make_sorted(); +} + VCL_BUILDER_FACTORY_CONSTRUCTOR(OTableTreeListBox, 0) void OTableTreeListBox::implSetDefaultImages() @@ -131,6 +140,12 @@ void OTableTreeListBox::implOnNewConnection( const Reference< XConnection >& _rx m_xImageProvider.reset( new ImageProvider( m_xConnection ) ); } +void TableTreeListBox::implOnNewConnection( const Reference< XConnection >& _rxConnection ) +{ + m_xConnection = _rxConnection; + m_xImageProvider.reset( new ImageProvider( m_xConnection ) ); +} + void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConnection ) { Sequence< OUString > sTables, sViews; @@ -173,6 +188,48 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn UpdateTableList( _rxConnection, sTables, sViews ); } +void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConnection ) +{ + Sequence< OUString > sTables, sViews; + + OUString sCurrentActionError; + try + { + Reference< XTablesSupplier > xTableSupp( _rxConnection, UNO_QUERY_THROW ); + sCurrentActionError = DBA_RES(STR_NOTABLEINFO); + + Reference< XNameAccess > xTables,xViews; + + Reference< XViewsSupplier > xViewSupp( _rxConnection, UNO_QUERY ); + if ( xViewSupp.is() ) + { + xViews = xViewSupp->getViews(); + if (xViews.is()) + sViews = xViews->getElementNames(); + } + + xTables = xTableSupp->getTables(); + if (xTables.is()) + sTables = xTables->getElementNames(); + } + catch(RuntimeException&) + { + OSL_FAIL("OTableTreeListBox::UpdateTableList : caught an RuntimeException!"); + } + catch ( const SQLException& ) + { + throw; + } + catch(Exception&) + { + css::uno::Any anyEx = cppu::getCaughtException(); + // a non-SQLException exception occurred ... simply throw an SQLException + throw SQLException(sCurrentActionError, nullptr, "", 0, anyEx); + } + + UpdateTableList( _rxConnection, sTables, sViews ); +} + namespace { struct OViewSetter @@ -216,6 +273,27 @@ void OTableTreeListBox::UpdateTableList( UpdateTableList( _rxConnection, aTables ); } +void TableTreeListBox::UpdateTableList( + const Reference< XConnection >& _rxConnection, + const Sequence< OUString>& _rTables, + const Sequence< OUString>& _rViews + ) +{ + TNames aTables; + aTables.resize(_rTables.getLength()); + try + { + Reference< XDatabaseMetaData > xMeta( _rxConnection->getMetaData(), UNO_QUERY_THROW ); + std::transform( _rTables.begin(), _rTables.end(), + aTables.begin(), OViewSetter( _rViews, xMeta->supportsMixedCaseQuotedIdentifiers() ) ); + } + catch(Exception&) + { + DBG_UNHANDLED_EXCEPTION("dbaccess"); + } + UpdateTableList( _rxConnection, aTables ); +} + namespace { std::vector< OUString > lcl_getMetaDataStrings_throw( const Reference< XResultSet >& _rxMetaDataResult, sal_Int32 _nColumnIndex ) @@ -305,6 +383,92 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn } } +void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConnection, const TNames& _rTables ) +{ + implOnNewConnection( _rxConnection ); + + // throw away all the old stuff + m_xTreeView->clear(); + + try + { + if (haveVirtualRoot()) + { + OUString sRootEntryText; + if ( std::none_of(_rTables.begin(),_rTables.end(), + [] (const TNames::value_type& name) { return !name.second; }) ) + sRootEntryText = DBA_RES(STR_ALL_TABLES); + else if ( std::none_of(_rTables.begin(),_rTables.end(), + [] (const TNames::value_type& name) { return name.second; }) ) + sRootEntryText = DBA_RES(STR_ALL_VIEWS); + else + sRootEntryText = DBA_RES(STR_ALL_TABLES_AND_VIEWS); + OUString sId(OUString::number(DatabaseObjectContainer::TABLES)); + OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE); + std::unique_ptr<weld::TreeIter> xRet(m_xTreeView->make_iterator()); + m_xTreeView->insert(nullptr, -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xRet.get()); + m_xTreeView->set_image(*xRet, sImageId, -1); + m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE, 0); + m_xTreeView->set_text(*xRet, sRootEntryText, 1); + } + + if ( _rTables.empty() ) + // nothing to do (besides inserting the root entry) + return; + + // get the table/view names + Reference< XDatabaseMetaData > xMeta( _rxConnection->getMetaData(), UNO_QUERY_THROW ); + for (auto const& table : _rTables) + { + // add the entry + implAddEntry( + xMeta, + table.first, + false + ); + } + + if ( !m_bNoEmptyFolders && lcl_shouldDisplayEmptySchemasAndCatalogs( _rxConnection ) ) + { + bool bSupportsCatalogs = xMeta->supportsCatalogsInDataManipulation(); + bool bSupportsSchemas = xMeta->supportsSchemasInDataManipulation(); + + if ( bSupportsCatalogs || bSupportsSchemas ) + { + // we display empty catalogs if the DB supports catalogs, and they're noted at the beginning of a + // composed name. Otherwise, we display empty schematas. (also see the tree structure explained in + // implAddEntry) + bool bCatalogs = bSupportsCatalogs && xMeta->isCatalogAtStart(); + + std::vector< OUString > aFolderNames( lcl_getMetaDataStrings_throw( + bCatalogs ? xMeta->getCatalogs() : xMeta->getSchemas(), 1 ) ); + sal_Int32 nFolderType = bCatalogs ? DatabaseObjectContainer::CATALOG : DatabaseObjectContainer::SCHEMA; + + OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE); + + std::unique_ptr<weld::TreeIter> xRootEntry(getAllObjectsEntry()); + std::unique_ptr<weld::TreeIter> xRet(m_xTreeView->make_iterator()); + for (auto const& folderName : aFolderNames) + { + std::unique_ptr<weld::TreeIter> xFolder(GetEntryPosByName(folderName, xRootEntry.get())); + if (!xFolder) + { + OUString sId(OUString::number(nFolderType)); + m_xTreeView->insert(xRootEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xRet.get()); + m_xTreeView->set_image(*xRet, sImageId, -1); + m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE, 0); + m_xTreeView->set_text(*xRet, folderName, 1); + } + } + } + } + } + catch ( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("dbaccess"); + } +} + bool OTableTreeListBox::isWildcardChecked(SvTreeListEntry* _pEntry) { if (_pEntry) @@ -316,17 +480,39 @@ bool OTableTreeListBox::isWildcardChecked(SvTreeListEntry* _pEntry) return false; } +bool TableTreeListBox::isWildcardChecked(weld::TreeIter& rEntry) +{ +// return m_xTreeView->get_text_emphasis(rEntry, 2); + return m_xTreeView->get_text_emphasis(rEntry, 1); +} + void OTableTreeListBox::checkWildcard(SvTreeListEntry* _pEntry) { SetCheckButtonState(_pEntry, SvButtonState::Checked); checkedButton_noBroadcast(_pEntry); } +void TableTreeListBox::checkWildcard(weld::TreeIter& rEntry) +{ + m_xTreeView->set_toggle(rEntry, TRISTATE_TRUE, 0); + checkedButton_noBroadcast(rEntry); +} + SvTreeListEntry* OTableTreeListBox::getAllObjectsEntry() const { return haveVirtualRoot() ? First() : nullptr; } +std::unique_ptr<weld::TreeIter> TableTreeListBox::getAllObjectsEntry() const +{ + if (!haveVirtualRoot()) + return nullptr; + auto xRet = m_xTreeView->make_iterator(); + if (!m_xTreeView->get_iter_first(*xRet)) + return nullptr; + return xRet; +} + void OTableTreeListBox::checkedButton_noBroadcast(SvTreeListEntry* _pEntry) { OMarkableTreeListBox::checkedButton_noBroadcast(_pEntry); @@ -340,6 +526,52 @@ void OTableTreeListBox::checkedButton_noBroadcast(SvTreeListEntry* _pEntry) implEmphasize(_pEntry, SvButtonState::Checked == eState); } +void TableTreeListBox::checkedButton_noBroadcast(weld::TreeIter& rEntry) +{ + TriState eState = m_xTreeView->get_toggle(rEntry, 0); + 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 + { + std::unique_ptr<weld::TreeIter> xChildEntry(m_xTreeView->make_iterator(&rEntry)); + std::unique_ptr<weld::TreeIter> xSiblingEntry(m_xTreeView->make_iterator(&rEntry)); + bool bChildEntry = m_xTreeView->iter_next(*xChildEntry); + bool bSiblingEntry = m_xTreeView->iter_next_sibling(*xSiblingEntry); + while (bChildEntry && (!bSiblingEntry || !xChildEntry->equal(*xSiblingEntry))) + { + m_xTreeView->set_toggle(*xChildEntry, eState, 0); + bChildEntry = m_xTreeView->iter_next(*xChildEntry); + } + } + + if (m_xTreeView->is_selected(rEntry)) + { + m_xTreeView->selected_foreach([this, eState](weld::TreeIter& rSelected){ + m_xTreeView->set_toggle(rSelected, eState, 0); + 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)); + std::unique_ptr<weld::TreeIter> xSiblingEntry(m_xTreeView->make_iterator(&rSelected)); + bool bChildEntry = m_xTreeView->iter_next(*xChildEntry); + bool bSiblingEntry = m_xTreeView->iter_next_sibling(*xSiblingEntry); + while (bChildEntry && (!bSiblingEntry || !xChildEntry->equal(*xSiblingEntry))) + { + m_xTreeView->set_toggle(*xChildEntry, eState, 0); + bChildEntry = m_xTreeView->iter_next(*xChildEntry); + } + } + return false; + }); + } + + CheckButtons(); + + // if an entry has children, it makes a difference if the entry is checked + // because all children are checked or if the user checked it explicitly. + // So we track explicit (un)checking + implEmphasize(rEntry, eState == TRISTATE_TRUE); +} + void OTableTreeListBox::implEmphasize(SvTreeListEntry* _pEntry, bool _bChecked, bool _bUpdateDescendants, bool _bUpdateAncestors) { OSL_ENSURE(_pEntry, "OTableTreeListBox::implEmphasize: invalid entry (NULL)!"); @@ -378,6 +610,39 @@ void OTableTreeListBox::implEmphasize(SvTreeListEntry* _pEntry, bool _bChecked, } } +void TableTreeListBox::implEmphasize(weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants, bool _bUpdateAncestors) +{ + // special emphasizing handling for the "all objects" entry + bool bAllObjectsEntryAffected = haveVirtualRoot() && (getAllObjectsEntry()->equal(rEntry)); + if ( m_xTreeView->iter_has_child(rEntry) // the entry has children + || bAllObjectsEntryAffected // or it is the "all objects" entry + ) + { + m_xTreeView->set_text_emphasis(rEntry, _bChecked, 1); + } + + if (_bUpdateDescendants) + { + std::unique_ptr<weld::TreeIter> xChild(m_xTreeView->make_iterator(&rEntry)); + // remove the mark for all children of the checked entry + bool bChildLoop = m_xTreeView->iter_children(*xChild); + while (bChildLoop) + { + if (m_xTreeView->iter_has_child(*xChild)) + implEmphasize(*xChild, false, true, false); + bChildLoop = m_xTreeView->iter_next_sibling(*xChild); + } + } + + if (_bUpdateAncestors) + { + std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator(&rEntry)); + // remove the mark for all ancestors of the entry + if (m_xTreeView->iter_parent(*xParent)) + implEmphasize(*xParent, false, false); + } +} + void OTableTreeListBox::InitEntry(SvTreeListEntry* _pEntry, const OUString& _rString, const Image& _rCollapsedBitmap, const Image& _rExpandedBitmap, SvLBoxButtonKind _eButtonKind) { OMarkableTreeListBox::InitEntry(_pEntry, _rString, _rCollapsedBitmap, _rExpandedBitmap, _eButtonKind); @@ -451,6 +716,86 @@ SvTreeListEntry* OTableTreeListBox::implAddEntry( return pRet; } +void TableTreeListBox::implAddEntry( + const Reference< XDatabaseMetaData >& _rxMeta, + const OUString& _rTableName, + bool _bCheckName + ) +{ + OSL_PRECOND( _rxMeta.is(), "OTableTreeListBox::implAddEntry: invalid meta data!" ); + if ( !_rxMeta.is() ) + return; + + // split the complete name into its components + OUString sCatalog, sSchema, sName; + qualifiedNameComponents( _rxMeta, _rTableName, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation ); + + std::unique_ptr<weld::TreeIter> xParentEntry(getAllObjectsEntry()); + + // if the DB uses catalog at the start of identifiers, then our hierarchy is + // catalog + // +- schema + // +- table + // else it is + // schema + // +- catalog + // +- table + bool bCatalogAtStart = _rxMeta->isCatalogAtStart(); + const OUString& rFirstName = bCatalogAtStart ? sCatalog : sSchema; + const sal_Int32 nFirstFolderType = bCatalogAtStart ? DatabaseObjectContainer::CATALOG : DatabaseObjectContainer::SCHEMA; + const OUString& rSecondName = bCatalogAtStart ? sSchema : sCatalog; + const sal_Int32 nSecondFolderType = bCatalogAtStart ? DatabaseObjectContainer::SCHEMA : DatabaseObjectContainer::CATALOG; + + if ( !rFirstName.isEmpty() ) + { + std::unique_ptr<weld::TreeIter> xFolder(GetEntryPosByName(rFirstName, xParentEntry.get())); + if (!xFolder) + { + xFolder = m_xTreeView->make_iterator(); + OUString sId(OUString::number(nFirstFolderType)); + OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE); + m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xFolder.get()); + m_xTreeView->set_image(*xFolder, sImageId, -1); + m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE, 0); + m_xTreeView->set_text(*xFolder, rFirstName, 1); + } + xParentEntry = std::move(xFolder); + } + + if ( !rSecondName.isEmpty() ) + { + std::unique_ptr<weld::TreeIter> xFolder(GetEntryPosByName(rSecondName, xParentEntry.get())); + if (!xFolder) + { + xFolder = m_xTreeView->make_iterator(); + OUString sId(OUString::number(nSecondFolderType)); + OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE); + m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xFolder.get()); + m_xTreeView->set_image(*xFolder, sImageId, -1); + m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE, 0); + m_xTreeView->set_text(*xFolder, rSecondName, 1); + } + xParentEntry = std::move(xFolder); + } + + if (!_bCheckName || !GetEntryPosByName(sName, xParentEntry.get())) + { + std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator(); + m_xTreeView->insert(xParentEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, nullptr, false, xEntry.get()); + + auto xGraphic = m_xImageProvider->getXGraphic(_rTableName, DatabaseObject::TABLE); + if (xGraphic.is()) + m_xTreeView->set_image(*xEntry, xGraphic, -1); + else + { + OUString sImageId(m_xImageProvider->getImageId(_rTableName, DatabaseObject::TABLE)); + m_xTreeView->set_image(*xEntry, sImageId, -1); + } + m_xTreeView->set_toggle(*xEntry, TRISTATE_FALSE, 0); + m_xTreeView->set_text(*xEntry, sName, 1); + } +} + NamedDatabaseObject OTableTreeListBox::describeObject( SvTreeListEntry* _pEntry ) { NamedDatabaseObject aObject; @@ -596,6 +941,107 @@ void OTableTreeListBox::removedTable( const OUString& _rName ) } } +std::unique_ptr<weld::TreeIter> TableTreeListBox::GetEntryPosByName(const OUString& aName, weld::TreeIter* pStart, const IEntryFilter* _pFilter) const +{ + auto xEntry(m_xTreeView->make_iterator(pStart)); + if (!pStart && !m_xTreeView->get_iter_first(*xEntry)) + return nullptr; + + do + { + if (m_xTreeView->get_text(*xEntry) == aName) + { + if (!_pFilter || _pFilter->includeEntry(reinterpret_cast<void*>(m_xTreeView->get_id(*xEntry).toUInt64()))) + { + // found + return xEntry; + } + } + } while (m_xTreeView->iter_next(*xEntry)); + + return nullptr; +} + +void TableTreeListBox::CheckButtons() +{ + auto xEntry(m_xTreeView->make_iterator()); + if (!m_xTreeView->get_iter_first(*xEntry)) + return; + + do + { + implDetermineState(*xEntry); + } while (m_xTreeView->iter_next_sibling(*xEntry)); +} + +TriState TableTreeListBox::implDetermineState(weld::TreeIter& rEntry) +{ + TriState eState = m_xTreeView->get_toggle(rEntry, 0); + if (!m_xTreeView->iter_has_child(rEntry)) + // nothing to do in this bottom-up routine if there are no children ... + return eState; + + // loop through the children and check their states + sal_uInt16 nCheckedChildren = 0; + sal_uInt16 nChildrenOverall = 0; + + std::unique_ptr<weld::TreeIter> xChild(m_xTreeView->make_iterator(&rEntry)); + bool bChildLoop = m_xTreeView->iter_children(*xChild); + while (bChildLoop) + { + TriState eChildState = implDetermineState(*xChild); + if (eChildState == TRISTATE_INDET) + break; + if (eChildState == TRISTATE_TRUE) + ++nCheckedChildren; + ++nChildrenOverall; + bChildLoop = m_xTreeView->iter_next_sibling(*xChild); + } + + if (bChildLoop) + { + // we did not finish the loop because at least one of the children is in tristate + eState = TRISTATE_INDET; + + // but this means that we did not finish all the siblings of pChildLoop, + // so their checking may be incorrect at the moment + // -> correct this + while (bChildLoop) + { + implDetermineState(*xChild); + bChildLoop = m_xTreeView->iter_next_sibling(*xChild); + } + } + else + { + // none if the children are in tristate + if (nCheckedChildren) + { + // we have at least one child checked + if (nCheckedChildren != nChildrenOverall) + { + // not all children are checked + eState = TRISTATE_INDET; + } + else + { + // all children are checked + eState = TRISTATE_TRUE; + } + } + else + { + // no children are checked + eState = TRISTATE_FALSE; + } + } + + // finally set the entry to the state we just determined + m_xTreeView->set_toggle(rEntry, eState, 0); + + return eState; +} + } // namespace dbaui /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx index 233157aa66f0..d5b8ec000344 100644 --- a/dbaccess/source/ui/dlg/tablespage.cxx +++ b/dbaccess/source/ui/dlg/tablespage.cxx @@ -66,32 +66,25 @@ namespace dbaui using namespace ::comphelper; // OTableSubscriptionPage - OTableSubscriptionPage::OTableSubscriptionPage(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs, + OTableSubscriptionPage::OTableSubscriptionPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs, OTableSubscriptionDialog* _pTablesDlg) - : OGenericAdministrationPage(pParent, "TablesFilterPage", - "dbaccess/ui/tablesfilterpage.ui", _rCoreAttrs) + : OGenericAdministrationPage(pParent, "dbaccess/ui/tablesfilterpage.ui", "TablesFilterPage", _rCoreAttrs) , m_bCatalogAtStart(true) , m_pTablesDlg(_pTablesDlg) + , m_xTables(m_xBuilder->weld_widget("TablesFilterPage")) + , m_xTablesList(new TableTreeListBox(m_xBuilder->weld_tree_view("treeview"))) { - get(m_pTables, "TablesFilterPage"); + m_xTablesList->init(); - get(m_pTablesList, "treeview"); - m_pTablesList->init(); - m_pTablesList->set_width_request(56 * m_pTablesList->approximate_char_width()); - m_pTablesList->set_height_request(12 * m_pTablesList->GetTextHeight()); + weld::TreeView& rWidget = m_xTablesList->GetWidget(); - m_pTablesList->SetCheckHandler(LINK(this,OGenericAdministrationPage,OnControlModified)); + rWidget.set_size_request(rWidget.get_approximate_digit_width() * 48, + rWidget.get_height_rows(12)); // initialize the TabListBox - m_pTablesList->SetSelectionMode( SelectionMode::Multiple ); - m_pTablesList->SetDragDropMode( DragDropMode::NONE ); - m_pTablesList->EnableInplaceEditing( false ); - m_pTablesList->SetStyle(m_pTablesList->GetStyle() | WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT); + rWidget.set_selection_mode(SelectionMode::Multiple); - m_pTablesList->Clear(); - - m_pTablesList->SetCheckButtonHdl(LINK(this, OTableSubscriptionPage, OnTreeEntryButtonChecked)); - m_pTablesList->SetCheckHandler(LINK(this, OTableSubscriptionPage, OnTreeEntryChecked)); + rWidget.connect_toggled(LINK(this, OTableSubscriptionPage, OnTreeEntryChecked)); } OTableSubscriptionPage::~OTableSubscriptionPage() @@ -107,34 +100,10 @@ namespace dbaui ::comphelper::disposeComponent(m_xCurrentConnection); } catch (RuntimeException&) { } - m_pTables.clear(); - m_pTablesList.clear(); m_pTablesDlg.clear(); OGenericAdministrationPage::dispose(); } - void OTableSubscriptionPage::StateChanged( StateChangedType nType ) - { - OGenericAdministrationPage::StateChanged( nType ); - - if ( nType == StateChangedType::ControlBackground ) - { - // Check if we need to get new images for normal/high contrast mode - m_pTablesList->notifyHiContrastChanged(); - } - } - void OTableSubscriptionPage::DataChanged( const DataChangedEvent& rDCEvt ) - { - OGenericAdministrationPage::DataChanged( rDCEvt ); - - if ((( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) || - ( rDCEvt.GetType() == DataChangedEventType::DISPLAY )) && - ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE )) - { - // Check if we need to get new images for normal/high contrast mode - m_pTablesList->notifyHiContrastChanged(); - } - } void OTableSubscriptionPage::implCheckTables(const Sequence< OUString >& _rTables) { // the meta data for the current connection, used for splitting up table names @@ -155,7 +124,7 @@ namespace dbaui // check the ones which are in the list OUString sCatalog, sSchema, sName; - SvTreeListEntry* pRootEntry = m_pTablesList->getAllObjectsEntry(); + std::unique_ptr<weld::TreeIter> xRootEntry(m_xTablesList->getAllObjectsEntry()); for (const OUString& rIncludeTable : _rTables) { @@ -168,34 +137,34 @@ namespace dbaui bool bAllSchemas = (1 == sSchema.getLength()) && ('%' == sSchema[0]); // the catalog entry - SvTreeListEntry* pCatalog = m_pTablesList->GetEntryPosByName(sCatalog, pRootEntry); - if (!(pCatalog || sCatalog.isEmpty())) + std::unique_ptr<weld::TreeIter> xCatalog(m_xTablesList->GetEntryPosByName(sCatalog, xRootEntry.get())); + if (!(xCatalog || sCatalog.isEmpty())) // the table (resp. its catalog) referred in this filter entry does not exist anymore continue; - if (bAllSchemas && pCatalog) + if (bAllSchemas && xCatalog) { - m_pTablesList->checkWildcard(pCatalog); + m_xTablesList->checkWildcard(*xCatalog); continue; } // the schema entry - SvTreeListEntry* pSchema = m_pTablesList->GetEntryPosByName(sSchema, (pCatalog ? pCatalog : pRootEntry)); - if (!(pSchema || sSchema.isEmpty())) + std::unique_ptr<weld::TreeIter> xSchema = m_xTablesList->GetEntryPosByName(sSchema, (xCatalog ? xCatalog.get() : xRootEntry.get())); + if (!(xSchema || sSchema.isEmpty())) // the table (resp. its schema) referred in this filter entry does not exist anymore continue; - if (bAllTables && pSchema) + if (bAllTables && xSchema) { - m_pTablesList->checkWildcard(pSchema); + m_xTablesList->checkWildcard(*xSchema); continue; } - SvTreeListEntry* pEntry = m_pTablesList->GetEntryPosByName(sName, pSchema ? pSchema : (pCatalog ? pCatalog : pRootEntry) ); - if (pEntry) - m_pTablesList->SetCheckButtonState(pEntry, SvButtonState::Checked); + 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_pTablesList->CheckButtons(); + m_xTablesList->CheckButtons(); } void OTableSubscriptionPage::implCompleteTablesCheck( const css::uno::Sequence< OUString >& _rTableFilter ) @@ -236,7 +205,7 @@ namespace dbaui { if (!m_pTablesDlg->getCurrentSettings(aConnectionParams)) { - m_pTablesList->Clear(); + m_xTablesList->GetWidget().clear(); m_pTablesDlg->endExecution(); return; } @@ -265,9 +234,8 @@ namespace dbaui try { - WaitObject aWaitCursor(this); - m_pTablesList->GetModel()->SetSortMode(SortAscending); - m_pTablesList->GetModel()->SetCompareHdl(LINK(this, OTableSubscriptionPage, OnTreeEntryCompare)); + weld::WaitObject aWaitCursor(GetDialogFrameWeld()); + m_xTablesList->GetWidget().set_sort_order(false); Reference<XPropertySet> xProp = m_pTablesDlg->getCurrentDataSource(); OSL_ENSURE(xProp.is(),"No data source set!"); @@ -296,7 +264,7 @@ namespace dbaui if ( m_xCurrentConnection.is() ) { - m_pTablesList->UpdateTableList( m_xCurrentConnection ); + m_xTablesList->UpdateTableList( m_xCurrentConnection ); if (m_pTablesDlg) m_pTablesDlg->successfullyConnected(); } @@ -312,8 +280,8 @@ namespace dbaui vcl::Window *pParent = GetParentDialog(); OSQLMessageBox aMessageBox(pParent ? pParent->GetFrameWeld() : nullptr, aErrorInfo); aMessageBox.run(); - m_pTables->Enable(false); - m_pTablesList->Clear(); + m_xTables->set_sensitive(false); + m_xTablesList->GetWidget().clear(); if ( m_pTablesDlg ) { @@ -353,13 +321,15 @@ namespace dbaui implCompleteTablesCheck( aTableFilter ); // expand the first entry by default - SvTreeListEntry* pExpand = m_pTablesList->getAllObjectsEntry(); - while (pExpand) + std::unique_ptr<weld::TreeIter> xExpand = m_xTablesList->getAllObjectsEntry(); + while (xExpand) { - m_pTablesList->Expand(pExpand); - pExpand = m_pTablesList->FirstChild(pExpand); - if (pExpand && pExpand->NextSibling()) - pExpand = nullptr; + m_xTablesList->GetWidget().expand_row(*xExpand); + if (!m_xTablesList->GetWidget().iter_children(*xExpand)) + break; + std::unique_ptr<weld::TreeIter> xSibling(m_xTablesList->GetWidget().make_iterator(xExpand.get())); + if (m_xTablesList->GetWidget().iter_next_sibling(*xSibling)) + xExpand.reset(); } // update the toolbox according the current selection and check state @@ -368,16 +338,22 @@ namespace dbaui void OTableSubscriptionPage::CheckAll( bool _bCheck ) { - SvButtonState eState = _bCheck ? SvButtonState::Checked : SvButtonState::Unchecked; - SvTreeListEntry* pEntry = m_pTablesList->First(); - while (pEntry) + std::unique_ptr<weld::TreeIter> xEntry(m_xTablesList->GetWidget().make_iterator()); + if (m_xTablesList->GetWidget().get_iter_first(*xEntry)) { - m_pTablesList->SetCheckButtonState( pEntry, eState); - pEntry = m_pTablesList->Next(pEntry); + do + { + m_xTablesList->GetWidget().set_toggle(*xEntry, _bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 0); + } + while (m_xTablesList->GetWidget().iter_next(*xEntry)); } - if (_bCheck && m_pTablesList->getAllObjectsEntry()) - m_pTablesList->checkWildcard(m_pTablesList->getAllObjectsEntry()); + if (_bCheck) + { + auto xRoot = m_xTablesList->getAllObjectsEntry(); + if (xRoot) + m_xTablesList->checkWildcard(*xRoot); + } } DeactivateRC OTableSubscriptionPage::DeactivatePage(SfxItemSet* _pSet) @@ -393,88 +369,66 @@ namespace dbaui return nResult; } - IMPL_LINK_NOARG( OTableSubscriptionPage, OnTreeEntryButtonChecked, SvTreeListBox*, void ) + + IMPL_LINK_NOARG(OTableSubscriptionPage, OnTreeEntryChecked, const row_col&, void) { + weld::TreeView& rTreeView = m_xTablesList->GetWidget(); + std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); + if (rTreeView.get_cursor(xEntry.get())) + m_xTablesList->checkedButton_noBroadcast(*xEntry); callModifiedHdl(); } - IMPL_LINK( OTableSubscriptionPage, OnTreeEntryChecked, void*, _pControl, void ) - { - OnControlModified(_pControl); - } - IMPL_LINK( OTableSubscriptionPage, OnTreeEntryCompare, const SvSortData&, _rSortData, sal_Int32 ) - { - const SvTreeListEntry* pLHS = _rSortData.pLeft; - const SvTreeListEntry* pRHS = _rSortData.pRight; - OSL_ENSURE(pLHS && pRHS, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid tree entries!"); - - const SvLBoxString* pLeftTextItem = static_cast<const SvLBoxString*>(pLHS->GetFirstItem(SvLBoxItemType::String)); - const SvLBoxString* pRightTextItem = static_cast<const SvLBoxString*>(pRHS->GetFirstItem(SvLBoxItemType::String)); - OSL_ENSURE(pLeftTextItem && pRightTextItem, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid text items!"); - - OUString sLeftText = pLeftTextItem->GetText(); - OUString sRightText = pRightTextItem->GetText(); - - sal_Int32 nCompareResult = 0; // equal by default - - if (m_xCollator.is()) - { - try - { - nCompareResult = m_xCollator->compareString(sLeftText, sRightText); - } - catch(Exception&) - { - } - } - else - // default behaviour if we do not have a collator -> do the simple string compare - nCompareResult = sLeftText.compareTo(sRightText); - - return nCompareResult; - } Sequence< OUString > OTableSubscriptionPage::collectDetailedSelection() const { Sequence< OUString > aTableFilter; static const char sWildcard[] = "%"; - const SvTreeListEntry* pAllObjectsEntry = m_pTablesList->getAllObjectsEntry(); - if (!pAllObjectsEntry) + std::unique_ptr<weld::TreeIter> xAllObjectsEntry(m_xTablesList->getAllObjectsEntry()); + if (!xAllObjectsEntry) return aTableFilter; - SvTreeListEntry* pEntry = m_pTablesList->GetModel()->Next(const_cast<SvTreeListEntry*>(pAllObjectsEntry)); - while(pEntry) + std::unique_ptr<weld::TreeIter> xEntry(m_xTablesList->GetWidget().make_iterator(xAllObjectsEntry.get())); + if (!m_xTablesList->GetWidget().iter_next(*xEntry)) + xEntry.reset(); + while (xEntry) { bool bCatalogWildcard = false; bool bSchemaWildcard = false; - SvTreeListEntry* pSchema = nullptr; - SvTreeListEntry* pCatalog = nullptr; + std::unique_ptr<weld::TreeIter> xSchema; + std::unique_ptr<weld::TreeIter> xCatalog; - if (m_pTablesList->GetCheckButtonState(pEntry) == SvButtonState::Checked && !m_pTablesList->GetModel()->HasChildren(pEntry)) + if (m_xTablesList->GetWidget().get_toggle(*xEntry, 0) == 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; - if(m_pTablesList->GetModel()->HasParent(pEntry)) + if (m_xTablesList->GetWidget().get_iter_depth(*xEntry)) { - pSchema = m_pTablesList->GetModel()->GetParent(pEntry); - if (pAllObjectsEntry == pSchema) + xSchema = m_xTablesList->GetWidget().make_iterator(xEntry.get()); + m_xTablesList->GetWidget().iter_parent(*xSchema); + if (xAllObjectsEntry->equal(*xSchema)) + { // do not want to have the root entry - pSchema = nullptr; + xSchema.reset(); + } - if (pSchema) + if (xSchema) { // it's a real schema entry, not the "all objects" root - if(m_pTablesList->GetModel()->HasParent(pSchema)) + if (m_xTablesList->GetWidget().get_iter_depth(*xSchema)) { - pCatalog = m_pTablesList->GetModel()->GetParent(pSchema); - if (pAllObjectsEntry == pCatalog) + xCatalog = m_xTablesList->GetWidget().make_iterator(xSchema.get()); + m_xTablesList->GetWidget().iter_parent(*xCatalog); + if (xAllObjectsEntry->equal(*xCatalog)) + { // do not want to have the root entry - pCatalog = nullptr; + xCatalog.reset(); + } - if (pCatalog) + if (xCatalog) { // it's a real catalog entry, not the "all objects" root - bCatalogWildcard = OTableTreeListBox::isWildcardChecked(pCatalog); + bCatalogWildcard = m_xTablesList->isWildcardChecked(*xCatalog); if (m_bCatalogAtStart) { - sComposedName.append(m_pTablesList->GetEntryText( pCatalog )).append(m_sCatalogSeparator); + sComposedName.append(m_xTablesList->GetWidget().get_text(*xCatalog)).append(m_sCatalogSeparator); if (bCatalogWildcard) sComposedName.append(sWildcard); } @@ -484,19 +438,19 @@ namespace dbaui sCatalog = sWildcard; else sCatalog.clear(); - sCatalog += m_sCatalogSeparator + m_pTablesList->GetEntryText( pCatalog ); + sCatalog += m_sCatalogSeparator + m_xTablesList->GetWidget().get_text(*xCatalog) ; } } } - bSchemaWildcard = OTableTreeListBox::isWildcardChecked(pSchema); - sComposedName.append(m_pTablesList->GetEntryText( pSchema )).append("."); + bSchemaWildcard = m_xTablesList->isWildcardChecked(*xSchema); + sComposedName.append(m_xTablesList->GetWidget().get_text(*xSchema)).append("."); } if (bSchemaWildcard) sComposedName.append(sWildcard); } if (!bSchemaWildcard && !bCatalogWildcard) - sComposedName.append(m_pTablesList->GetEntryText( pEntry )); + sComposedName.append(m_xTablesList->GetWidget().get_text(*xEntry)); if (!m_bCatalogAtStart && !bCatalogWildcard) sComposedName.append(sCatalog); @@ -509,26 +463,35 @@ namespace dbaui } if (bCatalogWildcard) - pEntry = implNextSibling(pCatalog); + xEntry = implNextSibling(xCatalog.get()); else if (bSchemaWildcard) - pEntry = implNextSibling(pSchema); + xEntry = implNextSibling(xSchema.get()); else - pEntry = m_pTablesList->GetModel()->Next(pEntry); + { + if (!m_xTablesList->GetWidget().iter_next(*xEntry)) + xEntry.reset(); + } } return aTableFilter; } - SvTreeListEntry* OTableSubscriptionPage::implNextSibling(SvTreeListEntry* _pEntry) const + std::unique_ptr<weld::TreeIter> OTableSubscriptionPage::implNextSibling(weld::TreeIter* pEntry) const { - SvTreeListEntry* pReturn = nullptr; - if (_pEntry) + std::unique_ptr<weld::TreeIter> xReturn; + if (pEntry) { - pReturn = _pEntry->NextSibling(); - if (!pReturn) - pReturn = implNextSibling(m_pTablesList->GetParent(_pEntry)); + xReturn = m_xTablesList->GetWidget().make_iterator(pEntry); + if (!m_xTablesList->GetWidget().iter_next_sibling(*xReturn)) + { + std::unique_ptr<weld::TreeIter> xParent = m_xTablesList->GetWidget().make_iterator(pEntry); + if (m_xTablesList->GetWidget().iter_parent(*xParent)) + xReturn = implNextSibling(xParent.get()); + else + xReturn.reset(); + } } - return pReturn; + return xReturn; } bool OTableSubscriptionPage::FillItemSet( SfxItemSet* _rCoreAttrs ) @@ -544,7 +507,8 @@ namespace dbaui if ( m_xCurrentConnection.is() ) { // collect the table filter data only if we have a connection - else no tables are displayed at all Sequence< OUString > aTableFilter; - if (dbaui::OTableTreeListBox::isWildcardChecked(m_pTablesList->getAllObjectsEntry())) + auto xRoot = m_xTablesList->getAllObjectsEntry(); + if (xRoot && m_xTablesList->isWildcardChecked(*xRoot)) { aTableFilter.realloc(1); aTableFilter[0] = "%"; @@ -565,7 +529,7 @@ namespace dbaui void OTableSubscriptionPage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) { - _rControlList.emplace_back(new ODisableWrapper<VclContainer>(m_pTables)); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Widget>(m_xTables.get())); } } // namespace dbaui diff --git a/dbaccess/source/ui/dlg/tablespage.hxx b/dbaccess/source/ui/dlg/tablespage.hxx index aaaebdb01acb..d432b1f917b6 100644 --- a/dbaccess/source/ui/dlg/tablespage.hxx +++ b/dbaccess/source/ui/dlg/tablespage.hxx @@ -35,9 +35,6 @@ namespace dbaui :public OGenericAdministrationPage { private: - VclPtr<VclContainer> m_pTables; - VclPtr<OTableTreeListBox> m_pTablesList; - OUString m_sCatalogSeparator; bool m_bCatalogAtStart : 1; @@ -47,15 +44,15 @@ namespace dbaui m_xCollator; VclPtr<OTableSubscriptionDialog> m_pTablesDlg; + std::unique_ptr<weld::Widget> m_xTables; + std::unique_ptr<TableTreeListBox> m_xTablesList; + public: virtual bool FillItemSet(SfxItemSet* _rCoreAttrs) override; virtual DeactivateRC DeactivatePage(SfxItemSet* _pSet) override; using OGenericAdministrationPage::DeactivatePage; - virtual void StateChanged( StateChangedType nStateChange ) override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - - OTableSubscriptionPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ,OTableSubscriptionDialog* _pTablesDlg); + OTableSubscriptionPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs ,OTableSubscriptionDialog* _pTablesDlg); virtual ~OTableSubscriptionPage() override; virtual void dispose() override; @@ -63,16 +60,15 @@ namespace dbaui virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override; virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override; - DECL_LINK( OnTreeEntryCompare, const SvSortData&, sal_Int32 ); - DECL_LINK( OnTreeEntryChecked, void*, void ); - DECL_LINK( OnTreeEntryButtonChecked, SvTreeListBox*, void ); + typedef std::pair<int, int> row_col; + DECL_LINK(OnTreeEntryChecked, const row_col&, void); /** check the tables in <member>m_aTablesList</member> according to <arg>_rTables</arg> */ void implCheckTables(const css::uno::Sequence< OUString >& _rTables); /// returns the next sibling, if not available, the next sibling of the parent, a.s.o. - SvTreeListEntry* implNextSibling(SvTreeListEntry* _pEntry) const; + std::unique_ptr<weld::TreeIter> implNextSibling(weld::TreeIter* pEntry) const; /** return the current selection in <member>m_aTablesList</member> */ diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx index 7e3beb87d480..f66b07a5ffc2 100644 --- a/dbaccess/source/ui/inc/dbtreelistbox.hxx +++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx @@ -26,6 +26,7 @@ #include <vcl/treelistbox.hxx> #include <vcl/timer.hxx> +#include <vcl/weld.hxx> #include <memory> #include <set> @@ -40,7 +41,7 @@ namespace dbaui class IEntryFilter { public: - virtual bool includeEntry( SvTreeListEntry* _pEntry ) const = 0; + virtual bool includeEntry(const void* pUserData) const = 0; protected: ~IEntryFilter() {} diff --git a/dbaccess/source/ui/inc/imageprovider.hxx b/dbaccess/source/ui/inc/imageprovider.hxx index d9e7b53e55b3..ee8a5a44d8d6 100644 --- a/dbaccess/source/ui/inc/imageprovider.hxx +++ b/dbaccess/source/ui/inc/imageprovider.hxx @@ -22,6 +22,7 @@ #include <vcl/image.hxx> +#include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdb/application/DatabaseObject.hpp> @@ -77,6 +78,15 @@ namespace dbaui Image& _out_rImage ); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits