[Libreoffice-commits] core.git: sc/source

Baran Aytas (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 17 08:53:15 UTC 2021


 sc/source/core/data/patattr.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 6184eefa835f0495ed8136471d61837f5662b6d6
Author:     Baran Aytas <barannaytas at gmail.com>
AuthorDate: Sat Sep 11 19:28:47 2021 +0300
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Fri Sep 17 10:52:41 2021 +0200

    tdf#140226: Make use of SfxPoolItems more typesafe by using StaticWhichCast
    
    Change-Id: Ideaf9ec500af7c3aecbb7086a123a3764cac54d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121956
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 795f8671522f..b9b2859104b2 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -581,19 +581,19 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r
 
         if ( pCondSet->GetItemState( ATTR_FONT_COLOR, true, &pItem ) != SfxItemState::SET )
             pItem = &rSrcSet.Get( ATTR_FONT_COLOR );
-        aColorItem.reset(static_cast<SvxColorItem*>(pItem->Clone()));
+        aColorItem.reset(&pItem->Clone()->StaticWhichCast(ATTR_FONT_COLOR));
 
         if ( pCondSet->GetItemState( ATTR_FONT, true, &pItem ) != SfxItemState::SET )
             pItem = &rSrcSet.Get( ATTR_FONT );
-        aFontItem.reset(static_cast<SvxFontItem*>(pItem->Clone()));
+        aFontItem.reset(&pItem->Clone()->StaticWhichCast(ATTR_FONT));
 
         if ( pCondSet->GetItemState( ATTR_CJK_FONT, true, &pItem ) != SfxItemState::SET )
             pItem = &rSrcSet.Get( ATTR_CJK_FONT );
-        aCjkFontItem.reset(static_cast<SvxFontItem*>(pItem->Clone()));
+        aCjkFontItem.reset(&pItem->Clone()->StaticWhichCast(ATTR_CJK_FONT));
 
         if ( pCondSet->GetItemState( ATTR_CTL_FONT, true, &pItem ) != SfxItemState::SET )
             pItem = &rSrcSet.Get( ATTR_CTL_FONT );
-        aCtlFontItem.reset(static_cast<SvxFontItem*>(pItem->Clone()));
+        aCtlFontItem.reset(&pItem->Clone()->StaticWhichCast(ATTR_CTL_FONT));
 
         if ( pCondSet->GetItemState( ATTR_FONT_HEIGHT, true, &pItem ) != SfxItemState::SET )
             pItem = &rSrcSet.Get( ATTR_FONT_HEIGHT );
@@ -627,11 +627,11 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r
 
         if ( pCondSet->GetItemState( ATTR_FONT_UNDERLINE, true, &pItem ) != SfxItemState::SET )
             pItem = &rSrcSet.Get( ATTR_FONT_UNDERLINE );
-        aUnderlineItem.reset(static_cast<SvxUnderlineItem*>(pItem->Clone()));
+        aUnderlineItem.reset(&pItem->Clone()->StaticWhichCast(ATTR_FONT_UNDERLINE));
 
         if ( pCondSet->GetItemState( ATTR_FONT_OVERLINE, true, &pItem ) != SfxItemState::SET )
             pItem = &rSrcSet.Get( ATTR_FONT_OVERLINE );
-        aOverlineItem.reset(static_cast<SvxOverlineItem*>(pItem->Clone()));
+        aOverlineItem.reset(&pItem->Clone()->StaticWhichCast(ATTR_FONT_OVERLINE));
 
         if ( pCondSet->GetItemState( ATTR_FONT_WORDLINE, true, &pItem ) != SfxItemState::SET )
             pItem = &rSrcSet.Get( ATTR_FONT_WORDLINE );


More information about the Libreoffice-commits mailing list