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

Jochen Nitschke j.nitschke+logerrit at ok.de
Mon Jul 25 06:01:22 UTC 2016


 sc/source/core/data/table5.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 54cc2f587d2ee2deb9fb334b1b9464213b8823c8
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sun Jul 24 21:16:50 2016 +0200

    sc: replace GET_SCALEVALUE macro with a lambda
    
    Change-Id: Id41cf9fec355f84fdc52565e089a8bb04c0e9bdb
    Reviewed-on: https://gerrit.libreoffice.org/27492
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 2ae8872..eb35dd0 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -51,8 +51,6 @@ using ::com::sun::star::uno::Sequence;
 using ::com::sun::star::sheet::TablePageBreakData;
 using ::std::set;
 
-#define GET_SCALEVALUE(set,id)  static_cast<const SfxUInt16Item&>(set.Get( id )).GetValue()
-
 void ScTable::UpdatePageBreaks( const ScRange* pUserArea )
 {
     if ( pDocument->IsImportingXML() )
@@ -1132,15 +1130,17 @@ void ScTable::SetPageStyle( const OUString& rName )
         if ( aPageStyle != aStrNew )
         {
             SfxStyleSheetBase* pOldStyle = pStylePool->Find( aPageStyle, SfxStyleFamily::Page );
-
             if ( pOldStyle && pNewStyle )
             {
                 SfxItemSet&  rOldSet          = pOldStyle->GetItemSet();
                 SfxItemSet&  rNewSet          = pNewStyle->GetItemSet();
-                const sal_uInt16 nOldScale        = GET_SCALEVALUE(rOldSet,ATTR_PAGE_SCALE);
-                const sal_uInt16 nOldScaleToPages = GET_SCALEVALUE(rOldSet,ATTR_PAGE_SCALETOPAGES);
-                const sal_uInt16 nNewScale        = GET_SCALEVALUE(rNewSet,ATTR_PAGE_SCALE);
-                const sal_uInt16 nNewScaleToPages = GET_SCALEVALUE(rNewSet,ATTR_PAGE_SCALETOPAGES);
+                auto getScaleValue = [](const SfxItemSet& rSet, sal_uInt16 nId)
+                    { return static_cast<const SfxUInt16Item&>(rSet.Get(nId)).GetValue(); };
+
+                const sal_uInt16 nOldScale        = getScaleValue(rOldSet,ATTR_PAGE_SCALE);
+                const sal_uInt16 nOldScaleToPages = getScaleValue(rOldSet,ATTR_PAGE_SCALETOPAGES);
+                const sal_uInt16 nNewScale        = getScaleValue(rNewSet,ATTR_PAGE_SCALE);
+                const sal_uInt16 nNewScaleToPages = getScaleValue(rNewSet,ATTR_PAGE_SCALETOPAGES);
 
                 if ( (nOldScale != nNewScale) || (nOldScaleToPages != nNewScaleToPages) )
                     InvalidateTextWidth(nullptr, nullptr, false, false);


More information about the Libreoffice-commits mailing list