cui/source/inc/cuitabarea.hxx  |   36 +++++++++++++++++++-----------------
 cui/source/tabpages/tparea.cxx |    6 ++++--
 2 files changed, 23 insertions(+), 19 deletions(-)

New commits:
commit c636c11f6b61af60d7a789cce2c68832cfe42f7c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Aug 11 14:53:33 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Aug 12 06:37:00 2025 +0200

    cui: Switch sal_uInt16 param to FillType
    
    Change-Id: I5a456343c72975319a4071d2a8760d59aee247bd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189371
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index acf2aadf30d0..844c9b2fa646 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -405,10 +405,12 @@ std::unique_ptr<SfxTabPage> 
SvxAreaTabPage::CreateWithSlideBackground(
 
 namespace {
 
-std::unique_ptr<SfxTabPage> lcl_CreateFillStyleTabPage(sal_uInt16 nId, 
weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& 
rSet)
+std::unique_ptr<SfxTabPage> lcl_CreateFillStyleTabPage(FillType eFillType, 
weld::Container* pPage,
+                                                       weld::DialogController* 
pController,
+                                                       const SfxItemSet& rSet)
 {
     CreateTabPage fnCreate = nullptr;
-    switch(nId)
+    switch (eFillType)
     {
         case TRANSPARENT: fnCreate = nullptr; break;
         case SOLID: fnCreate = &SvxColorTabPage::Create; break;
commit 326afc88739d57207c922ca2c3ae508864f92485
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Aug 11 14:33:03 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Aug 12 06:36:54 2025 +0200

    cui: Remember current area tab page button by ptr instead of index
    
    Change-Id: Ia6d074ab03ba5398dcf5dd27f5953209f139ce95
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189370
    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 5be6f1695d16..2fcdca1d628f 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -28,8 +28,6 @@
 #include <svx/PaletteManager.hxx>
 #include <svx/svdview.hxx>
 
-#define NO_BUTTON_SELECTED -1
-
 class ColorListBox;
 class SdrModel;
 class SvxBitmapCtl;
@@ -38,37 +36,41 @@ class SvxBitmapCtl;
 class ButtonBox
 {
     private:
-        sal_Int32 mnCurrentButton;
+        weld::Toggleable* mpCurrentButton;
         std::vector<weld::ToggleButton*> maButtonList;
         std::map<weld::Toggleable*, sal_Int32 > maButtonToPos;
     public:
         ButtonBox()
-        {
-            mnCurrentButton = NO_BUTTON_SELECTED;
-        };
+            : mpCurrentButton(nullptr) {};
+
         void AddButton(weld::ToggleButton* pButton)
         {
             maButtonList.push_back(pButton);
             maButtonToPos.insert( std::make_pair(pButton, maButtonList.size() 
- 1) );
         }
-        sal_Int32 GetCurrentButtonPos() const { return mnCurrentButton; }
-        sal_Int32 GetButtonPos(weld::Toggleable& rButton)
+
+        sal_Int32 GetCurrentButtonPos() const
+        {
+            if (mpCurrentButton)
+                return GetButtonPos(*mpCurrentButton);
+
+            return -1;
+        }
+
+        sal_Int32 GetButtonPos(weld::Toggleable& rButton) const
         {
             std::map<weld::Toggleable*, sal_Int32>::const_iterator aBtnPos = 
maButtonToPos.find(&rButton);
             assert(aBtnPos != maButtonToPos.end() && "Unknown button");
             return aBtnPos->second;
         }
+
         void SelectButton(weld::Toggleable& rButton)
         {
-            const sal_Int32 nPos = GetButtonPos(rButton);
-            assert(nPos >= 0 && "Invalid button position");
-
-            if (mnCurrentButton != NO_BUTTON_SELECTED)
-            {
-                maButtonList[mnCurrentButton]->set_active(false);
-            }
-            mnCurrentButton = nPos;
-            maButtonList[mnCurrentButton]->set_active(true);
+            if (mpCurrentButton)
+                mpCurrentButton->set_active(false);
+
+            mpCurrentButton = &rButton;
+            rButton.set_active(true);
         }
 };
 

Reply via email to