diff options
author | Olivier Hallot <olivier.hallot@documentfoundation.org> | 2012-01-01 12:55:53 -0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-01-02 19:17:17 +0100 |
commit | 6af59644d6508049409a03d1c4a598ea2bef521e (patch) | |
tree | 6897eaf76372c606a487ebb0135962e6c7e52cb7 /oox/source/xls | |
parent | 93d2a2eb4dd13d81b9be4f087653baecb33ead67 (diff) |
Fix for fdo43460 Part XXV getLength() to isEmpty()
Please find attached a partial fix for Easy Hack FDO43460
Part XXI
Module
oox
Diffstat (limited to 'oox/source/xls')
31 files changed, 157 insertions, 157 deletions
diff --git a/oox/source/xls/addressconverter.cxx b/oox/source/xls/addressconverter.cxx index fd7217afac89..8a5a6701d165 100644 --- a/oox/source/xls/addressconverter.cxx +++ b/oox/source/xls/addressconverter.cxx @@ -729,7 +729,7 @@ void AddressConverter::convertToCellRangeList( ApiCellRangeList& orRanges, while( (0 <= nPos) && (nPos < nLen) ) { OUString aToken = rString.getToken( 0, ' ', nPos ); - if( (aToken.getLength() > 0) && convertToCellRange( aRange, aToken, nSheet, true, bTrackOverflow ) ) + if( !aToken.isEmpty() && convertToCellRange( aRange, aToken, nSheet, true, bTrackOverflow ) ) orRanges.push_back( aRange ); } } diff --git a/oox/source/xls/autofilterbuffer.cxx b/oox/source/xls/autofilterbuffer.cxx index 7a3e6fad0be0..ec92a90fcbf4 100644 --- a/oox/source/xls/autofilterbuffer.cxx +++ b/oox/source/xls/autofilterbuffer.cxx @@ -129,7 +129,7 @@ bool lclTrimTrailingAsterisks( OUString& rValue ) bool lclConvertWildcardsToRegExp( OUString& rValue ) { // check existence of the wildcard characters '*' and '?' - if( (rValue.getLength() > 0) && ((rValue.indexOf( '*' ) >= 0) || (rValue.indexOf( '?' ) >= 0)) ) + if( !rValue.isEmpty() && ((rValue.indexOf( '*' ) >= 0) || (rValue.indexOf( '?' ) >= 0)) ) { OUStringBuffer aBuffer; aBuffer.ensureCapacity( rValue.getLength() + 5 ); @@ -249,7 +249,7 @@ void DiscreteFilter::importAttribs( sal_Int32 nElement, const AttributeList& rAt case XLS_TOKEN( filter ): { OUString aValue = rAttribs.getXString( XML_val, OUString() ); - if( aValue.getLength() > 0 ) + if( !aValue.isEmpty() ) maValues.push_back( aValue ); } break; @@ -276,7 +276,7 @@ void DiscreteFilter::importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm case BIFF12_ID_DISCRETEFILTER: { OUString aValue = BiffHelper::readString( rStrm ); - if( aValue.getLength() > 0 ) + if( !aValue.isEmpty() ) maValues.push_back( aValue ); } break; @@ -384,7 +384,7 @@ void FilterCriterionModel::readBiffData( SequenceInputStream& rStrm ) { rStrm.skip( 8 ); OUString aValue = BiffHelper::readString( rStrm ).trim(); - if( aValue.getLength() > 0 ) + if( !aValue.isEmpty() ) maValue <<= aValue; } break; @@ -468,7 +468,7 @@ void FilterCriterionModel::readString( BiffInputStream& rStrm, BiffType eBiff, r rStrm.readUniStringBody( mnStrLen, true ) : rStrm.readCharArrayUC( mnStrLen, eTextEnc, true ); aValue = aValue.trim(); - if( aValue.getLength() > 0 ) + if( !aValue.isEmpty() ) maValue <<= aValue; } } @@ -494,7 +494,7 @@ void CustomFilter::importAttribs( sal_Int32 nElement, const AttributeList& rAttr FilterCriterionModel aCriterion; aCriterion.mnOperator = rAttribs.getToken( XML_operator, XML_equal ); OUString aValue = rAttribs.getXString( XML_val, OUString() ).trim(); - if( (aCriterion.mnOperator == XML_equal) || (aCriterion.mnOperator == XML_notEqual) || (aValue.getLength() > 0) ) + if( (aCriterion.mnOperator == XML_equal) || (aCriterion.mnOperator == XML_notEqual) || (!aValue.isEmpty()) ) aCriterion.maValue <<= aValue; appendCriterion( aCriterion ); } @@ -554,7 +554,7 @@ ApiFilterSettings CustomFilter::finalizeImport( sal_Int32 /*nMaxCount*/ ) bool bNotEqual = nOperator == FilterOperator2::NOT_EQUAL; if( bEqual || bNotEqual ) { - if( aValue.getLength() == 0 ) + if( aValue.isEmpty() ) { // empty comparison string: create empty/not empty filters nOperator = bNotEqual ? FilterOperator2::NOT_EMPTY : FilterOperator2::EMPTY; @@ -565,7 +565,7 @@ ApiFilterSettings CustomFilter::finalizeImport( sal_Int32 /*nMaxCount*/ ) bool bHasLeadingAsterisk = lclTrimLeadingAsterisks( aValue ); bool bHasTrailingAsterisk = lclTrimTrailingAsterisks( aValue ); // just '***' matches everything, do not create a filter field - bValidOperator = aValue.getLength() > 0; + bValidOperator = !aValue.isEmpty(); if( bValidOperator ) { if( bHasLeadingAsterisk && bHasTrailingAsterisk ) diff --git a/oox/source/xls/condformatbuffer.cxx b/oox/source/xls/condformatbuffer.cxx index 26355dc2a1c2..c2341dc7b79c 100644 --- a/oox/source/xls/condformatbuffer.cxx +++ b/oox/source/xls/condformatbuffer.cxx @@ -542,7 +542,7 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries > break; } - if( aReplaceFormula.getLength() > 0 ) + if( !aReplaceFormula.isEmpty() ) { OUString aAddress, aRanges, aText, aComp; sal_Int32 nStrPos = aReplaceFormula.getLength(); @@ -551,17 +551,17 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries > switch( aReplaceFormula[ nStrPos + 1 ] ) { case 'B': // current base address - if( aAddress.getLength() == 0 ) + if( aAddress.isEmpty() ) aAddress = FormulaProcessorBase::generateAddress2dString( mrCondFormat.getRanges().getBaseAddress(), false ); aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, aAddress ); break; case 'R': // range list of conditional formatting - if( aRanges.getLength() == 0 ) + if( aRanges.isEmpty() ) aRanges = FormulaProcessorBase::generateRangeList2dString( mrCondFormat.getRanges(), true, ',', true ); aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, aRanges ); break; case 'T': // comparison text - if( aText.getLength() == 0 ) + if( aText.isEmpty() ) // quote the comparison text, and handle embedded quote characters aText = FormulaProcessorBase::generateApiString( maModel.maText ); aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, aText ); @@ -579,7 +579,7 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries > OUString::valueOf( static_cast< sal_Int32 >( maModel.mbBottom ? 1 : 0 ) ) ); break; case 'C': // average comparison operator - if( aComp.getLength() == 0 ) + if( aComp.isEmpty() ) aComp = maModel.mbAboveAverage ? (maModel.mbEqualAverage ? CREATE_OUSTRING( ">=" ) : CREATE_OUSTRING( ">" )) : (maModel.mbEqualAverage ? CREATE_OUSTRING( "<=" ) : CREATE_OUSTRING( "<" )); @@ -608,7 +608,7 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries > // style name for the formatting attributes OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); - if( aStyleName.getLength() > 0 ) + if( !aStyleName.isEmpty() ) lclAppendProperty( aProps, CREATE_OUSTRING( "StyleName" ), aStyleName ); // append the new rule diff --git a/oox/source/xls/connectionsbuffer.cxx b/oox/source/xls/connectionsbuffer.cxx index e066613c082e..51b79703cf3a 100644 --- a/oox/source/xls/connectionsbuffer.cxx +++ b/oox/source/xls/connectionsbuffer.cxx @@ -124,7 +124,7 @@ void lclParseTables( WebPrModel::TablesVector& rTables, const OUString& rTableNa { rTables.clear(); OUString aTableNames = rTableNames.trim(); - while( aTableNames.getLength() > 0 ) + while( !aTableNames.isEmpty() ) { sal_Int32 nSep = -1; // table names are enclosed in double quotes @@ -139,7 +139,7 @@ void lclParseTables( WebPrModel::TablesVector& rTables, const OUString& rTableNa nSep = aTableNames.indexOf( ',', nEndQuote + 1 ); // extract text between quote characters OUString aTableName = aTableNames.copy( 1, nEndQuote - 1 ).trim(); - if( aTableName.getLength() > 0 ) + if( !aTableName.isEmpty() ) rTables.push_back( Any( aTableName ) ); else rTables.push_back( Any() ); @@ -150,7 +150,7 @@ void lclParseTables( WebPrModel::TablesVector& rTables, const OUString& rTableNa if( nSep < 0 ) nSep = aTableNames.getLength(); OUString aTableIndex = aTableNames.copy( 0, nSep ).trim(); - if( (aTableIndex.getLength() > 0) && (aTableIndex[ 0 ] >= '1') && (aTableIndex[ 0 ] <= '9') ) + if( !aTableIndex.isEmpty() && (aTableIndex[ 0 ] >= '1') && (aTableIndex[ 0 ] <= '9') ) rTables.push_back( Any( aTableIndex.toInt32() ) ); else rTables.push_back( Any() ); diff --git a/oox/source/xls/defnamesbuffer.cxx b/oox/source/xls/defnamesbuffer.cxx index e2319ca79a9d..17418d658a89 100644 --- a/oox/source/xls/defnamesbuffer.cxx +++ b/oox/source/xls/defnamesbuffer.cxx @@ -244,7 +244,7 @@ DefinedNameBase::DefinedNameBase( const WorkbookHelper& rHelper ) : const OUString& DefinedNameBase::getUpcaseModelName() const { - if( maUpModelName.getLength() == 0 ) + if( maUpModelName.isEmpty() ) maUpModelName = lclGetUpcaseModelName( maModel.maName ); return maUpModelName; } @@ -279,7 +279,7 @@ Any DefinedNameBase::getReference( const CellAddress& rBaseAddr ) const ApiTokenSequence DefinedNameBase::importOoxFormula( sal_Int16 nBaseSheet ) { - return (maModel.maFormula.getLength() > 0) ? + return (!maModel.maFormula.isEmpty()) ? getFormulaParser().importFormula( CellAddress( nBaseSheet, 0, 0 ), maModel.maFormula ) : getFormulaParser().convertErrorToFormula( BIFF_ERR_NAME ); } diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index 98f5e28420ce..75cf0c8d562e 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -104,13 +104,13 @@ Shape::Shape( const WorksheetHelper& rHelper, const AttributeList& rAttribs, con WorksheetHelper( rHelper ) { OUString aMacro = rAttribs.getXString( XML_macro, OUString() ); - if( aMacro.getLength() > 0 ) + if( !aMacro.isEmpty() ) maMacroName = getFormulaParser().importMacroName( aMacro ); } void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& rxShapes ) { - if( (maMacroName.getLength() > 0) && mxShape.is() ) + if( !maMacroName.isEmpty() && mxShape.is() ) { VbaMacroAttacherRef xAttacher( new ShapeMacroAttacher( maMacroName, mxShape ) ); getBaseFilter().getVbaProject().registerMacroAttacher( xAttacher ); @@ -436,7 +436,7 @@ OUString VmlDrawing::getShapeBaseName( const ::oox::vml::ShapeBase& rShape ) con bool VmlDrawing::convertClientAnchor( Rectangle& orShapeRect, const OUString& rShapeAnchor ) const { - if( rShapeAnchor.getLength() == 0 ) + if( rShapeAnchor.isEmpty() ) return false; ShapeAnchor aAnchor( *this ); aAnchor.importVmlAnchor( rShapeAnchor ); @@ -450,7 +450,7 @@ Reference< XShape > VmlDrawing::createAndInsertClientXShape( const ::oox::vml::S // simulate the legacy drawing controls with OLE form controls OUString aShapeName = rShape.getShapeName(); const ::oox::vml::ClientData* pClientData = rShape.getClientData(); - if( (aShapeName.getLength() > 0) && pClientData ) + if( !aShapeName.isEmpty() && pClientData ) { Rectangle aShapeRect = rShapeRect; const ::oox::vml::TextBox* pTextBox = rShape.getTextBox(); @@ -603,10 +603,10 @@ Reference< XShape > VmlDrawing::createAndInsertClientXShape( const ::oox::vml::S Reference< XShape > xShape = createAndInsertXControlShape( aControl, rxShapes, aShapeRect, nCtrlIndex ); // control shape macro - if( xShape.is() && (nCtrlIndex >= 0) && (pClientData->maFmlaMacro.getLength() > 0) ) + if( xShape.is() && (nCtrlIndex >= 0) && !pClientData->maFmlaMacro.isEmpty() ) { OUString aMacroName = getFormulaParser().importMacroName( pClientData->maFmlaMacro ); - if( aMacroName.getLength() > 0 ) + if( !aMacroName.isEmpty() ) { Reference< XIndexContainer > xFormIC = getControlForm().getXForm(); VbaMacroAttacherRef xAttacher( new VmlControlMacroAttacher( aMacroName, xFormIC, nCtrlIndex, pClientData->mnObjType, pClientData->mnDropStyle ) ); @@ -642,7 +642,7 @@ void VmlDrawing::notifyXShapeInserted( const Reference< XShape >& rxShape, aPropSet.setProperty( PROP_Printable, pClientData->mbPrintObject ); // control source links - if( (pClientData->maFmlaLink.getLength() > 0) || (pClientData->maFmlaRange.getLength() > 0) ) + if( !pClientData->maFmlaLink.isEmpty() || !pClientData->maFmlaRange.isEmpty() ) maControlConv.bindToSources( xCtrlModel, pClientData->maFmlaLink, pClientData->maFmlaRange, getSheetIndex() ); } catch( Exception& ) @@ -656,7 +656,7 @@ void VmlDrawing::notifyXShapeInserted( const Reference< XShape >& rxShape, sal_uInt32 VmlDrawing::convertControlTextColor( const OUString& rTextColor ) const { // color attribute not present or 'auto' - use passed default color - if( (rTextColor.getLength() == 0) || rTextColor.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "auto" ) ) ) + if( rTextColor.isEmpty() || rTextColor.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "auto" ) ) ) return AX_SYSCOLOR_WINDOWTEXT; if( rTextColor[ 0 ] == '#' ) diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx index 93fc190b336a..d8cf3b1ff450 100644 --- a/oox/source/xls/drawingmanager.cxx +++ b/oox/source/xls/drawingmanager.cxx @@ -1317,10 +1317,10 @@ void BiffDrawingBase::finalizeImport() Reference< XShape > BiffDrawingBase::createAndInsertXShape( const OUString& rService, const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - OSL_ENSURE( rService.getLength() > 0, "BiffDrawingBase::createAndInsertXShape - missing UNO shape service name" ); + OSL_ENSURE( !rService.isEmpty(), "BiffDrawingBase::createAndInsertXShape - missing UNO shape service name" ); OSL_ENSURE( rxShapes.is(), "BiffDrawingBase::createAndInsertXShape - missing XShapes container" ); Reference< XShape > xShape; - if( (rService.getLength() > 0) && rxShapes.is() ) try + if( !rService.isEmpty() && rxShapes.is() ) try { xShape.set( getBaseFilter().getModelFactory()->createInstance( rService ), UNO_QUERY_THROW ); // insert shape into passed shape collection (maybe drawpage or group shape) diff --git a/oox/source/xls/excelchartconverter.cxx b/oox/source/xls/excelchartconverter.cxx index 5c63ee5ee701..da938eafd1fc 100644 --- a/oox/source/xls/excelchartconverter.cxx +++ b/oox/source/xls/excelchartconverter.cxx @@ -82,7 +82,7 @@ Reference< XDataSequence > ExcelChartConverter::createDataSequence( if( rxDataProvider.is() ) { OUString aRangeRep; - if( rDataSeq.maFormula.getLength() > 0 ) + if( !rDataSeq.maFormula.isEmpty() ) { // parse the formula string, create a token sequence FormulaParser& rParser = getFormulaParser(); @@ -105,7 +105,7 @@ Reference< XDataSequence > ExcelChartConverter::createDataSequence( aRangeRep = FormulaProcessorBase::generateApiArray( aMatrix ); } - if( aRangeRep.getLength() > 0 ) try + if( !aRangeRep.isEmpty() ) try { // create the data sequence xDataSeq = rxDataProvider->createDataSequenceByRangeRepresentation( aRangeRep ); diff --git a/oox/source/xls/excelfilter.cxx b/oox/source/xls/excelfilter.cxx index bbf6ce64c99a..9ac3cf30b389 100644 --- a/oox/source/xls/excelfilter.cxx +++ b/oox/source/xls/excelfilter.cxx @@ -123,7 +123,7 @@ bool ExcelFilter::importDocument() throw() OOX_DUMP_FILE( ::oox::dump::xlsb::Dumper ); OUString aWorkbookPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "officeDocument" ) ); - if( aWorkbookPath.getLength() == 0 ) + if( aWorkbookPath.isEmpty() ) return false; /* Construct the WorkbookGlobals object referred to by every instance of diff --git a/oox/source/xls/excelhandlers.cxx b/oox/source/xls/excelhandlers.cxx index a2019edef585..271e9be629b9 100644 --- a/oox/source/xls/excelhandlers.cxx +++ b/oox/source/xls/excelhandlers.cxx @@ -98,7 +98,7 @@ const sal_uInt16 BIFF_BOF_WORKSPACE = 0x0100; /// BIFF3-BIFF8 workspac BiffFragmentHandler::BiffFragmentHandler( const FilterBase& rFilter, const OUString& rStrmName ) { // do not automatically close the root stream (indicated by empty stream name) - bool bRootStrm = rStrmName.getLength() == 0; + bool bRootStrm = rStrmName.isEmpty(); mxXInStrm.reset( new BinaryXInputStream( rFilter.openInputStream( rStrmName ), !bRootStrm ) ); mxBiffStrm.reset( new BiffInputStream( *mxXInStrm ) ); } diff --git a/oox/source/xls/excelvbaproject.cxx b/oox/source/xls/excelvbaproject.cxx index c1306a827d44..12ba7cb86044 100644 --- a/oox/source/xls/excelvbaproject.cxx +++ b/oox/source/xls/excelvbaproject.cxx @@ -103,7 +103,7 @@ void ExcelVbaProject::prepareImport() PropertySet aSheetProp( xSheetsEnum->nextElement() ); OUString aCodeName; aSheetProp.getProperty( aCodeName, PROP_CodeName ); - if( aCodeName.getLength() > 0 ) + if( !aCodeName.isEmpty() ) { aUsedCodeNames.insert( aCodeName ); } diff --git a/oox/source/xls/externallinkbuffer.cxx b/oox/source/xls/externallinkbuffer.cxx index df5eccff2bf8..93e4fb3cf86b 100644 --- a/oox/source/xls/externallinkbuffer.cxx +++ b/oox/source/xls/externallinkbuffer.cxx @@ -112,7 +112,7 @@ ExternalName::ExternalName( const ExternalLink& rParentLink ) : void ExternalName::importDefinedName( const AttributeList& rAttribs ) { maModel.maName = rAttribs.getXString( XML_name, OUString() ); - OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importDefinedName - empty name" ); + OSL_ENSURE( !maModel.maName.isEmpty(), "ExternalName::importDefinedName - empty name" ); // zero-based index into sheet list of externalBook maModel.mnSheet = rAttribs.getInteger( XML_sheetId, -1 ); } @@ -120,7 +120,7 @@ void ExternalName::importDefinedName( const AttributeList& rAttribs ) void ExternalName::importDdeItem( const AttributeList& rAttribs ) { maModel.maName = rAttribs.getXString( XML_name, OUString() ); - OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importDdeItem - empty name" ); + OSL_ENSURE( !maModel.maName.isEmpty(), "ExternalName::importDdeItem - empty name" ); maExtNameModel.mbOleObj = false; maExtNameModel.mbStdDocName = rAttribs.getBool( XML_ole, false ); maExtNameModel.mbNotify = rAttribs.getBool( XML_advise, false ); @@ -135,7 +135,7 @@ void ExternalName::importValues( const AttributeList& rAttribs ) void ExternalName::importOleItem( const AttributeList& rAttribs ) { maModel.maName = rAttribs.getXString( XML_name, OUString() ); - OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importOleItem - empty name" ); + OSL_ENSURE( !maModel.maName.isEmpty(), "ExternalName::importOleItem - empty name" ); maExtNameModel.mbOleObj = true; maExtNameModel.mbNotify = rAttribs.getBool( XML_advise, false ); maExtNameModel.mbPreferPic = rAttribs.getBool( XML_preferPic, false ); @@ -145,7 +145,7 @@ void ExternalName::importOleItem( const AttributeList& rAttribs ) void ExternalName::importExternalName( SequenceInputStream& rStrm ) { rStrm >> maModel.maName; - OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importExternalName - empty name" ); + OSL_ENSURE( !maModel.maName.isEmpty(), "ExternalName::importExternalName - empty name" ); } void ExternalName::importExternalNameFlags( SequenceInputStream& rStrm ) @@ -233,7 +233,7 @@ void ExternalName::importExternalName( BiffInputStream& rStrm ) maModel.maName = (getBiff() == BIFF8) ? rStrm.readUniStringBody( rStrm.readuInt8() ) : rStrm.readByteStringUC( false, getTextEncoding() ); - OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importExternalName - empty name" ); + OSL_ENSURE( !maModel.maName.isEmpty(), "ExternalName::importExternalName - empty name" ); // load cell references that are stored in hidden external names (seen in BIFF3-BIFF4) bool bHiddenRef = (getBiff() <= BIFF4) && (maModel.maName.getLength() > 1) && (maModel.maName[ 0 ] == '\x01') && (rStrm.getRemaining() > 2); @@ -347,7 +347,7 @@ sal_Int32 ExternalName::getSheetCacheIndex() const bool ExternalName::getDdeItemInfo( DDEItemInfo& orItemInfo ) const { - if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && (maModel.maName.getLength() > 0) ) + if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && !maModel.maName.isEmpty() ) { orItemInfo.Item = maModel.maName; orItemInfo.Results = ContainerHelper::matrixToSequenceSequence( maResults ); @@ -358,7 +358,7 @@ bool ExternalName::getDdeItemInfo( DDEItemInfo& orItemInfo ) const bool ExternalName::getDdeLinkData( OUString& orDdeServer, OUString& orDdeTopic, OUString& orDdeItem ) { - if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && (maModel.maName.getLength() > 0) ) + if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && !maModel.maName.isEmpty() ) { // try to create a DDE link and to set the imported link results if( !mbDdeLinkCreated ) try @@ -620,7 +620,7 @@ void ExternalLink::importExternSheet( BiffInputStream& rStrm ) maCalcSheets.push_back( getWorksheets().getCalcSheetIndex( aSheetName ) ); break; case LINKTYPE_EXTERNAL: - insertExternalSheet( (aSheetName.getLength() > 0) ? aSheetName : WorksheetBuffer::getBaseFileName( maTargetUrl ) ); + insertExternalSheet( aSheetName.isEmpty() ? WorksheetBuffer::getBaseFileName( maTargetUrl ) : aSheetName); break; default:; } @@ -648,7 +648,7 @@ void ExternalLink::importExternalBook( BiffInputStream& rStrm ) // parse the encoded URL OUString aDummySheetName = parseBiffTargetUrl( aTarget ); - OSL_ENSURE( aDummySheetName.getLength() == 0, "ExternalLink::importExternalBook - sheet name in encoded URL" ); + OSL_ENSURE( aDummySheetName.isEmpty(), "ExternalLink::importExternalBook - sheet name in encoded URL" ); (void)aDummySheetName; // prevent compiler warning // load external sheet names and create the sheet caches in the Calc document @@ -819,7 +819,7 @@ void ExternalLink::setExternalTargetUrl( const OUString& rTargetUrl, const OUStr if( rTargetType == OOX_TARGETTYPE_EXTLINK ) { maTargetUrl = getBaseFilter().getAbsoluteUrl( rTargetUrl ); - if( maTargetUrl.getLength() > 0 ) + if( !maTargetUrl.isEmpty() ) meLinkType = LINKTYPE_EXTERNAL; } else if( rTargetType == OOX_TARGETTYPE_LIBRARY ) @@ -845,7 +845,7 @@ void ExternalLink::setDdeOleTargetUrl( const OUString& rClassName, const OUStrin { maClassName = rClassName; maTargetUrl = rTargetUrl; - meLinkType = ((maClassName.getLength() > 0) && (maTargetUrl.getLength() > 0)) ? eLinkType : LINKTYPE_UNKNOWN; + meLinkType = (maClassName.isEmpty() || maTargetUrl.isEmpty()) ? LINKTYPE_UNKNOWN : eLinkType; OSL_ENSURE( meLinkType == eLinkType, "ExternalLink::setDdeOleTargetUrl - missing classname or target" ); } @@ -863,9 +863,9 @@ OUString ExternalLink::parseBiffTargetUrl( const OUString& rBiffTargetUrl ) switch( getAddressConverter().parseBiffTargetUrl( aClassName, aTargetUrl, aSheetName, rBiffTargetUrl ) ) { case BIFF_TARGETTYPE_URL: - if( aTargetUrl.getLength() == 0 ) + if( aTargetUrl.isEmpty() ) { - meLinkType = (aSheetName.getLength() > 0) ? LINKTYPE_INTERNAL : LINKTYPE_SELF; + meLinkType = aSheetName.isEmpty() ? LINKTYPE_SELF : LINKTYPE_INTERNAL; } else if( (aTargetUrl.getLength() == 1) && (aTargetUrl[ 0 ] == ':') ) { @@ -879,12 +879,12 @@ OUString ExternalLink::parseBiffTargetUrl( const OUString& rBiffTargetUrl ) break; case BIFF_TARGETTYPE_SAMESHEET: - OSL_ENSURE( (aTargetUrl.getLength() == 0) && (aSheetName.getLength() == 0), "ExternalLink::parseBiffTargetUrl - unexpected target or sheet name" ); + OSL_ENSURE( aTargetUrl.isEmpty() && aSheetName.isEmpty(), "ExternalLink::parseBiffTargetUrl - unexpected target or sheet name" ); meLinkType = LINKTYPE_SAME; break; case BIFF_TARGETTYPE_LIBRARY: - OSL_ENSURE( aSheetName.getLength() == 0, "ExternalLink::parseBiffTargetUrl - unexpected sheet name" ); + OSL_ENSURE( aSheetName.isEmpty(), "ExternalLink::parseBiffTargetUrl - unexpected sheet name" ); setExternalTargetUrl( aTargetUrl, OOX_TARGETTYPE_LIBRARY ); break; @@ -900,7 +900,7 @@ OUString ExternalLink::parseBiffTargetUrl( const OUString& rBiffTargetUrl ) void ExternalLink::insertExternalSheet( const OUString& rSheetName ) { - OSL_ENSURE( rSheetName.getLength() > 0, "ExternalLink::insertExternalSheet - empty sheet name" ); + OSL_ENSURE( !rSheetName.isEmpty(), "ExternalLink::insertExternalSheet - empty sheet name" ); if( mxDocLink.is() ) { Reference< XExternalSheetCache > xSheetCache = mxDocLink->addSheetCache( rSheetName, false ); diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx index abdfbf3ba1bb..477a8f9008b3 100644 --- a/oox/source/xls/formulabase.cxx +++ b/oox/source/xls/formulabase.cxx @@ -907,13 +907,13 @@ void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nM if( getFlag( rFuncData.mnFlags, FUNCFLAG_MACROCALL ) ) { - OSL_ENSURE( xFuncInfo->maOoxFuncName.getLength() > 0, "FunctionProviderImpl::initFunc - missing OOXML function name" ); + OSL_ENSURE( !xFuncInfo->maOoxFuncName.isEmpty(), "FunctionProviderImpl::initFunc - missing OOXML function name" ); OSL_ENSURE( !getFlag( rFuncData.mnFlags, FUNCFLAG_MACROCALLODF ), "FunctionProviderImpl::initFunc - unexpected flag FUNCFLAG_MACROCALLODF" ); xFuncInfo->maBiffMacroName = CREATE_OUSTRING( "_xlfn." ) + xFuncInfo->maOoxFuncName; } else if( getFlag( rFuncData.mnFlags, FUNCFLAG_MACROCALLODF ) ) { - OSL_ENSURE( xFuncInfo->maOdfFuncName.getLength() > 0, "FunctionProviderImpl::initFunc - missing ODF function name" ); + OSL_ENSURE( !xFuncInfo->maOdfFuncName.isEmpty(), "FunctionProviderImpl::initFunc - missing ODF function name" ); xFuncInfo->maBiffMacroName = CREATE_OUSTRING( "_xlfnodf." ) + xFuncInfo->maOdfFuncName; } @@ -937,15 +937,15 @@ void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nM // insert the function info into the member maps maFuncs.push_back( xFuncInfo ); - if( xFuncInfo->maOdfFuncName.getLength() > 0 ) + if( !xFuncInfo->maOdfFuncName.isEmpty() ) maOdfFuncs[ xFuncInfo->maOdfFuncName ] = xFuncInfo; - if( xFuncInfo->maOoxFuncName.getLength() > 0 ) + if( !xFuncInfo->maOoxFuncName.isEmpty() ) maOoxFuncs[ xFuncInfo->maOoxFuncName ] = xFuncInfo; if( xFuncInfo->mnBiff12FuncId != NOID ) maBiff12Funcs[ xFuncInfo->mnBiff12FuncId ] = xFuncInfo; if( xFuncInfo->mnBiffFuncId != NOID ) maBiffFuncs[ xFuncInfo->mnBiffFuncId ] = xFuncInfo; - if( xFuncInfo->maBiffMacroName.getLength() > 0 ) + if( !xFuncInfo->maBiffMacroName.isEmpty() ) maMacroFuncs[ xFuncInfo->maBiffMacroName ] = xFuncInfo; } @@ -1185,7 +1185,7 @@ bool OpCodeProviderImpl::initOpCode( sal_Int32& ornOpCode, const ApiTokenMap& rT if( aIt != rTokenMap.end() ) { ornOpCode = aIt->second.OpCode; - if( rOoxName.getLength() > 0 ) + if( !rOoxName.isEmpty() ) { FormulaOpCodeMapEntry aEntry; aEntry.Name = rOoxName; @@ -1217,7 +1217,7 @@ bool OpCodeProviderImpl::initOpCode( sal_Int32& ornOpCode, const ApiTokenMap& rT bool OpCodeProviderImpl::initFuncOpCode( FunctionInfo& orFuncInfo, const ApiTokenMap& rFuncTokenMap ) { bool bIsValid = false; - if( orFuncInfo.maOdfFuncName.getLength() > 0 ) + if( !orFuncInfo.maOdfFuncName.isEmpty() ) { ApiTokenMap::const_iterator aIt = rFuncTokenMap.find( orFuncInfo.maOdfFuncName ); if( aIt != rFuncTokenMap.end() ) @@ -1234,7 +1234,7 @@ bool OpCodeProviderImpl::initFuncOpCode( FunctionInfo& orFuncInfo, const ApiToke if( bIsValid && (orFuncInfo.mnApiOpCode == OPCODE_EXTERNAL) ) { - bIsValid = (aIt->second.Data >>= orFuncInfo.maExtProgName) && (orFuncInfo.maExtProgName.getLength() > 0); + bIsValid = (aIt->second.Data >>= orFuncInfo.maExtProgName) && !orFuncInfo.maExtProgName.isEmpty(); OSL_ENSURE( bIsValid, OStringBuffer( "OpCodeProviderImpl::initFuncOpCode - no programmatical name for external function \"" ). append( OUStringToOString( orFuncInfo.maOdfFuncName, RTL_TEXTENCODING_ASCII_US ) ). @@ -1242,7 +1242,7 @@ bool OpCodeProviderImpl::initFuncOpCode( FunctionInfo& orFuncInfo, const ApiToke } // add to parser map, if OOXML function name exists - if( bIsValid && (orFuncInfo.maOoxFuncName.getLength() > 0) ) + if( bIsValid && !orFuncInfo.maOoxFuncName.isEmpty() ) { // create the parser map entry FormulaOpCodeMapEntry aEntry; @@ -1254,7 +1254,7 @@ bool OpCodeProviderImpl::initFuncOpCode( FunctionInfo& orFuncInfo, const ApiToke else { // ignore entries for functions unknown by Calc *and* by Excel - bIsValid = orFuncInfo.maOoxFuncName.getLength() == 0; + bIsValid = orFuncInfo.maOoxFuncName.isEmpty(); } } else if( orFuncInfo.mnBiffFuncId == BIFF_FUNC_EXTERNCALL ) @@ -1262,7 +1262,7 @@ bool OpCodeProviderImpl::initFuncOpCode( FunctionInfo& orFuncInfo, const ApiToke orFuncInfo.mnApiOpCode = OPCODE_EXTERNAL; bIsValid = true; } - else if( orFuncInfo.maOoxFuncName.getLength() > 0 ) + else if( !orFuncInfo.maOoxFuncName.isEmpty() ) { orFuncInfo.mnApiOpCode = OPCODE_BAD; bIsValid = true; @@ -1284,7 +1284,7 @@ bool OpCodeProviderImpl::initFuncOpCodes( const ApiTokenMap& rIntFuncTokenMap, c // insert the function info into the maps if( xFuncInfo->mnApiOpCode != OPCODE_NONAME ) { - if( (xFuncInfo->mnApiOpCode == OPCODE_EXTERNAL) && (xFuncInfo->maExtProgName.getLength() > 0) ) + if( (xFuncInfo->mnApiOpCode == OPCODE_EXTERNAL) && !xFuncInfo->maExtProgName.isEmpty() ) maExtProgFuncs[ xFuncInfo->maExtProgName ] = xFuncInfo; else maOpCodeFuncs[ xFuncInfo->mnApiOpCode ] = xFuncInfo; @@ -1499,7 +1499,7 @@ OUString FormulaProcessorBase::generateApiAddressString( const CellAddress& rAdd OUString aCellName; PropertySet aCellProp( getCellFromDoc( rAddress ) ); aCellProp.getProperty( aCellName, PROP_AbsoluteName ); - OSL_ENSURE( aCellName.getLength() > 0, "FormulaProcessorBase::generateApiAddressString - cannot create cell address string" ); + OSL_ENSURE( !aCellName.isEmpty(), "FormulaProcessorBase::generateApiAddressString - cannot create cell address string" ); return aCellName; } @@ -1508,7 +1508,7 @@ OUString FormulaProcessorBase::generateApiRangeString( const CellRangeAddress& r OUString aRangeName; PropertySet aRangeProp( getCellRangeFromDoc( rRange ) ); aRangeProp.getProperty( aRangeName, PROP_AbsoluteName ); - OSL_ENSURE( aRangeName.getLength() > 0, "FormulaProcessorBase::generateApiRangeString - cannot create cell range string" ); + OSL_ENSURE( !aRangeName.isEmpty(), "FormulaProcessorBase::generateApiRangeString - cannot create cell range string" ); return aRangeName; } @@ -1518,7 +1518,7 @@ OUString FormulaProcessorBase::generateApiRangeListString( const ApiCellRangeLis for( ApiCellRangeList::const_iterator aIt = rRanges.begin(), aEnd = rRanges.end(); aIt != aEnd; ++aIt ) { OUString aRangeName = generateApiRangeString( *aIt ); - if( aRangeName.getLength() > 0 ) + if( !aRangeName.isEmpty() ) { if( aBuffer.getLength() > 0 ) aBuffer.append( API_TOKEN_SEP ); @@ -1671,7 +1671,7 @@ void FormulaProcessorBase::convertStringToStringList( ApiTokenSequence& orTokens, sal_Unicode cStringSep, bool bTrimLeadingSpaces ) const { OUString aString; - if( extractString( aString, orTokens ) && (aString.getLength() > 0) ) + if( extractString( aString, orTokens ) && !aString.isEmpty() ) { ::std::vector< ApiToken > aNewTokens; sal_Int32 nPos = 0; diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx index fb4ca7b6bd50..b7f7ddc8fb0c 100644 --- a/oox/source/xls/formulaparser.cxx +++ b/oox/source/xls/formulaparser.cxx @@ -111,7 +111,7 @@ const FunctionInfo* FormulaFinalizer::getFunctionInfo( ApiToken& orFuncToken ) // write function op-code to the OPCODE_BAD token orFuncToken.OpCode = pLibFuncInfo->mnApiOpCode; // if it is an external function, insert programmatic function name - if( (orFuncToken.OpCode == OPCODE_EXTERNAL) && (pLibFuncInfo->maExtProgName.getLength() > 0) ) + if( (orFuncToken.OpCode == OPCODE_EXTERNAL) && (!pLibFuncInfo->maExtProgName.isEmpty()) ) orFuncToken.Data <<= pLibFuncInfo->maExtProgName; else orFuncToken.Data.clear(); // clear string from OPCODE_BAD @@ -130,10 +130,10 @@ const FunctionInfo* FormulaFinalizer::getExternCallInfo( ApiToken& orFuncToken, { orFuncToken.OpCode = pFuncInfo->mnApiOpCode; // programmatic add-in function name - if( (pFuncInfo->mnApiOpCode == OPCODE_EXTERNAL) && (pFuncInfo->maExtProgName.getLength() > 0) ) + if( (pFuncInfo->mnApiOpCode == OPCODE_EXTERNAL) && !pFuncInfo->maExtProgName.isEmpty() ) orFuncToken.Data <<= pFuncInfo->maExtProgName; // name of unsupported function, convert to OPCODE_BAD to preserve the name - else if( (pFuncInfo->mnApiOpCode == OPCODE_BAD) && (pFuncInfo->maOoxFuncName.getLength() > 0) ) + else if( (pFuncInfo->mnApiOpCode == OPCODE_BAD) && !pFuncInfo->maOoxFuncName.isEmpty() ) orFuncToken.Data <<= pFuncInfo->maOoxFuncName; return pFuncInfo; } @@ -146,7 +146,7 @@ const FunctionInfo* FormulaFinalizer::getExternCallInfo( ApiToken& orFuncToken, if( (rECToken.OpCode == OPCODE_NAME) && rECToken.Data.has< sal_Int32 >() ) { OUString aDefName = resolveDefinedName( rECToken.Data.get< sal_Int32 >() ); - if( aDefName.getLength() > 0 ) + if( !aDefName.isEmpty() ) { orFuncToken.OpCode = OPCODE_BAD; orFuncToken.Data <<= aDefName; @@ -907,10 +907,10 @@ bool FormulaParserImpl::pushFunctionOperatorToken( const FunctionInfo& rFuncInfo if( bOk ) { // create an external add-in call for the passed built-in function - if( (rFuncInfo.mnApiOpCode == OPCODE_EXTERNAL) && (rFuncInfo.maExtProgName.getLength() > 0) ) + if( (rFuncInfo.mnApiOpCode == OPCODE_EXTERNAL) && !rFuncInfo.maExtProgName.isEmpty() ) getOperandToken( 1, 0, 0 ).Data <<= rFuncInfo.maExtProgName; // create a bad token with unsupported function name - else if( (rFuncInfo.mnApiOpCode == OPCODE_BAD) && (rFuncInfo.maOoxFuncName.getLength() > 0) ) + else if( (rFuncInfo.mnApiOpCode == OPCODE_BAD) && !rFuncInfo.maOoxFuncName.isEmpty() ) getOperandToken( 1, 0, 0 ).Data <<= rFuncInfo.maOoxFuncName; } return bOk; @@ -1029,14 +1029,14 @@ bool FormulaParserImpl::pushEmbeddedRefOperand( const DefinedNameBase& rName, bo Any aRefAny = rName.getReference( maBaseAddr ); if( aRefAny.hasValue() ) return pushAnyOperand( aRefAny, OPCODE_PUSH ); - if( bPushBadToken && (rName.getModelName().getLength() > 0) && (rName.getModelName()[ 0 ] >= ' ') ) + if( bPushBadToken && !rName.getModelName().isEmpty() && (rName.getModelName()[ 0 ] >= ' ') ) return pushValueOperand( rName.getModelName(), OPCODE_BAD ); return pushBiffErrorOperand( BIFF_ERR_NAME ); } bool FormulaParserImpl::pushDefinedNameOperand( const DefinedNameRef& rxDefName ) { - if( !rxDefName || (rxDefName->getModelName().getLength() == 0) ) + if( !rxDefName || rxDefName->getModelName().isEmpty() ) return pushBiffErrorOperand( BIFF_ERR_NAME ); if( rxDefName->isMacroFunction() ) return pushValueOperand( rxDefName->getModelName(), OPCODE_MACRO ); @@ -2790,7 +2790,7 @@ bool lclExtractRefId( sal_Int32& rnRefId, OUString& rRemainder, const OUString& { rnRefId = rFormulaString.copy( 1, nBracketClose - 1 ).toInt32(); rRemainder = rFormulaString.copy( nBracketClose + 1 ); - return rRemainder.getLength() > 0; + return !rRemainder.isEmpty(); } } return false; @@ -2870,7 +2870,7 @@ ApiTokenSequence FormulaParser::convertNameToFormula( sal_Int32 nTokenIndex ) co ApiTokenSequence FormulaParser::convertNumberToHyperlink( const OUString& rUrl, double fValue ) const { - OSL_ENSURE( rUrl.getLength() > 0, "FormulaParser::convertNumberToHyperlink - missing URL" ); + OSL_ENSURE( !rUrl.isEmpty(), "FormulaParser::convertNumberToHyperlink - missing URL" ); if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiffFuncId( BIFF_FUNC_HYPERLINK ) ) { ApiTokenSequence aTokens( 6 ); diff --git a/oox/source/xls/numberformatsbuffer.cxx b/oox/source/xls/numberformatsbuffer.cxx index cde00392917c..785fc4600c96 100644 --- a/oox/source/xls/numberformatsbuffer.cxx +++ b/oox/source/xls/numberformatsbuffer.cxx @@ -1928,7 +1928,7 @@ void NumberFormat::setPredefinedId( const Locale& rLocale, sal_Int16 nPredefId ) sal_Int32 NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNumFmts, const Locale& rFromLocale ) { - if( rxNumFmts.is() && (maModel.maFmtCode.getLength() > 0) ) + if( rxNumFmts.is() && !maModel.maFmtCode.isEmpty() ) maApiData.mnIndex = lclCreateFormat( rxNumFmts, maModel.maFmtCode, maModel.maLocale, rFromLocale ); else maApiData.mnIndex = lclCreatePredefinedFormat( rxNumFmts, maModel.mnPredefId, maModel.maLocale ); @@ -1960,7 +1960,7 @@ NumberFormatsBuffer::NumberFormatsBuffer( const WorkbookHelper& rHelper ) : xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= maLocaleStr; // if set to "use system", get locale from system - if( maLocaleStr.getLength() == 0 ) + if( maLocaleStr.isEmpty() ) { aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.System/L10N/" ); xConfigNA.set( xConfigProv->createInstanceWithArguments( diff --git a/oox/source/xls/pagesettings.cxx b/oox/source/xls/pagesettings.cxx index c3cd279baed8..0625bb3e152f 100644 --- a/oox/source/xls/pagesettings.cxx +++ b/oox/source/xls/pagesettings.cxx @@ -454,7 +454,7 @@ void PageSettings::finalizeImport() void PageSettings::importPictureData( const Relations& rRelations, const OUString& rRelId ) { OUString aPicturePath = rRelations.getFragmentPathFromRelId( rRelId ); - if( aPicturePath.getLength() > 0 ) + if( !aPicturePath.isEmpty() ) maModel.maGraphicUrl = getBaseFilter().getGraphicHelper().importEmbeddedGraphicObject( aPicturePath ); } @@ -613,7 +613,7 @@ HeaderFooterParser::HeaderFooterParser( const WorkbookHelper& rHelper ) : double HeaderFooterParser::parse( const Reference< XHeaderFooterContent >& rxContext, const OUString& rData ) { - if( !rxContext.is() || (rData.getLength() == 0) || + if( !rxContext.is() || rData.isEmpty() || !maPortions[ HF_LEFT ].initialize( rxContext->getLeftText() ) || !maPortions[ HF_CENTER ].initialize( rxContext->getCenterText() ) || !maPortions[ HF_RIGHT ].initialize( rxContext->getRightText() ) ) @@ -949,7 +949,7 @@ void HeaderFooterParser::appendField( const Reference< XTextContent >& rxContent void HeaderFooterParser::convertFontName( const OUString& rName ) { - if( rName.getLength() > 0 ) + if( !rName.isEmpty() ) { // single dash is document default font if( (rName.getLength() == 1) && (rName[ 0 ] == '-') ) @@ -967,7 +967,7 @@ void HeaderFooterParser::convertFontStyle( const OUString& rStyle ) while( (0 <= nPos) && (nPos < nLen) ) { OString aToken = OUStringToOString( rStyle.getToken( 0, ' ', nPos ), RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase(); - if( aToken.getLength() > 0 ) + if( !aToken.isEmpty() ) { if( maBoldNames.count( aToken ) > 0 ) maFontModel.mbBold = true; @@ -1211,7 +1211,7 @@ void PageSettingsConverter::writePageSettingsProperties( aPropMap[ PROP_FooterHeight ] <<= maFooterData.mnHeight; aPropMap[ PROP_FooterBodyDistance ] <<= maFooterData.mnBodyDist; // background image - if( rModel.maGraphicUrl.getLength() > 0 ) + if( !rModel.maGraphicUrl.isEmpty() ) { aPropMap[ PROP_BackGraphicURL ] <<= rModel.maGraphicUrl; aPropMap[ PROP_BackGraphicLocation ] <<= ::com::sun::star::style::GraphicLocation_TILED; @@ -1225,8 +1225,8 @@ void PageSettingsConverter::convertHeaderFooterData( const OUString rOddContent, const OUString rEvenContent, bool bUseEvenContent, double fPageMargin, double fContentMargin ) { - bool bHasOddContent = rOddContent.getLength() > 0; - bool bHasEvenContent = bUseEvenContent && (rEvenContent.getLength() > 0); + bool bHasOddContent = !rOddContent.isEmpty(); + bool bHasEvenContent = bUseEvenContent && !rEvenContent.isEmpty(); sal_Int32 nOddHeight = bHasOddContent ? writeHeaderFooter( rPropSet, orHFData.mnRightPropId, rOddContent ) : 0; sal_Int32 nEvenHeight = bHasEvenContent ? writeHeaderFooter( rPropSet, orHFData.mnLeftPropId, rEvenContent ) : 0; @@ -1262,9 +1262,9 @@ void PageSettingsConverter::convertHeaderFooterData( sal_Int32 PageSettingsConverter::writeHeaderFooter( PropertySet& rPropSet, sal_Int32 nPropId, const OUString& rContent ) { - OSL_ENSURE( rContent.getLength() > 0, "PageSettingsConverter::writeHeaderFooter - empty h/f string found" ); + OSL_ENSURE( !rContent.isEmpty(), "PageSettingsConverter::writeHeaderFooter - empty h/f string found" ); sal_Int32 nHeight = 0; - if( rContent.getLength() > 0 ) + if( !rContent.isEmpty() ) { Reference< XHeaderFooterContent > xHFContent( rPropSet.getAnyProperty( nPropId ), UNO_QUERY ); if( xHFContent.is() ) diff --git a/oox/source/xls/pivotcachebuffer.cxx b/oox/source/xls/pivotcachebuffer.cxx index 49652dafe34a..e4ed2a381dd7 100644 --- a/oox/source/xls/pivotcachebuffer.cxx +++ b/oox/source/xls/pivotcachebuffer.cxx @@ -889,7 +889,7 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie Reference< XNamed > xGroupName; OUString aAutoName; Reference< XIndexAccess > xGroupsIA( aGroupInfo.Groups, UNO_QUERY_THROW ); - for( sal_Int32 nIdx = 0, nCount = xGroupsIA->getCount(); (nIdx < nCount) && (aAutoName.getLength() == 0); ++nIdx ) try + for( sal_Int32 nIdx = 0, nCount = xGroupsIA->getCount(); (nIdx < nCount) && (aAutoName.isEmpty()); ++nIdx ) try { Reference< XNameAccess > xItemsNA( xGroupsIA->getByIndex( nIdx ), UNO_QUERY_THROW ); if( xItemsNA->hasByName( aFirstItem ) ) @@ -901,17 +901,17 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie catch( Exception& ) { } - OSL_ENSURE( aAutoName.getLength() > 0, "PivotCacheField::createParentGroupField - cannot find auto-generated group name" ); + OSL_ENSURE( !aAutoName.isEmpty(), "PivotCacheField::createParentGroupField - cannot find auto-generated group name" ); // get the real group name from the list of group items OUString aGroupName; if( const PivotCacheItem* pGroupItem = maGroupItems.getCacheItem( static_cast< sal_Int32 >( aIt - aBeg ) ) ) aGroupName = pGroupItem->getName(); - OSL_ENSURE( aGroupName.getLength() > 0, "PivotCacheField::createParentGroupField - cannot find group name" ); - if( aGroupName.getLength() == 0 ) + OSL_ENSURE( !aGroupName.isEmpty(), "PivotCacheField::createParentGroupField - cannot find group name" ); + if( aGroupName.isEmpty() ) aGroupName = aAutoName; - if( xGroupName.is() && (aGroupName.getLength() > 0) ) + if( xGroupName.is() && !aGroupName.isEmpty() ) { // replace the auto-generated group name with the real name if( aAutoName != aGroupName ) @@ -1238,8 +1238,8 @@ void PivotCache::finalizeImport() case XML_worksheet: { // decide whether an external document is used - bool bInternal = (maTargetUrl.getLength() == 0) && (maSheetSrcModel.maRelId.getLength() == 0); - bool bExternal = maTargetUrl.getLength() > 0; // relation ID may be empty, e.g. BIFF import + bool bInternal = maTargetUrl.isEmpty() && maSheetSrcModel.maRelId.isEmpty(); + bool bExternal = !maTargetUrl.isEmpty(); // relation ID may be empty, e.g. BIFF import OSL_ENSURE( bInternal || bExternal, "PivotCache::finalizeImport - invalid external document URL" ); if( bInternal ) finalizeInternalSheetSource(); @@ -1329,13 +1329,13 @@ void PivotCache::importDConRef( BiffInputStream& rStrm ) // the URL with (required) sheet name and optional URL of an external document importDConUrl( rStrm ); - OSL_ENSURE( maSheetSrcModel.maSheet.getLength() > 0, "PivotCache::importDConRef - missing sheet name" ); + OSL_ENSURE( !maSheetSrcModel.maSheet.isEmpty(), "PivotCache::importDConRef - missing sheet name" ); } void PivotCache::importDConName( BiffInputStream& rStrm ) { maSheetSrcModel.maDefName = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteStringUC( false, getTextEncoding() ); - OSL_ENSURE( maSheetSrcModel.maDefName.getLength() > 0, "PivotCache::importDConName - missing defined name" ); + OSL_ENSURE( !maSheetSrcModel.maDefName.isEmpty(), "PivotCache::importDConName - missing defined name" ); importDConUrl( rStrm ); } @@ -1363,7 +1363,7 @@ void PivotCache::importDConUrl( BiffInputStream& rStrm ) aEncodedUrl = rStrm.readByteStringUC( false, getTextEncoding() ); } - if( aEncodedUrl.getLength() > 0 ) + if( !aEncodedUrl.isEmpty() ) { OUString aClassName; getAddressConverter().parseBiffTargetUrl( aClassName, maTargetUrl, maSheetSrcModel.maSheet, aEncodedUrl, true ); @@ -1376,7 +1376,7 @@ void PivotCache::finalizeInternalSheetSource() sal_Int16 nSheet = getWorksheets().getCalcSheetIndex( maSheetSrcModel.maSheet ); // if cache is based on a defined name or table, try to resolve to cell range - if( maSheetSrcModel.maDefName.getLength() > 0 ) + if( !maSheetSrcModel.maDefName.isEmpty() ) { // local or global defined name if( const DefinedName* pDefName = getDefinedNames().getByModelName( maSheetSrcModel.maDefName, nSheet ).get() ) @@ -1401,7 +1401,7 @@ void PivotCache::finalizeInternalSheetSource() mbValidSource = true; } // else sheet has been deleted, generate the source data from cache - else if( maSheetSrcModel.maSheet.getLength() > 0 ) + else if( !maSheetSrcModel.maSheet.isEmpty() ) { prepareSourceDataSheet(); // return here to skip the source range check below @@ -1419,8 +1419,8 @@ void PivotCache::finalizeExternalSheetSource() /* If pivot cache is based on external sheet data, try to restore sheet data from cache records. No support for external defined names or tables, sheet name and path to cache records fragment (OOXML only) are required. */ - bool bHasRelation = (getFilterType() == FILTER_BIFF) || (maDefModel.maRelId.getLength() > 0); - if( bHasRelation && (maSheetSrcModel.maDefName.getLength() == 0) && (maSheetSrcModel.maSheet.getLength() > 0) ) + bool bHasRelation = (getFilterType() == FILTER_BIFF) || !maDefModel.maRelId.isEmpty(); + if( bHasRelation && maSheetSrcModel.maDefName.isEmpty() && !maSheetSrcModel.maSheet.isEmpty() ) prepareSourceDataSheet(); } @@ -1462,7 +1462,7 @@ void PivotCacheBuffer::registerPivotCacheFragment( sal_Int32 nCacheId, const OUS { OSL_ENSURE( nCacheId >= 0, "PivotCacheBuffer::registerPivotCacheFragment - invalid pivot cache identifier" ); OSL_ENSURE( maFragmentPaths.count( nCacheId ) == 0, "PivotCacheBuffer::registerPivotCacheFragment - fragment path exists already" ); - if( (nCacheId >= 0) && (rFragmentPath.getLength() > 0) ) + if( (nCacheId >= 0) && !rFragmentPath.isEmpty() ) maFragmentPaths[ nCacheId ] = rFragmentPath; } diff --git a/oox/source/xls/pivotcachefragment.cxx b/oox/source/xls/pivotcachefragment.cxx index d86a15851735..4884976a790b 100644 --- a/oox/source/xls/pivotcachefragment.cxx +++ b/oox/source/xls/pivotcachefragment.cxx @@ -208,7 +208,7 @@ void PivotCacheDefinitionFragment::finalizeImport() if( mrPivotCache.isValidDataSource() && mrPivotCache.isBasedOnDummySheet() ) { OUString aRecFragmentPath = getRelations().getFragmentPathFromRelId( mrPivotCache.getRecordsRelId() ); - if( aRecFragmentPath.getLength() > 0 ) + if( !aRecFragmentPath.isEmpty() ) { sal_Int16 nSheet = mrPivotCache.getSourceRange().Sheet; WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, nSheet ); diff --git a/oox/source/xls/pivottablebuffer.cxx b/oox/source/xls/pivottablebuffer.cxx index 3a8ea647e781..fefced861456 100644 --- a/oox/source/xls/pivottablebuffer.cxx +++ b/oox/source/xls/pivottablebuffer.cxx @@ -529,7 +529,7 @@ void PivotTableField::finalizeImport( const Reference< XDataPilotDescriptor >& r xDPField.set( xDPFieldsIA->getByIndex( nDatabaseIdx ), UNO_QUERY_THROW ); Reference< XNamed > xDPFieldName( xDPField, UNO_QUERY_THROW ); maDPFieldName = xDPFieldName->getName(); - OSL_ENSURE( maDPFieldName.getLength() > 0, "PivotTableField::finalizeImport - no field name in source data found" ); + OSL_ENSURE( !maDPFieldName.isEmpty(), "PivotTableField::finalizeImport - no field name in source data found" ); // try to convert grouping settings if( const PivotCacheField* pCacheField = mrPivotTable.getCacheField( mnFieldIndex ) ) @@ -566,14 +566,14 @@ void PivotTableField::finalizeImport( const Reference< XDataPilotDescriptor >& r void PivotTableField::finalizeDateGroupingImport( const Reference< XDataPilotField >& rxBaseDPField, sal_Int32 nBaseFieldIdx ) { - if( maDPFieldName.getLength() == 0 ) // prevent endless loops if file format is broken + if( maDPFieldName.isEmpty() ) // prevent endless loops if file format is broken { if( const PivotCacheField* pCacheField = mrPivotTable.getCacheField( mnFieldIndex ) ) { if( !pCacheField->isDatabaseField() && pCacheField->hasDateGrouping() && (pCacheField->getGroupBaseField() == nBaseFieldIdx) ) { maDPFieldName = pCacheField->createDateGroupField( rxBaseDPField ); - OSL_ENSURE( maDPFieldName.getLength() > 0, "PivotTableField::finalizeDateGroupingImport - cannot create date group field" ); + OSL_ENSURE( !maDPFieldName.isEmpty(), "PivotTableField::finalizeDateGroupingImport - cannot create date group field" ); } } } @@ -581,7 +581,7 @@ void PivotTableField::finalizeDateGroupingImport( const Reference< XDataPilotFie void PivotTableField::finalizeParentGroupingImport( const Reference< XDataPilotField >& rxBaseDPField, PivotCacheGroupItemVector& orItemNames ) { - if( maDPFieldName.getLength() == 0 ) // prevent endless loops if file format is broken + if( maDPFieldName.isEmpty() ) // prevent endless loops if file format is broken { if( const PivotCacheField* pCacheField = mrPivotTable.getCacheField( mnFieldIndex ) ) { @@ -651,7 +651,7 @@ void PivotTableField::convertPageField( const PTPageFieldModel& rPageField ) if( const PivotCacheItem* pSharedItem = pCacheField->getCacheItem( nCacheItem ) ) { OUString aSelectedPage = pSharedItem->getName(); - if( aSelectedPage.getLength() > 0 ) + if( !aSelectedPage.isEmpty() ) aPropSet.setProperty( PROP_SelectedPage, aSelectedPage ); } } @@ -1361,7 +1361,7 @@ void PivotTable::finalizeImport() if( getAddressConverter().validateCellRange( maLocationModel.maRange, true, true ) ) { mpPivotCache = getPivotCaches().importPivotCacheFragment( maDefModel.mnCacheId ); - if( mpPivotCache && mpPivotCache->isValidDataSource() && (maDefModel.maName.getLength() > 0) ) + if( mpPivotCache && mpPivotCache->isValidDataSource() && !maDefModel.maName.isEmpty() ) { // clear destination area of the original pivot table try @@ -1461,7 +1461,7 @@ void PivotTable::finalizeParentGroupingImport( const Reference< XDataPilotField Reference< XDataPilotField > PivotTable::getDataPilotField( const OUString& rFieldName ) const { Reference< XDataPilotField > xDPField; - if( (rFieldName.getLength() > 0) && mxDPDescriptor.is() ) try + if( !rFieldName.isEmpty() && mxDPDescriptor.is() ) try { Reference< XNameAccess > xDPFieldsNA( mxDPDescriptor->getDataPilotFields(), UNO_QUERY_THROW ); xDPField.set( xDPFieldsNA->getByName( rFieldName ), UNO_QUERY ); diff --git a/oox/source/xls/querytablebuffer.cxx b/oox/source/xls/querytablebuffer.cxx index 97b10fa6a934..d9043684ee78 100644 --- a/oox/source/xls/querytablebuffer.cxx +++ b/oox/source/xls/querytablebuffer.cxx @@ -101,7 +101,7 @@ const sal_uInt32 BIFF_QTREFRESH_ADJUSTCOLWIDTH = 0x00000002; void lclAppendWebQueryTableName( OUStringBuffer& rTables, const OUString& rTableName ) { - if( rTableName.getLength() > 0 ) + if( !rTableName.isEmpty() ) { if( rTables.getLength() > 0 ) rTables.append( sal_Unicode( ';' ) ); @@ -325,7 +325,7 @@ void QueryTable::finalizeImport() if( pWebPr && !pWebPr->mbXml ) { OUString aFileUrl = getBaseFilter().getAbsoluteUrl( pWebPr->maUrl ); - if( aFileUrl.getLength() > 0 ) + if( !aFileUrl.isEmpty() ) { // resolve destination cell range (stored as defined name containing the range) OUString aDefName = maModel.maDefName.replace( ' ', '_' ).replace( '-', '_' ); @@ -341,7 +341,7 @@ void QueryTable::finalizeImport() CellAddress aDestPos( aDestRange.Sheet, aDestRange.StartColumn, aDestRange.StartRow ); // find tables mode: entire document, all tables, or specific tables OUString aTables = pWebPr->mbHtmlTables ? lclBuildWebQueryTables( pWebPr->maTables ) : CREATE_OUSTRING( "HTML_all" ); - if( aTables.getLength() > 0 ) try + if( !aTables.isEmpty() ) try { PropertySet aDocProps( getDocument() ); Reference< XAreaLinks > xAreaLinks( aDocProps.getAnyProperty( PROP_AreaLinks ), UNO_QUERY_THROW ); diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx index 7b025e58a687..48d5db87b9bc 100644 --- a/oox/source/xls/richstring.cxx +++ b/oox/source/xls/richstring.cxx @@ -579,9 +579,9 @@ RichStringPhoneticRef RichString::createPhonetic() void RichString::createTextPortions( const OString& rText, rtl_TextEncoding eTextEnc, FontPortionModelList& rPortions ) { maTextPortions.clear(); - sal_Int32 nStrLen = rText.getLength(); - if( nStrLen > 0 ) + if( !rText.isEmpty()) { + sal_Int32 nStrLen = rText.getLength(); // add leading and trailing string position to ease the following loop if( rPortions.empty() || (rPortions.front().mnPos > 0) ) rPortions.insert( rPortions.begin(), FontPortionModel( 0, -1 ) ); @@ -610,9 +610,9 @@ void RichString::createTextPortions( const OString& rText, rtl_TextEncoding eTex void RichString::createTextPortions( const OUString& rText, FontPortionModelList& rPortions ) { maTextPortions.clear(); - sal_Int32 nStrLen = rText.getLength(); - if( nStrLen > 0 ) + if( !rText.isEmpty() ) { + sal_Int32 nStrLen = rText.getLength(); // add leading and trailing string position to ease the following loop if( rPortions.empty() || (rPortions.front().mnPos > 0) ) rPortions.insert( rPortions.begin(), FontPortionModel( 0, -1 ) ); @@ -636,9 +636,9 @@ void RichString::createTextPortions( const OUString& rText, FontPortionModelList void RichString::createPhoneticPortions( const ::rtl::OUString& rText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen ) { maPhonPortions.clear(); - sal_Int32 nStrLen = rText.getLength(); - if( nStrLen > 0 ) + if( !rText.isEmpty()) { + sal_Int32 nStrLen = rText.getLength(); // no portions - assign phonetic text to entire base text if( rPortions.empty() ) rPortions.push_back( PhoneticPortionModel( 0, 0, nBaseLen ) ); diff --git a/oox/source/xls/scenariobuffer.cxx b/oox/source/xls/scenariobuffer.cxx index 23636dd0be7e..b0d24c994c64 100644 --- a/oox/source/xls/scenariobuffer.cxx +++ b/oox/source/xls/scenariobuffer.cxx @@ -168,7 +168,7 @@ void Scenario::finalizeImport() if( !aIt->mbDeleted && rAddrConv.checkCellAddress( aIt->maPos, true ) ) aRanges.push_back( CellRangeAddress( aIt->maPos.Sheet, aIt->maPos.Column, aIt->maPos.Row, aIt->maPos.Column, aIt->maPos.Row ) ); - if( !aRanges.empty() && (maModel.maName.getLength() > 0) ) try + if( !aRanges.empty() && !maModel.maName.isEmpty() ) try { /* Find an unused name for the scenario (Calc stores scenario data in hidden sheets named after the scenario following the base sheet). */ diff --git a/oox/source/xls/sheetdatabuffer.cxx b/oox/source/xls/sheetdatabuffer.cxx index 0839b9dc55d4..1514eb841a69 100644 --- a/oox/source/xls/sheetdatabuffer.cxx +++ b/oox/source/xls/sheetdatabuffer.cxx @@ -724,7 +724,7 @@ void SheetDataBuffer::finalizeTableOperation( const CellRangeAddress& rRange, co { sal_Int16 nSheet = getSheetIndex(); bool bOk = false; - if( !rModel.mbRef1Deleted && (rModel.maRef1.getLength() > 0) && (rRange.StartColumn > 0) && (rRange.StartRow > 0) ) + if( !rModel.mbRef1Deleted && !rModel.maRef1.isEmpty() && (rRange.StartColumn > 0) && (rRange.StartRow > 0) ) { CellRangeAddress aOpRange = rRange; CellAddress aRef1; diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx index dfb9db03ed0e..b6415f363dbc 100644 --- a/oox/source/xls/sheetdatacontext.cxx +++ b/oox/source/xls/sheetdatacontext.cxx @@ -217,7 +217,7 @@ void SheetDataContext::onEndElement() if( !mbHasFormula ) { // no formula created: try to set the cell value - if( maCellValue.getLength() > 0 ) switch( maCellData.mnCellType ) + if( !maCellValue.isEmpty() ) switch( maCellData.mnCellType ) { case XML_n: mrSheetData.setValueCell( maCellData, maCellValue.toDouble() ); @@ -247,7 +247,7 @@ void SheetDataContext::onEndElement() mrSheetData.setBlankCell( maCellData ); } } - else if( maCellValue.getLength() > 0 ) switch( maCellData.mnCellType ) + else if( !maCellValue.isEmpty() ) switch( maCellData.mnCellType ) { case XML_n: /* Set the pre-loaded value */ diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx index 28f7273aa589..a09c4eb0bd51 100644 --- a/oox/source/xls/stylesbuffer.cxx +++ b/oox/source/xls/stylesbuffer.cxx @@ -946,7 +946,7 @@ void Font::importCfRule( BiffInputStream& rStrm ) OSL_ENSURE( rStrm.getRemaining() >= 118, "Font::importCfRule - missing record data" ); sal_Int64 nRecPos = rStrm.tell(); maModel.maName = rStrm.readUniStringBody( rStrm.readuInt8() ); - maUsedFlags.mbNameUsed = maModel.maName.getLength() > 0; + maUsedFlags.mbNameUsed = !maModel.maName.isEmpty(); OSL_ENSURE( !rStrm.isEof() && (rStrm.tell() <= nRecPos + 64), "Font::importCfRule - font name too long" ); rStrm.seek( nRecPos + 64 ); rStrm >> nHeight >> nStyle >> nWeight >> nEscapement >> nUnderline; @@ -1110,19 +1110,19 @@ void Font::writeToPropertyMap( PropertyMap& rPropMap, FontPropertyType ePropType // font name properties if( maUsedFlags.mbNameUsed ) { - if( maApiData.maLatinFont.maName.getLength() > 0 ) + if( !maApiData.maLatinFont.maName.isEmpty() ) { rPropMap[ PROP_CharFontName ] <<= maApiData.maLatinFont.maName; rPropMap[ PROP_CharFontFamily ] <<= maApiData.maLatinFont.mnFamily; rPropMap[ PROP_CharFontCharSet ] <<= maApiData.maLatinFont.mnTextEnc; } - if( maApiData.maAsianFont.maName.getLength() > 0 ) + if( !maApiData.maAsianFont.maName.isEmpty() ) { rPropMap[ PROP_CharFontNameAsian ] <<= maApiData.maAsianFont.maName; rPropMap[ PROP_CharFontFamilyAsian ] <<= maApiData.maAsianFont.mnFamily; rPropMap[ PROP_CharFontCharSetAsian ] <<= maApiData.maAsianFont.mnTextEnc; } - if( maApiData.maCmplxFont.maName.getLength() > 0 ) + if( !maApiData.maCmplxFont.maName.isEmpty() ) { rPropMap[ PROP_CharFontNameComplex ] <<= maApiData.maCmplxFont.maName; rPropMap[ PROP_CharFontFamilyComplex ] <<= maApiData.maCmplxFont.mnFamily; @@ -2809,7 +2809,7 @@ OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, const OUString& rName, sa aStyleName.appendAscii( spcStyleNamePrefix ); if( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount) && (sppcStyleNames[ nBuiltinId ][ 0 ] != 0) ) aStyleName.appendAscii( sppcStyleNames[ nBuiltinId ] ); - else if( rName.getLength() > 0 ) + else if( !rName.isEmpty() ) aStyleName.append( rName ); else aStyleName.append( nBuiltinId ); @@ -2910,7 +2910,7 @@ void CellStyle::createCellStyle() { // #i1624# #i1768# ignore unnamed user styles if( !mbCreated ) - mbCreated = maFinalName.getLength() == 0; + mbCreated = maFinalName.isEmpty(); /* #i103281# do not create another style of the same name, if it exists already. This is needed to prevent that styles pasted from clipboard @@ -3036,7 +3036,7 @@ void CellStyleBuffer::finalizeImport() { const CellStyleModel& rModel = (*aIt)->getModel(); // #i1624# #i1768# ignore unnamed user styles - if( rModel.maName.getLength() > 0 ) + if( !rModel.maName.isEmpty() ) { if( aCellStyles.count( rModel.maName ) > 0 ) aConflictNameStyles.push_back( *aIt ); @@ -3114,7 +3114,7 @@ OUString CellStyleBuffer::createCellStyle( const CellStyleRef& rxCellStyle ) con { rxCellStyle->createCellStyle(); const OUString& rStyleName = rxCellStyle->getFinalStyleName(); - if( rStyleName.getLength() > 0 ) + if( !rStyleName.isEmpty() ) return rStyleName; } // on error: fallback to default style @@ -3423,7 +3423,7 @@ OUString StylesBuffer::createCellStyle( sal_Int32 nXfId ) const OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const { OUString& rStyleName = maDxfStyles[ nDxfId ]; - if( rStyleName.getLength() == 0 ) + if( rStyleName.isEmpty() ) { if( Dxf* pDxf = maDxfs.get( nDxfId ).get() ) { @@ -3435,7 +3435,7 @@ OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const pDxf->writeToPropertySet( aPropSet ); } // on error: fallback to default style - if( rStyleName.getLength() == 0 ) + if( rStyleName.isEmpty() ) rStyleName = maCellStyles.getDefaultStyleName(); } return rStyleName; diff --git a/oox/source/xls/tablebuffer.cxx b/oox/source/xls/tablebuffer.cxx index cc6647ab6e52..baefc3d41631 100644 --- a/oox/source/xls/tablebuffer.cxx +++ b/oox/source/xls/tablebuffer.cxx @@ -94,7 +94,7 @@ void Table::finalizeImport() // ranges (or tables in their terminology) as Table1, Table2 etc. We need // to import them as named db ranges because they may be referenced by // name in formula expressions. - if( (maModel.mnId > 0) && (maModel.maDisplayName.getLength() > 0) ) try + if( (maModel.mnId > 0) && !maModel.maDisplayName.isEmpty() ) try { maDBRangeName = maModel.maDisplayName; Reference< XDatabaseRange > xDatabaseRange( @@ -154,7 +154,7 @@ void TableBuffer::insertTableToMaps( const TableRef& rxTable ) { sal_Int32 nTableId = rxTable->getTableId(); const OUString& rDispName = rxTable->getDisplayName(); - if( (nTableId > 0) && (rDispName.getLength() > 0) ) + if( (nTableId > 0) && !rDispName.isEmpty() ) { OSL_ENSURE( !maIdTables.has( nTableId ), "TableBuffer::insertTableToMaps - multiple table identifier" ); maIdTables[ nTableId ] = rxTable; diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx index 9d22f5fdf937..d4e61fb9834e 100644 --- a/oox/source/xls/workbookfragment.cxx +++ b/oox/source/xls/workbookfragment.cxx @@ -200,25 +200,25 @@ void WorkbookFragment::finalizeImport() // read the theme substream OUString aThemeFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "theme" ) ); - if( aThemeFragmentPath.getLength() > 0 ) + if( !aThemeFragmentPath.isEmpty() ) importOoxFragment( new ThemeFragmentHandler( getFilter(), aThemeFragmentPath, getTheme() ) ); xGlobalSegment->setPosition( 0.25 ); // read the styles substream (requires finalized theme buffer) OUString aStylesFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "styles" ) ); - if( aStylesFragmentPath.getLength() > 0 ) + if( !aStylesFragmentPath.isEmpty() ) importOoxFragment( new StylesFragment( *this, aStylesFragmentPath ) ); xGlobalSegment->setPosition( 0.5 ); // read the shared string table substream (requires finalized styles buffer) OUString aSstFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "sharedStrings" ) ); - if( aSstFragmentPath.getLength() > 0 ) + if( !aSstFragmentPath.isEmpty() ) importOoxFragment( new SharedStringsFragment( *this, aSstFragmentPath ) ); xGlobalSegment->setPosition( 0.75 ); // read the connections substream OUString aConnFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "connections" ) ); - if( aConnFragmentPath.getLength() > 0 ) + if( !aConnFragmentPath.isEmpty() ) importOoxFragment( new ConnectionsFragment( *this, aConnFragmentPath ) ); xGlobalSegment->setPosition( 1.0 ); @@ -240,8 +240,8 @@ void WorkbookFragment::finalizeImport() { // get fragment path of the sheet OUString aFragmentPath = getFragmentPathFromRelation( *pRelation ); - OSL_ENSURE( aFragmentPath.getLength() > 0, "WorkbookFragment::finalizeImport - cannot access sheet fragment" ); - if( aFragmentPath.getLength() > 0 ) + OSL_ENSURE( !aFragmentPath.isEmpty(), "WorkbookFragment::finalizeImport - cannot access sheet fragment" ); + if( !aFragmentPath.isEmpty() ) { double fSegmentLength = getProgressBar().getFreeLength() / (nWorksheetCount - nWorksheet); ISegmentProgressBarRef xSheetSegment = getProgressBar().createSegment( fSegmentLength ); @@ -306,7 +306,7 @@ void WorkbookFragment::finalizeImport() // open the VBA project storage OUString aVbaFragmentPath = getFragmentPathFromFirstType( CREATE_MSOFFICE_RELATION_TYPE( "vbaProject" ) ); - if( aVbaFragmentPath.getLength() > 0 ) + if( !aVbaFragmentPath.isEmpty() ) { Reference< XInputStream > xInStrm = getBaseFilter().openInputStream( aVbaFragmentPath ); if( xInStrm.is() ) @@ -358,7 +358,7 @@ void WorkbookFragment::importPivotCache( SequenceInputStream& rStrm ) void WorkbookFragment::importExternalLinkFragment( ExternalLink& rExtLink ) { OUString aFragmentPath = getFragmentPathFromRelId( rExtLink.getRelId() ); - if( aFragmentPath.getLength() > 0 ) + if( !aFragmentPath.isEmpty() ) importOoxFragment( new ExternalLinkFragment( *this, aFragmentPath, rExtLink ) ); } diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx index 3cc56cdce7be..d1a61c9c00bc 100644 --- a/oox/source/xls/workbookhelper.cxx +++ b/oox/source/xls/workbookhelper.cxx @@ -365,7 +365,7 @@ Reference< XNamedRange > WorkbookGlobals::createNamedRangeObject( OUString& orNa { // create the name and insert it into the Calc document Reference< XNamedRange > xNamedRange; - if( orName.getLength() > 0 ) try + if( !orName.isEmpty() ) try { // find an unused name PropertySet aDocProps( mxDoc ); @@ -387,7 +387,7 @@ Reference< XNamedRange > WorkbookGlobals::createLocalNamedRangeObject( OUString& { // create the name and insert it into the Calc document Reference< XNamedRange > xNamedRange; - if( orName.getLength() > 0 ) try + if( !orName.isEmpty() ) try { // find an unused name Reference< XIndexAccess > xSheets(mxDoc->getSheets(), UNO_QUERY_THROW); @@ -418,7 +418,7 @@ Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString // create database range and insert it into the Calc document Reference< XDatabaseRange > xDatabaseRange; - if( bValidRange && (orName.getLength() > 0) ) try + if( bValidRange && !orName.isEmpty() ) try { // find an unused name PropertySet aDocProps( mxDoc ); diff --git a/oox/source/xls/worksheetbuffer.cxx b/oox/source/xls/worksheetbuffer.cxx index 84ffb4c955b8..be741ab6aec9 100644 --- a/oox/source/xls/worksheetbuffer.cxx +++ b/oox/source/xls/worksheetbuffer.cxx @@ -207,7 +207,7 @@ WorksheetBuffer::IndexNamePair WorksheetBuffer::createSheet( const OUString& rPr Reference< XIndexAccess > xSheetsIA( xSheets, UNO_QUERY_THROW ); Reference< XNameAccess > xSheetsNA( xSheets, UNO_QUERY_THROW ); sal_Int16 nCalcSheet = -1; - OUString aSheetName = (rPreferredName.getLength() == 0) ? CREATE_OUSTRING( "Sheet" ) : rPreferredName; + OUString aSheetName = rPreferredName.isEmpty() ? CREATE_OUSTRING( "Sheet" ) : rPreferredName; PropertySet aPropSet; if( nSheetPos < xSheetsIA->getCount() ) { diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx index 3832a1b034f6..a045c46feb46 100644 --- a/oox/source/xls/worksheetfragment.cxx +++ b/oox/source/xls/worksheetfragment.cxx @@ -224,7 +224,7 @@ WorksheetFragment::WorksheetFragment( const WorksheetHelper& rHelper, const OUSt // import comments related to this worksheet OUString aCommentsFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "comments" ) ); - if( aCommentsFragmentPath.getLength() > 0 ) + if( !aCommentsFragmentPath.isEmpty() ) importOoxFragment( new CommentsFragment( *this, aCommentsFragmentPath ) ); } @@ -731,7 +731,7 @@ void WorksheetFragment::importControl( SequenceInputStream& rStrm ) void WorksheetFragment::importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const OUString& rRelId ) { OUString aFragmentPath = getFragmentPathFromRelId( rRelId ); - if( aFragmentPath.getLength() > 0 ) + if( !aFragmentPath.isEmpty() ) getBaseFilter().importBinaryData( orEmbeddedData, aFragmentPath ); } diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index e8a29729638c..14e7d2403eba 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -979,7 +979,7 @@ void WorksheetGlobals::finalizeHyperlinkRanges() const { OUString aUrl = getHyperlinkUrl( *aIt ); // try to insert URL into each cell of the range - if( aUrl.getLength() > 0 ) + if( !aUrl.isEmpty() ) for( CellAddress aAddress( getSheetIndex(), aIt->maRange.StartColumn, aIt->maRange.StartRow ); aAddress.Row <= aIt->maRange.EndRow; ++aAddress.Row ) for( aAddress.Column = aIt->maRange.StartColumn; aAddress.Column <= aIt->maRange.EndColumn; ++aAddress.Column ) insertHyperlink( aAddress, aUrl ); @@ -989,14 +989,14 @@ void WorksheetGlobals::finalizeHyperlinkRanges() const OUString WorksheetGlobals::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) const { OUStringBuffer aUrlBuffer; - if( rHyperlink.maTarget.getLength() > 0 ) + if( !rHyperlink.maTarget.isEmpty() ) aUrlBuffer.append( getBaseFilter().getAbsoluteUrl( rHyperlink.maTarget ) ); - if( rHyperlink.maLocation.getLength() > 0 ) + if( !rHyperlink.maLocation.isEmpty() ) aUrlBuffer.append( sal_Unicode( '#' ) ).append( rHyperlink.maLocation ); OUString aUrl = aUrlBuffer.makeStringAndClear(); // convert '#SheetName!A1' to '#SheetName.A1' - if( (aUrl.getLength() > 0) && (aUrl[ 0 ] == '#') ) + if( !aUrl.isEmpty() && (aUrl[ 0 ] == '#') ) { sal_Int32 nSepPos = aUrl.lastIndexOf( '!' ); if( nSepPos > 0 ) @@ -1006,7 +1006,7 @@ OUString WorksheetGlobals::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) c // #i66592# convert sheet names that have been renamed on import OUString aSheetName = aUrl.copy( 1, nSepPos - 1 ); OUString aCalcName = getWorksheets().getCalcSheetName( aSheetName ); - if( aCalcName.getLength() > 0 ) + if( !aCalcName.isEmpty() ) aUrl = aUrl.replaceAt( 1, nSepPos - 1, aCalcName ); } } @@ -1316,9 +1316,9 @@ void WorksheetGlobals::finalizeDrawings() { case FILTER_OOXML: // import DML and VML - if( maDrawingPath.getLength() > 0 ) + if( !maDrawingPath.isEmpty() ) importOoxFragment( new DrawingFragment( *this, maDrawingPath ) ); - if( maVmlDrawingPath.getLength() > 0 ) + if( !maVmlDrawingPath.isEmpty() ) importOoxFragment( new VmlDrawingFragment( *this, maVmlDrawingPath ) ); break; |