diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-25 18:40:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-26 10:57:03 +0200 |
commit | ac2d415a52f22caf0012b7d9b17d015aca27db9d (patch) | |
tree | 5c2f153ea470ff77dd00109d3006547869e9b332 /sc/source/ui/vba | |
parent | 47f0e83989c4c03d9690229b6433a5541032a3eb (diff) |
loplugin:oncevar in sc
Change-Id: Ice59e286debb6bd0eb692f2b2b0c2c5087c069c0
Reviewed-on: https://gerrit.libreoffice.org/39239
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/vba')
-rw-r--r-- | sc/source/ui/vba/excelvbahelper.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/vba/vbamenuitems.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/vba/vbamenus.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/vba/vbanames.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/vba/vbasheetobject.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbawindow.cxx | 36 |
7 files changed, 29 insertions, 44 deletions
diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index 41f12cec6cfc..b0ecaeb83245 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -194,7 +194,6 @@ implnCut( const uno::Reference< frame::XModel>& xModel ) void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bTranspose) { PasteCellsWarningReseter resetWarningBox; - InsCellCmd eMoveMode = INS_NONE; ScTabViewShell* pTabViewShell = getBestViewShell( xModel ); if ( pTabViewShell ) @@ -209,7 +208,7 @@ void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, InsertDele pDoc = pOwnClip->GetDocument(); pTabViewShell->PasteFromClip( nFlags, pDoc, nFunction, bSkipEmpty, bTranspose, false, - eMoveMode, InsertDeleteFlags::NONE, true ); + INS_NONE, InsertDeleteFlags::NONE, true ); pTabViewShell->CellContentChanged(); } } diff --git a/sc/source/ui/vba/vbamenuitems.cxx b/sc/source/ui/vba/vbamenuitems.cxx index 76fb396352c9..8d12983e28d6 100644 --- a/sc/source/ui/vba/vbamenuitems.cxx +++ b/sc/source/ui/vba/vbamenuitems.cxx @@ -101,8 +101,9 @@ ScVbaMenuItems::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) uno::Reference< excel::XMenuItem > SAL_CALL ScVbaMenuItems::Add( const OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& /*ShortcutKey*/, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& /*StatusBar*/, const css::uno::Any& /*HelpFile*/, const css::uno::Any& /*HelpContextID*/ ) { - sal_Int32 nType = office::MsoControlType::msoControlButton; - uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore ); + uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( + uno::makeAny( office::MsoControlType::msoControlButton ), + uno::Any(), uno::Any(), Before, Restore ); xCommandBarControl->setCaption( Caption ); if( OnAction.hasValue() ) { diff --git a/sc/source/ui/vba/vbamenus.cxx b/sc/source/ui/vba/vbamenus.cxx index be32c02008d0..9c3f86ad904c 100644 --- a/sc/source/ui/vba/vbamenus.cxx +++ b/sc/source/ui/vba/vbamenus.cxx @@ -93,8 +93,9 @@ ScVbaMenus::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) uno::Reference< excel::XMenu > SAL_CALL ScVbaMenus::Add( const OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) { - sal_Int32 nType = office::MsoControlType::msoControlPopup; - uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore ); + uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( + uno::makeAny( office::MsoControlType::msoControlPopup ), + uno::Any(), uno::Any(), Before, Restore ); xCommandBarControl->setCaption( Caption ); return uno::Reference< excel::XMenu >( new ScVbaMenu( this, mxContext, xCommandBarControl ) ); } diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index 9ff4af38f77d..7267aa615521 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -103,10 +103,8 @@ ScVbaNames::Add( const css::uno::Any& Name , { if ( ScRangeData::IsNameValid( sName , getScDocument() ) != ScRangeData::NAME_VALID ) { - OUString sResult ; - sal_Int32 nToken = 0; sal_Int32 nIndex = 0; - sResult = sName.getToken( nToken , '!' , nIndex ); + OUString sResult = sName.getToken( 0 , '!' , nIndex ); if ( -1 == nIndex ) sResult = sName; else @@ -200,7 +198,6 @@ ScVbaNames::Add( const css::uno::Any& Name , uno::Any aAny2; if ( mxNames.is() ) { - sal_Int32 nUnoType = 0; table::CellAddress aCellAddr( aAddr.Sheet , aAddr.StartColumn , aAddr.StartRow ); if ( mxNames->hasByName( sName ) ) mxNames->removeByName(sName); @@ -215,7 +212,7 @@ ScVbaNames::Add( const css::uno::Any& Name , sTmp += ","; sTmp = sTmp + "'" + xRange->getWorksheet()->getName() + "'." + sRangeAdd; } - mxNames->addNewByName( sName , sTmp , aCellAddr , nUnoType); + mxNames->addNewByName( sName, sTmp, aCellAddr, 0/*nUnoType*/); return Item( uno::makeAny( sName ), uno::Any() ); } } diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 49a0d263bb48..59769264ec1a 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -1266,7 +1266,7 @@ inline table::CellRangeAddress lclGetRangeAddress( const uno::Reference< RangeTy void lclClearRange( const uno::Reference< table::XCellRange >& rxCellRange ) { using namespace ::com::sun::star::sheet::CellFlags; - sal_Int32 nFlags = VALUE | DATETIME | STRING | ANNOTATION | FORMULA | HARDATTR | STYLES | EDITATTR | FORMATTED; + sal_Int32 const nFlags = VALUE | DATETIME | STRING | ANNOTATION | FORMULA | HARDATTR | STYLES | EDITATTR | FORMATTED; uno::Reference< sheet::XSheetOperation > xSheetOperation( rxCellRange, uno::UNO_QUERY_THROW ); xSheetOperation->clearContents( nFlags ); } @@ -1586,7 +1586,7 @@ void SAL_CALL ScVbaRange::Clear() { using namespace ::com::sun::star::sheet::CellFlags; - sal_Int32 nFlags = VALUE | DATETIME | STRING | FORMULA | HARDATTR | EDITATTR | FORMATTED; + sal_Int32 const nFlags = VALUE | DATETIME | STRING | FORMULA | HARDATTR | EDITATTR | FORMATTED; ClearContents( nFlags, true ); } @@ -1628,7 +1628,7 @@ void SAL_CALL ScVbaRange::ClearContents() { using namespace ::com::sun::star::sheet::CellFlags; - sal_Int32 nFlags = VALUE | DATETIME | STRING | FORMULA; + sal_Int32 const nFlags = VALUE | DATETIME | STRING | FORMULA; ClearContents( nFlags, true ); } @@ -1637,7 +1637,7 @@ ScVbaRange::ClearFormats() { // FIXME: need to check if we need to combine FORMATTED using namespace ::com::sun::star::sheet::CellFlags; - sal_Int32 nFlags = HARDATTR | FORMATTED | EDITATTR; + sal_Int32 const nFlags = HARDATTR | FORMATTED | EDITATTR; ClearContents( nFlags, false ); } @@ -2079,8 +2079,8 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut RangeHelper thisRange( mxRange ); table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress(); ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) ); - ScRefFlags ROW_ABS = ( ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS ); - ScRefFlags COL_ABS = ( ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS ); + ScRefFlags const ROW_ABS = ( ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS ); + ScRefFlags const COL_ABS = ( ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS ); if ( RowAbsolute.hasValue() ) { @@ -5105,10 +5105,9 @@ ScVbaRange::AutoFill( const uno::Reference< excel::XRange >& Destination, const break; } } - double fEndValue = MAXDOUBLE; ScDocShell* pDocSh = getDocShellFromRange( mxRange ); pDocSh->GetDocFunc().FillAuto( aSourceRange, nullptr, eDir, eCmd, eDateCmd, - nCount, fStep, fEndValue, true, true ); + nCount, fStep, MAXDOUBLE/*fEndValue*/, true, true ); } sal_Bool SAL_CALL ScVbaRange::GoalSeek( const uno::Any& Goal, const uno::Reference< excel::XRange >& ChangingCell ) diff --git a/sc/source/ui/vba/vbasheetobject.cxx b/sc/source/ui/vba/vbasheetobject.cxx index c339062b2ce2..5d2a94019073 100644 --- a/sc/source/ui/vba/vbasheetobject.cxx +++ b/sc/source/ui/vba/vbasheetobject.cxx @@ -225,7 +225,7 @@ void SAL_CALL ScVbaSheetObjectBase::setName( const OUString& rName ) sal_Int32 SAL_CALL ScVbaSheetObjectBase::getPlacement() { - sal_Int32 nRet = excel::XlPlacement::xlMoveAndSize; + sal_Int32 const nRet = excel::XlPlacement::xlMoveAndSize; #if 0 // TODO: not working at the moment. SvxShape* pShape = SvxShape::getImplementation( mxShape ); if(pShape) diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index f0a7b7f4692a..5586c9347daa 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -485,97 +485,85 @@ ScVbaWindow::RangeSelection() sal_Bool SAL_CALL ScVbaWindow::getDisplayGridlines() { - OUString sName( SC_UNO_SHOWGRID ); bool bGrid = true; - getControllerProps()->getPropertyValue( sName ) >>= bGrid; + getControllerProps()->getPropertyValue( SC_UNO_SHOWGRID ) >>= bGrid; return bGrid; } void SAL_CALL ScVbaWindow::setDisplayGridlines( sal_Bool _displaygridlines ) { - OUString sName( SC_UNO_SHOWGRID ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _displaygridlines )); + getControllerProps()->setPropertyValue( SC_UNO_SHOWGRID, uno::makeAny( _displaygridlines )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayHeadings() { - OUString sName( SC_UNO_COLROWHDR ); bool bHeading = true; - getControllerProps()->getPropertyValue( sName ) >>= bHeading; + getControllerProps()->getPropertyValue( SC_UNO_COLROWHDR ) >>= bHeading; return bHeading; } void SAL_CALL ScVbaWindow::setDisplayHeadings( sal_Bool _bDisplayHeadings ) { - OUString sName( SC_UNO_COLROWHDR ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayHeadings )); + getControllerProps()->setPropertyValue( SC_UNO_COLROWHDR, uno::makeAny( _bDisplayHeadings )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayHorizontalScrollBar() { - OUString sName( SC_UNO_HORSCROLL ); bool bHorizontalScrollBar = true; - getControllerProps()->getPropertyValue( sName ) >>= bHorizontalScrollBar; + getControllerProps()->getPropertyValue( SC_UNO_HORSCROLL ) >>= bHorizontalScrollBar; return bHorizontalScrollBar; } void SAL_CALL ScVbaWindow::setDisplayHorizontalScrollBar( sal_Bool _bDisplayHorizontalScrollBar ) { - OUString sName( SC_UNO_HORSCROLL ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayHorizontalScrollBar )); + getControllerProps()->setPropertyValue( SC_UNO_HORSCROLL, uno::makeAny( _bDisplayHorizontalScrollBar )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayOutline() { - OUString sName( SC_UNO_OUTLSYMB ); bool bOutline = true; - getControllerProps()->getPropertyValue( sName ) >>= bOutline; + getControllerProps()->getPropertyValue( SC_UNO_OUTLSYMB ) >>= bOutline; return bOutline; } void SAL_CALL ScVbaWindow::setDisplayOutline( sal_Bool _bDisplayOutline ) { - OUString sName( SC_UNO_OUTLSYMB ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayOutline )); + getControllerProps()->setPropertyValue( SC_UNO_OUTLSYMB, uno::makeAny( _bDisplayOutline )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayVerticalScrollBar() { - OUString sName( SC_UNO_VERTSCROLL ); bool bVerticalScrollBar = true; - getControllerProps()->getPropertyValue( sName ) >>= bVerticalScrollBar; + getControllerProps()->getPropertyValue( SC_UNO_VERTSCROLL ) >>= bVerticalScrollBar; return bVerticalScrollBar; } void SAL_CALL ScVbaWindow::setDisplayVerticalScrollBar( sal_Bool _bDisplayVerticalScrollBar ) { - OUString sName( SC_UNO_VERTSCROLL ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayVerticalScrollBar )); + getControllerProps()->setPropertyValue( SC_UNO_VERTSCROLL, uno::makeAny( _bDisplayVerticalScrollBar )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayWorkbookTabs() { - OUString sName( SC_UNO_SHEETTABS ); bool bWorkbookTabs = true; - getControllerProps()->getPropertyValue( sName ) >>= bWorkbookTabs; + getControllerProps()->getPropertyValue( SC_UNO_SHEETTABS ) >>= bWorkbookTabs; return bWorkbookTabs; } void SAL_CALL ScVbaWindow::setDisplayWorkbookTabs( sal_Bool _bDisplayWorkbookTabs ) { - OUString sName( SC_UNO_SHEETTABS ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayWorkbookTabs )); + getControllerProps()->setPropertyValue( SC_UNO_SHEETTABS, uno::makeAny( _bDisplayWorkbookTabs )); } sal_Bool SAL_CALL |