chart2/source/controller/dialogs/res_DataLabel.cxx | 14 +++--- cui/source/dialogs/FontFeaturesDialog.cxx | 2 cui/source/tabpages/align.cxx | 20 ++++---- cui/source/tabpages/chardlg.cxx | 16 +++---- cui/source/tabpages/paragrph.cxx | 48 ++++++++++----------- cui/source/tabpages/swpossizetabpage.cxx | 8 +-- cui/source/tabpages/transfrm.cxx | 16 +++---- include/vcl/weld.hxx | 31 +++++++------ sc/source/ui/attrdlg/tabpages.cxx | 24 +++++----- svtools/source/brwbox/ebbcontrols.cxx | 2 vcl/inc/qt5/QtInstanceTreeView.hxx | 3 - vcl/inc/qt5/QtTools.hxx | 3 + vcl/qt5/QtInstanceTreeView.cxx | 32 -------------- vcl/qt5/QtTools.cxx | 32 ++++++++++++++ vcl/source/app/weldutils.cxx | 2 15 files changed, 127 insertions(+), 126 deletions(-)
New commits: commit dd965f6d9878e33115e1123cf1b8b9c33a210634 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 16 20:36:13 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Jul 18 07:06:24 2025 +0200 weld: Use more specific CheckButton param for TriStateEnabled The TriStateEnabled struct implements logic to loop through the three different TriState states for a weld::Toggleable. In practice, it is only used for weld::CheckButton objects, and (while not instantly clear from the API) TRISTATE_INDET isn't actually supported by all weld::Toggleable subclasses. Switch the param to TriStateEnabled::ButtonToggled from weld::Toggleable& to weld::CheckButton& and rename to CheckButtonToggled to make clearer this is only for CheckButton. As a consequence, adjust callers that were passing just a weld::Toggleable& to pass a CheckButton& (to the same underlying object) to adhere to the new method signature. This is one step towards making the inconsistent state specific to weld::CheckButton, i.e. (re)move it from weld::Toggleable and other subclasses. Change-Id: I843c1c7075f91c0b81605ecb5d7e54621b9074c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187992 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index 98db10ff1873..d35e7c9e5b29 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -224,19 +224,19 @@ IMPL_LINK(DataLabelResources, NumberFormatDialogHdl, weld::Button&, rButton, voi IMPL_LINK(DataLabelResources, CheckHdl, weld::Toggleable&, rToggle, void) { if (&rToggle == m_xCBNumber.get()) - m_aNumberState.ButtonToggled(rToggle); + m_aNumberState.CheckButtonToggled(*m_xCBNumber); else if (&rToggle == m_xCBPercent.get()) - m_aPercentState.ButtonToggled(rToggle); + m_aPercentState.CheckButtonToggled(*m_xCBPercent); else if (&rToggle == m_xCBCategory.get()) - m_aCategoryState.ButtonToggled(rToggle); + m_aCategoryState.CheckButtonToggled(*m_xCBCategory); else if (&rToggle == m_xCBSymbol.get()) - m_aSymbolState.ButtonToggled(rToggle); + m_aSymbolState.CheckButtonToggled(*m_xCBSymbol); else if (&rToggle == m_xCBDataSeries.get()) - m_aDataSeriesState.ButtonToggled(rToggle); + m_aDataSeriesState.CheckButtonToggled(*m_xCBDataSeries); else if (&rToggle == m_xCBWrapText.get()) - m_aWrapTextState.ButtonToggled(rToggle); + m_aWrapTextState.CheckButtonToggled(*m_xCBWrapText); else if (&rToggle == m_xCBCustomLeaderLines.get()) - m_aCustomLeaderLinesState.ButtonToggled(rToggle); + m_aCustomLeaderLinesState.CheckButtonToggled(*m_xCBCustomLeaderLines); EnableControls(); } diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx index dd036c37bb28..e0b299cc680d 100644 --- a/cui/source/dialogs/FontFeaturesDialog.cxx +++ b/cui/source/dialogs/FontFeaturesDialog.cxx @@ -203,7 +203,7 @@ void FontFeaturesDialog::updateFontPreview() IMPL_LINK(FontFeatureItem, CheckBoxToggledHdl, weld::Toggleable&, rToggle, void) { - m_aTriStateEnabled.ButtonToggled(rToggle); + m_aTriStateEnabled.CheckButtonToggled(*m_xCheck); m_aTriStateEnabled.bTriStateEnabled = false; m_aToggleHdl.Call(rToggle); } diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index 638350f515b0..987a42157327 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -752,31 +752,31 @@ bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, TypedWhichId return eMethodOld != eMethodNew; } -IMPL_LINK(AlignmentTabPage, StackedClickHdl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(AlignmentTabPage, StackedClickHdl, weld::Toggleable&, void) { - m_aStackedState.ButtonToggled(rToggle); + m_aStackedState.CheckButtonToggled(*m_xCbStacked); UpdateEnableControls(); } -IMPL_LINK(AlignmentTabPage, AsianModeClickHdl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(AlignmentTabPage, AsianModeClickHdl, weld::Toggleable&, void) { - m_aAsianModeState.ButtonToggled(rToggle); + m_aAsianModeState.CheckButtonToggled(*m_xCbAsianMode); } -IMPL_LINK(AlignmentTabPage, WrapClickHdl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(AlignmentTabPage, WrapClickHdl, weld::Toggleable&, void) { - m_aWrapState.ButtonToggled(rToggle); + m_aWrapState.CheckButtonToggled(*m_xBtnWrap); UpdateEnableControls(); } -IMPL_LINK(AlignmentTabPage, HyphenClickHdl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(AlignmentTabPage, HyphenClickHdl, weld::Toggleable&, void) { - m_aHyphenState.ButtonToggled(rToggle); + m_aHyphenState.CheckButtonToggled(*m_xBtnHyphen); } -IMPL_LINK(AlignmentTabPage, ShrinkClickHdl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(AlignmentTabPage, ShrinkClickHdl, weld::Toggleable&, void) { - m_aShrinkState.ButtonToggled(rToggle); + m_aShrinkState.CheckButtonToggled(*m_xBtnShrink); } IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableHdl, weld::ComboBox&, void) diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index cbc58dfedaed..978ed42ee460 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -1641,9 +1641,9 @@ void SvxCharEffectsPage::SelectHdl_Impl(const weld::ComboBox* pBox) UpdatePreview_Impl(); } -IMPL_LINK(SvxCharEffectsPage, CbClickHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxCharEffectsPage, CbClickHdl_Impl, weld::Toggleable&, void) { - m_aIndividualWordsState.ButtonToggled(rToggle); + m_aIndividualWordsState.CheckButtonToggled(*m_xIndividualWordsBtn); UpdatePreview_Impl(); UpdatePreview_Impl(); } @@ -2031,20 +2031,20 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) ChangesApplied(); } -IMPL_LINK(SvxCharEffectsPage, HiddenBtnClickHdl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxCharEffectsPage, HiddenBtnClickHdl, weld::Toggleable&, void) { - m_aHiddenState.ButtonToggled(rToggle); + m_aHiddenState.CheckButtonToggled(*m_xHiddenBtn); } -IMPL_LINK(SvxCharEffectsPage, OutlineBtnClickHdl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxCharEffectsPage, OutlineBtnClickHdl, weld::Toggleable&, void) { - m_aOutlineState.ButtonToggled(rToggle); + m_aOutlineState.CheckButtonToggled(*m_xOutlineBtn); UpdatePreview_Impl(); } -IMPL_LINK(SvxCharEffectsPage, ShadowBtnClickHdl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxCharEffectsPage, ShadowBtnClickHdl, weld::Toggleable&, void) { - m_aShadowState.ButtonToggled(rToggle); + m_aShadowState.CheckButtonToggled(*m_xShadowBtn); UpdatePreview_Impl(); } diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 212b523d6ebb..ce13e2acfdb0 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -2606,9 +2606,9 @@ void SvxExtParagraphTabPage::PageBreakHdl() } } -IMPL_LINK(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::Toggleable&, void) { - aPageBreakState.ButtonToggled(rToggle); + aPageBreakState.CheckButtonToggled(*m_xPageBreakBox); PageBreakHdl(); } @@ -2619,9 +2619,9 @@ void SvxExtParagraphTabPage::AllowSplitHdl() m_xOrphanBox->set_sensitive(bEnable); } -IMPL_LINK(SvxExtParagraphTabPage, AllowSplitHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, AllowSplitHdl_Impl, weld::Toggleable&, void) { - aAllowSplitState.ButtonToggled(rToggle); + aAllowSplitState.CheckButtonToggled(*m_xAllowSplitBox); AllowSplitHdl(); } @@ -2645,15 +2645,15 @@ void SvxExtParagraphTabPage::WidowHdl() } } -IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, WidowHdl_Impl, weld::Toggleable&, void) { - aWidowState.ButtonToggled(rToggle); + aWidowState.CheckButtonToggled(*m_xWidowBox); WidowHdl(); } -IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::Toggleable&, void) { - aOrphanState.ButtonToggled(rToggle); + aOrphanState.CheckButtonToggled(*m_xOrphanBox); OrphanHdl(); } @@ -2717,9 +2717,9 @@ void SvxExtParagraphTabPage::HyphenClickHdl() m_xHyphenBox->set_state(bEnable ? TRISTATE_TRUE : TRISTATE_FALSE); } -IMPL_LINK(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::Toggleable&, void) { - aHyphenState.ButtonToggled(rToggle); + aHyphenState.CheckButtonToggled(*m_xHyphenBox); HyphenClickHdl(); } @@ -2743,9 +2743,9 @@ void SvxExtParagraphTabPage::ApplyCollClickHdl() } } -IMPL_LINK(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::Toggleable&, void) { - aApplyCollState.ButtonToggled(rToggle); + aApplyCollState.CheckButtonToggled(*m_xApplyCollBtn); ApplyCollClickHdl(); } @@ -2795,15 +2795,15 @@ void SvxExtParagraphTabPage::PageNumBoxClickHdl() m_xPagenumEdit->set_sensitive(m_xPageNumBox->get_state() == TRISTATE_TRUE); } -IMPL_LINK(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, weld::Toggleable&, void) { - aPageNumState.ButtonToggled(rToggle); + aPageNumState.CheckButtonToggled(*m_xPageNumBox); PageNumBoxClickHdl(); } -IMPL_LINK(SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl, weld::Toggleable&, void) { - aKeepParaState.ButtonToggled(rToggle); + aKeepParaState.CheckButtonToggled(*m_xKeepParaBox); } void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet& aSet) @@ -2815,9 +2815,9 @@ void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet& aSet) DisablePageBreak(); } -IMPL_LINK(SvxExtParagraphTabPage, AcrossParagraphHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, AcrossParagraphHdl_Impl, weld::Toggleable&, void) { - aAcrossParagraphState.ButtonToggled(rToggle); + aAcrossParagraphState.CheckButtonToggled(*m_xAcrossParagraphBox); if (m_xAcrossParagraphBox->get_state() != TRISTATE_TRUE ) { m_xAcrossColumnBox->set_state( TRISTATE_FALSE ); @@ -2840,9 +2840,9 @@ IMPL_LINK(SvxExtParagraphTabPage, AcrossParagraphHdl_Impl, weld::Toggleable&, rT } } -IMPL_LINK(SvxExtParagraphTabPage, AcrossColumnHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, AcrossColumnHdl_Impl, weld::Toggleable&, void) { - aAcrossColumnState.ButtonToggled(rToggle); + aAcrossColumnState.CheckButtonToggled(*m_xAcrossColumnBox); if (m_xAcrossColumnBox->get_state() != TRISTATE_TRUE ) { m_xAcrossPageBox->set_state( TRISTATE_FALSE ); @@ -2865,9 +2865,9 @@ IMPL_LINK(SvxExtParagraphTabPage, AcrossColumnHdl_Impl, weld::Toggleable&, rTogg } } -IMPL_LINK(SvxExtParagraphTabPage, AcrossPageHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, AcrossPageHdl_Impl, weld::Toggleable&, void) { - aAcrossPageState.ButtonToggled(rToggle); + aAcrossPageState.CheckButtonToggled(*m_xAcrossPageBox); if (m_xAcrossPageBox->get_state() == TRISTATE_TRUE ) { m_xAcrossParagraphBox->set_state( TRISTATE_TRUE ); @@ -2892,9 +2892,9 @@ IMPL_LINK(SvxExtParagraphTabPage, AcrossPageHdl_Impl, weld::Toggleable&, rToggle } } -IMPL_LINK(SvxExtParagraphTabPage, AcrossSpreadHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK_NOARG(SvxExtParagraphTabPage, AcrossSpreadHdl_Impl, weld::Toggleable&, void) { - aAcrossSpreadState.ButtonToggled(rToggle); + aAcrossSpreadState.CheckButtonToggled(*m_xAcrossSpreadBox); if (m_xAcrossSpreadBox->get_state() == TRISTATE_TRUE ) { m_xAcrossParagraphBox->set_state( TRISTATE_TRUE ); diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 7af3a52233f6..d12c065bbfe2 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1649,18 +1649,6 @@ class VCL_DLLPUBLIC ToggleButton : virtual public Button, virtual public Togglea friend class ::LOKTrigger; }; -struct VCL_DLLPUBLIC TriStateEnabled -{ - TriState eState; - bool bTriStateEnabled; - TriStateEnabled() - : eState(TRISTATE_INDET) - , bTriStateEnabled(true) - { - } - void ButtonToggled(Toggleable& rToggle); -}; - class VCL_DLLPUBLIC MenuButton : virtual public ToggleButton { friend class ::LOKTrigger; @@ -1724,6 +1712,18 @@ public: virtual void set_label_wrap(bool wrap) = 0; }; +struct VCL_DLLPUBLIC TriStateEnabled +{ + TriState eState; + bool bTriStateEnabled; + TriStateEnabled() + : eState(TRISTATE_INDET) + , bTriStateEnabled(true) + { + } + void CheckButtonToggled(CheckButton& rToggle); +}; + class VCL_DLLPUBLIC RadioButton : virtual public CheckButton { public: diff --git a/sc/source/ui/attrdlg/tabpages.cxx b/sc/source/ui/attrdlg/tabpages.cxx index 34931979499a..0e62a9ada6c5 100644 --- a/sc/source/ui/attrdlg/tabpages.cxx +++ b/sc/source/ui/attrdlg/tabpages.cxx @@ -137,28 +137,28 @@ DeactivateRC ScTabPageProtection::DeactivatePage( SfxItemSet* pSetP ) return DeactivateRC::LeavePage; } -IMPL_LINK(ScTabPageProtection, ProtectClickHdl, weld::Toggleable&, rBox, void) +IMPL_LINK_NOARG(ScTabPageProtection, ProtectClickHdl, weld::Toggleable&, void) { - aProtectState.ButtonToggled(rBox); - ButtonClick(rBox); + aProtectState.CheckButtonToggled(*m_xBtnProtect); + ButtonClick(*m_xBtnProtect); } -IMPL_LINK(ScTabPageProtection, HideCellClickHdl, weld::Toggleable&, rBox, void) +IMPL_LINK_NOARG(ScTabPageProtection, HideCellClickHdl, weld::Toggleable&, void) { - aHideCellState.ButtonToggled(rBox); - ButtonClick(rBox); + aHideCellState.CheckButtonToggled(*m_xBtnHideCell); + ButtonClick(*m_xBtnHideCell); } -IMPL_LINK(ScTabPageProtection, HideFormulaClickHdl, weld::Toggleable&, rBox, void) +IMPL_LINK_NOARG(ScTabPageProtection, HideFormulaClickHdl, weld::Toggleable&, void) { - aHideFormulaState.ButtonToggled(rBox); - ButtonClick(rBox); + aHideFormulaState.CheckButtonToggled(*m_xBtnHideFormula); + ButtonClick(*m_xBtnHideFormula); } -IMPL_LINK(ScTabPageProtection, HidePrintClickHdl, weld::Toggleable&, rBox, void) +IMPL_LINK_NOARG(ScTabPageProtection, HidePrintClickHdl, weld::Toggleable&, void) { - aHidePrintState.ButtonToggled(rBox); - ButtonClick(rBox); + aHidePrintState.CheckButtonToggled(*m_xBtnHidePrint); + ButtonClick(*m_xBtnHidePrint); } void ScTabPageProtection::ButtonClick(const weld::Toggleable& rBox) diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index 1c568dc89b42..35ee6916ffa1 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -261,7 +261,7 @@ namespace svt IMPL_LINK_NOARG(CheckBoxControl, OnToggle, weld::Toggleable&, void) { - m_aModeState.ButtonToggled(*m_xBox); + m_aModeState.CheckButtonToggled(*m_xBox); m_aToggleLink.Call(*m_xBox); CallModifyHdls(); } diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index 51a933cab74a..70b742f91e58 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -95,7 +95,7 @@ Dialog* AssistantController::getDialog() { return m_xAssistant.get(); } AssistantController::~AssistantController() {} -void TriStateEnabled::ButtonToggled(weld::Toggleable& rToggle) +void TriStateEnabled::CheckButtonToggled(weld::CheckButton& rToggle) { if (bTriStateEnabled) { commit f285cda22eefba3e9641fdbc840760344c851ce8 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 16 17:46:29 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Jul 18 07:06:17 2025 +0200 tdf#130857 qt: Move helpers to convert VCL <-> Qt checkstate to QtTools They're not specific to QtInstanceTreeView. Move them to QtTools for reuse from elsewhere. Change-Id: I35410fd6502c328dc5b9a6383fa974132b884274 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187991 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/inc/qt5/QtInstanceTreeView.hxx b/vcl/inc/qt5/QtInstanceTreeView.hxx index 7bc55cb8be6b..a4d95c6fb8b1 100644 --- a/vcl/inc/qt5/QtInstanceTreeView.hxx +++ b/vcl/inc/qt5/QtInstanceTreeView.hxx @@ -213,9 +213,6 @@ private: QModelIndex firstTextColumnModelIndex(const weld::TreeIter& rIter) const; static QAbstractItemView::SelectionMode mapSelectionMode(SelectionMode eMode); - static Qt::CheckState toQtCheckState(TriState eTristate); - static TriState toVclTriState(Qt::CheckState eCheckState); - private Q_SLOTS: void handleActivated(); void handleDataChanged(const QModelIndex& rTopLeft, const QModelIndex& rBottomRight, diff --git a/vcl/inc/qt5/QtTools.hxx b/vcl/inc/qt5/QtTools.hxx index ca179c38c86a..ea35710bc9b6 100644 --- a/vcl/inc/qt5/QtTools.hxx +++ b/vcl/inc/qt5/QtTools.hxx @@ -97,6 +97,9 @@ inline QDate toQDate(const Date& rDate) inline Date toDate(const QDate& rDate) { return Date(rDate.day(), rDate.month(), rDate.year()); } +Qt::CheckState toQtCheckState(TriState eTristate); +TriState toVclTriState(Qt::CheckState eTristate); + Qt::DropActions toQtDropActions(sal_Int8 dragOperation); sal_Int8 toVclDropActions(Qt::DropActions dragOperation); sal_Int8 toVclDropAction(Qt::DropAction dragOperation); diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx index 2977c3cdb169..f97489c4b7ba 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -1066,38 +1066,6 @@ QModelIndex QtInstanceTreeView::firstTextColumnModelIndex(const weld::TreeIter& return QModelIndex(); } -Qt::CheckState QtInstanceTreeView::toQtCheckState(TriState eTristate) -{ - switch (eTristate) - { - case TRISTATE_FALSE: - return Qt::CheckState::Unchecked; - case TRISTATE_TRUE: - return Qt::CheckState::Checked; - case TRISTATE_INDET: - return Qt::CheckState::PartiallyChecked; - default: - assert(false && "unhandled Tristate value"); - return Qt::CheckState::PartiallyChecked; - } -} - -TriState QtInstanceTreeView::toVclTriState(Qt::CheckState eTristate) -{ - switch (eTristate) - { - case Qt::CheckState::Unchecked: - return TRISTATE_FALSE; - case Qt::CheckState::Checked: - return TRISTATE_TRUE; - case Qt::CheckState::PartiallyChecked: - return TRISTATE_INDET; - default: - assert(false && "unhandled Qt::CheckState value"); - return TRISTATE_INDET; - } -} - void QtInstanceTreeView::handleActivated() { SolarMutexGuard g; diff --git a/vcl/qt5/QtTools.cxx b/vcl/qt5/QtTools.cxx index 201762f9f6c7..b94cd2f0d11d 100644 --- a/vcl/qt5/QtTools.cxx +++ b/vcl/qt5/QtTools.cxx @@ -38,6 +38,38 @@ void CairoDeleter::operator()(cairo_surface_t* pSurface) const { cairo_surface_destroy(pSurface); } +Qt::CheckState toQtCheckState(TriState eTristate) +{ + switch (eTristate) + { + case TRISTATE_FALSE: + return Qt::CheckState::Unchecked; + case TRISTATE_TRUE: + return Qt::CheckState::Checked; + case TRISTATE_INDET: + return Qt::CheckState::PartiallyChecked; + default: + assert(false && "unhandled Tristate value"); + return Qt::CheckState::PartiallyChecked; + } +}; + +TriState toVclTriState(Qt::CheckState eTristate) +{ + switch (eTristate) + { + case Qt::CheckState::Unchecked: + return TRISTATE_FALSE; + case Qt::CheckState::Checked: + return TRISTATE_TRUE; + case Qt::CheckState::PartiallyChecked: + return TRISTATE_INDET; + default: + assert(false && "unhandled Qt::CheckState value"); + return TRISTATE_INDET; + } +}; + sal_uInt16 toVclKeyboardModifiers(Qt::KeyboardModifiers eKeyModifiers) { sal_uInt16 nCode = 0; commit f9d12f085f9edc14a091d08f17dc8bd906a647a6 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 16 17:07:40 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Jul 18 07:06:09 2025 +0200 weld: Stop using weld::Toggleable::{g,s}et_inconsistent from outside Make weld::Toggleable::get_inconsistent and weld::Toggleable::set_inconsistent protected. Switch all external callers to weld::Toggleable::get_state and weld::Toggleable::set_state that (currently) use the (now protected) methods internally, so this shouldn't result in any change in behavior. Conceptually, weld::Toggleable supports three states (TRISTATE_INDET, TRISTATE_TRUE, TRISTATE_FALSE). That GTK's GtkCheckButton has a different concept of two bool properties (CheckButton:active [1] and GtkCheckButton::inconsistent [2]) is an implementation detail that code using weld::CheckButton etc. should not have to bother about, so leave it internal to weld::Toggleable and subclasses. [1] https://docs.gtk.org/gtk4/property.CheckButton.active.html [2] https://docs.gtk.org/gtk4/method.CheckButton.get_inconsistent.html Change-Id: Idcc0553500cc34e5902000869b09608d22eb491c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187990 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index 72a2f2ab60b3..a88640beed12 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -770,7 +770,7 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet) } if (m_xPositionCB->get_state_changed_from_saved()) { - if (m_xPositionCB->get_inconsistent()) + if (m_xPositionCB->get_state() == TRISTATE_INDET) rSet->InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS ); else rSet->Put( @@ -781,7 +781,7 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet) if (m_xSizeCB->get_state_changed_from_saved()) { - if (m_xSizeCB->get_inconsistent()) + if (m_xSizeCB->get_state() == TRISTATE_INDET) rSet->InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE ); else rSet->Put( @@ -948,7 +948,7 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet) } else { - m_xPositionCB->set_inconsistent(true); + m_xPositionCB->set_state(TRISTATE_INDET); } m_xPositionCB->save_state(); @@ -960,7 +960,7 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet) m_xSizeCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue()); } else - m_xSizeCB->set_inconsistent(true); + m_xSizeCB->set_state(TRISTATE_INDET); m_xSizeCB->save_state(); pItem = GetItem( *rSet, SID_HTML_MODE ); diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index 8e573635aeb5..80ed92a94c81 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -929,7 +929,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs ) if (m_xTsbPosProtect->get_state_changed_from_saved()) { - if( m_xTsbPosProtect->get_inconsistent() ) + if (m_xTsbPosProtect->get_state() == TRISTATE_INDET) { rOutAttrs->InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS ); } @@ -969,7 +969,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs ) if (m_xTsbSizeProtect->get_state_changed_from_saved()) { - if ( m_xTsbSizeProtect->get_inconsistent() ) + if (m_xTsbSizeProtect->get_state() == TRISTATE_INDET) rOutAttrs->InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE ); else rOutAttrs->Put( @@ -982,7 +982,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs ) { if (!mbIgnoreAutoGrowWidth) { - if( m_xTsbAutoGrowWidth->get_inconsistent() ) + if (m_xTsbAutoGrowWidth->get_state() == TRISTATE_INDET) rOutAttrs->InvalidateItem( SID_ATTR_TRANSFORM_AUTOWIDTH ); else rOutAttrs->Put( @@ -996,7 +996,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs ) { if (!mbIgnoreAutoGrowHeight) { - if (m_xTsbAutoGrowHeight->get_inconsistent()) + if (m_xTsbAutoGrowHeight->get_state() == TRISTATE_INDET) { rOutAttrs->InvalidateItem( SID_ATTR_TRANSFORM_AUTOHEIGHT ); } @@ -1042,7 +1042,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* ) } else { - m_xTsbPosProtect->set_inconsistent(true); + m_xTsbPosProtect->set_state(TRISTATE_INDET); } m_xTsbPosProtect->save_state(); @@ -1076,7 +1076,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* ) m_xTsbSizeProtect->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue()); } else - m_xTsbSizeProtect->set_inconsistent(true); + m_xTsbSizeProtect->set_state(TRISTATE_INDET); pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOWIDTH ); if ( pItem ) @@ -1084,7 +1084,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* ) m_xTsbAutoGrowWidth->set_active(static_cast<const SfxBoolItem*>( pItem )->GetValue()); } else - m_xTsbAutoGrowWidth->set_inconsistent(true); + m_xTsbAutoGrowWidth->set_state(TRISTATE_INDET); pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOHEIGHT ); if ( pItem ) @@ -1092,7 +1092,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* ) m_xTsbAutoGrowHeight->set_active(static_cast<const SfxBoolItem*>( pItem )->GetValue()); } else - m_xTsbAutoGrowHeight->set_inconsistent(true); + m_xTsbAutoGrowHeight->set_state(TRISTATE_INDET); // Is matching set? OUString aStr = GetUserData(); diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 564004be1905..7af3a52233f6 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1606,9 +1606,6 @@ public: virtual void set_active(bool active) = 0; virtual bool get_active() const = 0; - virtual void set_inconsistent(bool inconsistent) = 0; - virtual bool get_inconsistent() const = 0; - TriState get_state() const { if (get_inconsistent()) @@ -1641,6 +1638,10 @@ public: bool get_state_changed_from_saved() const { return m_eSavedValue != get_state(); } virtual void connect_toggled(const Link<Toggleable&, void>& rLink) { m_aToggleHdl = rLink; } + +protected: + virtual void set_inconsistent(bool inconsistent) = 0; + virtual bool get_inconsistent() const = 0; }; class VCL_DLLPUBLIC ToggleButton : virtual public Button, virtual public Toggleable