[Libreoffice-commits] .: sc/source svl/inc svl/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Feb 6 11:31:32 PST 2012


 sc/source/ui/app/scmod.cxx            |   42 +++++++++++++++-------------------
 sc/source/ui/docshell/docsh4.cxx      |   19 ++++++---------
 sc/source/ui/drawfunc/fuins2.cxx      |    9 +------
 sc/source/ui/pagedlg/scuitphfedit.cxx |   13 ++--------
 sc/source/ui/view/cellsh1.cxx         |   42 ++++++++++++++++------------------
 sc/source/ui/view/cellsh2.cxx         |    5 ----
 sc/source/ui/view/cellsh4.cxx         |   14 +++--------
 sc/source/ui/view/tabvwsh3.cxx        |    6 +---
 sc/source/ui/view/tabvwshd.cxx        |    5 ----
 sc/source/ui/view/tabvwshf.cxx        |   29 +++++++++--------------
 svl/inc/svl/itemset.hxx               |    2 +
 svl/source/items/itemset.cxx          |    5 ++++
 12 files changed, 77 insertions(+), 114 deletions(-)

New commits:
commit e64c291c5fd1d3ff625dc118ad7e0460df03eb78
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Feb 6 14:29:55 2012 -0500

    I think it's time we had a real method for this...
    
    This helps eliminate dozens of IS_AVAILABLE macros scattered across
    Calc code.  I'm sure we have other similar macros like this
    elsewhere.

diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index a011370..7072387 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -958,8 +958,6 @@ sal_uInt16 ScModule::GetOptDigitLanguage()
 //                      und SID_AUTOSPELL_CHECK
 //
 
