cui/source/inc/cuitabarea.hxx | 21 ++++----- cui/source/tabpages/tparea.cxx | 14 ++++-- cui/source/tabpages/tpcolor.cxx | 90 ++++++++++++++++++++-------------------- vcl/qt5/QtInstanceContainer.cxx | 1 4 files changed, 66 insertions(+), 60 deletions(-)
New commits: commit 40c62273b194a8857f03ccfd0ad0a67540299405 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Aug 12 14:04:25 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Aug 12 20:25:56 2025 +0200 cui: Prefix SvxColorTabPage members with 'm_' Change-Id: I69b350ee9e35768f3e8d7170c044252605835859 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189426 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 2e66c6fd630f..7db9826360e1 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -668,16 +668,16 @@ enum class ColorModel class SvxColorTabPage : public SfxTabPage { private: - const SfxItemSet& rOutAttrs; + const SfxItemSet& m_rOutAttrs; - XColorListRef pColorList; + XColorListRef m_pColorList; - ChangeType* pnColorListState; + ChangeType* m_pnColorListState; - XFillAttrSetItem aXFillAttr; - SfxItemSet& rXFSet; + XFillAttrSetItem m_aXFillAttr; + SfxItemSet& m_rXFSet; - ColorModel eCM; + ColorModel m_eCM; Color m_aPreviousColor; NamedColor m_aCurrentColor; @@ -765,8 +765,7 @@ public: void SetPropertyList( XPropertyListType t, const XPropertyListRef &xRef ); void SetColorList( const XColorListRef& pColList ); - - void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; } + void SetColorChgd(ChangeType* pIn) { m_pnColorListState = pIn; } virtual void FillUserData() override; }; diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index ccdb16886f92..867a199159e5 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -43,12 +43,12 @@ using namespace com::sun::star; SvxColorTabPage::SvxColorTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs) : SfxTabPage(pPage, pController, u"cui/ui/colorpage.ui"_ustr, u"ColorPage"_ustr, &rInAttrs) - , rOutAttrs ( rInAttrs ) + , m_rOutAttrs(rInAttrs) // All the horrific pointers we store and should not - , pnColorListState( nullptr ) - , aXFillAttr( rInAttrs.GetPool() ) - , rXFSet( aXFillAttr.GetItemSet() ) - , eCM( ColorModel::RGB ) + , m_pnColorListState( nullptr ) + , m_aXFillAttr( rInAttrs.GetPool() ) + , m_rXFSet( m_aXFillAttr.GetItemSet() ) + , m_eCM( ColorModel::RGB ) , m_xValSetColorList(new SvxColorValueSet(m_xBuilder->weld_scrolled_window(u"colorsetwin"_ustr, true))) , m_xValSetRecentList(new SvxColorValueSet(nullptr)) , m_xSelectPalette(m_xBuilder->weld_combo_box(u"paletteselector"_ustr)) @@ -94,10 +94,10 @@ SvxColorTabPage::SvxColorTabPage(weld::Container* pPage, weld::DialogController* SetExchangeSupport(); // setting the output device - rXFSet.Put( XFillStyleItem(drawing::FillStyle_SOLID) ); - rXFSet.Put( XFillColorItem(OUString(), COL_BLACK) ); - m_aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); - m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + m_rXFSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); + m_rXFSet.Put(XFillColorItem(OUString(), COL_BLACK)); + m_aCtlPreviewOld.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); // set handler m_xSelectPalette->connect_changed(LINK(this, SvxColorTabPage, SelectPaletteLBHdl)); @@ -120,7 +120,7 @@ SvxColorTabPage::SvxColorTabPage(weld::Container* pPage, weld::DialogController* Link<weld::Toggleable&,void> aLink2 = LINK( this, SvxColorTabPage, SelectColorModeHdl_Impl ); m_xRbRGB->connect_toggled(aLink2); m_xRbCMYK->connect_toggled(aLink2); - SetColorModel( eCM ); + SetColorModel(m_eCM); ChangeColorModel(); m_xBtnAdd->connect_clicked( LINK( this, SvxColorTabPage, ClickAddHdl_Impl ) ); @@ -167,7 +167,7 @@ SvxColorTabPage::~SvxColorTabPage() void SvxColorTabPage::ImpColorCountChanged() { - if (!pColorList.is()) + if (!m_pColorList.is()) return; m_xValSetColorList->SetColCount(SvxColorValueSet::getColumnCount()); m_xValSetRecentList->SetColCount(SvxColorValueSet::getColumnCount()); @@ -191,7 +191,7 @@ void SvxColorTabPage::FillPaletteLB() void SvxColorTabPage::Construct() { - if (pColorList.is()) + if (m_pColorList.is()) { FillPaletteLB(); ImpColorCountChanged(); @@ -200,10 +200,10 @@ void SvxColorTabPage::Construct() void SvxColorTabPage::ActivatePage( const SfxItemSet& ) { - if( !pColorList.is() ) + if (!m_pColorList.is()) return; - if( const XFillColorItem* pFillColorItem = rOutAttrs.GetItemIfSet( GetWhich( XATTR_FILLCOLOR ) ) ) + if (const XFillColorItem* pFillColorItem = m_rOutAttrs.GetItemIfSet(GetWhich(XATTR_FILLCOLOR))) { SetColorModel( ColorModel::RGB ); ChangeColorModel(); @@ -220,7 +220,7 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& ) } - m_aCtlPreviewOld.SetAttributes(aXFillAttr.GetItemSet()); + m_aCtlPreviewOld.SetAttributes(m_aXFillAttr.GetItemSet()); m_aCtlPreviewOld.Invalidate(); SelectValSetHdl_Impl(m_xValSetColorList.get()); @@ -253,7 +253,7 @@ bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet ) void SvxColorTabPage::UpdateModified() { - bool bEnable = pColorList.is() && pColorList->Count(); + bool bEnable = m_pColorList.is() && m_pColorList->Count(); m_xBtnWorkOn->set_sensitive(bEnable); } @@ -272,8 +272,8 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet ) // set color model OUString aStr = GetUserData(); - eCM = static_cast<ColorModel>(aStr.toInt32()); - SetColorModel( eCM ); + m_eCM = static_cast<ColorModel>(aStr.toInt32()); + SetColorModel(m_eCM); ChangeColorModel(); NamedColor aColor; @@ -297,8 +297,8 @@ IMPL_LINK_NOARG(SvxColorTabPage, SpinValueHdl_Impl, weld::SpinButton&, void) static_cast<sal_uInt8>(PercentToColor_Impl(m_xBcustom->get_value()))); UpdateColorValues(); - rXFSet.Put( XFillColorItem( OUString(), m_aCurrentColor.m_aColor ) ); - m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + m_rXFSet.Put(XFillColorItem(OUString(), m_aCurrentColor.m_aColor)); + m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); m_aCtlPreviewNew.Invalidate(); } @@ -312,8 +312,8 @@ IMPL_LINK_NOARG(SvxColorTabPage, MetricSpinValueHdl_Impl, weld::MetricSpinButton static_cast<sal_uInt8>(PercentToColor_Impl(m_xMcustom->get_value(FieldUnit::NONE)))); ConvertColorValues (m_aCurrentColor.m_aColor, ColorModel::RGB); - rXFSet.Put( XFillColorItem( OUString(), m_aCurrentColor.m_aColor ) ); - m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + m_rXFSet.Put(XFillColorItem(OUString(), m_aCurrentColor.m_aColor)); + m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); m_aCtlPreviewNew.Invalidate(); } @@ -323,8 +323,8 @@ IMPL_LINK_NOARG(SvxColorTabPage, ModifiedHdl_Impl, weld::Entry&, void) m_aCurrentColor.m_aColor = m_xHexcustom->GetColor(); UpdateColorValues(); - rXFSet.Put( XFillColorItem( OUString(), m_aCurrentColor.m_aColor ) ); - m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + m_rXFSet.Put(XFillColorItem(OUString(), m_aCurrentColor.m_aColor)); + m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); m_aCtlPreviewNew.Invalidate(); } @@ -404,9 +404,9 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, weld::Button&, void) m_aCurrentColor.m_aColor = aPreviewColor; UpdateColorValues( false ); // fill ItemSet and pass it on to XOut - rXFSet.Put( XFillColorItem( OUString(), aPreviewColor ) ); - //m_aCtlPreviewOld.SetAttributes( aXFillAttr ); - m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + m_rXFSet.Put(XFillColorItem(OUString(), aPreviewColor)); + //m_aCtlPreviewOld.SetAttributes(m_aXFillAttr); + m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); m_aCtlPreviewNew.Invalidate(); } @@ -467,15 +467,15 @@ IMPL_LINK_NOARG(SvxColorTabPage, SelectPaletteLBHdl, weld::ComboBox&, void) SfxOkDialogController* pController = GetDialogController(); SvxAreaTabDialog* pArea = dynamic_cast<SvxAreaTabDialog*>(pController); SvxLineTabDialog* pLine = dynamic_cast<SvxLineTabDialog*>(pController); - pColorList = pList; + m_pColorList = pList; if( pArea ) pArea->SetNewColorList(pList); else if( pLine ) pLine->SetNewColorList(pList); else SetColorList(pList); - *pnColorListState |= ChangeType::CHANGED; - *pnColorListState &= ~ChangeType::MODIFIED; + *m_pnColorListState |= ChangeType::CHANGED; + *m_pnColorListState &= ~ChangeType::MODIFIED; } } if (nPos != 0) @@ -495,8 +495,8 @@ IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void) Color aColor = pValSet->GetItemColor( nPos ); - rXFSet.Put( XFillColorItem( OUString(), aColor ) ); - m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + m_rXFSet.Put(XFillColorItem(OUString(), aColor)); + m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); m_aCtlPreviewNew.Invalidate(); NamedColor aNamedColor; @@ -561,9 +561,9 @@ void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell) IMPL_LINK_NOARG(SvxColorTabPage, SelectColorModeHdl_Impl, weld::Toggleable&, void) { if (m_xRbRGB->get_active()) - eCM = ColorModel::RGB; + m_eCM = ColorModel::RGB; else if (m_xRbCMYK->get_active()) - eCM = ColorModel::CMYK; + m_eCM = ColorModel::CMYK; ChangeColorModel(); UpdateColorValues(); } @@ -584,9 +584,9 @@ void SvxColorTabPage::ChangeColor(const NamedColor &rNewColor, bool bUpdatePrese // fill ItemSet and pass it on to XOut XFillColorItem aItem(OUString(), m_aCurrentColor.m_aColor); aItem.setComplexColor(m_aCurrentColor.getComplexColor()); - rXFSet.Put(aItem); + m_rXFSet.Put(aItem); - m_aCtlPreviewNew.SetAttributes(aXFillAttr.GetItemSet()); + m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); m_aCtlPreviewNew.Invalidate(); } @@ -600,7 +600,7 @@ void SvxColorTabPage::SetColorModel( ColorModel eModel ) void SvxColorTabPage::ChangeColorModel() { - switch( eCM ) + switch (m_eCM) { case ColorModel::RGB: { @@ -624,10 +624,10 @@ void SvxColorTabPage::ChangeColorModel() void SvxColorTabPage::UpdateColorValues( bool bUpdatePreset ) { - if (eCM != ColorModel::RGB) + if (m_eCM != ColorModel::RGB) { - ConvertColorValues (m_aPreviousColor, eCM ); - ConvertColorValues (m_aCurrentColor.m_aColor, eCM); + ConvertColorValues(m_aPreviousColor, m_eCM); + ConvertColorValues(m_aCurrentColor.m_aColor, m_eCM); m_xCcustom->set_value( ColorToPercent_Impl( m_aCurrentColor.m_aColor.GetRed() ), FieldUnit::PERCENT ); m_xMcustom->set_value( ColorToPercent_Impl( m_aCurrentColor.m_aColor.GetBlue() ), FieldUnit::PERCENT ); @@ -686,7 +686,7 @@ sal_Int32 SvxColorTabPage::FindInCustomColors(std::u16string_view aColorName) sal_Int32 SvxColorTabPage::FindInPalette( const Color& rColor ) { - return pColorList->GetIndexOfColor(rColor); + return m_pColorList->GetIndexOfColor(rColor); } // A RGB value is converted to a CMYK value - not in an ideal way as @@ -738,7 +738,7 @@ sal_uInt16 SvxColorTabPage::ColorToPercent_Impl( sal_uInt16 nColor ) { sal_uInt16 nValue = 0; - switch (eCM) + switch (m_eCM) { case ColorModel::RGB : nValue = nColor; @@ -757,7 +757,7 @@ sal_uInt16 SvxColorTabPage::PercentToColor_Impl( sal_uInt16 nPercent ) { sal_uInt16 nValue = 0; - switch (eCM) + switch (m_eCM) { case ColorModel::RGB : nValue = nPercent; @@ -775,14 +775,14 @@ sal_uInt16 SvxColorTabPage::PercentToColor_Impl( sal_uInt16 nPercent ) void SvxColorTabPage::FillUserData() { // the color model is saved in the Ini-file - SetUserData( OUString::number( static_cast<int>(eCM) ) ); + SetUserData(OUString::number(static_cast<int>(m_eCM))); } void SvxColorTabPage::SetPropertyList( XPropertyListType t, const XPropertyListRef &xRef ) { OSL_ASSERT( t == XPropertyListType::Color ); - pColorList = XColorListRef( static_cast<XColorList *>(xRef.get() ) ); + m_pColorList = XColorListRef(static_cast<XColorList*>(xRef.get())); } void SvxColorTabPage::SetColorList( const XColorListRef& pColList ) commit 3ffa3be35ee712db24ec9b2ffa55e96c3d97d169 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Aug 12 13:25:15 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Aug 12 20:25:50 2025 +0200 tdf#130857 cui: Refine toggle logic in "Area" tab page commit 770bf5a1f42be2d7397b30b91467a7dca4dc1785 Date: Sun Jun 16 19:32:31 2019 +0530 tdf#124549 Check Button toggle state before toggle. introduced logic to toggle the state of the toggle button in the top row of the "Area" tab page to active again if it was toggled off by clicking on it, because one button should always remain active, i.e. toggling a button to inactive should only happen by clicking another toggle button. For the GTK and VCL implementations, the toggle signal is only emitted when initiated by user action. For the native Qt implementation however, signals are (currently) also emitted when toggled programmatically, so this logic would result in the previously active button to still remain active when clicking on another one. As a consequence, multiple buttons (like "None", "Color", "Gradient") could all be shown as active at the same time in Writer's "Format" -> "Page Style" dialog, tab "Area", in a WIP branch where support for that dialog is declared with with SAL_VCL_QT_USE_WELDED_WIDGETS=1. That doesn't make sense. Refine the logic a bit to only reset the state to active when the currently active button would be toggled off without another one having been set to active previously. Change-Id: I36b2082a014640ef62098c80f8ab191b768ee072 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189424 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index a427fb6e92d7..2e66c6fd630f 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -75,11 +75,13 @@ class ButtonBox void SelectButton(weld::Toggleable& rButton) { - if (mpCurrentButton) - mpCurrentButton->set_active(false); + weld::Toggleable* pPreviousButton = mpCurrentButton; mpCurrentButton = &rButton; rButton.set_active(true); + + if (pPreviousButton) + pPreviousButton->set_active(false); } }; diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index 8723eb362d77..271f6b8e36e7 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -412,12 +412,16 @@ std::unique_ptr<SfxTabPage> SvxAreaTabPage::CreateFillStyleTabPage(FillType eFil IMPL_LINK(SvxAreaTabPage, SelectFillTypeHdl_Impl, weld::Toggleable&, rButton, void) { - //tdf#124549 - If the button is already active do not toggle it back. - if(!rButton.get_active()) + if (rButton.get_active()) + { + SelectFillType(rButton); + m_bBtnClicked = true; + } + else if (maBox.GetCurrentFillType() == maBox.GetFillType(rButton)) + { + // tdf#124549 - If the button is already active do not toggle it back. rButton.set_active(true); - - SelectFillType(rButton); - m_bBtnClicked = true; + } } void SvxAreaTabPage::SelectFillType(weld::Toggleable& rButton, const SfxItemSet* _pSet) commit d1c526afc29b969297f91ba6922cb72b37267e68 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Aug 12 13:12:22 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Aug 12 20:25:44 2025 +0200 tdf#130857 qt weld: Hide widget scheduled for deletion If a widget is scheduled for deletion in QtInstanceContainer::move because it is removed from the container, but not moved to any new one, hide the widget in addition to calling QObject::deleteLater. This ensures the widget is no longer visible right away, not only when it eventually gets deleted. This also matchws what is already done in QtBuilder::deleteObject. Without this commit in place, rendering issues due to labels of the temporary tab pages created in SvxAreaTabPage::SetOptimalSize were seen with SAL_VCL_QT_USE_WELDED_WIDGETS=1 with a WIP branch for supporting Writer's "Format" -> "Page Style" dialog, tab "Area". (QtInstanceContainer::move gets called from the tab page dtor, ~SfxTabPage.) Change-Id: I8e7210d759905dfc2394af5eae6bd9d7e39e802b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189423 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtInstanceContainer.cxx b/vcl/qt5/QtInstanceContainer.cxx index a3f431444d4c..249d902ab86e 100644 --- a/vcl/qt5/QtInstanceContainer.cxx +++ b/vcl/qt5/QtInstanceContainer.cxx @@ -28,6 +28,7 @@ void QtInstanceContainer::move(weld::Widget* pWidget, weld::Container* pNewParen if (!pNewParent) { + pQWidget->hide(); pQWidget->deleteLater(); return; }