svx/source/tbxctrls/PaletteManager.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit c7f3e925693c48d6653d83bc7186de55b8bab053
Author:     Mike Kaganski <[email protected]>
AuthorDate: Mon Nov 24 17:21:26 2025 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Tue Nov 25 11:01:23 2025 +0100

    GetItem with TypedWhichId already returns needed type
    
    No need to assign to SfxPoolItem*, only to cast to needed type again.
    
    Change-Id: If3725284bf693c8d5bc2d896190f9cb6d39d1a39
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194472
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins
    Code-Style: Mike Kaganski <[email protected]>

diff --git a/svx/source/tbxctrls/PaletteManager.cxx 
b/svx/source/tbxctrls/PaletteManager.cxx
index 71ea035d3fe9..fb592d1b3a06 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -61,9 +61,8 @@ PaletteManager::PaletteManager() :
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
     if(pDocSh)
     {
-        const SfxPoolItem* pItem = nullptr;
-        if( nullptr != ( pItem = pDocSh->GetItem(SID_COLOR_TABLE) ) )
-            mpColorList = 
pItem->StaticWhichCast(SID_COLOR_TABLE).GetColorList();
+        if (const SvxColorListItem* pItem = pDocSh->GetItem(SID_COLOR_TABLE))
+            mpColorList = pItem->GetColorList();
     }
     if(!mpColorList.is())
         mpColorList = XColorList::CreateStdColorList();
@@ -324,9 +323,8 @@ OUString PaletteManager::GetPaletteName()
         SfxObjectShell* pDocSh = SfxObjectShell::Current();
         if(pDocSh)
         {
-            const SfxPoolItem* pItem = nullptr;
-            if( nullptr != ( pItem = pDocSh->GetItem(SID_COLOR_TABLE) ) )
-                mpColorList = 
pItem->StaticWhichCast(SID_COLOR_TABLE).GetColorList();
+            if (const SvxColorListItem* pItem = 
pDocSh->GetItem(SID_COLOR_TABLE))
+                mpColorList = pItem->GetColorList();
         }
     }
     return aNames[mnCurrentPalette];

Reply via email to