-#define IS_AVAILABLE(w,item) (SFX_ITEM_SET==rOptSet.GetItemState((w),sal_True,&item))
-
 void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 {
     sal_uInt16 nOldSpellLang, nOldCjkLang, nOldCtlLang;
@@ -996,26 +994,26 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 
     //  Linguistik nicht mehr
 
-    if ( IS_AVAILABLE(SID_ATTR_METRIC,pItem) )
+    if (rOptSet.HasItem(SID_ATTR_METRIC, pItem))
     {
         PutItem( *pItem );
         pAppCfg->SetAppMetric( (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue() );
         bSaveAppOptions = sal_True;
     }
 
-    if ( IS_AVAILABLE(SCITEM_USERLIST,pItem) )
+    if (rOptSet.HasItem(SCITEM_USERLIST, pItem))
     {
         ScGlobal::SetUserList( ((const ScUserListItem*)pItem)->GetUserList() );
         bSaveAppOptions = sal_True;
     }
 
-    if ( IS_AVAILABLE(SID_SC_OPT_SYNCZOOM,pItem) )
+    if (rOptSet.HasItem(SID_SC_OPT_SYNCZOOM, pItem))
     {
         pAppCfg->SetSynchronizeZoom( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
         bSaveAppOptions = sal_True;
     }
 
-    if ( IS_AVAILABLE(SID_SC_OPT_KEY_BINDING_COMPAT,pItem) )
+    if (rOptSet.HasItem(SID_SC_OPT_KEY_BINDING_COMPAT, pItem))
     {
         sal_uInt16 nVal = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
         ScOptionsUtil::KeyBindingType eOld = pAppCfg->GetKeyBindingType();
@@ -1032,7 +1030,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
     // ViewOptions
     //============================================
 
-    if ( IS_AVAILABLE(SID_SCVIEWOPTIONS,pItem) )
+    if (rOptSet.HasItem(SID_SCVIEWOPTIONS, pItem))
     {
         const ScViewOptions& rNewOpt = ((const ScTpViewItem*)pItem)->GetViewOptions();
 
@@ -1064,7 +1062,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
     // da GridOptions Member der ViewOptions ist!
     //============================================
 
-    if ( IS_AVAILABLE(SID_ATTR_GRID_OPTIONS,pItem) )
+    if ( rOptSet.HasItem(SID_ATTR_GRID_OPTIONS,pItem) )
     {
         ScGridOptions aNewGridOpt( (const SvxOptionsGrid&)((const SvxGridItem&)*pItem) );
 
@@ -1098,7 +1096,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
     // DocOptions
     //============================================
 
-    if ( IS_AVAILABLE(SID_SCDOCOPTIONS,pItem) )
+    if ( rOptSet.HasItem(SID_SCDOCOPTIONS,pItem) )
     {
         const ScDocOptions& rNewOpt = ((const ScTpCalcItem*)pItem)->GetDocOptions();
 
@@ -1126,7 +1124,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
     }
 
     // nach den eigentlichen DocOptions auch noch die TabDistance setzen
-    if ( IS_AVAILABLE(SID_ATTR_DEFTABSTOP,pItem) )
+    if ( rOptSet.HasItem(SID_ATTR_DEFTABSTOP,pItem) )
     {
         sal_uInt16 nTabDist = ((SfxUInt16Item*)pItem)->GetValue();
         ScDocOptions aOpt(GetDocOptions());
@@ -1146,7 +1144,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 
     //  AutoSpell nach den Doc-Options (weil Member)
 
-    if ( IS_AVAILABLE(SID_AUTOSPELL_CHECK,pItem) )              // an Doc-Options
+    if ( rOptSet.HasItem(SID_AUTOSPELL_CHECK,pItem) )              // an Doc-Options
     {
         sal_Bool bDoAutoSpell = ((const SfxBoolItem*)pItem)->GetValue();
 
@@ -1192,43 +1190,43 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
     // InputOptions
     //============================================
 
-    if ( IS_AVAILABLE(SID_SC_INPUT_SELECTIONPOS,pItem) )
+    if ( rOptSet.HasItem(SID_SC_INPUT_SELECTIONPOS,pItem) )
     {
         pInputCfg->SetMoveDir( ((const SfxUInt16Item*)pItem)->GetValue() );
         bSaveInputOptions = sal_True;
     }
-    if ( IS_AVAILABLE(SID_SC_INPUT_SELECTION,pItem) )
+    if ( rOptSet.HasItem(SID_SC_INPUT_SELECTION,pItem) )
     {
         pInputCfg->SetMoveSelection( ((const SfxBoolItem*)pItem)->GetValue() );
         bSaveInputOptions = sal_True;
     }
-    if ( IS_AVAILABLE(SID_SC_INPUT_EDITMODE,pItem) )
+    if ( rOptSet.HasItem(SID_SC_INPUT_EDITMODE,pItem) )
     {
         pInputCfg->SetEnterEdit( ((const SfxBoolItem*)pItem)->GetValue() );
         bSaveInputOptions = sal_True;
     }
-    if ( IS_AVAILABLE(SID_SC_INPUT_FMT_EXPAND,pItem) )
+    if ( rOptSet.HasItem(SID_SC_INPUT_FMT_EXPAND,pItem) )
     {
         pInputCfg->SetExtendFormat( ((const SfxBoolItem*)pItem)->GetValue() );
         bSaveInputOptions = sal_True;
     }
-    if ( IS_AVAILABLE(SID_SC_INPUT_RANGEFINDER,pItem) )
+    if ( rOptSet.HasItem(SID_SC_INPUT_RANGEFINDER,pItem) )
     {
         pInputCfg->SetRangeFinder( ((const SfxBoolItem*)pItem)->GetValue() );
         bSaveInputOptions = sal_True;
     }
-    if ( IS_AVAILABLE(SID_SC_INPUT_REF_EXPAND,pItem) )
+    if ( rOptSet.HasItem(SID_SC_INPUT_REF_EXPAND,pItem) )
     {
         pInputCfg->SetExpandRefs( ((const SfxBoolItem*)pItem)->GetValue() );
         bSaveInputOptions = sal_True;
     }
-    if ( IS_AVAILABLE(SID_SC_INPUT_MARK_HEADER,pItem) )
+    if ( rOptSet.HasItem(SID_SC_INPUT_MARK_HEADER,pItem) )
     {
         pInputCfg->SetMarkHeader( ((const SfxBoolItem*)pItem)->GetValue() );
         bSaveInputOptions = sal_True;
         bUpdateMarks = sal_True;
     }
-    if ( IS_AVAILABLE(SID_SC_INPUT_TEXTWYSIWYG,pItem) )
+    if ( rOptSet.HasItem(SID_SC_INPUT_TEXTWYSIWYG,pItem) )
     {
         sal_Bool bNew = ((const SfxBoolItem*)pItem)->GetValue();
         if ( bNew != pInputCfg->GetTextWysiwyg() )
@@ -1238,7 +1236,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
             bUpdateRefDev = sal_True;
         }
     }
-    if( IS_AVAILABLE( SID_SC_INPUT_REPLCELLSWARN, pItem ) )
+    if( rOptSet.HasItem( SID_SC_INPUT_REPLCELLSWARN, pItem ) )
     {
         pInputCfg->SetReplaceCellsWarn( ((const SfxBoolItem*)pItem)->GetValue() );
         bSaveInputOptions = sal_True;
@@ -1248,7 +1246,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
     // PrintOptions
     //============================================
 
-    if ( IS_AVAILABLE(SID_SCPRINTOPTIONS,pItem) )
+    if ( rOptSet.HasItem(SID_SCPRINTOPTIONS,pItem) )
     {
         const ScPrintOptions& rNewOpt = ((const ScTpPrintItem*)pItem)->GetPrintOptions();
         SetPrintOptions( rNewOpt );
@@ -1344,8 +1342,6 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
     }
 }
 
-#undef IS_AVAILABLE
-
 //------------------------------------------------------------------
 //
 //                      Input-Handler
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 7e5f395..7718b42 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -131,9 +131,6 @@ using namespace ::com::sun::star;
         ((SvxSetItem&)(set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \
             Get(ATTR_PAGE_SHARED)).GetValue()
 
-#define IS_AVAILABLE(WhichId,ppItem) \
-    (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
-
 #define SC_PREVIEW_SIZE_X   10000
 #define SC_PREVIEW_SIZE_Y   12400
 
@@ -159,10 +156,10 @@ void ScDocShell::Execute( SfxRequest& rReq )
             const SfxPoolItem* pRowItem;
             const SfxPoolItem* pTabItem;
             const SfxPoolItem* pTextItem;
-            if( pReqArgs && IS_AVAILABLE( FN_PARAM_1, &pColItem ) &&
-                            IS_AVAILABLE( FN_PARAM_2, &pRowItem ) &&
-                            IS_AVAILABLE( FN_PARAM_3, &pTabItem ) &&
-                            IS_AVAILABLE( SID_SC_SETTEXT, &pTextItem ) )
+            if( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, pColItem ) &&
+                            pReqArgs->HasItem( FN_PARAM_2, pRowItem ) &&
+                            pReqArgs->HasItem( FN_PARAM_3, pTabItem ) &&
+                            pReqArgs->HasItem( SID_SC_SETTEXT, pTextItem ) )
             {
                 //  Parameter sind 1-based !!!
                 SCCOL nCol = ((SfxInt16Item*)pColItem)->GetValue() - 1;
@@ -291,18 +288,18 @@ void ScDocShell::Execute( SfxRequest& rReq )
                 sal_Bool bRowInit = false;
                 sal_Bool bAddRange = (nSlot == SID_CHART_ADDSOURCE);
 
-                if( IS_AVAILABLE( SID_CHART_NAME, &pItem ) )
+                if( pReqArgs->HasItem( SID_CHART_NAME, pItem ) )
                     aChartName = ((const SfxStringItem*)pItem)->GetValue();
 
-                if( IS_AVAILABLE( SID_CHART_SOURCE, &pItem ) )
+                if( pReqArgs->HasItem( SID_CHART_SOURCE, pItem ) )
                     aRangeName = ((const SfxStringItem*)pItem)->GetValue();
 
-                if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+                if( pReqArgs->HasItem( FN_PARAM_1, pItem ) )
                 {
                     bColHeaders = ((const SfxBoolItem*)pItem)->GetValue();
                     bColInit = sal_True;
                 }
-                if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
+                if( pReqArgs->HasItem( FN_PARAM_2, pItem ) )
                 {
                     bRowHeaders = ((const SfxBoolItem*)pItem)->GetValue();
                     bRowInit = sal_True;
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index ba7f2df..4cbf062 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -95,11 +95,6 @@ using namespace ::com::sun::star;
 
 extern SdrObject* pSkipPaintObj;            // output.cxx - dieses Objekt nicht zeichnen
 
-//------------------------------------------------------------------------
-
-#define IS_AVAILABLE(WhichId,ppItem) \
-    (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
-
 namespace {
 
 void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScViewData* pViewData,
@@ -507,7 +502,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
         if( pReqArgs )
         {
             const SfxPoolItem* pItem;
-            if( IS_AVAILABLE( FN_PARAM_5, &pItem ) )
+            if( pReqArgs->HasItem( FN_PARAM_5, pItem ) )
             aRangeString = ::rtl::OUString( ((const SfxStringItem*)pItem)->GetValue());
 
             aPositionRange = pViewSh->GetViewData()->GetCurPos();
@@ -607,7 +602,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
             const SfxPoolItem* pItem;
             sal_uInt16 nToTable = 0;
 
-            if( IS_AVAILABLE( FN_PARAM_4, &pItem ) )
+            if( pReqArgs->HasItem( FN_PARAM_4, pItem ) )
             {
                 if ( pItem->ISA( SfxUInt16Item ) )
                     nToTable = ((const SfxUInt16Item*)pItem)->GetValue();
diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx
index 6eee2dd..3b78edf 100644
--- a/sc/source/ui/pagedlg/scuitphfedit.cxx
+++ b/sc/source/ui/pagedlg/scuitphfedit.cxx
@@ -161,15 +161,12 @@ void ScHFEditPage::SetNumType(SvxNumType eNumType)
     aWndRight.SetNumType(eNumType);
 }
 
-// -----------------------------------------------------------------------
-
-#define IS_AVAILABLE(w)(rCoreSet.GetItemState( (w) ) >= SFX_ITEM_AVAILABLE)
-
 void ScHFEditPage::Reset( const SfxItemSet& rCoreSet )
 {
-    if ( IS_AVAILABLE( nWhich ) )
+    const SfxPoolItem* pItem = NULL;
+    if ( rCoreSet.HasItem(nWhich, pItem) )
     {
-        const ScPageHFItem& rItem = (const ScPageHFItem&)(rCoreSet.Get( nWhich ));
+        const ScPageHFItem& rItem = static_cast<const ScPageHFItem&>(*pItem);
 
         if( const EditTextObject* pLeft = rItem.GetLeftArea() )
             aWndLeft.SetText( *pLeft );
@@ -182,10 +179,6 @@ void ScHFEditPage::Reset( const SfxItemSet& rCoreSet )
     }
 }
 
-#undef IS_AVAILABLE
-
-// -----------------------------------------------------------------------
-
 sal_Bool ScHFEditPage::FillItemSet( SfxItemSet& rCoreSet )
 {
     ScPageHFItem    aItem( nWhich );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 603d7b8..0b71f25 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -105,8 +105,6 @@
 #include <svx/svxdlg.hxx>
 #include <svx/dialogs.hrc>
 #include "scabstdlg.hxx"
-#define IS_AVAILABLE(WhichId,ppItem) \
-    (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
 
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
@@ -201,7 +199,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     const SfxPoolItem* pItem;
                     String aFlags;
 
-                    if( IS_AVAILABLE( FID_INS_CELL, &pItem ) )
+                    if( pReqArgs->HasItem( FID_INS_CELL, pItem ) )
                         aFlags = ((const SfxStringItem*)pItem)->GetValue();
                     if( aFlags.Len() )
                     {
@@ -271,7 +269,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     const SfxPoolItem* pItem;
                     String aFlags;
 
-                    if( IS_AVAILABLE( FID_DELETE_CELL, &pItem ) )
+                    if( pReqArgs->HasItem( FID_DELETE_CELL, pItem ) )
                         aFlags = ((const SfxStringItem*)pItem)->GetValue();
                     if( aFlags.Len() )
                     {
@@ -354,7 +352,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     const   SfxPoolItem* pItem;
                     String  aFlags = 'A';
 
-                    if( IS_AVAILABLE( SID_DELETE, &pItem ) )
+                    if( pReqArgs->HasItem( SID_DELETE, pItem ) )
                         aFlags = ((const SfxStringItem*)pItem)->GetValue();
 
                     aFlags.ToUpperAscii();
@@ -468,7 +466,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     const   SfxPoolItem* pItem;
                     String  aFlags = 'A';
 
-                    if( IS_AVAILABLE( FID_FILL_TAB, &pItem ) )
+                    if( pReqArgs->HasItem( FID_FILL_TAB, pItem ) )
                         aFlags = ((const SfxStringItem*)pItem)->GetValue();
 
                     aFlags.ToUpperAscii();
@@ -587,17 +585,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
                     bDoIt=false;
 
-                    if( IS_AVAILABLE( FID_FILL_SERIES, &pItem ) )
+                    if( pReqArgs->HasItem( FID_FILL_SERIES, pItem ) )
                         aFillDir = ((const SfxStringItem*)pItem)->GetValue();
-                    if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+                    if( pReqArgs->HasItem( FN_PARAM_1, pItem ) )
                         aFillCmd = ((const SfxStringItem*)pItem)->GetValue();
-                    if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
+                    if( pReqArgs->HasItem( FN_PARAM_2, pItem ) )
                         aFillDateCmd = ((const SfxStringItem*)pItem)->GetValue();
-                    if( IS_AVAILABLE( FN_PARAM_3, &pItem ) )
+                    if( pReqArgs->HasItem( FN_PARAM_3, pItem ) )
                         aFillStep = ((const SfxStringItem*)pItem)->GetValue();
-                    if( IS_AVAILABLE( FN_PARAM_4, &pItem ) )
+                    if( pReqArgs->HasItem( FN_PARAM_4, pItem ) )
                         aFillStart = ((const SfxStringItem*)pItem)->GetValue();
-                    if( IS_AVAILABLE( FN_PARAM_5, &pItem ) )
+                    if( pReqArgs->HasItem( FN_PARAM_5, pItem ) )
                         aFillMax = ((const SfxStringItem*)pItem)->GetValue();
 
                     if( aFillDir.Len() )
@@ -838,7 +836,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 {
                     const SfxPoolItem* pItem;
 
-                    if( IS_AVAILABLE( FID_FILL_AUTO, &pItem ) )
+                    if( pReqArgs->HasItem( FID_FILL_AUTO, pItem ) )
                     {
                         ScAddress aScAddress;
                         String aArg = ((const SfxStringItem*)pItem)->GetValue();
@@ -1029,7 +1027,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     const SfxPoolItem* pItem;
                     bOk = false;
 
-                    if( IS_AVAILABLE( SID_OUTLINE_MAKE, &pItem ) )
+                    if( pReqArgs->HasItem( SID_OUTLINE_MAKE, pItem ) )
                     {
                         String aCol = ((const SfxStringItem*)pItem)->GetValue();
                         aCol.ToUpperAscii();
@@ -1091,7 +1089,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     const SfxPoolItem* pItem;
                     bOk = false;
 
-                    if( IS_AVAILABLE( SID_OUTLINE_REMOVE, &pItem ) )
+                    if( pReqArgs->HasItem( SID_OUTLINE_REMOVE, pItem ) )
                     {
                         String aCol = ((const SfxStringItem*)pItem)->GetValue();
                         aCol.ToUpperAscii();
@@ -1232,7 +1230,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         const   SfxPoolItem* pItem;
                         String  aFlags = 'A';
 
-                        if( IS_AVAILABLE( FID_INS_CELL_CONTENTS, &pItem ) )
+                        if( pReqArgs->HasItem( FID_INS_CELL_CONTENTS, pItem ) )
                             aFlags = ((const SfxStringItem*)pItem)->GetValue();
 
                         aFlags.ToUpperAscii();
@@ -1717,13 +1715,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 const SfxPoolItem* pItem;
                 String  aName, aSymbol, aAttrib;
 
-                if( IS_AVAILABLE( FID_DEFINE_NAME, &pItem ) )
+                if( pReqArgs->HasItem( FID_DEFINE_NAME, pItem ) )
                     aName = ((const SfxStringItem*)pItem)->GetValue();
 
-                if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+                if( pReqArgs->HasItem( FN_PARAM_1, pItem ) )
                     aSymbol = ((const SfxStringItem*)pItem)->GetValue();
 
-                if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
+                if( pReqArgs->HasItem( FN_PARAM_2, pItem ) )
                     aAttrib = ((const SfxStringItem*)pItem)->GetValue();
 
                 if ( aName.Len() && aSymbol.Len() )
@@ -1774,7 +1772,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 {
                     const SfxPoolItem* pItem;
 
-                    if( IS_AVAILABLE( SID_UPDATECHART, &pItem ) )
+                    if( pReqArgs->HasItem( SID_UPDATECHART, pItem ) )
                         bAll = ((const SfxBoolItem*)pItem)->GetValue();
                 }
 
@@ -2010,7 +2008,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             if( pReqArgs )
             {
                 const SfxPoolItem* pItem;
-                if( IS_AVAILABLE( SID_HYPERLINK_SETLINK, &pItem ) )
+                if( pReqArgs->HasItem( SID_HYPERLINK_SETLINK, pItem ) )
                 {
                     const SvxHyperlinkItem* pHyper = (const SvxHyperlinkItem*) pItem;
                     const String& rName   = pHyper->GetName();
@@ -2030,7 +2028,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             if( pReqArgs )
             {
                 const SfxPoolItem* pItem;
-                if( IS_AVAILABLE( FID_CONDITIONAL_FORMAT, &pItem ) )
+                if( pReqArgs->HasItem( FID_CONDITIONAL_FORMAT, pItem ) )
                 {
                     // when RefInput has switched to other tabs as data table, switch back
                     if ( GetViewData()->GetTabNo() != GetViewData()->GetRefTabNo() )
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index a51e8b9..210277f 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -78,11 +78,6 @@
 
 using namespace com::sun::star;
 
-#define IS_AVAILABLE(WhichId,ppItem) \
-    (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
-
-//------------------------------------------------------------------
-
 bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange )
 {
     OSL_ENSURE( pData, "lcl_GetTextToColumnsRange: pData is null!" );
diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index 7c40ca9..1e65f43 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -50,12 +50,6 @@
 
 #include "vcl/svapp.hxx"
 
-//------------------------------------------------------------------
-
-#define IS_AVAILABLE(WhichId,ppItem) \
-    (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
-
-
 void ScCellShell::ExecuteCursor( SfxRequest& rReq )
 {
     ScViewData* pData = GetViewData();
@@ -69,9 +63,9 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
     if ( pReqArgs != NULL )
     {
         const   SfxPoolItem* pItem;
-        if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+        if (pReqArgs->HasItem(FN_PARAM_1, pItem))
             nRepeat = static_cast<SCsCOLROW>(((const SfxInt16Item*)pItem)->GetValue());
-        if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
+        if (pReqArgs->HasItem(FN_PARAM_2, pItem))
             bSel = ((const SfxBoolItem*)pItem)->GetValue();
     }
     else
@@ -231,7 +225,7 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
     if ( pReqArgs != NULL )
     {
         const SfxPoolItem* pItem;
-        if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+        if (pReqArgs->HasItem(FN_PARAM_1, pItem))
             nRepeat = static_cast<SCsCOLROW>(((const SfxInt16Item*)pItem)->GetValue());
     }
 
@@ -419,7 +413,7 @@ void ScCellShell::ExecutePage( SfxRequest& rReq )
     if ( pReqArgs != NULL )
     {
         const   SfxPoolItem* pItem;
-        if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
+        if (pReqArgs->HasItem(FN_PARAM_2, pItem))
             bSel = ((const SfxBoolItem*)pItem)->GetValue();
     }
     else
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 6745097..ebd6490 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -85,8 +85,6 @@
 using ::std::auto_ptr;
 
 #define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() )
-#define IS_AVAILABLE(WhichId,ppItem) \
-    (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
 #define GET_STRING(nid) ((const SfxStringItem&)pReqArgs->Get(nid)).GetValue()
 #define GET_UINT16(nid) ((const SfxUInt16Item&)pReqArgs->Get(nid)).GetValue()
 #define GET_BOOL(nid)   ((const SfxBoolItem&)pReqArgs->Get(nid)).GetValue()
@@ -998,7 +996,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
                 if( pReqArgs )
                 {
                     const SfxPoolItem* pItem;
-                    if( IS_AVAILABLE( FID_PROTECT_DOC, &pItem ) &&
+                    if( pReqArgs->HasItem( FID_PROTECT_DOC, pItem ) &&
                         ((const SfxBoolItem*)pItem)->GetValue() == pDoc->IsDocProtected() )
                     {
                         rReq.Ignore();
@@ -1071,7 +1069,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
             {
                 const SfxPoolItem* pItem;
                 bool bNewProtection = !bOldProtection;
-                if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
+                if( pReqArgs->HasItem( FID_PROTECT_TABLE, pItem ) )
                     bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
                 if( bNewProtection == bOldProtection )
                 {
diff --git a/sc/source/ui/view/tabvwshd.cxx b/sc/source/ui/view/tabvwshd.cxx
index 2755fdd..ea92d23 100644
--- a/sc/source/ui/view/tabvwshd.cxx
+++ b/sc/source/ui/view/tabvwshd.cxx
@@ -52,11 +52,6 @@
 
 // STATIC DATA -----------------------------------------------------------
 
-//------------------------------------------------------------------
-
-#define IS_AVAILABLE(WhichId,ppItem) \
-    (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
-
 //!         Parent-Window fuer Dialoge
 //!         Problem: OLE Server!
 
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 897b8d7..e9558d3 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -64,11 +64,6 @@
 using ::boost::scoped_ptr;
 using namespace com::sun::star;
 
-#define IS_AVAILABLE(WhichId,ppItem) \
-    (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
-
-//------------------------------------------------------------------
-
 void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 {
     ScViewData* pViewData   = GetViewData();
@@ -92,7 +87,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                 if( pReqArgs != NULL )
                 {
                     const SfxPoolItem* pItem;
-                    if( IS_AVAILABLE( FID_TABLE_VISIBLE, &pItem ) )
+                    if( pReqArgs->HasItem( FID_TABLE_VISIBLE, pItem ) )
                         bVisible = ((const SfxBoolItem*)pItem)->GetValue();
                 }
 
@@ -134,7 +129,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                 if( pReqArgs != NULL )
                 {
                     const SfxPoolItem* pItem;
-                    if( IS_AVAILABLE( FID_TABLE_HIDE, &pItem ) )
+                    if( pReqArgs->HasItem( FID_TABLE_HIDE, pItem ) )
                         aName = ((const SfxStringItem*)pItem)->GetValue();
                 }
 
@@ -159,7 +154,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                 if ( pReqArgs )
                 {
                     const SfxPoolItem* pItem;
-                    if( IS_AVAILABLE( FID_TABLE_SHOW, &pItem ) )
+                    if( pReqArgs->HasItem( FID_TABLE_SHOW, pItem ) )
                     {
                         aName = ((const SfxStringItem*)pItem)->GetValue();
 
@@ -222,8 +217,8 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                     const SfxPoolItem*  pNameItem;
                     String              aName;
 
-                    if ( IS_AVAILABLE( FN_PARAM_1, &pTabItem ) &&
-                         IS_AVAILABLE( nSlot, &pNameItem ) )
+                    if ( pReqArgs->HasItem( FN_PARAM_1, pTabItem ) &&
+                         pReqArgs->HasItem( nSlot, pNameItem ) )
                     {
                         //  Tabellennr. von Basic: 1-basiert
 
@@ -369,10 +364,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                     const SfxPoolItem* pItem;
                     String      aName;
 
-                    if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+                    if( pReqArgs->HasItem( FN_PARAM_1, pItem ) )
                         nTabNr = ((const SfxUInt16Item*)pItem)->GetValue();
 
-                    if( IS_AVAILABLE( nSlot, &pItem ) )
+                    if( pReqArgs->HasItem( nSlot, pItem ) )
                         aName = ((const SfxStringItem*)pItem)->GetValue();
 
                     switch ( nSlot )
@@ -486,16 +481,16 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                     SCTAB nTableCount = pDoc->GetTableCount();
                     const SfxPoolItem* pItem;
 
-                    if( IS_AVAILABLE( FID_TAB_MOVE, &pItem ) )
+                    if( pReqArgs->HasItem( FID_TAB_MOVE, pItem ) )
                         aDocName = ((const SfxStringItem*)pItem)->GetValue();
-                    if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+                    if( pReqArgs->HasItem( FN_PARAM_1, pItem ) )
                     {
                         //  Tabelle ist 1-basiert
                         nTab = ((const SfxUInt16Item*)pItem)->GetValue() - 1;
                         if ( nTab >= nTableCount )
                             nTab = SC_TAB_APPEND;
                     }
-                    if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
+                    if( pReqArgs->HasItem( FN_PARAM_2, pItem ) )
                         bCpy = ((const SfxBoolItem*)pItem)->GetValue();
 
                     if (!aDocName.isEmpty())
@@ -705,10 +700,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                     sal_Bool                bDone = false;
                     const SfxPoolItem*  pItem;
                     Color               aColor;
-                    if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+                    if( pReqArgs->HasItem( FN_PARAM_1, pItem ) )
                         nTabNr = ((const SfxUInt16Item*)pItem)->GetValue();
 
-                    if( IS_AVAILABLE( nSlot, &pItem ) )
+                    if( pReqArgs->HasItem( nSlot, pItem ) )
                         aColor = ((const SvxColorItem*)pItem)->GetValue();
 
                     if ( nTabSelCount > 1 )
diff --git a/svl/inc/svl/itemset.hxx b/svl/inc/svl/itemset.hxx
index b3dea2c..e939365 100644
--- a/svl/inc/svl/itemset.hxx
+++ b/svl/inc/svl/itemset.hxx
@@ -134,6 +134,8 @@ public:
                                                 sal_Bool bSrchInParent = sal_True,
                                                 const SfxPoolItem **ppItem = 0 ) const;
 
+    bool                        HasItem(sal_uInt16 nWhich, const SfxPoolItem*& rpItem) const;
+
     virtual void                DisableItem(sal_uInt16 nWhich);
     virtual void                InvalidateItem( sal_uInt16 nWhich );
     virtual sal_uInt16              ClearItem( sal_uInt16 nWhich = 0);
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 62ac9f2..f094d93 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -546,6 +546,11 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
     return eRet;
 }
 
+bool SfxItemSet::HasItem(sal_uInt16 nWhich, const SfxPoolItem*& rpItem) const
+{
+    return SFX_ITEM_SET == GetItemState(nWhich, true, &rpItem);
+}
+
 // -----------------------------------------------------------------------
 
 const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich )


More information about the Libreoffice-commits mailing list