summaryrefslogtreecommitdiff
path: root/sc/source/ui/vba
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-22 16:55:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-26 09:38:53 +0200
commit30b635c26d6cc07b5a84dc0d829f0b0cde3d1f5a (patch)
tree0ed53ffc7dd75bc6ca40c99453ae39fea3421462 /sc/source/ui/vba
parent94c548ac6468a567aa352fc47e5d2acc34076130 (diff)
loplugin:flatten in sc
Change-Id: I40653af2d90ef123cf77d7223c520cba0e5a3aca Reviewed-on: https://gerrit.libreoffice.org/42661 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/vbaapplication.cxx9
-rw-r--r--sc/source/ui/vba/vbaborders.cxx87
-rw-r--r--sc/source/ui/vba/vbachart.cxx7
-rw-r--r--sc/source/ui/vba/vbachartobject.cxx7
-rw-r--r--sc/source/ui/vba/vbainterior.cxx39
-rw-r--r--sc/source/ui/vba/vbamenubars.cxx12
-rw-r--r--sc/source/ui/vba/vbamenuitems.cxx29
-rw-r--r--sc/source/ui/vba/vbamenus.cxx19
-rw-r--r--sc/source/ui/vba/vbapalette.cxx7
-rw-r--r--sc/source/ui/vba/vbarange.cxx90
-rw-r--r--sc/source/ui/vba/vbaworkbooks.cxx7
-rw-r--r--sc/source/ui/vba/vbaworksheet.cxx80
-rw-r--r--sc/source/ui/vba/vbaworksheets.cxx17
13 files changed, 200 insertions, 210 deletions
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index 1c915d15ae3b..31e7b114c7bb 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -569,12 +569,11 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll )
if( Scroll.hasValue() )
{
bool aScroll = false;
- if( Scroll >>= aScroll )
- {
- bScroll = aScroll;
- }
- else
+ if( !(Scroll >>= aScroll) )
throw uno::RuntimeException("second parameter should be boolean" );
+
+ bScroll = aScroll;
+
}
OUString sRangeName;
diff --git a/sc/source/ui/vba/vbaborders.cxx b/sc/source/ui/vba/vbaborders.cxx
index 169597f39be1..2b54dad4fd17 100644
--- a/sc/source/ui/vba/vbaborders.cxx
+++ b/sc/source/ui/vba/vbaborders.cxx
@@ -172,13 +172,12 @@ public:
sal_Int32 nColor = 0;
_color >>= nColor;
table::BorderLine aBorderLine;
- if ( getBorderLine( aBorderLine ) )
- {
- aBorderLine.Color = XLRGBToOORGB( nColor );
- setBorderLine( aBorderLine );
- }
- else
+ if ( !getBorderLine( aBorderLine ) )
throw uno::RuntimeException("No Implementation available" );
+
+ aBorderLine.Color = XLRGBToOORGB( nColor );
+ setBorderLine( aBorderLine );
+
}
uno::Any SAL_CALL getColorIndex() override
@@ -236,29 +235,28 @@ public:
sal_Int32 nWeight = 0;
_weight >>= nWeight;
table::BorderLine aBorderLine;
- if ( getBorderLine( aBorderLine ) )
+ if ( !getBorderLine( aBorderLine ) )
+ throw uno::RuntimeException("Method failed" );
+
+ switch ( nWeight )
{
- switch ( nWeight )
- {
- case XlBorderWeight::xlThin:
- aBorderLine.OuterLineWidth = OOLineThin;
- break;
- case XlBorderWeight::xlMedium:
- aBorderLine.OuterLineWidth = OOLineMedium;
- break;
- case XlBorderWeight::xlThick:
- aBorderLine.OuterLineWidth = OOLineThick;
- break;
- case XlBorderWeight::xlHairline:
- aBorderLine.OuterLineWidth = OOLineHairline;
- break;
- default:
- throw uno::RuntimeException("Bad param" );
- }
- setBorderLine( aBorderLine );
+ case XlBorderWeight::xlThin:
+ aBorderLine.OuterLineWidth = OOLineThin;
+ break;
+ case XlBorderWeight::xlMedium:
+ aBorderLine.OuterLineWidth = OOLineMedium;
+ break;
+ case XlBorderWeight::xlThick:
+ aBorderLine.OuterLineWidth = OOLineThick;
+ break;
+ case XlBorderWeight::xlHairline:
+ aBorderLine.OuterLineWidth = OOLineHairline;
+ break;
+ default:
+ throw uno::RuntimeException("Bad param" );
}
- else
- throw uno::RuntimeException("Method failed" );
+ setBorderLine( aBorderLine );
+
}
void SAL_CALL setTintAndShade( const uno::Any& /*rAny*/ ) override
@@ -283,26 +281,25 @@ public:
sal_Int32 nLineStyle = 0;
_linestyle >>= nLineStyle;
table::BorderLine aBorderLine;
- if ( getBorderLine( aBorderLine ) )
+ if ( !getBorderLine( aBorderLine ) )
+ throw uno::RuntimeException("Method failed" );
+
+ switch ( nLineStyle )
{
- switch ( nLineStyle )
- {
- case XlLineStyle::xlContinuous:
- case XlLineStyle::xlDash:
- case XlLineStyle::xlDashDot:
- case XlLineStyle::xlDashDotDot:
- case XlLineStyle::xlDot:
- case XlLineStyle::xlDouble:
- case XlLineStyle::xlLineStyleNone:
- case XlLineStyle::xlSlantDashDot:
- break;
- default:
- throw uno::RuntimeException("Bad param" );
- }
- setBorderLine( aBorderLine );
+ case XlLineStyle::xlContinuous:
+ case XlLineStyle::xlDash:
+ case XlLineStyle::xlDashDot:
+ case XlLineStyle::xlDashDotDot:
+ case XlLineStyle::xlDot:
+ case XlLineStyle::xlDouble:
+ case XlLineStyle::xlLineStyleNone:
+ case XlLineStyle::xlSlantDashDot:
+ break;
+ default:
+ throw uno::RuntimeException("Bad param" );
}
- else
- throw uno::RuntimeException("Method failed" );
+ setBorderLine( aBorderLine );
+
}
};
diff --git a/sc/source/ui/vba/vbachart.cxx b/sc/source/ui/vba/vbachart.cxx
index 07fd2447b1f4..50c78108ba8b 100644
--- a/sc/source/ui/vba/vbachart.cxx
+++ b/sc/source/ui/vba/vbachart.cxx
@@ -551,10 +551,11 @@ ScVbaChart::Activate()
// e.g. 'ThisWorkbook'
uno::Reference< XHelperInterface > xParent( getParent() );
ScVbaChartObject* pChartObj = static_cast< ScVbaChartObject* >( xParent.get() );
- if ( pChartObj )
- pChartObj->Activate();
- else
+ if ( !pChartObj )
throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), "no ChartObject as parent" );
+
+ pChartObj->Activate();
+
}
void SAL_CALL
diff --git a/sc/source/ui/vba/vbachartobject.cxx b/sc/source/ui/vba/vbachartobject.cxx
index 617e61128e8f..8337d037e8ec 100644
--- a/sc/source/ui/vba/vbachartobject.cxx
+++ b/sc/source/ui/vba/vbachartobject.cxx
@@ -96,10 +96,11 @@ ScVbaChartObject::Delete()
uno::Reference< excel::XWorksheet > xParent( getParent(), uno::UNO_QUERY_THROW );
uno::Reference< excel::XChartObjects > xColl( xParent->ChartObjects( uno::Any() ), uno::UNO_QUERY_THROW );
ScVbaChartObjects* pChartObjectsImpl = static_cast< ScVbaChartObjects* >( xColl.get() );
- if (pChartObjectsImpl)
- pChartObjectsImpl->removeByName( getPersistName() );
- else
+ if (!pChartObjectsImpl)
throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), "Parent is not ChartObjects" );
+
+ pChartObjectsImpl->removeByName( getPersistName() );
+
}
void
diff --git a/sc/source/ui/vba/vbainterior.cxx b/sc/source/ui/vba/vbainterior.cxx
index 6e7b626a8702..3178d88ca6dc 100644
--- a/sc/source/ui/vba/vbainterior.cxx
+++ b/sc/source/ui/vba/vbainterior.cxx
@@ -304,13 +304,12 @@ ScVbaInterior::getPattern()
void SAL_CALL
ScVbaInterior::setPattern( const uno::Any& _pattern )
{
- if( _pattern >>= m_nPattern )
- {
- SetUserDefinedAttributes( PATTERN, SetAttributeData( m_nPattern ) );
- SetMixedColor();
- }
- else
+ if( !(_pattern >>= m_nPattern) )
throw uno::RuntimeException("Invalid Pattern index" );
+
+ SetUserDefinedAttributes( PATTERN, SetAttributeData( m_nPattern ) );
+ SetMixedColor();
+
}
Color
ScVbaInterior::GetBackColor()
@@ -352,13 +351,12 @@ void SAL_CALL
ScVbaInterior::setPatternColor( const uno::Any& _patterncolor )
{
sal_Int32 nPattColor = 0;
- if( _patterncolor >>= nPattColor )
- {
- SetUserDefinedAttributes( PATTERNCOLOR, SetAttributeData( XLRGBToOORGB( nPattColor ) ) );
- SetMixedColor();
- }
- else
+ if( !(_patterncolor >>= nPattColor) )
throw uno::RuntimeException("Invalid Pattern Color" );
+
+ SetUserDefinedAttributes( PATTERNCOLOR, SetAttributeData( XLRGBToOORGB( nPattColor ) ) );
+ SetMixedColor();
+
}
uno::Any SAL_CALL
ScVbaInterior::getPatternColorIndex()
@@ -372,16 +370,15 @@ void SAL_CALL
ScVbaInterior::setPatternColorIndex( const uno::Any& _patterncolorindex )
{
sal_Int32 nColorIndex = 0;
- if( _patterncolorindex >>= nColorIndex )
- {
- if( nColorIndex == 0 )
- return;
- sal_Int32 nPattColor = 0;
- GetIndexColor( nColorIndex ) >>= nPattColor;
- setPatternColor( uno::makeAny( OORGBToXLRGB( nPattColor ) ) );
- }
- else
+ if( !(_patterncolorindex >>= nColorIndex) )
throw uno::RuntimeException("Invalid Pattern Color" );
+
+ if( nColorIndex == 0 )
+ return;
+ sal_Int32 nPattColor = 0;
+ GetIndexColor( nColorIndex ) >>= nPattColor;
+ setPatternColor( uno::makeAny( OORGBToXLRGB( nPattColor ) ) );
+
}
uno::Any SAL_CALL ScVbaInterior::getThemeColor()
diff --git a/sc/source/ui/vba/vbamenubars.cxx b/sc/source/ui/vba/vbamenubars.cxx
index 1c2759990c66..fb5eb65ea7a5 100644
--- a/sc/source/ui/vba/vbamenubars.cxx
+++ b/sc/source/ui/vba/vbamenubars.cxx
@@ -31,14 +31,12 @@ public:
virtual uno::Any SAL_CALL nextElement() override
{
// FIXME: should be add menubar
- if( hasMoreElements() )
- {
- uno::Reference< XCommandBar > xCommandBar( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
- uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( m_xParent, m_xContext, xCommandBar ) );
- return uno::makeAny( xMenuBar );
- }
- else
+ if( !hasMoreElements() )
throw container::NoSuchElementException();
+
+ uno::Reference< XCommandBar > xCommandBar( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
+ uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( m_xParent, m_xContext, xCommandBar ) );
+ return uno::makeAny( xMenuBar );
}
};
diff --git a/sc/source/ui/vba/vbamenuitems.cxx b/sc/source/ui/vba/vbamenuitems.cxx
index 8d12983e28d6..fc89a1e3415b 100644
--- a/sc/source/ui/vba/vbamenuitems.cxx
+++ b/sc/source/ui/vba/vbamenuitems.cxx
@@ -34,23 +34,22 @@ public:
virtual uno::Any SAL_CALL nextElement() override
{
// FIXME: should be add menu
- if( hasMoreElements() )
+ if( !hasMoreElements() )
+ throw container::NoSuchElementException();
+
+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
{
- uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
- if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
- {
- uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
- return uno::makeAny( xMenu );
- }
- else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
- {
- uno::Reference< excel::XMenuItem > xMenuItem( new ScVbaMenuItem( m_xParent, m_xContext, xCommandBarControl ) );
- return uno::makeAny( xMenuItem );
- }
- nextElement();
+ uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
+ return uno::makeAny( xMenu );
}
- else
- throw container::NoSuchElementException();
+ else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
+ {
+ uno::Reference< excel::XMenuItem > xMenuItem( new ScVbaMenuItem( m_xParent, m_xContext, xCommandBarControl ) );
+ return uno::makeAny( xMenuItem );
+ }
+ nextElement();
+
return uno::Any();
}
};
diff --git a/sc/source/ui/vba/vbamenus.cxx b/sc/source/ui/vba/vbamenus.cxx
index 9c3f86ad904c..d2a73bf10bde 100644
--- a/sc/source/ui/vba/vbamenus.cxx
+++ b/sc/source/ui/vba/vbamenus.cxx
@@ -33,18 +33,17 @@ public:
virtual uno::Any SAL_CALL nextElement() override
{
// FIXME: should be add menu
- if( hasMoreElements() )
+ if( !hasMoreElements() )
+ throw container::NoSuchElementException();
+
+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
{
- uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
- if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
- {
- uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
- return uno::makeAny( xMenu );
- }
- nextElement();
+ uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
+ return uno::makeAny( xMenu );
}
- else
- throw container::NoSuchElementException();
+ nextElement();
+
return uno::Any();
}
};
diff --git a/sc/source/ui/vba/vbapalette.cxx b/sc/source/ui/vba/vbapalette.cxx
index 4010200a370f..557b00937e0b 100644
--- a/sc/source/ui/vba/vbapalette.cxx
+++ b/sc/source/ui/vba/vbapalette.cxx
@@ -95,10 +95,11 @@ ScVbaPalette::getPalette() const
{
uno::Reference< container::XIndexAccess > xIndex;
uno::Reference< beans::XPropertySet > xProps;
- if ( m_pShell )
- xProps.set( m_pShell->GetModel(), uno::UNO_QUERY_THROW );
- else
+ if ( !m_pShell )
throw uno::RuntimeException("Can't extract palette, no doc shell" );
+
+ xProps.set( m_pShell->GetModel(), uno::UNO_QUERY_THROW );
+
xIndex.set( xProps->getPropertyValue("ColorPalette"), uno::UNO_QUERY );
if ( !xIndex.is() )
return new DefaultPalette();
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 756b7cc6be6c..f0dd8bb376cc 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -3335,25 +3335,27 @@ void updateTableSortField( const uno::Reference< table::XCellRange >& xParentRan
// make sure that upper left point of key range is within the
// parent range
- if ( ( !bIsSortColumn && colRowKeyAddress.StartColumn >= parentRangeAddress.StartColumn &&
- colRowKeyAddress.StartColumn <= parentRangeAddress.EndColumn ) || ( bIsSortColumn &&
- colRowKeyAddress.StartRow >= parentRangeAddress.StartRow &&
- colRowKeyAddress.StartRow <= parentRangeAddress.EndRow ) )
- {
- //determine col/row index
- if ( bIsSortColumn )
- aTableField.Field = colRowKeyAddress.StartRow - parentRangeAddress.StartRow;
- else
- aTableField.Field = colRowKeyAddress.StartColumn - parentRangeAddress.StartColumn;
- aTableField.IsCaseSensitive = bMatchCase;
+ if (
+ ( bIsSortColumn || colRowKeyAddress.StartColumn < parentRangeAddress.StartColumn ||
+ colRowKeyAddress.StartColumn > parentRangeAddress.EndColumn )
+ &&
+ ( !bIsSortColumn || colRowKeyAddress.StartRow < parentRangeAddress.StartRow ||
+ colRowKeyAddress.StartRow > parentRangeAddress.EndRow )
+ )
+ throw uno::RuntimeException("Illegal Key param" );
- if ( nOrder == excel::XlSortOrder::xlAscending )
- aTableField.IsAscending = true;
- else
- aTableField.IsAscending = false;
- }
+ //determine col/row index
+ if ( bIsSortColumn )
+ aTableField.Field = colRowKeyAddress.StartRow - parentRangeAddress.StartRow;
else
- throw uno::RuntimeException("Illegal Key param" );
+ aTableField.Field = colRowKeyAddress.StartColumn - parentRangeAddress.StartColumn;
+ aTableField.IsCaseSensitive = bMatchCase;
+
+ if ( nOrder == excel::XlSortOrder::xlAscending )
+ aTableField.IsAscending = true;
+ else
+ aTableField.IsAscending = false;
+
}
@@ -4873,25 +4875,24 @@ uno::Any ScVbaRange::getShowDetail()
// check if the specified range is a single summary column or row.
table::CellRangeAddress thisAddress = helper.getCellRangeAddressable()->getRangeAddress();
- if( (thisAddress.StartRow == thisAddress.EndRow && thisAddress.EndRow == aOutlineAddress.EndRow ) ||
- (thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn ))
- {
- bool bColumn = thisAddress.StartRow != thisAddress.EndRow;
- ScDocument& rDoc = getDocumentFromRange( mxRange );
- ScOutlineTable* pOutlineTable = rDoc.GetOutlineTable(static_cast<SCTAB>(thisAddress.Sheet), true);
- const ScOutlineArray& rOutlineArray = bColumn ? pOutlineTable->GetColArray(): pOutlineTable->GetRowArray();
- SCCOLROW nPos = bColumn ? (SCCOLROW)(thisAddress.EndColumn-1):(SCCOLROW)(thisAddress.EndRow-1);
- const ScOutlineEntry* pEntry = rOutlineArray.GetEntryByPos( 0, nPos );
- if( pEntry )
- {
- const bool bShowDetail = !pEntry->IsHidden();
- return uno::makeAny( bShowDetail );
- }
- }
- else
+ if( (thisAddress.StartRow != thisAddress.EndRow || thisAddress.EndRow != aOutlineAddress.EndRow ) &&
+ (thisAddress.StartColumn != thisAddress.EndColumn || thisAddress.EndColumn != aOutlineAddress.EndColumn ))
{
throw uno::RuntimeException("Can not set Range.ShowDetail attribute" );
}
+
+ bool bColumn = thisAddress.StartRow != thisAddress.EndRow;
+ ScDocument& rDoc = getDocumentFromRange( mxRange );
+ ScOutlineTable* pOutlineTable = rDoc.GetOutlineTable(static_cast<SCTAB>(thisAddress.Sheet), true);
+ const ScOutlineArray& rOutlineArray = bColumn ? pOutlineTable->GetColArray(): pOutlineTable->GetRowArray();
+ SCCOLROW nPos = bColumn ? (SCCOLROW)(thisAddress.EndColumn-1):(SCCOLROW)(thisAddress.EndRow-1);
+ const ScOutlineEntry* pEntry = rOutlineArray.GetEntryByPos( 0, nPos );
+ if( pEntry )
+ {
+ const bool bShowDetail = !pEntry->IsHidden();
+ return uno::makeAny( bShowDetail );
+ }
+
return aNULL();
}
@@ -4913,21 +4914,20 @@ void ScVbaRange::setShowDetail(const uno::Any& aShowDetail)
// check if the specified range is a single summary column or row.
table::CellRangeAddress thisAddress = helper.getCellRangeAddressable()->getRangeAddress();
- if( (thisAddress.StartRow == thisAddress.EndRow && thisAddress.EndRow == aOutlineAddress.EndRow ) ||
- (thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn ))
- {
- // #FIXME, seems there is a different behavior between MSO and OOo.
- // In OOo, the showDetail will show all the level entrys, while only show the first level entry in MSO
- uno::Reference< sheet::XSheetOutline > xSheetOutline( helper.getSpreadSheet(), uno::UNO_QUERY_THROW );
- if( bShowDetail )
- xSheetOutline->showDetail( aOutlineAddress );
- else
- xSheetOutline->hideDetail( aOutlineAddress );
- }
- else
+ if( (thisAddress.StartRow != thisAddress.EndRow || thisAddress.EndRow != aOutlineAddress.EndRow ) &&
+ (thisAddress.StartColumn != thisAddress.EndColumn || thisAddress.EndColumn != aOutlineAddress.EndColumn ))
{
throw uno::RuntimeException("Can not set Range.ShowDetail attribute" );
}
+
+ // #FIXME, seems there is a different behavior between MSO and OOo.
+ // In OOo, the showDetail will show all the level entrys, while only show the first level entry in MSO
+ uno::Reference< sheet::XSheetOutline > xSheetOutline( helper.getSpreadSheet(), uno::UNO_QUERY_THROW );
+ if( bShowDetail )
+ xSheetOutline->showDetail( aOutlineAddress );
+ else
+ xSheetOutline->hideDetail( aOutlineAddress );
+
}
uno::Reference< excel::XRange > SAL_CALL
diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx
index 8b4f68e64f50..1fd605d8b972 100644
--- a/sc/source/ui/vba/vbaworkbooks.cxx
+++ b/sc/source/ui/vba/vbaworkbooks.cxx
@@ -242,10 +242,11 @@ ScVbaWorkbooks::Open( const OUString& rFileName, const uno::Any& /*UpdateLinks*/
throw uno::RuntimeException("Expected value for Delimiter" );
OUString sStr;
Delimiter >>= sStr;
- if ( !sStr.isEmpty() )
- nDelim = sStr[0];
- else
+ if ( sStr.isEmpty() )
throw uno::RuntimeException("Incorrect value for Delimiter" );
+
+ nDelim = sStr[0];
+
}
getCurrentDelim() = nDelim; //set new current
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index 265f3c46ad6b..4ded2493209a 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -335,26 +335,25 @@ ScVbaWorksheet::getEnableSelection()
{
uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
SCTAB nTab = 0;
- if ( ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
+ if ( !ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
+ throw uno::RuntimeException("Sheet Name does not exist." );
+
+ uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
+ ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
+ bool bLockedCells = false;
+ bool bUnlockedCells = false;
+ if( pProtect )
{
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
- ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
- bool bLockedCells = false;
- bool bUnlockedCells = false;
- if( pProtect )
- {
- bLockedCells = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
- bUnlockedCells = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
- }
- if( bLockedCells )
- return excel::XlEnableSelection::xlNoRestrictions;
- if( bUnlockedCells )
- return excel::XlEnableSelection::xlUnlockedCells;
- return excel::XlEnableSelection::xlNoSelection;
+ bLockedCells = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+ bUnlockedCells = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
}
- else
- throw uno::RuntimeException("Sheet Name does not exist." );
+ if( bLockedCells )
+ return excel::XlEnableSelection::xlNoRestrictions;
+ if( bUnlockedCells )
+ return excel::XlEnableSelection::xlUnlockedCells;
+ return excel::XlEnableSelection::xlNoSelection;
+
}
void
@@ -369,31 +368,30 @@ ScVbaWorksheet::setEnableSelection( sal_Int32 nSelection )
uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
SCTAB nTab = 0;
- if ( ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
+ if ( !ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
+ throw uno::RuntimeException("Sheet Name does not exist." );
+
+ uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
+ ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
+ // default is xlNoSelection
+ bool bLockedCells = false;
+ bool bUnlockedCells = false;
+ if( nSelection == excel::XlEnableSelection::xlNoRestrictions )
{
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
- ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
- // default is xlNoSelection
- bool bLockedCells = false;
- bool bUnlockedCells = false;
- if( nSelection == excel::XlEnableSelection::xlNoRestrictions )
- {
- bLockedCells = true;
- bUnlockedCells = true;
- }
- else if( nSelection == excel::XlEnableSelection::xlUnlockedCells )
- {
- bUnlockedCells = true;
- }
- if( pProtect )
- {
- pProtect->setOption( ScTableProtection::SELECT_LOCKED_CELLS, bLockedCells );
- pProtect->setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, bUnlockedCells );
- }
+ bLockedCells = true;
+ bUnlockedCells = true;
}
- else
- throw uno::RuntimeException("Sheet Name does not exist." );
+ else if( nSelection == excel::XlEnableSelection::xlUnlockedCells )
+ {
+ bUnlockedCells = true;
+ }
+ if( pProtect )
+ {
+ pProtect->setOption( ScTableProtection::SELECT_LOCKED_CELLS, bLockedCells );
+ pProtect->setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, bUnlockedCells );
+ }
+
}
diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx
index 7c209dd42bbe..0a9a79401d3a 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -350,17 +350,16 @@ void SAL_CALL
ScVbaWorksheets::setVisible( const uno::Any& _visible )
{
bool bState = false;
- if ( _visible >>= bState )
+ if ( !(_visible >>= bState) )
+ throw uno::RuntimeException("Visible property doesn't support non boolean #FIXME" );
+
+ uno::Reference< container::XEnumeration > xEnum( createEnumeration(), uno::UNO_QUERY_THROW );
+ while ( xEnum->hasMoreElements() )
{
- uno::Reference< container::XEnumeration > xEnum( createEnumeration(), uno::UNO_QUERY_THROW );
- while ( xEnum->hasMoreElements() )
- {
- uno::Reference< excel::XWorksheet > xSheet( xEnum->nextElement(), uno::UNO_QUERY_THROW );
- xSheet->setVisible( bState ? 1 : 0 );
- }
+ uno::Reference< excel::XWorksheet > xSheet( xEnum->nextElement(), uno::UNO_QUERY_THROW );
+ xSheet->setVisible( bState ? 1 : 0 );
}
- else
- throw uno::RuntimeException("Visible property doesn't support non boolean #FIXME" );
+
}
void SAL_CALL