weld OTableSubscriptionPage
Change-Id: I55c23448480384c9a7d78cd55550bb4812ebde72
Reviewed-on: https://gerrit.libreoffice.org/70314
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 7494d28..9356357 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 33380b1..d235637 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 59215e5..9d6f904 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 6bde14b..a4480c5 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 66a4d72..bd7a333 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 0ff836f6..342b353 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 6adbb94..45fe4cf 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 e1f0a86..ac6b4f1 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 fbbd962..c825121 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 2eff684..c830b6e 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 ce46b3c..e9134ef 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 0438cda..e8d23d2 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 6f24858..8d058c6 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 2bdc0bf..045f394 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 98528c5..45ca15d 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 705a810..6fec332 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 8a90f1d..348e346 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 1fef474..c771f05 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 63c74ab..e69080d 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 9275c13..0f1e730 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 f2331ec..215c8f67 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 f543ba7..d67f41f 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 b4e00e1..08cbb87 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 ee49f5b..3125108 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 9211300..0d8912d 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 9e8b7de..b89fa02 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 233157a..d5b8ec0 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 aaaebdb..d432b1f 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 7e3beb8..f66b07a 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 d9e7b53..ee8a5a4 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
);
OUString getImageId(
const OUString& _rName,
const sal_Int32 _nDatabaseObjectType
);
// check whether the connection can give us an icon
css::uno::Reference<css::graphic::XGraphic> getXGraphic(const OUString& _rName,
const sal_Int32 _nDatabaseObjectType);
/** returns the default image to be used for a database object
In opposite to getImages, this method does not check the concrete object
@@ -119,6 +129,9 @@ namespace dbaui
static Image getFolderImage(
sal_Int32 _nDatabaseObjectType
);
static OUString getFolderImageId(
sal_Int32 _nDatabaseObjectType
);
/** retrieves the image to be used for a database as a whole.
@return
diff --git a/dbaccess/source/ui/inc/tabletree.hxx b/dbaccess/source/ui/inc/tabletree.hxx
index 22047ac..e5f9e32 100644
--- a/dbaccess/source/ui/inc/tabletree.hxx
+++ b/dbaccess/source/ui/inc/tabletree.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XDriver.hpp>
#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
#include <vcl/weld.hxx>
#include <memory>
namespace dbaui
@@ -118,7 +119,7 @@ public:
/** determine if the given entry is 'wildcard checked'
@see checkWildcard
*/
static bool isWildcardChecked(SvTreeListEntry* _pEntry);
static bool isWildcardChecked(SvTreeListEntry* pEntry);
private:
virtual void InitEntry(SvTreeListEntry* _pEntry, const OUString& _rString, const Image& _rCollapsedBitmap, const Image& _rExpandedBitmap, SvLBoxButtonKind _eButtonKind) override;
@@ -158,6 +159,126 @@ private:
};
class TableTreeListBox
{
css::uno::Reference< css::sdbc::XConnection >
m_xConnection; // the connection we're working for, set in implOnNewConnection, called by UpdateTableList
std::unique_ptr< ImageProvider >
m_xImageProvider; // provider for our images
bool m_bVirtualRoot; // should the first entry be visible
bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed?
std::unique_ptr<weld::TreeView> m_xTreeView;
public:
TableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView);
weld::TreeView& GetWidget() { return *m_xTreeView; }
void init() { m_bVirtualRoot = true; }
typedef std::pair< OUString, bool > TTableViewName;
typedef std::vector< TTableViewName > TNames;
void suppressEmptyFolders() { m_bNoEmptyFolders = true; }
/** determines whether the given entry denotes a tables folder
*/
static bool isFolderEntry( const SvTreeListEntry* _pEntry );
/** fill the table list with the tables belonging to the connection described by the parameters
@param _rxConnection
the connection, which must support the service com.sun.star.sdb.Connection
@throws
<type scope="css::sdbc">SQLException</type> if no connection could be created
*/
void UpdateTableList(
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
);
/** fill the table list with the tables and views determined by the two given containers.
The views sequence is used to determine which table is of type view.
@param _rxConnection the connection where you got the object names from. Must not be NULL.
Used to split the full qualified names into its parts.
@param _rTables table/view sequence
@param _rViews view sequence
*/
void UpdateTableList(
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
const css::uno::Sequence< OUString>& _rTables,
const css::uno::Sequence< OUString>& _rViews
);
/** returns a NamedDatabaseObject record which describes the given entry
*/
css::sdb::application::NamedDatabaseObject
describeObject( SvTreeListEntry* _pEntry );
/** to be used if a foreign instance added a table
*/
SvTreeListEntry* addedTable( const OUString& _rName );
/** to be used if a foreign instance removed a table
*/
void removedTable( const OUString& _rName );
/** returns the fully qualified name of a table entry
@param _pEntry
the entry whose name is to be obtained. Must not denote a folder entry.
*/
OUString getQualifiedTableName( SvTreeListEntry* _pEntry ) const;
SvTreeListEntry* getEntryByQualifiedName( const OUString& _rName );
std::unique_ptr<weld::TreeIter> getAllObjectsEntry() const;
/** does a wildcard check of the given entry
<p>There are two different 'checked' states: If the user checks all children of an entry, this is different
from checking the entry itself. The second is called 'wildcard' checking, 'cause in the resulting
table filter it's represented by a wildcard.</p>
*/
void checkWildcard(weld::TreeIter& rEntry);
/** determine if the given entry is 'wildcard checked'
@see checkWildcard
*/
bool isWildcardChecked(weld::TreeIter& rEntry);
std::unique_ptr<weld::TreeIter> GetEntryPosByName(const OUString& aName, weld::TreeIter* pStart = nullptr, const IEntryFilter* _pFilter = nullptr) const;
void CheckButtons(); // make the button states consistent (bottom-up)
void checkedButton_noBroadcast(weld::TreeIter& rEntry);
private:
TriState implDetermineState(weld::TreeIter& rEntry);
void implEmphasize(weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
/** adds the given entry to our list
@precond
our image provider must already have been reset to the connection to which the meta data
belong.
*/
void implAddEntry(
const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxMeta,
const OUString& _rTableName,
bool _bCheckName = true
);
void implOnNewConnection( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
bool haveVirtualRoot() const { return m_bVirtualRoot; }
/** fill the table list with the tables and views determined by the two given containers
@param _rxConnection the connection where you got the object names from. Must not be NULL.
Used to split the full qualified names into its parts.
@param _rTables table/view sequence, the second argument is <TRUE/> if it is a table, otherwise it is a view.
*/
void UpdateTableList(
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
const TNames& _rTables
);
};
} // namespace dbaui
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLETREE_HXX
diff --git a/dbaccess/source/ui/misc/imageprovider.cxx b/dbaccess/source/ui/misc/imageprovider.cxx
index a17795a..426f992 100644
--- a/dbaccess/source/ui/misc/imageprovider.cxx
+++ b/dbaccess/source/ui/misc/imageprovider.cxx
@@ -21,7 +21,6 @@
#include <stringconstants.hxx>
#include <bitmaps.hlst>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/graphic/GraphicColorMode.hpp>
#include <com/sun/star/sdb/application/XTableUIProvider.hpp>
#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
@@ -144,6 +143,33 @@ namespace dbaui
}
}
OUString ImageProvider::getImageId(const OUString& _rName, const sal_Int32 _nDatabaseObjectType)
{
if (_nDatabaseObjectType != DatabaseObject::TABLE)
{
// for types other than tables, the icon does not depend on the concrete object
return getDefaultImageResourceID( _nDatabaseObjectType );
}
else
{
// no -> determine by type
OUString sImageResourceID;
lcl_getTableImageResourceID_nothrow( *m_pData, _rName, sImageResourceID );
return sImageResourceID;
}
}
Reference<XGraphic> ImageProvider::getXGraphic(const OUString& _rName, const sal_Int32 _nDatabaseObjectType)
{
Reference<XGraphic> xGraphic;
if (_nDatabaseObjectType == DatabaseObject::TABLE)
{
// check whether the connection can give us an icon
lcl_getConnectionProvidedTableIcon_nothrow( *m_pData, _rName, xGraphic );
}
return xGraphic;
}
Image ImageProvider::getDefaultImage( sal_Int32 _nDatabaseObjectType )
{
Image aObjectImage;
@@ -205,6 +231,31 @@ namespace dbaui
return aFolderImage;
}
OUString ImageProvider::getFolderImageId( sal_Int32 _nDatabaseObjectType )
{
OUString sImageResourceID;
switch ( _nDatabaseObjectType )
{
case DatabaseObject::QUERY:
sImageResourceID = QUERYFOLDER_TREE_ICON;
break;
case DatabaseObject::FORM:
sImageResourceID = FORMFOLDER_TREE_ICON;
break;
case DatabaseObject::REPORT:
sImageResourceID = REPORTFOLDER_TREE_ICON;
break;
case DatabaseObject::TABLE:
sImageResourceID = TABLEFOLDER_TREE_ICON;
break;
default:
OSL_FAIL( "ImageProvider::getDefaultImage: invalid database object type!" );
break;
}
return sImageResourceID;
}
Image ImageProvider::getDatabaseImage()
{
return Image(StockImage::Yes, DATABASE_TREE_ICON);
diff --git a/dbaccess/uiconfig/ui/tablesfilterpage.ui b/dbaccess/uiconfig/ui/tablesfilterpage.ui
index c568e21..682f215 100644
--- a/dbaccess/uiconfig/ui/tablesfilterpage.ui
+++ b/dbaccess/uiconfig/ui/tablesfilterpage.ui
@@ -1,8 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Tue Jan 21 15:00:47 2014 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="dba">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkTreeStore" id="liststore2">
<columns>
<!-- column-name check1 -->
<column type="gboolean"/>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
<!-- column-name checkvis1 -->
<column type="gboolean"/>
<!-- column-name checktri1 -->
<column type="gboolean"/>
<!-- column-name weight1 -->
<column type="gint"/>
</columns>
</object>
<object class="GtkFrame" id="TablesFilterPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -30,33 +47,71 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="tablesfilterpage|label2">Mark the tables that should be visible for the applications.</property>
<property name="wrap">True</property>
<property name="max_width_chars">56</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="dbulo-OTableTreeListBox" id="treeview:border">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="treeview">
<property name="width_request">-1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore2</property>
<property name="headers_visible">False</property>
<property name="search_column">1</property>
<property name="enable_tree_lines">True</property>
<property name="show_expanders">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Macro Library List-selection2"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn8">
<property name="spacing">6</property>
<child>
<object class="GtkCellRendererToggle" id="cellrenderer5"/>
<attributes>
<attribute name="visible">4</attribute>
<attribute name="active">0</attribute>
<attribute name="inconsistent">5</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext5"/>
<attributes>
<attribute name="pixbuf">1</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext6"/>
<attributes>
<attribute name="text">2</attribute>
<attribute name="weight">5</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index c4b3ceb..22a4145 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -549,7 +549,7 @@ IMPL_LINK(UpdateDialog, entryToggled, const row_col&, rRowCol, void)
// error's can't be enabled
const UpdateDialog::Index* p = reinterpret_cast<UpdateDialog::Index const *>(m_xUpdates->get_id(rRowCol.first).toInt64());
if (p->m_eKind == SPECIFIC_ERROR)
m_xUpdates->set_toggle(nRow, false, 0);
m_xUpdates->set_toggle(nRow, TRISTATE_FALSE, 0);
enableOk();
}
@@ -558,7 +558,7 @@ sal_uInt16 UpdateDialog::insertItem(UpdateDialog::Index *pEntry, bool bEnabledCh
{
int nEntry = m_xUpdates->n_children();
m_xUpdates->append();
m_xUpdates->set_toggle(nEntry, bEnabledCheckBox, 0);
m_xUpdates->set_toggle(nEntry, bEnabledCheckBox ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
m_xUpdates->set_text(nEntry, pEntry->m_aName, 1);
m_xUpdates->set_id(nEntry, OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
@@ -654,7 +654,7 @@ void UpdateDialog::enableOk() {
if (!m_xChecking->get_visible()) {
int nChecked = 0;
for (int i = 0, nCount = m_xUpdates->n_children(); i < nCount; ++i) {
if (m_xUpdates->get_toggle(i, 0))
if (m_xUpdates->get_toggle(i, 0) == TRISTATE_TRUE)
++nChecked;
}
m_xOk->set_sensitive(nChecked != 0);
@@ -1057,7 +1057,7 @@ IMPL_LINK_NOARG(UpdateDialog, okHandler, weld::Button&, void)
UpdateDialog::Index const * p =
reinterpret_cast< UpdateDialog::Index const * >(
m_xUpdates->get_id(i).toInt64());
if (p->m_eKind == ENABLED_UPDATE && m_xUpdates->get_toggle(i, 0)) {
if (p->m_eKind == ENABLED_UPDATE && m_xUpdates->get_toggle(i, 0) == TRISTATE_TRUE) {
m_updateData.push_back( m_enabledUpdates[ p->m_nIndex ] );
}
}
diff --git a/desktop/uiconfig/ui/updatedialog.ui b/desktop/uiconfig/ui/updatedialog.ui
index 683f052..820871d 100644
--- a/desktop/uiconfig/ui/updatedialog.ui
+++ b/desktop/uiconfig/ui/updatedialog.ui
@@ -371,6 +371,8 @@
<column type="gchararray"/>
<!-- column-name checkvis1 -->
<column type="gboolean"/>
<!-- column-name checktri1 -->
<column type="gboolean"/>
</columns>
</object>
</interface>
diff --git a/include/vcl/svimpbox.hxx b/include/vcl/svimpbox.hxx
index 9753629..3c17f78 100644
--- a/include/vcl/svimpbox.hxx
+++ b/include/vcl/svimpbox.hxx
@@ -89,6 +89,7 @@ class VCL_DLLPUBLIC SvImpLBox
{
friend class ImpLBSelEng;
friend class SvTreeListBox;
friend class SalInstanceTreeView;
friend class IconView;
private:
SvTreeList* pTree;
diff --git a/include/vcl/svlbitm.hxx b/include/vcl/svlbitm.hxx
index e5c5f6d..16665dd 100644
--- a/include/vcl/svlbitm.hxx
+++ b/include/vcl/svlbitm.hxx
@@ -104,6 +104,8 @@ public:
class VCL_DLLPUBLIC SvLBoxString : public SvLBoxItem
{
private:
bool mbEmphasized;
protected:
OUString maText;
@@ -117,6 +119,9 @@ public:
SvTreeListEntry* pEntry,
SvViewDataItem* pViewData = nullptr) override;
void Emphasize(bool bEmphasize) { mbEmphasized = bEmphasize; }
bool IsEmphasized() const { return mbEmphasized; }
const OUString& GetText() const
{
return maText;
diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx
index b90ee4b..c88ada0 100644
--- a/include/vcl/treelistbox.hxx
+++ b/include/vcl/treelistbox.hxx
@@ -270,6 +270,10 @@ private:
VCL_DLLPRIVATE static void RemoveBoxFromDDList_Impl( const SvTreeListBox& rB );
DECL_DLLPRIVATE_LINK( DragFinishHdl_Impl, sal_Int8, void );
// after a checkbox entry is inserted, use this to get its width to support
// autowidth for the 1st checkbox column
VCL_DLLPRIVATE void CheckBoxInserted(SvTreeListEntry* pEntry);
protected:
bool CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 );
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index a7a195a..1529abe 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -522,6 +522,7 @@ private:
public:
TreeIter() {}
virtual bool equal(const TreeIter& rOther) const = 0;
virtual ~TreeIter() {}
};
@@ -556,10 +557,9 @@ protected:
void signal_toggled(const std::pair<int, int>& rRowCol) { m_aRadioToggleHdl.Call(rRowCol); }
public:
virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
const OUString* pId, const OUString* pIconName,
VirtualDevice* pImageSurface, const OUString* pExpanderName,
bool bChildrenOnDemand, TreeIter* pRet)
virtual void insert(const TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface,
const OUString* pExpanderName, bool bChildrenOnDemand, TreeIter* pRet)
= 0;
void insert(int nRow, TreeIter* pRet = nullptr)
@@ -590,12 +590,12 @@ public:
{
insert(nullptr, -1, &rStr, &rId, &rImage, nullptr, nullptr, false, nullptr);
}
void append(const weld::TreeIter* pParent, const OUString& rId, const OUString& rStr,
void append(const TreeIter* pParent, const OUString& rId, const OUString& rStr,
const OUString& rImage)
{
insert(pParent, -1, &rStr, &rId, &rImage, nullptr, nullptr, false, nullptr);
}
void append(const weld::TreeIter* pParent, const OUString& rStr)
void append(const TreeIter* pParent, const OUString& rStr)
{
insert(pParent, -1, &rStr, nullptr, nullptr, nullptr, nullptr, false, nullptr);
}
@@ -606,10 +606,14 @@ public:
void connect_changed(const Link<TreeView&, void>& rLink) { m_aChangeHdl = rLink; }
void connect_row_activated(const Link<TreeView&, void>& rLink) { m_aRowActivatedHdl = rLink; }
// Argument is a pair of row, col describing the node in non-tree mode.
// If in tree mode, then retrieve the toggled node with get_cursor
void connect_toggled(const Link<const std::pair<int, int>&, void>& rLink)
{
m_aRadioToggleHdl = rLink;
}
void connect_column_clicked(const Link<int, void>& rLink) { m_aColumnClickedHdl = rLink; }
void connect_model_changed(const Link<TreeView&, void>& rLink) { m_aModelChangedHdl = rLink; }
@@ -625,8 +629,8 @@ public:
virtual void set_text(int row, const OUString& rText, int col = -1) = 0;
virtual void set_sensitive(int row, bool bSensitive, int col = -1) = 0;
virtual void set_id(int row, const OUString& rId) = 0;
virtual void set_toggle(int row, bool bOn, int col) = 0;
virtual bool get_toggle(int row, int col) const = 0;
virtual void set_toggle(int row, TriState eState, int col) = 0;
virtual TriState get_toggle(int row, int col) const = 0;
virtual void set_image(int row, const OUString& rImage, int col = -1) = 0;
virtual void set_image(int row, VirtualDevice& rImage, int col = -1) = 0;
virtual void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage,
@@ -694,7 +698,11 @@ public:
virtual void expand_row(const TreeIter& rIter) = 0;
virtual void collapse_row(const TreeIter& rIter) = 0;
virtual void set_text(const TreeIter& rIter, const OUString& rStr, int col = -1) = 0;
virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage, int col = -1) = 0;
virtual void set_image(const TreeIter& rIter, const OUString& rImage, int col = -1) = 0;
virtual void set_text_emphasis(const TreeIter& rIter, bool bOn, int col) = 0;
virtual bool get_text_emphasis(const TreeIter& rIter, int col) const = 0;
virtual void set_toggle(const TreeIter& rIter, TriState bOn, int col) = 0;
virtual TriState get_toggle(const TreeIter& rIter, int col) const = 0;
virtual OUString get_text(const TreeIter& rIter, int col = -1) const = 0;
virtual void set_id(const TreeIter& rIter, const OUString& rId) = 0;
virtual OUString get_id(const TreeIter& rIter) const = 0;
@@ -704,8 +712,7 @@ public:
virtual void scroll_to_row(const TreeIter& rIter) = 0;
virtual bool is_selected(const TreeIter& rIter) const = 0;
virtual void move_subtree(weld::TreeIter& rNode, const weld::TreeIter* pNewParent,
int nIndexInNewParent)
virtual void move_subtree(TreeIter& rNode, const TreeIter* pNewParent, int nIndexInNewParent)
= 0;
//calling func on each selected element until func returns true or we run out of elements
diff --git a/sc/source/ui/dbgui/dpgroupdlg.cxx b/sc/source/ui/dbgui/dpgroupdlg.cxx
index 273a0d9..1edace5 100644
--- a/sc/source/ui/dbgui/dpgroupdlg.cxx
+++ b/sc/source/ui/dbgui/dpgroupdlg.cxx
@@ -225,7 +225,7 @@ ScDPDateGroupDlg::ScDPDateGroupDlg(weld::Window* pParent,
for (size_t nIdx = 0; nIdx < SAL_N_ELEMENTS(aDatePartResIds); ++nIdx)
{
mxLbUnits->append();
mxLbUnits->set_toggle(nIdx, (nDatePart & spnDateParts[ nIdx ]) != 0, 0);
mxLbUnits->set_toggle(nIdx, (nDatePart & spnDateParts[ nIdx ]) ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
mxLbUnits->set_text(nIdx, ScResId(aDatePartResIds[nIdx]), 1);
}
@@ -296,7 +296,7 @@ sal_Int32 ScDPDateGroupDlg::GetDatePart() const
// return listbox contents for "units" mode
sal_Int32 nDatePart = 0;
for (int nIdx = 0, nCount = mxLbUnits->n_children(); nIdx < nCount; ++nIdx )
if (mxLbUnits->get_toggle(nIdx, 0))
if (mxLbUnits->get_toggle(nIdx, 0) == TRISTATE_TRUE)
nDatePart |= spnDateParts[ nIdx ];
return nDatePart;
}
@@ -328,7 +328,7 @@ namespace
{
for (int i = 0; i < rView.n_children(); ++i)
{
if (rView.get_toggle(i, 0))
if (rView.get_toggle(i, 0) == TRISTATE_TRUE)
return true;
}
return false;
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index ddfb6c0..7d93d84 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -94,7 +94,7 @@ bool lclFillListBox(weld::TreeView& rLBox, const vector<ScDPLabelData::Member>&
{
rLBox.append();
int pos = rLBox.n_children() - 1;
rLBox.set_toggle(pos, false, 0);
rLBox.set_toggle(pos, TRISTATE_FALSE, 0);
OUString aName = rMember.getDisplayName();
if (!aName.isEmpty())
rLBox.set_text(pos, aName, 1);
@@ -681,7 +681,7 @@ void ScDPSubtotalOptDlg::FillLabelData( ScDPLabelData& rLabelData ) const
rLabelData.maMembers = maLabelData.maMembers;
int nVisCount = m_xLbHide->n_children();
for (int nPos = 0; nPos < nVisCount; ++nPos)
rLabelData.maMembers[nPos].mbVisible = !m_xLbHide->get_toggle(nPos, 0);
rLabelData.maMembers[nPos].mbVisible = m_xLbHide->get_toggle(nPos, 0) == TRISTATE_FALSE;
// *** HIERARCHY ***
@@ -789,7 +789,7 @@ void ScDPSubtotalOptDlg::InitHideListBox()
lclFillListBox(*m_xLbHide, maLabelData.maMembers);
size_t n = maLabelData.maMembers.size();
for (size_t i = 0; i < n; ++i)
m_xLbHide->set_toggle(i, !maLabelData.maMembers[i].mbVisible, 0);
m_xLbHide->set_toggle(i, maLabelData.maMembers[i].mbVisible ? TRISTATE_FALSE : TRISTATE_TRUE, 0);
bool bEnable = m_xLbHide->n_children() > 0;
m_xHideFrame->set_sensitive(bEnable);
}
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index cecfad8..8517e28 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -101,7 +101,7 @@ bool ScTpSubTotalGroup::DoReset( sal_uInt16 nGroupNo,
// first we have to clear the listboxes...
for (int nLbEntry = 0, nCount = mxLbColumns->n_children(); nLbEntry < nCount; ++nLbEntry)
{
mxLbColumns->set_toggle(nLbEntry, false, 0);
mxLbColumns->set_toggle(nLbEntry, TRISTATE_FALSE, 0);
mxLbColumns->set_id(nLbEntry, "0");
}
mxLbFunctions->select(0);
@@ -124,7 +124,7 @@ bool ScTpSubTotalGroup::DoReset( sal_uInt16 nGroupNo,
{
sal_uInt16 nCheckPos = GetFieldSelPos( pSubTotals[i] );
mxLbColumns->set_toggle(nCheckPos, true, 0);
mxLbColumns->set_toggle(nCheckPos, TRISTATE_TRUE, 0);
mxLbColumns->set_id(nCheckPos, OUString::number(FuncToLbPos(pFunctions[i])));
if (i == 0 || nCheckPos < nFirstChecked)
@@ -150,7 +150,7 @@ namespace
int nRet = 0;
for (sal_Int32 i=0, nEntryCount = rTreeView.n_children(); i < nEntryCount; ++i)
{
if (rTreeView.get_toggle(i, 0))
if (rTreeView.get_toggle(i, 0) == TRISTATE_TRUE)
++nRet;
}
return nRet;
@@ -210,7 +210,7 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo,
for ( sal_Int32 i=0, nCheck=0; i<nEntryCount; i++ )
{
if (mxLbColumns->get_toggle(i, 0))
if (mxLbColumns->get_toggle(i, 0) == TRISTATE_TRUE)
{
OSL_ENSURE( nCheck <= nCheckCount,
"Range error :-(" );
@@ -260,7 +260,7 @@ void ScTpSubTotalGroup::FillListBoxes()
nFieldArr[i] = col;
mxLbGroup->insert_text(i+1, aFieldName);
mxLbColumns->insert(i);
mxLbColumns->set_toggle(i, false, 0);
mxLbColumns->set_toggle(i, TRISTATE_FALSE, 0);
mxLbColumns->set_text(i, aFieldName, 1);
mxLbColumns->set_id(i, "0");
i++;
@@ -358,7 +358,7 @@ void ScTpSubTotalGroup::SelectHdl(const weld::Widget *pLb)
else if ( pLb == mxLbFunctions.get() )
{
mxLbColumns->set_id(nColumn, OUString::number(nFunction));
mxLbColumns->set_toggle(nColumn, true, 0);
mxLbColumns->set_toggle(nColumn, TRISTATE_TRUE, 0);
}
}
}
diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx
index 3dc4708..909e205 100644
--- a/sc/source/ui/miscdlgs/protectiondlg.cxx
+++ b/sc/source/ui/miscdlgs/protectiondlg.cxx
@@ -73,7 +73,7 @@ ScTableProtectionDlg::~ScTableProtectionDlg()
void ScTableProtectionDlg::SetDialogData(const ScTableProtection& rData)
{
for (size_t i = 0; i < aOptions.size(); ++i)
m_xOptionsListBox->set_toggle(i, rData.isOptionEnabled(aOptions[i]), 0);
m_xOptionsListBox->set_toggle(i, rData.isOptionEnabled(aOptions[i]) ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
}
void ScTableProtectionDlg::WriteData(ScTableProtection& rData) const
@@ -84,14 +84,14 @@ void ScTableProtectionDlg::WriteData(ScTableProtection& rData) const
rData.setPassword(m_xPassword1Edit->get_text());
for (size_t i = 0; i < aOptions.size(); ++i)
rData.setOption(aOptions[i], m_xOptionsListBox->get_toggle(i, 0));
rData.setOption(aOptions[i], m_xOptionsListBox->get_toggle(i, 0) == TRISTATE_TRUE);
}
void ScTableProtectionDlg::InsertEntry(const OUString& rTxt)
{
m_xOptionsListBox->append();
const int nRow = m_xOptionsListBox->n_children() - 1;
m_xOptionsListBox->set_toggle(nRow, false, 0);
m_xOptionsListBox->set_toggle(nRow, TRISTATE_FALSE, 0);
m_xOptionsListBox->set_text(nRow, rTxt, 1);
}
@@ -115,8 +115,8 @@ void ScTableProtectionDlg::Init()
InsertEntry(m_aDeleteColumns);
InsertEntry(m_aDeleteRows);
m_xOptionsListBox->set_toggle(0, true, 0);
m_xOptionsListBox->set_toggle(1, true, 0);
m_xOptionsListBox->set_toggle(0, TRISTATE_TRUE, 0);
m_xOptionsListBox->set_toggle(1, TRISTATE_TRUE, 0);
m_xOptionsListBox->thaw();
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index 072595f..26ff15c 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -128,7 +128,7 @@ const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties(
rValue <<= pStringItem->GetIntValue();
}
else
rValue <<= m_xLbSettings->get_toggle(nEntryPos, 0);
rValue <<= m_xLbSettings->get_toggle(nEntryPos, 0) == TRISTATE_TRUE;
}
}
else
@@ -184,7 +184,7 @@ void ScSolverOptionsDialog::FillListBox()
if ( eClass == uno::TypeClass_BOOLEAN )
{
// check box entry
m_xLbSettings->set_toggle(nPos, ScUnoHelpFunctions::GetBoolFromAny(aValue), 0);
m_xLbSettings->set_toggle(nPos, ScUnoHelpFunctions::GetBoolFromAny(aValue) ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
m_xLbSettings->set_text(nPos, aVisName, 1);
}
else
diff --git a/sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui b/sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui
index 33ffb9b..51ae488 100644
--- a/sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui
+++ b/sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui
@@ -12,6 +12,8 @@
<column type="gchararray"/>
<!-- column-name checkvis1 -->
<column type="gboolean"/>
<!-- column-name checktri1 -->
<column type="gboolean"/>
</columns>
</object>
<object class="GtkAdjustment" id="adjustment1">
diff --git a/sc/uiconfig/scalc/ui/groupbydate.ui b/sc/uiconfig/scalc/ui/groupbydate.ui
index 4a5db5c..351cf85 100644
--- a/sc/uiconfig/scalc/ui/groupbydate.ui
+++ b/sc/uiconfig/scalc/ui/groupbydate.ui
@@ -17,6 +17,8 @@
<column type="gchararray"/>
<!-- column-name checkvis1 -->
<column type="gboolean"/>
<!-- column-name checktri1 -->
<column type="gboolean"/>
</columns>
</object>
<object class="GtkDialog" id="PivotTableGroupByDate">
diff --git a/sc/uiconfig/scalc/ui/protectsheetdlg.ui b/sc/uiconfig/scalc/ui/protectsheetdlg.ui
index 85f021b..aa3e9e2 100644
--- a/sc/uiconfig/scalc/ui/protectsheetdlg.ui
+++ b/sc/uiconfig/scalc/ui/protectsheetdlg.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="ProtectSheetDialog">
diff --git a/sc/uiconfig/scalc/ui/solveroptionsdialog.ui b/sc/uiconfig/scalc/ui/solveroptionsdialog.ui
index 5388ef0..6a7fb3e 100644
--- a/sc/uiconfig/scalc/ui/solveroptionsdialog.ui
+++ b/sc/uiconfig/scalc/ui/solveroptionsdialog.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="SolverOptionsDialog">
diff --git a/sc/uiconfig/scalc/ui/subtotalgrppage.ui b/sc/uiconfig/scalc/ui/subtotalgrppage.ui
index 994a7d1..40515be 100644
--- a/sc/uiconfig/scalc/ui/subtotalgrppage.ui
+++ b/sc/uiconfig/scalc/ui/subtotalgrppage.ui
@@ -20,6 +20,8 @@
<column type="gchararray"/>
<!-- column-name checkvis1 -->
<column type="gboolean"/>
<!-- column-name checktri1 -->
<column type="gboolean"/>
</columns>
</object>
<object class="GtkBox" id="SubTotalGrpPage">
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 97833bf..e219d1d 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -491,6 +491,7 @@ SwCaptionOptPage::SwCaptionOptPage(TabPageParent pParent, const SfxItemSet& rSet
std::vector<int> aWidths;
aWidths.push_back(m_xCheckLB->get_checkbox_column_width());
aWidths.push_back(m_xCheckLB->get_checkbox_column_width());
m_xCheckLB->set_column_fixed_widths(aWidths);
SwStyleNameMapper::FillUIName(RES_POOLCOLL_LABEL_ABB, m_sIllustration);
@@ -590,7 +591,7 @@ bool SwCaptionOptPage::FillItemSet( SfxItemSet* )
int nCheckCount = 0;
for (int i = 0, nCount = m_xCheckLB->n_children(); i < nCount; ++i)
{
if (m_xCheckLB->get_toggle(i, 0))
if (m_xCheckLB->get_toggle(i, 0) == TRISTATE_TRUE)
++nCheckCount;
InsCaptionOpt* pData = reinterpret_cast<InsCaptionOpt*>(m_xCheckLB->get_id(i).toInt64());
bRet |= pModOpt->SetCapOption(bHTMLMode, pData);
@@ -618,15 +619,15 @@ void SwCaptionOptPage::Reset( const SfxItemSet* rSet)
// Writer objects
int nPos = 0;
m_xCheckLB->append();
m_xCheckLB->set_toggle(nPos, false, 0);
m_xCheckLB->set_toggle(nPos, TRISTATE_FALSE, 0);
m_xCheckLB->set_text(nPos, m_sSWTable, 1);
SetOptions(nPos++, TABLE_CAP);
m_xCheckLB->append();
m_xCheckLB->set_toggle(nPos, false, 0);
m_xCheckLB->set_toggle(nPos, TRISTATE_FALSE, 0);
m_xCheckLB->set_text(nPos, m_sSWFrame, 1);
SetOptions(nPos++, FRAME_CAP);
m_xCheckLB->append();
m_xCheckLB->set_toggle(nPos, false, 0);
m_xCheckLB->set_toggle(nPos, TRISTATE_FALSE, 0);
m_xCheckLB->set_text(nPos, m_sSWGraphic, 1);
SetOptions(nPos++, GRAPHIC_CAP);
@@ -651,7 +652,7 @@ void SwCaptionOptPage::Reset( const SfxItemSet* rSet)
// don't show product version
sClass = sClass.replaceFirst( sComplete, sWithoutVersion );
m_xCheckLB->append();
m_xCheckLB->set_toggle(nPos, false, 0);
m_xCheckLB->set_toggle(nPos, TRISTATE_FALSE, 0);
m_xCheckLB->set_text(nPos, sClass, 1);
SetOptions( nPos++, OLE_CAP, &rOleId );
}
@@ -671,7 +672,7 @@ void SwCaptionOptPage::SetOptions(const sal_uLong nPos,
{
InsCaptionOpt* pIns = new InsCaptionOpt(*pOpt);
m_xCheckLB->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(pIns)));
m_xCheckLB->set_toggle(nPos, pOpt->UseCaption(), 0);
m_xCheckLB->set_toggle(nPos, pOpt->UseCaption() ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
}
else
{
@@ -693,7 +694,7 @@ void SwCaptionOptPage::UpdateEntry(int nSelEntry)
{
if (nSelEntry != -1)
{
bool bChecked = m_xCheckLB->get_toggle(nSelEntry, 0);
bool bChecked = m_xCheckLB->get_toggle(nSelEntry, 0) == TRISTATE_TRUE;
m_xSettingsGroup->set_sensitive(bChecked);
bool bNumSep = bChecked && m_xLbCaptionOrder->get_active() == 1;
@@ -816,7 +817,7 @@ void SwCaptionOptPage::SaveEntry(int nEntry)
InsCaptionOpt* pOpt = reinterpret_cast<InsCaptionOpt*>(m_xCheckLB->get_id(nEntry).toInt64());
pOpt->UseCaption() = m_xCheckLB->get_toggle(nEntry, 0);
pOpt->UseCaption() = m_xCheckLB->get_toggle(nEntry, 0) == TRISTATE_TRUE;
const OUString aName(m_xCategoryBox->get_active_text());
if (aName == m_sNone)
pOpt->SetCategory("");
@@ -881,7 +882,7 @@ IMPL_LINK(SwCaptionOptPage, OrderHdl, weld::ComboBox&, rBox, void)
bool bChecked = false;
if (nSelEntry != -1)
{
bChecked = m_xCheckLB->get_toggle(nSelEntry, 0);
bChecked = m_xCheckLB->get_toggle(nSelEntry, 0) == TRISTATE_TRUE;
}
int nPos = rBox.get_active();
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 6790e971..0208d36 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -575,7 +575,10 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(weld::Window* pParent,
OUString sEntry = rStyles.getToken(0, TOX_STYLE_DELIMITER, nPos);
m_xHeaderTree->append_text(sEntry);
for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
m_xHeaderTree->set_toggle(nRow, i == j - 1, j + 1);
{
TriState eState = i == j - 1 ? TRISTATE_TRUE : TRISTATE_FALSE;
m_xHeaderTree->set_toggle(nRow, eState, j + 1);
}
++nRow;
} while (nPos>=0);
}
@@ -605,7 +608,10 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(weld::Window* pParent,
{
m_xHeaderTree->append_text(aName);
for (sal_uInt16 k = 0; k <= MAXLEVEL; ++k)
m_xHeaderTree->set_toggle(nRow, k == 0, k + 1);
{
TriState eState = k == 0 ? TRISTATE_TRUE : TRISTATE_FALSE;
m_xHeaderTree->set_toggle(nRow, eState, k + 1);
}
++nRow;
}
}
@@ -635,7 +641,10 @@ IMPL_LINK(SwAddStylesDlg_Impl, TreeSizeAllocHdl, const Size&, rSize, void)
IMPL_LINK(SwAddStylesDlg_Impl, RadioToggleOnHdl, const row_col&, rRowCol, void)
{
for (sal_uInt16 i = 0; i <= MAXLEVEL; ++i)
m_xHeaderTree->set_toggle(rRowCol.first, rRowCol.second == i + 1, i + 1);
{
TriState eState = rRowCol.second == i + 1 ? TRISTATE_TRUE : TRISTATE_FALSE;
m_xHeaderTree->set_toggle(rRowCol.first, eState, i + 1);
}
}
IMPL_LINK(SwAddStylesDlg_Impl, KeyInput, const KeyEvent&, rKEvt, bool)
@@ -668,7 +677,7 @@ IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl, weld::Button&, void)
int nToggleColumn = 0;
for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
{
if (m_xHeaderTree->get_toggle(i, j + 1))
if (m_xHeaderTree->get_toggle(i, j + 1) == TRISTATE_TRUE)
{
nToggleColumn = j;
break;
@@ -696,7 +705,7 @@ IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, weld::Button&, rBtn, void)
int nToggleColumn = 0;
for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
{
if (m_xHeaderTree->get_toggle(nEntry, j + 1))
if (m_xHeaderTree->get_toggle(nEntry, j + 1) == TRISTATE_TRUE)
{
nToggleColumn = j;
break;
@@ -715,7 +724,9 @@ IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, weld::Button&, rBtn, void)
}
for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
m_xHeaderTree->set_toggle(nEntry, j == nToggleColumn, j + 1);
{
m_xHeaderTree->set_toggle(nEntry, j == nToggleColumn ? TRISTATE_TRUE : TRISTATE_FALSE, j + 1);
}
}
}
@@ -788,7 +799,7 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(TabPageParent pParent, const SfxItemSet&
{
OUString sId(OUString::number(static_cast<sal_uInt32>(RES_SRCTYPES[i].second)));
m_xFromObjCLB->append();
m_xFromObjCLB->set_toggle(i, false, 0);
m_xFromObjCLB->set_toggle(i, TRISTATE_FALSE, 0);
m_xFromObjCLB->set_text(i, SwResId(RES_SRCTYPES[i].first), 1);
m_xFromObjCLB->set_id(i, sId);
}
@@ -1006,7 +1017,7 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
for (int nFromObj = 0, nCount = m_xFromObjCLB->n_children(); nFromObj < nCount; ++nFromObj)
{
SwTOOElements nData = static_cast<SwTOOElements>(m_xFromObjCLB->get_id(nFromObj).toInt32());
m_xFromObjCLB->set_toggle(nFromObj, bool(nData & nOLEData), 0);
m_xFromObjCLB->set_toggle(nFromObj, bool(nData & nOLEData) ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
}
}
else if(TOX_AUTHORITIES == aCurType.eType)
@@ -1101,7 +1112,7 @@ void SwTOXSelectTabPage::FillTOXDescription()
SwTOOElements nOLEData = SwTOOElements::NONE;
for (int i = 0, nCount = m_xFromObjCLB->n_children(); i < nCount; ++i)
{
if (m_xFromObjCLB->get_toggle(i, 0))
if (m_xFromObjCLB->get_toggle(i, 0) == TRISTATE_TRUE)
{
SwTOOElements nData = static_cast<SwTOOElements>(m_xFromObjCLB->get_id(i).toInt32());
nOLEData |= nData;
diff --git a/sw/uiconfig/swriter/ui/assignstylesdialog.ui b/sw/uiconfig/swriter/ui/assignstylesdialog.ui
index 6d4a931..6a95455 100644
--- a/sw/uiconfig/swriter/ui/assignstylesdialog.ui
+++ b/sw/uiconfig/swriter/ui/assignstylesdialog.ui
@@ -62,6 +62,28 @@
<column type="gboolean"/>
<!-- column-name checkvis11 -->
<column type="gboolean"/>
<!-- column-name checktri1 -->
<column type="gboolean"/>
<!-- column-name checktri2 -->
<column type="gboolean"/>
<!-- column-name checktri3 -->
<column type="gboolean"/>
<!-- column-name checktri4 -->
<column type="gboolean"/>
<!-- column-name checktri5 -->
<column type="gboolean"/>
<!-- column-name checktri6 -->
<column type="gboolean"/>
<!-- column-name checktri7 -->
<column type="gboolean"/>
<!-- column-name checktri8 -->
<column type="gboolean"/>
<!-- column-name checktri9 -->
<column type="gboolean"/>
<!-- column-name checktri10 -->
<column type="gboolean"/>
<!-- column-name checktri11 -->
<column type="gboolean"/>
</columns>
</object>
<object class="GtkDialog" id="AssignStylesDialog">
diff --git a/sw/uiconfig/swriter/ui/optcaptionpage.ui b/sw/uiconfig/swriter/ui/optcaptionpage.ui
index d56d14d..a133a12 100644
--- a/sw/uiconfig/swriter/ui/optcaptionpage.ui
+++ b/sw/uiconfig/swriter/ui/optcaptionpage.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="OptCaptionPage">
diff --git a/sw/uiconfig/swriter/ui/tocindexpage.ui b/sw/uiconfig/swriter/ui/tocindexpage.ui
index 4d37bd9..6a9d2e2 100644
--- a/sw/uiconfig/swriter/ui/tocindexpage.ui
+++ b/sw/uiconfig/swriter/ui/tocindexpage.ui
@@ -47,6 +47,8 @@
<column type="gchararray"/>
<!-- column-name checkvis1 -->
<column type="gboolean"/>
<!-- column-name checktri1 -->
<column type="gboolean"/>
</columns>
</object>
<object class="GtkBox" id="TocIndexPage">
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 5b60f02..361b8d7 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -51,6 +51,7 @@
#include <vcl/ptrstyle.hxx>
#include <vcl/slider.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/svimpbox.hxx>
#include <vcl/svlbitm.hxx>
#include <vcl/svtabbx.hxx>
#include <vcl/tabctrl.hxx>
@@ -2265,9 +2266,44 @@ struct SalInstanceTreeIter : public weld::TreeIter
: iter(pOrig ? pOrig->iter : nullptr)
{
}
virtual bool equal(const TreeIter& rOther) const override
{
return iter == static_cast<const SalInstanceTreeIter&>(rOther).iter;
}
SvTreeListEntry* iter;
};
namespace
{
TriState get_toggle(SvTreeListEntry* pEntry, int col)
{
++col; //skip dummy/expander column
if (static_cast<size_t>(col) == pEntry->ItemCount())
return TRISTATE_FALSE;
assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
SvLBoxItem& rItem = pEntry->GetItem(col);
assert(dynamic_cast<SvLBoxButton*>(&rItem));
SvLBoxButton& rToggle = static_cast<SvLBoxButton&>(rItem);
if (rToggle.IsStateTristate())
return TRISTATE_INDET;
else if (rToggle.IsStateChecked())
return TRISTATE_TRUE;
return TRISTATE_FALSE;
}
bool get_text_emphasis(SvTreeListEntry* pEntry, int col)
{
++col; //skip dummy/expander column
assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
SvLBoxItem& rItem = pEntry->GetItem(col);
assert(dynamic_cast<SvLBoxString*>(&rItem));
return static_cast<SvLBoxString&>(rItem).IsEmphasized();
}
}
class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::TreeView
{
private:
@@ -2276,6 +2312,7 @@ private:
VclPtr<SvTabListBox> m_xTreeView;
SvLBoxButtonData m_aCheckButtonData;
SvLBoxButtonData m_aRadioButtonData;
bool m_bDisableCheckBoxAutoWidth;
int m_nSortColumn;
DECL_LINK(SelectHdl, SvTreeListBox*, void);
@@ -2294,6 +2331,7 @@ public:
, m_xTreeView(pTreeView)
, m_aCheckButtonData(pTreeView, false)
, m_aRadioButtonData(pTreeView, true)
, m_bDisableCheckBoxAutoWidth(false)
, m_nSortColumn(-1)
{
m_xTreeView->SetNodeDefaultImages();
@@ -2338,6 +2376,7 @@ public:
virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override
{
m_bDisableCheckBoxAutoWidth = true;
std::vector<long> aTabPositions;
aTabPositions.push_back(0);
for (size_t i = 0; i < rWidths.size(); ++i)
@@ -2670,25 +2709,20 @@ public:
set_sensitive(pEntry, bSensitive, col);
}
virtual bool get_toggle(int pos, int col) const override
virtual TriState get_toggle(int pos, int col) const override
{
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
++col; //skip dummy/expander column
if (static_cast<size_t>(col) == pEntry->ItemCount())
return false;
assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
SvLBoxItem& rItem = pEntry->GetItem(col);
assert(dynamic_cast<SvLBoxButton*>(&rItem));
return static_cast<SvLBoxButton&>(rItem).IsStateChecked();
return ::get_toggle(pEntry, col);
}
virtual void set_toggle(int pos, bool bOn, int col) override
virtual TriState get_toggle(const weld::TreeIter& rIter, int col) const override
{
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
return ::get_toggle(rVclIter.iter, col);
}
void set_toggle(SvTreeListEntry* pEntry, TriState eState, int col)
{
bool bRadio = std::find(m_aRadioIndexes.begin(), m_aRadioIndexes.end(), col) != m_aRadioIndexes.end();
++col; //skip dummy/expander column
@@ -2698,23 +2732,86 @@ public:
if (static_cast<size_t>(col) == pEntry->ItemCount())
{
pEntry->AddItem(std::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox,
bRadio ? &m_aRadioButtonData : &m_aCheckButtonData));
SvLBoxButtonData* pData = bRadio ? &m_aRadioButtonData : &m_aCheckButtonData;
// if we want to have the implicit auto-sizing of the checkbox
// column we need to call EnableCheckButton and CheckBoxInserted to
// let it figure out that width. But we don't want to override any
// explicitly set column width, so disable this if we've set
// explicit column widths
if (!m_bDisableCheckBoxAutoWidth)
{
if (!(m_xTreeView->GetTreeFlags() & SvTreeFlags::CHKBTN))
{
m_xTreeView->EnableCheckButton(pData);
// EnableCheckButton clobbered this, restore it
pData->SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
}
}
pEntry->AddItem(std::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, pData));
SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
m_xTreeView->InitViewData(pViewData, pEntry);
if (!m_bDisableCheckBoxAutoWidth)
m_xTreeView->CheckBoxInserted(pEntry);
}
assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
SvLBoxItem& rItem = pEntry->GetItem(col);
assert(dynamic_cast<SvLBoxButton*>(&rItem));
if (bOn)
static_cast<SvLBoxButton&>(rItem).SetStateChecked();
else
static_cast<SvLBoxButton&>(rItem).SetStateUnchecked();
switch (eState)
{
case TRISTATE_TRUE:
static_cast<SvLBoxButton&>(rItem).SetStateChecked();
break;
case TRISTATE_FALSE:
static_cast<SvLBoxButton&>(rItem).SetStateUnchecked();
break;
case TRISTATE_INDET:
static_cast<SvLBoxButton&>(rItem).SetStateTristate();
break;
}
m_xTreeView->ModelHasEntryInvalidated(pEntry);
}
virtual void set_toggle(int pos, TriState eState, int col) override
{
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
set_toggle(pEntry, eState, col);
}
virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col) override
{
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
set_toggle(rVclIter.iter, eState, col);
}
void set_text_emphasis(SvTreeListEntry* pEntry, bool bOn, int col)
{
++col; //skip dummy/expander column
assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
SvLBoxItem& rItem = pEntry->GetItem(col);
assert(dynamic_cast<SvLBoxString*>(&rItem));
static_cast<SvLBoxString&>(rItem).Emphasize(bOn);
m_xTreeView->ModelHasEntryInvalidated(pEntry);
}
virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col) override
{
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
set_text_emphasis(rVclIter.iter, bOn, col);
}
virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const override
{
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
return ::get_text_emphasis(rVclIter.iter, col);
}
void set_image(SvTreeListEntry* pEntry, const Image& rImage, int col)
{
if (col == -1)
@@ -3244,7 +3341,15 @@ IMPL_LINK(SalInstanceTreeView, ToggleHdl, SvLBoxButtonData*, pData, void)
// tdf#122874 Select the row, calling SelectHdl, before handling
// the toggle
m_xTreeView->Select(pEntry, true);
if (!m_xTreeView->IsSelected(pEntry))
{
m_xTreeView->SelectAll(false);
m_xTreeView->Select(pEntry, true);
}
// toggled signal handlers can query get_cursor to get which
// node was clicked
m_xTreeView->pImpl->pCursor = pEntry;
for (int i = 1, nCount = pEntry->ItemCount(); i < nCount; ++i)
{
diff --git a/vcl/source/treelist/svlbitm.cxx b/vcl/source/treelist/svlbitm.cxx
index 76d67ff..e7732f6 100644
--- a/vcl/source/treelist/svlbitm.cxx
+++ b/vcl/source/treelist/svlbitm.cxx
@@ -173,11 +173,13 @@ bool SvLBoxButtonData::IsRadio() {
SvLBoxString::SvLBoxString(const OUString& rStr)
: maText(rStr)
: mbEmphasized(false)
, maText(rStr)
{
}
SvLBoxString::SvLBoxString()
: mbEmphasized(false)
{
}
@@ -203,7 +205,19 @@ void SvLBoxString::Paint(
nStyle |= DrawTextFlags::PathEllipsis | DrawTextFlags::Center;
aSize.setWidth( rDev.GetEntryWidth() );
}
if (mbEmphasized)
{
rRenderContext.Push();
vcl::Font aFont(rRenderContext.GetFont());
aFont.SetWeight(WEIGHT_BOLD);
rRenderContext.SetFont(aFont);
}
rRenderContext.DrawText(tools::Rectangle(rPos, aSize), maText, nStyle);
if (mbEmphasized)
rRenderContext.Pop();
}
std::unique_ptr<SvLBoxItem> SvLBoxString::Clone(SvLBoxItem const * pSource) const
@@ -218,7 +232,19 @@ void SvLBoxString::InitViewData(
{
if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this );
if (mbEmphasized)
{
pView->Push();
vcl::Font aFont( pView->GetFont());
aFont.SetWeight(WEIGHT_BOLD);
pView->Control::SetFont( aFont );
}
pViewData->maSize = Size(pView->GetTextWidth(maText), pView->GetTextHeight());
if (mbEmphasized)
pView->Pop();
}
// ***************************************************************
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index 1a2bb1e..5bd2a6f 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -1679,6 +1679,20 @@ void SvTreeListBox::SetCollapsedEntryBmp(SvTreeListEntry* pEntry,const Image& aB
}
}
void SvTreeListBox::CheckBoxInserted(SvTreeListEntry* pEntry)
{
SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
if( pItem )
{
long nWidth = pItem->GetSize(this, pEntry).Width();
if( mnCheckboxItemWidth < nWidth )
{
mnCheckboxItemWidth = nWidth;
nTreeFlags |= SvTreeFlags::RECALCTABS;
}
}
}
void SvTreeListBox::ImpEntryInserted( SvTreeListEntry* pEntry )
{
@@ -1712,19 +1726,9 @@ void SvTreeListBox::ImpEntryInserted( SvTreeListEntry* pEntry )
if( !(nTreeFlags & SvTreeFlags::CHKBTN) )
return;
SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
if( pItem )
{
long nWidth = pItem->GetSize(this, pEntry).Width();
if( mnCheckboxItemWidth < nWidth )
{
mnCheckboxItemWidth = nWidth;
nTreeFlags |= SvTreeFlags::RECALCTABS;
}
}
CheckBoxInserted(pEntry);
}
void SvTreeListBox::SetCheckButtonState( SvTreeListEntry* pEntry, SvButtonState eState)
{
if( !(nTreeFlags & SvTreeFlags::CHKBTN) )
@@ -1846,7 +1850,6 @@ void SvTreeListBox::SetDefaultCollapsedEntryBmp( const Image& aBmp )
void SvTreeListBox::EnableCheckButton( SvLBoxButtonData* pData )
{
DBG_ASSERT(!GetEntryCount(),"EnableCheckButton: Entry count != 0");
if( !pData )
nTreeFlags &= ~SvTreeFlags::CHKBTN;
else
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 853b282..06a2ba5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5634,6 +5634,10 @@ struct GtkInstanceTreeIter : public weld::TreeIter
else
memset(&iter, 0, sizeof(iter));
}
virtual bool equal(const TreeIter& rOther) const override
{
return memcmp(&iter, &static_cast<const GtkInstanceTreeIter&>(rOther).iter, sizeof(GtkTreeIter)) == 0;
}
GtkTreeIter iter;
};
@@ -5647,6 +5651,10 @@ private:
std::vector<gulong> m_aColumnSignalIds;
// map from toggle column to toggle visibility column
std::map<int, int> m_aToggleVisMap;
// map from toggle column to tristate column
std::map<int, int> m_aToggleTriStateMap;
// map from text column to text weight column
std::map<int, int> m_aWeightMap;
std::vector<GtkSortType> m_aSavedSortTypes;
std::vector<int> m_aSavedSortColumns;
std::vector<int> m_aViewColToModelCol;
@@ -5745,15 +5753,29 @@ private:
return sRet;
}
gint get_int(const GtkTreeIter& iter, int col) const
{
gint nRet(-1);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
gtk_tree_model_get(pModel, const_cast<GtkTreeIter*>(&iter), col, &nRet, -1);
return nRet;
}
bool get_bool(const GtkTreeIter& iter, int col) const
{
gboolean bRet(false);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
gtk_tree_model_get(pModel, const_cast<GtkTreeIter*>(&iter), col, &bRet, -1);
return bRet;
}
bool get_bool(int pos, int col) const
{
gboolean bRet(false);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos))
{
gtk_tree_model_get(pModel, &iter, col, &bRet, -1);
}
bRet = get_bool(iter, col);
return bRet;
}
@@ -5768,9 +5790,12 @@ private:
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos))
{
set(iter, col, rText);
}
}
void set(const GtkTreeIter& iter, int col, bool bOn)
{
gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), col, bOn, -1);
}
void set(int pos, int col, bool bOn)
@@ -5778,9 +5803,12 @@ private:
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos))
{
gtk_tree_store_set(m_pTreeStore, &iter, col, bOn, -1);
}
set(iter, col, bOn);
}
void set(const GtkTreeIter& iter, int col, gint bInt)
{
gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), col, bInt, -1);
}
static gboolean signalTestExpandRow(GtkTreeView*, GtkTreeIter* iter, GtkTreePath*, gpointer widget)
@@ -5926,15 +5954,18 @@ public:
for (GList* pRenderer = g_list_first(pRenderers); pRenderer; pRenderer = g_list_next(pRenderer))
{
GtkCellRenderer* pCellRenderer = GTK_CELL_RENDERER(pRenderer->data);
if (m_nTextCol == -1 && GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
{
m_nTextCol = nIndex;
if (m_nTextCol == -1)
m_nTextCol = nIndex;
m_aWeightMap[nIndex] = -1;
}
else if (GTK_IS_CELL_RENDERER_TOGGLE(pCellRenderer))
{
g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", reinterpret_cast<gpointer>(nIndex));
g_signal_connect(G_OBJECT(pCellRenderer), "toggled", G_CALLBACK(signalCellToggled), this);
m_aToggleVisMap[nIndex] = -1;
m_aToggleTriStateMap[nIndex] = -1;
}
else if (GTK_IS_CELL_RENDERER_PIXBUF(pCellRenderer))
{
@@ -5950,11 +5981,15 @@ public:
g_list_free(pRenderers);
m_aViewColToModelCol.push_back(nIndex - 1);
}
m_nIdCol = nIndex++;
for (auto& a : m_aToggleVisMap)
{
a.second = nIndex++;
}
for (auto& a : m_aToggleTriStateMap)
a.second = nIndex++;
for (auto& a : m_aWeightMap)
a.second = nIndex++;
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
m_nRowDeletedSignalId = g_signal_connect(pModel, "row-deleted", G_CALLBACK(signalRowDeleted), this);
@@ -6337,17 +6372,64 @@ public:
set(pos, col, rText);
}
virtual bool get_toggle(int pos, int col) const override
virtual TriState get_toggle(int pos, int col) const override
{
return get_bool(pos, get_model_col(col));
col = get_model_col(col);
if (get_bool(pos, m_aToggleTriStateMap.find(col)->second))
return TRISTATE_INDET;
return get_bool(pos, col) ? TRISTATE_TRUE : TRISTATE_FALSE;
}
virtual void set_toggle(int pos, bool bOn, int col) override
virtual TriState get_toggle(const weld::TreeIter& rIter, int col) const override
{
col = get_model_col(col);
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
if (get_bool(rGtkIter.iter, m_aToggleTriStateMap.find(col)->second))
return TRISTATE_INDET;
return get_bool(rGtkIter.iter, col) ? TRISTATE_TRUE : TRISTATE_FALSE;
}
virtual void set_toggle(int pos, TriState eState, int col) override
{
col = get_model_col(col);
// checkbuttons are invisible until toggled on or off
set(pos, m_aToggleVisMap[col], true);
set(pos, col, bOn);
if (eState == TRISTATE_INDET)
set(pos, m_aToggleTriStateMap[col], true);
else
{
set(pos, m_aToggleTriStateMap[col], false);
set(pos, col, eState == TRISTATE_TRUE);
}
}
virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col) override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
col = get_model_col(col);
// checkbuttons are invisible until toggled on or off
set(rGtkIter.iter, m_aToggleVisMap[col], true);
if (eState == TRISTATE_INDET)
set(rGtkIter.iter, m_aToggleTriStateMap[col], true);
else
{
set(rGtkIter.iter, m_aToggleTriStateMap[col], false);
set(rGtkIter.iter, col, eState == TRISTATE_TRUE);
}
}
virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col) override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
col = get_model_col(col);
set(rGtkIter.iter, m_aWeightMap[col], bOn ? PANGO_WEIGHT_BOLD : -1);
}
virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
col = get_model_col(col);
return get_int(rGtkIter.iter, m_aWeightMap.find(col)->second) == PANGO_WEIGHT_BOLD;
}
using GtkInstanceWidget::set_sensitive;
@@ -6360,6 +6442,8 @@ public:
col = get_model_col(col);
col += m_nIdCol + 1; // skip over id column
col += m_aToggleVisMap.size(); // skip over toggle columns
col += m_aToggleTriStateMap.size(); // skip over tristate columns
col += m_aWeightMap.size(); // skip over weight columns
set(pos, col, bSensitive);
}