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 | |
parent | tabs -> spaces (diff) | |
download | core-6af59644d6508049409a03d1c4a598ea2bef521e.tar.gz core-6af59644d6508049409a03d1c4a598ea2bef521e.zip |
Fix for fdo43460 Part XXV getLength() to isEmpty()
Please find attached a partial fix for Easy Hack FDO43460
Part XXI
Module
oox
98 files changed, 403 insertions, 403 deletions
diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx index 7ef467838525..9d9f1cc0d7a3 100644 --- a/mysqlc/source/mysqlc_connection.cxx +++ b/mysqlc/source/mysqlc_connection.cxx @@ -139,17 +139,17 @@ void OConnection::construct(const OUString& url, const Sequence< PropertyValue > } token = url.getToken(0, '/', nIndex); - if (token.getLength()) { + if (!token.isEmpty()) { sal_Int32 nIndex1 = 0; OUString hostandport = token.getToken(0,':', nIndex1); - if (hostandport.getLength()) { + if (!hostandport.isEmpty()) { aHostName = hostandport; hostandport = token.getToken(0, ':', nIndex1); - if (hostandport.getLength() && nIndex1) { + if (!hostandport.isEmpty() && nIndex1) { nPort = hostandport.toInt32(); } token = url.getToken(0, '/', nIndex); - if (token.getLength() && nIndex) { + if (!token.isEmpty() && nIndex) { aDbName = token; } } diff --git a/oox/inc/oox/dump/dumperbase.hxx b/oox/inc/oox/dump/dumperbase.hxx index 18207cff4952..8debfa561e45 100644 --- a/oox/inc/oox/dump/dumperbase.hxx +++ b/oox/inc/oox/dump/dumperbase.hxx @@ -955,7 +955,7 @@ template< typename ListType > ::boost::shared_ptr< ListType > SharedConfigData::createNameList( const ::rtl::OUString& rListName ) { ::boost::shared_ptr< ListType > xList; - if( rListName.getLength() > 0 ) + if( !rListName.isEmpty() ) { xList.reset( new ListType( *this ) ); setNameList( rListName, xList ); diff --git a/oox/source/core/contexthandler2.cxx b/oox/source/core/contexthandler2.cxx index fc79afce76e2..20c62f6b7039 100644 --- a/oox/source/core/contexthandler2.cxx +++ b/oox/source/core/contexthandler2.cxx @@ -183,7 +183,7 @@ void ContextHandler2Helper::processCollectedChars() OUString aChars = rInfo.maChars.makeStringAndClear(); if( mbEnableTrimSpace && rInfo.mbTrimSpaces ) aChars = aChars.trim(); - if( aChars.getLength() > 0 ) + if( !aChars.isEmpty() ) onCharacters( aChars ); } } diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 5e37d06ebc9a..c8acd4d01ade 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -102,8 +102,8 @@ DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl ) { UrlPool& rUrlPool = StaticUrlPool::get(); ::osl::MutexGuard aGuard( rUrlPool.maMutex ); - mbValid = (rUrl.getLength() == 0) || (rUrlPool.maUrls.count( rUrl ) == 0); - if( mbValid && (rUrl.getLength() > 0) ) + mbValid = rUrl.isEmpty() || (rUrlPool.maUrls.count( rUrl ) == 0); + if( mbValid && !rUrl.isEmpty() ) { rUrlPool.maUrls.insert( rUrl ); maUrl = rUrl; @@ -114,7 +114,7 @@ DocumentOpenedGuard::~DocumentOpenedGuard() { UrlPool& rUrlPool = StaticUrlPool::get(); ::osl::MutexGuard aGuard( rUrlPool.maMutex ); - if( maUrl.getLength() > 0 ) + if( !maUrl.isEmpty() ) rUrlPool.maUrls.erase( maUrl ); } @@ -334,7 +334,7 @@ OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const /* (1) convert all backslashes to slashes, and check that passed URL is not empty. */ OUString aUrl = rUrl.replace( '\\', '/' ); - if( aUrl.getLength() == 0 ) + if( aUrl.isEmpty() ) return aUrl; /* (2) add 'file:///' to absolute Windows paths, e.g. convert @@ -359,7 +359,7 @@ OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const /* (5) handle URLs relative to current drive, e.g. the URL '/path1/file1' relative to the base URL 'file:///C:/path2/file2' does not result in the expected 'file:///C:/path1/file1', but in 'file:///path1/file1'. */ - if( (aUrl.getLength() >= 1) && (aUrl[ 0 ] == '/') && + if( !aUrl.isEmpty() && (aUrl[ 0 ] == '/') && mxImpl->maFileUrl.match( aFilePrefix ) && lclIsDosDrive( mxImpl->maFileUrl, nFilePrefixLen ) ) { @@ -441,8 +441,8 @@ Sequence< NamedValue > FilterBase::requestEncryptionData( ::comphelper::IDocPass bool FilterBase::importBinaryData( StreamDataSequence& orDataSeq, const OUString& rStreamName ) { - OSL_ENSURE( rStreamName.getLength() > 0, "FilterBase::importBinaryData - empty stream name" ); - if( rStreamName.getLength() == 0 ) + OSL_ENSURE( !rStreamName.isEmpty(), "FilterBase::importBinaryData - empty stream name" ); + if( rStreamName.isEmpty() ) return false; // try to open the stream (this may fail - do not assert) @@ -517,7 +517,7 @@ sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rMediaDes sal_Bool bRet = sal_False; setMediaDescriptor( rMediaDescSeq ); DocumentOpenedGuard aOpenedGuard( mxImpl->maFileUrl ); - if( aOpenedGuard.isValid() || !mxImpl->maFileUrl.getLength() ) + if( aOpenedGuard.isValid() || mxImpl->maFileUrl.isEmpty() ) { mxImpl->initializeFilter(); switch( mxImpl->meDirection ) diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index c0bde4dabe82..259b5c1f653e 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -223,7 +223,7 @@ OUString FilterDetectDocHandler::getFilterNameFromContentType( const OUString& r void FilterDetectDocHandler::parseContentTypesDefault( const AttributeList& rAttribs ) { // only if no overridden part name found - if( mrFilterName.getLength() == 0 ) + if( mrFilterName.isEmpty() ) { // check if target path ends with extension OUString aExtension = rAttribs.getString( XML_Extension, OUString() ); diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx index 3030ef436883..f1e39d4ce08e 100644 --- a/oox/source/core/relations.cxx +++ b/oox/source/core/relations.cxx @@ -50,7 +50,7 @@ OUString lclRemoveFileName( const OUString& rPath ) OUString lclAppendFileName( const OUString& rPath, const OUString& rFileName ) { - return (rPath.getLength() == 0) ? rFileName : + return rPath.isEmpty() ? rFileName : OUStringBuffer( rPath ).append( sal_Unicode( '/' ) ).append( rFileName ).makeStringAndClear(); } @@ -101,7 +101,7 @@ OUString Relations::getExternalTargetFromFirstType( const OUString& rType ) cons OUString Relations::getFragmentPathFromRelation( const Relation& rRelation ) const { // no target, no fragment path - if( rRelation.mbExternal || (rRelation.maTarget.getLength() == 0) ) + if( rRelation.mbExternal || rRelation.maTarget.isEmpty() ) return OUString(); // absolute target: return it without leading slash (#i100978) @@ -109,7 +109,7 @@ OUString Relations::getFragmentPathFromRelation( const Relation& rRelation ) con return rRelation.maTarget.copy( 1 ); // empty fragment path: return target - if( maFragmentPath.getLength() == 0 ) + if( maFragmentPath.isEmpty() ) return rRelation.maTarget; // resolve relative target path according to base path diff --git a/oox/source/core/relationshandler.cxx b/oox/source/core/relationshandler.cxx index 021b73a53487..d64ec71802e5 100644 --- a/oox/source/core/relationshandler.cxx +++ b/oox/source/core/relationshandler.cxx @@ -85,7 +85,7 @@ Reference< XFastContextHandler > RelationsFragment::createFastChildContext( aRelation.maId = aAttribs.getString( XML_Id, OUString() ); aRelation.maType = aAttribs.getString( XML_Type, OUString() ); aRelation.maTarget = aAttribs.getString( XML_Target, OUString() ); - if( (aRelation.maId.getLength() > 0) && (aRelation.maType.getLength() > 0) && (aRelation.maTarget.getLength() > 0) ) + if( !aRelation.maId.isEmpty() && !aRelation.maType.isEmpty() && !aRelation.maTarget.isEmpty() ) { sal_Int32 nTargetMode = aAttribs.getToken( XML_TargetMode, XML_Internal ); OSL_ENSURE( (nTargetMode == XML_Internal) || (nTargetMode == XML_External), diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index cf93e14aafd9..f5868bf21eff 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -266,8 +266,8 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r // fragment handler must contain path to fragment stream OUString aFragmentPath = rxHandler->getFragmentPath(); - OSL_ENSURE( aFragmentPath.getLength() > 0, "XmlFilterBase::importFragment - missing fragment path" ); - if( aFragmentPath.getLength() == 0 ) + OSL_ENSURE( !aFragmentPath.isEmpty(), "XmlFilterBase::importFragment - missing fragment path" ); + if( aFragmentPath.isEmpty() ) return false; // try to import binary streams (fragment extension must be '.bin') @@ -343,8 +343,8 @@ Reference<XDocument> XmlFilterBase::importFragment( const ::rtl::OUString& aFrag Reference<XDocument> xRet; // path to fragment stream valid? - OSL_ENSURE( aFragmentPath.getLength() > 0, "XmlFilterBase::importFragment - empty fragment path" ); - if( aFragmentPath.getLength() == 0 ) + OSL_ENSURE( !aFragmentPath.isEmpty(), "XmlFilterBase::importFragment - empty fragment path" ); + if( aFragmentPath.isEmpty() ) return xRet; // try to open the fragment stream (this may fail - do not assert) @@ -488,7 +488,7 @@ OUString XmlFilterBase::addRelation( const Reference< XOutputStream > xOutputStr static void writeElement( FSHelperPtr pDoc, sal_Int32 nXmlElement, const OUString& sValue ) { - if( sValue.getLength() == 0 ) + if( sValue.isEmpty() ) return; pDoc->startElement( nXmlElement, FSEND ); pDoc->write( sValue ); diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx index 242d83b8e0fb..264ea9fc2ab1 100644 --- a/oox/source/docprop/docprophandler.cxx +++ b/oox/source/docprop/docprophandler.cxx @@ -72,7 +72,7 @@ void OOXMLDocPropHandler::InitNew() // ------------------------------------------------ void OOXMLDocPropHandler::AddCustomProperty( const uno::Any& aAny ) { - if ( m_aCustomPropertyName.getLength() ) + if ( !m_aCustomPropertyName.isEmpty() ) { const uno::Reference< beans::XPropertyContainer > xUserProps = m_xDocProp->getUserDefinedProperties(); @@ -164,7 +164,7 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( const ::rtl::OUString // ------------------------------------------------ uno::Sequence< ::rtl::OUString > OOXMLDocPropHandler::GetKeywordsSet( const ::rtl::OUString& aChars ) { - if ( aChars.getLength() ) + if ( !aChars.isEmpty() ) { uno::Sequence< ::rtl::OUString > aResult( 20 ); sal_Int32 nCounter = 0; @@ -181,7 +181,7 @@ uno::Sequence< ::rtl::OUString > OOXMLDocPropHandler::GetKeywordsSet( const ::rt case (sal_Unicode)'\t': // this is a delimiter // unfortunately I did not find any specification for the possible delimiters - if ( aResult[nCounter].getLength() ) + if ( !aResult[nCounter].isEmpty() ) { if ( nCounter >= aResult.getLength() ) aResult.realloc( nCounter + 10 ); @@ -246,7 +246,7 @@ void OOXMLDocPropHandler::UpdateDocStatistic( const ::rtl::OUString& aChars ) break; } - if ( aName.getLength() ) + if ( !aName.isEmpty() ) { sal_Bool bFound = sal_False; sal_Int32 nLen = aSet.getLength(); diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index 261494327efd..12d48129dead 100644 --- a/oox/source/drawingml/chart/chartconverter.cxx +++ b/oox/source/drawingml/chart/chartconverter.cxx @@ -148,7 +148,7 @@ Reference< XDataSequence > ChartConverter::createDataSequence( const Reference< aRangeRep = lclGenerateApiArray( aMatrix ); } - if( aRangeRep.getLength() > 0 ) try + if( !aRangeRep.isEmpty() ) try { // create the data sequence xDataSeq = rxDataProvider->createDataSequenceByRangeRepresentation( aRangeRep ); diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index 822ac520d66b..bee3d7c089a7 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -129,9 +129,9 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern /* If the title model is missing, but the chart shows exactly one series, the series title is shown as chart title. */ OUString aAutoTitle = aPlotAreaConv.getAutomaticTitle(); - if( mrModel.mxTitle.is() || (aAutoTitle.getLength() > 0) ) + if( mrModel.mxTitle.is() || !aAutoTitle.isEmpty() ) { - if( aAutoTitle.getLength() == 0 ) + if( aAutoTitle.isEmpty() ) aAutoTitle = CREATE_OUSTRING( "Chart Title" ); Reference< XTitled > xTitled( getChartDocument(), UNO_QUERY_THROW ); TitleConverter aTitleConv( *this, mrModel.mxTitle.getOrCreate() ); @@ -184,7 +184,7 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern } // embedded drawing shapes - if( mrModel.maDrawingPath.getLength() > 0 ) try + if( !mrModel.maDrawingPath.isEmpty() ) try { /* Get the internal draw page of the chart document, if no external drawing page has been passed. */ diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 1b07ae33c494..7aca5b8f958c 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1141,7 +1141,7 @@ void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFo if( mxData->mxNumFmts.is() ) { sal_Int32 nPropId = bPercentFormat ? PROP_PercentageNumberFormat : PROP_NumberFormat; - if( rNumberFormat.mbSourceLinked || (rNumberFormat.maFormatCode.getLength() == 0) ) + if( rNumberFormat.mbSourceLinked || rNumberFormat.maFormatCode.isEmpty() ) { rPropSet.setAnyProperty( nPropId, Any() ); } diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 3ed07e6b914a..052237675caa 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -374,7 +374,7 @@ Reference< XLabeledDataSequence > ErrorBarConverter::createLabeledDataSequence( } break; } - OSL_ENSURE( aRole.getLength() > 0, "ErrorBarConverter::createLabeledDataSequence - invalid error bar direction" ); + OSL_ENSURE( !aRole.isEmpty(), "ErrorBarConverter::createLabeledDataSequence - invalid error bar direction" ); return lclCreateLabeledDataSequence( *this, mrModel.maSources.get( eSourceType ).get(), aRole ); } @@ -422,7 +422,7 @@ void TrendlineConverter::convertFromModel( const Reference< XDataSeries >& rxDat case XML_power: aServiceName = CREATE_OUSTRING( "com.sun.star.chart2.PotentialRegressionCurve" ); break; default: OSL_FAIL( "TrendlineConverter::convertFromModel - unknown trendline type" ); } - if( aServiceName.getLength() > 0 ) + if( !aServiceName.isEmpty() ) { Reference< XRegressionCurve > xRegCurve( createInstance( aServiceName ), UNO_QUERY_THROW ); PropertySet aPropSet( xRegCurve ); diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx index 5699a0d3f4b8..9ed69fe4fde5 100644 --- a/oox/source/drawingml/chart/titleconverter.cxx +++ b/oox/source/drawingml/chart/titleconverter.cxx @@ -109,11 +109,11 @@ Sequence< Reference< XFormattedString > > TextConverter::createStringSequence( if( mrModel.mxDataSeq.is() && !mrModel.mxDataSeq->maData.empty() ) mrModel.mxDataSeq->maData.begin()->second >>= aString; // no linked string -> fall back to default string - if( aString.getLength() == 0 ) + if( aString.isEmpty() ) aString = rDefaultText; // create formatted string object - if( aString.getLength() > 0 ) + if( !aString.isEmpty() ) { Reference< XFormattedString > xFmtStr = appendFormattedString( aStringVec, aString, false ); PropertySet aPropSet( xFmtStr ); diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx index cd752859d288..b5c7290dd42d 100644 --- a/oox/source/drawingml/customshapegeometry.cxx +++ b/oox/source/drawingml/customshapegeometry.cxx @@ -236,7 +236,7 @@ rtl::OUString GetFormulaParameter( const EnhancedCustomShapeParameter& rParamete static EnhancedCustomShapeParameter GetAdjCoordinate( CustomShapeProperties& rCustomShapeProperties, const::rtl::OUString& rValue, sal_Bool bNoSymbols = sal_True ) { com::sun::star::drawing::EnhancedCustomShapeParameter aRet; - if ( rValue.getLength() ) + if ( !rValue.isEmpty() ) { sal_Bool bConstant = sal_True; sal_Int32 nConstant = -1; @@ -412,7 +412,7 @@ static EnhancedCustomShapeParameter GetAdjCoordinate( CustomShapeProperties& rCu sal_Unicode n = rValue[ 0 ]; if ( ( n == '+' ) || ( n == '-' ) ) { - if ( rValue.getLength() > 0 ) + if ( !rValue.isEmpty() ) n = rValue[ 1 ]; } if ( ( n >= '0' ) && ( n <= '9' ) ) @@ -483,7 +483,7 @@ static rtl::OUString convertToOOEquation( CustomShapeProperties& rCustomShapePro do { rtl::OUString aToken( rSource.getToken( 0, ' ', nIndex ) ); - if ( aToken.getLength() ) + if ( !aToken.isEmpty() ) aTokens.push_back( aToken ); } while ( nIndex >= 0 ); diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index ad53443ac6cb..91a475f63468 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -138,10 +138,10 @@ static sal_Int32 calcDepth( const rtl::OUString& rNodeName, const dgm::Connections::const_iterator aEndCxn( rCnx.end() ); while( aCurrCxn != aEndCxn ) { - if( aCurrCxn->msParTransId.getLength() && - aCurrCxn->msSibTransId.getLength() && - aCurrCxn->msSourceId.getLength() && - aCurrCxn->msDestId.getLength() && + if( !aCurrCxn->msParTransId.isEmpty() && + !aCurrCxn->msSibTransId.isEmpty() && + !aCurrCxn->msSourceId.isEmpty() && + !aCurrCxn->msDestId.isEmpty() && aCurrCxn->mnType != XML_presOf && aCurrCxn->mnType != XML_presParOf && rNodeName == aCurrCxn->msDestId ) @@ -176,7 +176,7 @@ void Diagram::build( ) << normalizeDotName(aCurrPoint->msModelId).getStr() << "["; - if( aCurrPoint->msPresentationLayoutName.getLength() ) + if( !aCurrPoint->msPresentationLayoutName.isEmpty() ) output << "label=\"" << rtl::OUStringToOString( aCurrPoint->msPresentationLayoutName, @@ -230,7 +230,7 @@ void Diagram::build( ) OSL_ENSURE(bInserted1,"Diagram::build(): non-unique point model id"); - if( aCurrPoint->msPresentationLayoutName.getLength() ) + if( !aCurrPoint->msPresentationLayoutName.isEmpty() ) { DiagramData::PointsNameMap::value_type::second_type& rVec= getData()->getPointsPresNameMap()[aCurrPoint->msPresentationLayoutName]; @@ -244,11 +244,11 @@ void Diagram::build( ) while( aCurrCxn != aEndCxn ) { #if OSL_DEBUG_LEVEL > 1 - if( aCurrCxn->msParTransId.getLength() || - aCurrCxn->msSibTransId.getLength() ) + if( !aCurrCxn->msParTransId.isEmpty() || + !aCurrCxn->msSibTransId.isEmpty() ) { - if( aCurrCxn->msSourceId.getLength() || - aCurrCxn->msDestId.getLength() ) + if( !aCurrCxn->msSourceId.isEmpty() || + !aCurrCxn->msDestId.isEmpty() ) { output << "\t" << normalizeDotName(aCurrCxn->msSourceId).getStr() @@ -279,8 +279,8 @@ void Diagram::build( ) << "\"];" << std::endl; } } - else if( aCurrCxn->msSourceId.getLength() || - aCurrCxn->msDestId.getLength() ) + else if( !aCurrCxn->msSourceId.isEmpty() || + !aCurrCxn->msDestId.isEmpty() ) output << "\t" << normalizeDotName(aCurrCxn->msSourceId).getStr() << " -> " @@ -391,7 +391,7 @@ void loadDiagram( ShapePtr& pShape, pDiagram->setLayout( pLayout ); // data - if( rDataModelPath.getLength() > 0 ) + if( !rDataModelPath.isEmpty() ) { rtl::Reference< core::FragmentHandler > xRef( new DiagramDataFragmentHandler( rFilter, rDataModelPath, pData )); @@ -408,7 +408,7 @@ void loadDiagram( ShapePtr& pShape, } // layout - if( rLayoutPath.getLength() > 0 ) + if( !rLayoutPath.isEmpty() ) { rtl::Reference< core::FragmentHandler > xRef( new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout )); @@ -420,7 +420,7 @@ void loadDiagram( ShapePtr& pShape, } // style - if( rQStylePath.getLength() > 0 ) + if( !rQStylePath.isEmpty() ) { rtl::Reference< core::FragmentHandler > xRef( new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() )); @@ -432,7 +432,7 @@ void loadDiagram( ShapePtr& pShape, } // colors - if( rColorStylePath.getLength() > 0 ) + if( !rColorStylePath.isEmpty() ) { rtl::Reference< core::FragmentHandler > xRef( new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() )); diff --git a/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx index 22aa2992b1f2..73338576c563 100644 --- a/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx +++ b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx @@ -48,7 +48,7 @@ DiagramDefinitionContext::DiagramDefinitionContext( ContextHandler& rParent, OSL_TRACE( "OOX: DiagramDefinitionContext::DiagramDefinitionContext()" ); mpLayout->setDefStyle( xAttributes->getOptionalValue( XML_defStyle ) ); OUString sValue = xAttributes->getOptionalValue( XML_minVer ); - if( sValue.getLength() == 0 ) + if( sValue.isEmpty() ) { sValue = CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" ); } diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 16b9420edcf1..5bad9f544769 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -468,7 +468,7 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, sal_uI // TODO(Q1): apply styling & coloring - taking // layout node's styleLbl for both style & color // now, but docs are a bit unclear on this - if( msStyleLabel.getLength() ) + if( !msStyleLabel.isEmpty() ) { OSL_TRACE("setting style with label %s", OUSTRING_TO_CSTR( msStyleLabel ) ); diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index bf9361260fc2..ad6cf4b112c7 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -310,7 +310,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, OUString aGraphicUrl = rGraphicHelper.createGraphicObject( maBlipProps.mxGraphic ); // push bitmap or named bitmap to property map - if( (aGraphicUrl.getLength() > 0) && rPropMap.setProperty( SHAPEPROP_FillBitmapUrl, aGraphicUrl ) ) + if( !aGraphicUrl.isEmpty() && rPropMap.setProperty( SHAPEPROP_FillBitmapUrl, aGraphicUrl ) ) eFillStyle = FillStyle_BITMAP; // set other bitmap properties, if bitmap has been inserted into the map @@ -404,7 +404,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe } OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic ); - if( aGraphicUrl.getLength() > 0 ) + if( !aGraphicUrl.isEmpty() ) rPropMap[ PROP_GraphicURL ] <<= aGraphicUrl; // cropping diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx index 82a2f5906923..ef5cbc3502a1 100644 --- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx +++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx @@ -170,7 +170,7 @@ BlipContext::BlipContext( ContextHandler& rParent, { // internal picture URL OUString aFragmentPath = getFragmentPathFromRelId( aAttribs.getString( R_TOKEN( embed ), OUString() ) ); - if( aFragmentPath.getLength() > 0 ) + if( !aFragmentPath.isEmpty() ) mrBlipProps.mxGraphic = getFilter().getGraphicHelper().importEmbeddedGraphic( aFragmentPath ); } else if( aAttribs.hasAttribute( R_TOKEN( link ) ) ) diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index 5f7385a2d98d..016fbf3af38a 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -155,7 +155,7 @@ OleObjectGraphicDataContext::~OleObjectGraphicDataContext() { /* Register the OLE shape at the VML drawing, this prevents that the related VML shape converts the OLE object by itself. */ - if( mrOleObjectInfo.maShapeId.getLength() > 0 ) + if( !mrOleObjectInfo.maShapeId.isEmpty() ) if( ::oox::vml::Drawing* pVmlDrawing = getFilter().getVmlDrawing() ) pVmlDrawing->registerOleObject( mrOleObjectInfo ); } @@ -182,7 +182,7 @@ Reference< XFastContextHandler > OleObjectGraphicDataContext::createFastChildCon else { OUString aFragmentPath = getFragmentPathFromRelation( *pRelation ); - if( aFragmentPath.getLength() > 0 ) + if( !aFragmentPath.isEmpty() ) getFilter().importBinaryData( mrOleObjectInfo.maEmbeddedData, aFragmentPath ); } } diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index 1975561ab808..06958aa13de8 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -50,24 +50,24 @@ HyperLinkContext::HyperLinkContext( ContextHandler& rParent, { OUString sURL, sHref; OUString aRelId = xAttributes->getOptionalValue( R_TOKEN( id ) ); - if ( aRelId.getLength() ) + if ( !aRelId.isEmpty() ) { OSL_TRACE("OOX: URI rId %s", ::rtl::OUStringToOString (aRelId, RTL_TEXTENCODING_UTF8).pData->buffer); sHref = getRelations().getExternalTargetFromRelId( aRelId ); - if( sHref.getLength() > 0 ) + if( !sHref.isEmpty() ) { OSL_TRACE("OOX: URI href %s", ::rtl::OUStringToOString (sHref, RTL_TEXTENCODING_UTF8).pData->buffer); sURL = getFilter().getAbsoluteUrl( sHref ); } } OUString sTooltip = xAttributes->getOptionalValue( R_TOKEN( tooltip ) ); - if ( sTooltip.getLength() ) + if ( !sTooltip.isEmpty() ) maProperties[ PROP_Representation ] <<= sTooltip; OUString sFrame = xAttributes->getOptionalValue( R_TOKEN( tgtFrame ) ); - if( sFrame.getLength() ) + if( !sFrame.isEmpty() ) maProperties[ PROP_TargetFrame ] <<= sFrame; OUString aAction = xAttributes->getOptionalValue( XML_action ); - if ( aAction.getLength() ) + if ( !aAction.isEmpty() ) { // reserved values of the unrestricted string aAction: // ppaction://customshow?id=SHOW_ID // custom presentation @@ -140,7 +140,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler& rParent, } } } - if ( sURL.getLength() ) + if ( !sURL.isEmpty() ) maProperties[ PROP_URL ] <<= sURL; // TODO unhandled diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index 4bfdcad76433..9676795ffe21 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -327,7 +327,7 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap, } // push the properties (filled aNamedMarker.Name indicates valid marker) - if( aNamedMarker.Name.getLength() > 0 ) + if( !aNamedMarker.Name.isEmpty() ) { if( bLineEnd ) { diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index f551b85ce757..54d9527e03d3 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -210,12 +210,12 @@ void Shape::addShape( try { rtl::OUString sServiceName( msServiceName ); - if( sServiceName.getLength() ) + if( !sServiceName.isEmpty() ) { basegfx::B2DHomMatrix aMatrix( aTransformation ); Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, pTheme, rxShapes, pShapeRect, sal_False, aMatrix ) ); - if( pShapeMap && msId.getLength() ) + if( pShapeMap && !msId.isEmpty() ) { (*pShapeMap)[ msId ] = shared_from_this(); } @@ -429,7 +429,7 @@ Reference< XShape > Shape::createAndInsert( Reference< XPropertySet > xSet( mxShape, UNO_QUERY ); if( mxShape.is() && xSet.is() ) { - if( msName.getLength() ) + if( !msName.isEmpty() ) { Reference< container::XNamed > xNamed( mxShape, UNO_QUERY ); if( xNamed.is() ) @@ -618,13 +618,13 @@ OUString Shape::finalizeServiceName( XmlFilterBase& rFilter, const OUString& rSe // get the path to the representation graphic OUString aGraphicPath; - if( mxOleObjectInfo->maShapeId.getLength() > 0 ) + if( !mxOleObjectInfo->maShapeId.isEmpty() ) if( ::oox::vml::Drawing* pVmlDrawing = rFilter.getVmlDrawing() ) if( const ::oox::vml::ShapeBase* pVmlShape = pVmlDrawing->getShapes().getShapeById( mxOleObjectInfo->maShapeId, true ) ) aGraphicPath = pVmlShape->getGraphicPath(); // import and store the graphic - if( aGraphicPath.getLength() > 0 ) + if( !aGraphicPath.isEmpty() ) { Reference< graphic::XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath ); if( xGraphic.is() ) @@ -644,8 +644,8 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& { case FRAMETYPE_CHART: { - OSL_ENSURE( mxChartShapeInfo->maFragmentPath.getLength() > 0, "Shape::finalizeXShape - missing chart fragment" ); - if( mxShape.is() && (mxChartShapeInfo->maFragmentPath.getLength() > 0) ) try + OSL_ENSURE( !mxChartShapeInfo->maFragmentPath.isEmpty(), "Shape::finalizeXShape - missing chart fragment" ); + if( mxShape.is() && !mxChartShapeInfo->maFragmentPath.isEmpty() ) try { // set the chart2 OLE class ID at the OLE shape PropertySet aShapeProp( mxShape ); diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx index fe625230416c..f05153c74dba 100644 --- a/oox/source/drawingml/shapepropertymap.cxx +++ b/oox/source/drawingml/shapepropertymap.cxx @@ -130,7 +130,7 @@ bool ShapePropertyMap::setAnyProperty( ShapePropertyId ePropId, const Any& rValu bool ShapePropertyMap::setLineMarker( sal_Int32 nPropId, const Any& rValue ) { NamedValue aNamedMarker; - if( (rValue >>= aNamedMarker) && (aNamedMarker.Name.getLength() > 0) ) + if( (rValue >>= aNamedMarker) && !aNamedMarker.Name.isEmpty() ) { // push line marker explicitly if( !maShapePropInfo.mbNamedLineMarker ) @@ -154,7 +154,7 @@ bool ShapePropertyMap::setLineDash( sal_Int32 nPropId, const Any& rValue ) if( rValue.has< LineDash >() ) { OUString aDashName = mrModelObjHelper.insertLineDash( rValue.get< LineDash >() ); - return (aDashName.getLength() > 0) && setProperty( nPropId, aDashName ); + return !aDashName.isEmpty() && setProperty( nPropId, aDashName ); } return false; @@ -170,7 +170,7 @@ bool ShapePropertyMap::setFillGradient( sal_Int32 nPropId, const Any& rValue ) if( rValue.has< Gradient >() ) { OUString aGradientName = mrModelObjHelper.insertFillGradient( rValue.get< Gradient >() ); - return (aGradientName.getLength() > 0) && setProperty( nPropId, aGradientName ); + return !aGradientName.isEmpty() && setProperty( nPropId, aGradientName ); } return false; @@ -182,7 +182,7 @@ bool ShapePropertyMap::setGradientTrans( sal_Int32 nPropId, const Any& rValue ) if( rValue.has< Gradient >() ) { OUString aGradientName = mrModelObjHelper.insertTransGrandient( rValue.get< Gradient >() ); - return ( aGradientName.getLength() > 0 ) && setProperty( nPropId, aGradientName ); + return !aGradientName.isEmpty() && setProperty( nPropId, aGradientName ); } return false; @@ -198,7 +198,7 @@ bool ShapePropertyMap::setFillBitmapUrl( sal_Int32 nPropId, const Any& rValue ) if( rValue.has< OUString >() ) { OUString aBitmapUrlName = mrModelObjHelper.insertFillBitmapUrl( rValue.get< OUString >() ); - return (aBitmapUrlName.getLength() > 0) && setProperty( nPropId, aBitmapUrlName ); + return !aBitmapUrlName.isEmpty() && setProperty( nPropId, aBitmapUrlName ); } return false; diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx index a6434c64c294..7fbd4bd5d431 100644 --- a/oox/source/drawingml/table/tableproperties.cxx +++ b/oox/source/drawingml/table/tableproperties.cxx @@ -119,7 +119,7 @@ const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilt else if ( rBase.getTableStyles() ) { const std::vector< TableStyle >& rTableStyles( rBase.getTableStyles()->getTableStyles() ); - const rtl::OUString aStyleId( getStyleId().getLength() ? getStyleId() : rBase.getTableStyles()->getDefaultStyleId() ); + const rtl::OUString aStyleId( getStyleId().isEmpty() ? rBase.getTableStyles()->getDefaultStyleId() : getStyleId() ); std::vector< TableStyle >::const_iterator aIter( rTableStyles.begin() ); while( aIter != rTableStyles.end() ) { diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 3c77a35309f0..ea84306a3bb9 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -66,23 +66,23 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, // ST_Coordinate OUString sValue; sValue = xAttributes->getOptionalValue( XML_lIns ); - if( sValue.getLength() ) { - sal_Int32 nLeftInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 91440 / 360 ); + if( !sValue.isEmpty() ) { + sal_Int32 nLeftInset = ( !sValue.isEmpty() ? GetCoordinate( sValue ) : 91440 / 360 ); mrTextBodyProp.maPropertyMap[ PROP_TextLeftDistance ] <<= static_cast< sal_Int32 >( nLeftInset ); } sValue = xAttributes->getOptionalValue( XML_tIns ); - if( sValue.getLength() ) { - sal_Int32 nTopInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 91440 / 360 ); + if( !sValue.isEmpty() ) { + sal_Int32 nTopInset = ( !sValue.isEmpty() ? GetCoordinate( sValue ) : 91440 / 360 ); mrTextBodyProp.maPropertyMap[ PROP_TextUpperDistance ] <<= static_cast< sal_Int32 >( nTopInset ); } sValue = xAttributes->getOptionalValue( XML_rIns ); - if( sValue.getLength() ) { - sal_Int32 nRightInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 91440 / 360 ); + if( !sValue.isEmpty() ) { + sal_Int32 nRightInset = ( !sValue.isEmpty() ? GetCoordinate( sValue ) : 91440 / 360 ); mrTextBodyProp.maPropertyMap[ PROP_TextRightDistance ] <<= static_cast< sal_Int32 >( nRightInset ); } sValue = xAttributes->getOptionalValue( XML_bIns ); - if( sValue.getLength() ) { - sal_Int32 nBottonInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 45720 / 360 ); + if( !sValue.isEmpty() ) { + sal_Int32 nBottonInset = ( !sValue.isEmpty() ? GetCoordinate( sValue ) : 45720 / 360 ); mrTextBodyProp.maPropertyMap[ PROP_TextLowerDistance ] <<= static_cast< sal_Int32 >( nBottonInset ); } diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index fb4b0690bc80..adfa2fe095ec 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -101,7 +101,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource if( maCharColor.isUsed() ) rPropMap[ PROP_CharColor ] <<= maCharColor.getColor( rFilter.getGraphicHelper() ); - if( moLang.has() && (moLang.get().getLength() > 0) ) + if( moLang.has() && !moLang.get().isEmpty() ) { lang::Locale aLocale; sal_Int32 nSepPos = moLang.get().indexOf( sal_Unicode( '-' ), 0 ); diff --git a/oox/source/drawingml/textfont.cxx b/oox/source/drawingml/textfont.cxx index 5cd0fe2b996f..9503db839e39 100644 --- a/oox/source/drawingml/textfont.cxx +++ b/oox/source/drawingml/textfont.cxx @@ -77,7 +77,7 @@ void TextFont::setAttributes( const AttributeList& rAttribs ) void TextFont::assignIfUsed( const TextFont& rTextFont ) { - if( rTextFont.maTypeface.getLength() > 0 ) + if( !rTextFont.maTypeface.isEmpty() ) *this = rTextFont; } @@ -94,7 +94,7 @@ bool TextFont::implGetFontData( OUString& rFontName, sal_Int16& rnFontPitch, sal rFontName = maTypeface; rnFontPitch = lclGetFontPitch( extractValue< sal_Int16 >( mnPitch, 0, 4 ) ); rnFontFamily = lclGetFontFamily( extractValue< sal_Int16 >( mnPitch, 4, 4 ) ); - return rFontName.getLength() > 0; + return !rFontName.isEmpty(); } // ============================================================================ diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx index 0bee2766e673..2164bf2ee11e 100644 --- a/oox/source/drawingml/textparagraphpropertiescontext.cxx +++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx @@ -100,7 +100,7 @@ TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler& if ( xAttribs->hasAttribute( XML_indent ) ) { sValue = xAttribs->getOptionalValue( XML_indent ); - mrTextParagraphProperties.getFirstLineIndentation() = boost::optional< sal_Int32 >( sValue.getLength() == 0 ? 0 : GetCoordinate( sValue ) ); + mrTextParagraphProperties.getFirstLineIndentation() = boost::optional< sal_Int32 >( sValue.isEmpty() ? 0 : GetCoordinate( sValue ) ); } // ST_TextIndentLevelType @@ -123,14 +123,14 @@ TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler& if ( xAttribs->hasAttribute( XML_marL ) ) { sValue = xAttribs->getOptionalValue( XML_marL ); - mrTextParagraphProperties.getParaLeftMargin() = boost::optional< sal_Int32 >( sValue.getLength() == 0 ? 0 : GetCoordinate( sValue ) ); + mrTextParagraphProperties.getParaLeftMargin() = boost::optional< sal_Int32 >( sValue.isEmpty() ? 0 : GetCoordinate( sValue ) ); } // ParaRightMargin if ( xAttribs->hasAttribute( XML_marR ) ) { sValue = xAttribs->getOptionalValue( XML_marR ); - sal_Int32 nMarR = ( sValue.getLength() == 0 ? 0 : GetCoordinate( sValue ) ); + sal_Int32 nMarR = sValue.isEmpty() ? 0 : GetCoordinate( sValue ) ; rPropertyMap[ PROP_ParaRightMargin ] <<= nMarR; } diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx index 3c5b99c419fd..93c9ca76bbf3 100644 --- a/oox/source/drawingml/textrun.cxx +++ b/oox/source/drawingml/textrun.cxx @@ -87,7 +87,7 @@ sal_Int32 TextRun::insertAt( if ( !aTextCharacterProps.maSymbolFont.getFontData( aSymbolFontName, nSymbolFontPitch, nSymbolFontFamily, rFilterBase ) ) xText->insertString( xStart, getText(), sal_False ); - else if ( getText().getLength() ) + else if ( !getText().isEmpty() ) { // !!#i113673<<< sal_Int16 nLatinFontPitch = 0, nLatinFontFamily = 0; aTextCharacterProps.maLatinFont.getFontData( aLatinFontName, nLatinFontPitch, nLatinFontFamily, rFilterBase ); diff --git a/oox/source/drawingml/texttabstoplistcontext.cxx b/oox/source/drawingml/texttabstoplistcontext.cxx index 4e3340f7f192..9aae5924d55b 100644 --- a/oox/source/drawingml/texttabstoplistcontext.cxx +++ b/oox/source/drawingml/texttabstoplistcontext.cxx @@ -70,7 +70,7 @@ namespace oox { namespace drawingml { OUString sValue; TabStop aTabStop; sValue = xAttribs->getOptionalValue( XML_pos ); - if( sValue.getLength() ) + if( !sValue.isEmpty() ) { aTabStop.Position = GetCoordinate( sValue ); } diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index 976ae644ca0d..6dbc2ebdaa55 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -2359,7 +2359,7 @@ void WorkbookStreamObject::implDumpRecordBody() } } OUString aName = dumpString( "name", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH ); - if( (aName.getLength() > 0) && (aName[ 0 ] == 1) && (rStrm.getRemaining() >= 2) ) + if( !aName.isEmpty() && (aName[ 0 ] == 1) && (rStrm.getRemaining() >= 2) ) getFormulaDumper().dumpNameFormula(); } break; @@ -4527,7 +4527,7 @@ RootStorageObject::RootStorageObject( const DumperBase& rParent ) void RootStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { - if( (rStrgPath.getLength() == 0) && (rStrmName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Book" ) ) || rStrmName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Workbook" ) )) ) + if( rStrgPath.isEmpty() && (rStrmName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Book" )) || rStrmName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Workbook" ) )) ) WorkbookStreamObject( *this, rxStrm, rSysFileName ).dump(); else if( rStrgPath.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "_SX_DB" ) ) ) PivotCacheStreamObject( *this, rxStrm, BIFF5, rSysFileName ).dump(); diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index f1623799e25c..eacbba362d71 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -617,7 +617,7 @@ void StringHelper::appendEncString( OUStringBuffer& rStr, const OUString& rData, void StringHelper::appendToken( OUStringBuffer& rStr, const OUString& rToken, sal_Unicode cSep ) { - if( (rStr.getLength() > 0) && (rToken.getLength() > 0) ) + if( (rStr.getLength() > 0) && (!rToken.isEmpty()) ) rStr.append( cSep ); rStr.append( rToken ); } @@ -631,7 +631,7 @@ void StringHelper::appendToken( OUStringBuffer& rStr, sal_Int64 nToken, sal_Unic void StringHelper::prependToken( OUStringBuffer& rStr, const OUString& rToken, sal_Unicode cSep ) { - if( (rStr.getLength() > 0) && (rToken.getLength() > 0) ) + if( rStr.getLength() > 0 && !rToken.isEmpty() ) rStr.insert( 0, cSep ); rStr.insert( 0, rToken ); } @@ -878,7 +878,7 @@ bool StringHelper::convertStringToBool( const OUString& rData ) OUStringPair StringHelper::convertStringToPair( const OUString& rString, sal_Unicode cSep ) { OUStringPair aPair; - if( rString.getLength() > 0 ) + if( !rString.isEmpty() ) { sal_Int32 nEqPos = rString.indexOf( cSep ); if( nEqPos < 0 ) @@ -903,7 +903,7 @@ void StringHelper::convertStringToStringList( OUStringVector& orVec, const OUStr while( (0 <= nPos) && (nPos < nLen) ) { OUString aToken = getToken( aUnquotedData, nPos, OOX_DUMP_LF ); - if( !bIgnoreEmpty || (aToken.getLength() > 0) ) + if( !bIgnoreEmpty || !aToken.isEmpty() ) orVec.push_back( aToken ); } } @@ -1058,13 +1058,13 @@ ConfigItemBase::LineType ConfigItemBase::readConfigLine( TextInputStream& rStrm, OUString& orKey, OUString& orData ) const { OUString aLine; - while( !rStrm.isEof() && (aLine.getLength() == 0) ) + while( !rStrm.isEof() && aLine.isEmpty() ) { aLine = rStrm.readLine(); - if( (aLine.getLength() > 0) && (aLine[ 0 ] == OOX_DUMP_BOM) ) + if( !aLine.isEmpty() && (aLine[ 0 ] == OOX_DUMP_BOM) ) aLine = aLine.copy( 1 ); aLine = StringHelper::trimSpaces( aLine ); - if( aLine.getLength() > 0 ) + if( !aLine.isEmpty() ) { // ignore comments (starting with hash or semicolon) sal_Unicode cChar = aLine[ 0 ]; @@ -1076,7 +1076,7 @@ ConfigItemBase::LineType ConfigItemBase::readConfigLine( OUStringPair aPair = StringHelper::convertStringToPair( aLine ); orKey = aPair.first; orData = aPair.second; - return ((orKey.getLength() > 0) && ((orData.getLength() > 0) || !orKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "end" ) ))) ? + return (!orKey.isEmpty() && (!orData.isEmpty() || !orKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "end" ) ))) ? LINETYPE_DATA : LINETYPE_END; } @@ -1239,7 +1239,7 @@ void MultiList::setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNam { sal_Int64 nKey = nStartKey; for( OUStringVector::const_iterator aIt = rNames.begin(), aEnd = rNames.end(); aIt != aEnd; ++aIt, ++nKey ) - if( !mbIgnoreEmpty || (aIt->getLength() > 0) ) + if( !mbIgnoreEmpty || !aIt->isEmpty() ) insertRawName( nKey, *aIt ); } @@ -1300,7 +1300,7 @@ OUString FlagsList::implGetName( const Config& /*rCfg*/, sal_Int64 nKey ) const if( !getFlag( mnIgnore, nMask ) ) { const OUString& rFlagName = aIt->second; - bool bOnOff = (rFlagName.getLength() > 0) && (rFlagName[ 0 ] == ':'); + bool bOnOff = !rFlagName.isEmpty() && rFlagName[ 0 ] == ':'; bool bFlag = getFlag( nKey, nMask ); if( bOnOff ) { @@ -1309,7 +1309,7 @@ OUString FlagsList::implGetName( const Config& /*rCfg*/, sal_Int64 nKey ) const } else { - bool bNegated = (rFlagName.getLength() > 0) && (rFlagName[ 0 ] == '!'); + bool bNegated = !rFlagName.isEmpty() && rFlagName[ 0 ] == '!'; sal_Int32 nBothSep = bNegated ? rFlagName.indexOf( '!', 1 ) : -1; if( bFlag ) { @@ -1383,8 +1383,8 @@ void CombiList::implSetName( sal_Int64 nKey, const OUString& rName ) { OUStringPair aFilter = StringHelper::convertStringToPair( aPair.second, '~' ); ExtItemFormatKey aKey( nKey ); - if( (aFilter.first.getLength() > 0) && StringHelper::convertStringToInt( aKey.maFilter.first, aFilter.first ) && - (aFilter.second.getLength() > 0) && StringHelper::convertStringToInt( aKey.maFilter.second, aFilter.second ) ) + if( !aFilter.first.isEmpty() && StringHelper::convertStringToInt( aKey.maFilter.first, aFilter.first ) && + !aFilter.second.isEmpty() && StringHelper::convertStringToInt( aKey.maFilter.second, aFilter.second ) ) { if( aKey.maFilter.first == 0 ) aKey.maFilter.second = 0; @@ -1443,7 +1443,7 @@ OUString CombiList::implGetName( const Config& rCfg, sal_Int64 nKey ) const default:; } StringHelper::appendToken( aItem, aValue.makeStringAndClear(), OOX_DUMP_ITEMSEP ); - if( rItemFmt.maListName.getLength() > 0 ) + if( !rItemFmt.maListName.isEmpty() ) { OUString aValueName = rCfg.getName( rItemFmt.maListName, static_cast< sal_Int64 >( nUValue ) ); StringHelper::appendToken( aItem, aValueName, OOX_DUMP_ITEMSEP ); @@ -1516,7 +1516,7 @@ SharedConfigData::SharedConfigData( const OUString& rFileName, mbPwCancelled( false ) { OUString aFileUrl = InputOutputHelper::convertFileNameToUrl( rFileName ); - if( aFileUrl.getLength() > 0 ) + if( !aFileUrl.isEmpty() ) { sal_Int32 nNamePos = InputOutputHelper::getFileNamePos( aFileUrl ); maConfigPath = aFileUrl.copy( 0, nNamePos ); @@ -1541,7 +1541,7 @@ const OUString* SharedConfigData::getOption( const OUString& rKey ) const void SharedConfigData::setNameList( const OUString& rListName, const NameListRef& rxList ) { - if( rListName.getLength() > 0 ) + if( !rListName.isEmpty() ) maNameLists[ rListName ] = rxList; } @@ -1575,7 +1575,7 @@ Sequence< NamedValue > SharedConfigData::requestEncryptionData( ::comphelper::ID bool SharedConfigData::implIsValid() const { - return mbLoaded && mxContext.is() && mxRootStrg.get() && (maSysFileName.getLength() > 0); + return mbLoaded && mxContext.is() && mxRootStrg.get() && !maSysFileName.isEmpty(); } void SharedConfigData::implProcessConfigItemStr( @@ -1642,7 +1642,7 @@ void SharedConfigData::createUnitConverter( const OUString& rData ) if( aDataVec.size() >= 2 ) { OUString aFactor = aDataVec[ 1 ]; - bool bRecip = (aFactor.getLength() > 0) && (aFactor[ 0 ] == '/'); + bool bRecip = !aFactor.isEmpty() && aFactor[ 0 ] == '/'; if( bRecip ) aFactor = aFactor.copy( 1 ); double fFactor; @@ -1688,13 +1688,13 @@ void Config::construct( const Config& rParent ) void Config::construct( const sal_Char* pcEnvVar, const FilterBase& rFilter ) { - if( rFilter.getFileUrl().getLength() > 0 ) + if( !rFilter.getFileUrl().isEmpty() ) construct( pcEnvVar, rFilter.getComponentContext(), rFilter.getStorage(), rFilter.getFileUrl(), rFilter.getMediaDescriptor() ); } void Config::construct( const sal_Char* pcEnvVar, const Reference< XComponentContext >& rxContext, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc ) { - if( pcEnvVar && rxRootStrg.get() && (rSysFileName.getLength() > 0) ) + if( pcEnvVar && rxRootStrg.get() && !rSysFileName.isEmpty() ) if( const sal_Char* pcFileName = ::getenv( pcEnvVar ) ) mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxContext, rxRootStrg, rSysFileName, rMediaDesc ) ); } @@ -1925,7 +1925,7 @@ void Output::endItem() if( mnItemLevel > 0 ) { maLastItem = OUString( maLine.getStr() + mnLastItem ); - if( (maLastItem.getLength() == 0) && (mnLastItem > 0) && (maLine[ mnLastItem - 1 ] == OOX_DUMP_ITEMSEP) ) + if( maLastItem.isEmpty() && mnLastItem > 0 && maLine[ mnLastItem - 1 ] == OOX_DUMP_ITEMSEP ) maLine.setLength( mnLastItem - 1 ); --mnItemLevel; } @@ -2188,7 +2188,7 @@ void StorageObjectBase::construct( const ObjectBase& rParent ) bool StorageObjectBase::implIsValid() const { - return mxStrg.get() && (maSysPath.getLength() > 0) && ObjectBase::implIsValid(); + return mxStrg.get() && !maSysPath.isEmpty() && ObjectBase::implIsValid(); } void StorageObjectBase::implDump() @@ -2286,7 +2286,7 @@ void StorageObjectBase::extractStorage( const StorageRef& rxStrg, const OUString return; // process preferred storages and streams in root storage first - if( rStrgPath.getLength() == 0 ) + if( rStrgPath.isEmpty() ) for( PreferredItemVector::iterator aIt = maPreferred.begin(), aEnd = maPreferred.end(); aIt != aEnd; ++aIt ) extractItem( rxStrg, rStrgPath, aIt->maName, rSysPath, aIt->mbStorage, !aIt->mbStorage ); @@ -2296,7 +2296,7 @@ void StorageObjectBase::extractStorage( const StorageRef& rxStrg, const OUString // skip processed preferred items OUString aItemName = aIt.getName(); bool bFound = false; - if( rStrgPath.getLength() == 0 ) + if( rStrgPath.isEmpty() ) for( PreferredItemVector::iterator aIIt = maPreferred.begin(), aIEnd = maPreferred.end(); !bFound && (aIIt != aIEnd); ++aIIt ) bFound = aIIt->maName == aItemName; if( !bFound ) @@ -2651,7 +2651,7 @@ sal_Unicode InputObjectBase::dumpChar( const String& rName, rtl_TextEncoding eTe sal_uInt8 nChar; *mxStrm >> nChar; OUString aChar = OStringToOUString( OString( static_cast< sal_Char >( nChar ) ), eTextEnc ); - sal_Unicode cChar = (aChar.getLength() > 0) ? aChar[ 0 ] : 0; + sal_Unicode cChar = aChar.isEmpty() ? 0 : aChar[ 0 ]; writeCharItem( rName( "char" ), cChar ); return cChar; } @@ -2915,7 +2915,7 @@ void TextLineStreamObject::implDumpText( TextInputStream& rTextStrm ) while( !rTextStrm.isEof() ) { OUString aLine = rTextStrm.readLine(); - if( !rTextStrm.isEof() || (aLine.getLength() > 0) ) + if( !rTextStrm.isEof() || !aLine.isEmpty() ) implDumpLine( aLine, ++nLine ); } } @@ -3012,7 +3012,7 @@ void XmlStreamObject::implDumpText( TextInputStream& rTextStrm ) entirely. */ mxOut->writeString( aElem ); mxOut->newLine(); - if( aText.trim().getLength() > 0 ) + if( !aText.trim().isEmpty() ) { mxOut->writeString( aText ); mxOut->newLine(); diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx index a7c0daf85a7a..8c5e5a065de1 100644 --- a/oox/source/dump/oledumper.cxx +++ b/oox/source/dump/oledumper.cxx @@ -1654,7 +1654,7 @@ void FormControlStreamObject::implDump() if( mbReadGuid ) maProgId = cfg().getStringOption( dumpGuid(), OUString() ); - if( (maProgId.getLength() > 0) && !mxStrm->isEof() ) + if( !maProgId.isEmpty() && !mxStrm->isEof() ) { if( maProgId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.CommandButton.1" ) ) ) AxCommandButtonObject( *this ).dump(); @@ -2191,7 +2191,7 @@ void VbaDirStreamObject::implDumpRecordBody() dumpByteString( "description" ); break; case 0x002B: - if( maCurrStream.getLength() > 0 ) + if( !maCurrStream.isEmpty() ) mrVbaData.maStrmOffsets[ maCurrStream ] = mnCurrOffset; maCurrStream = OUString(); mnCurrOffset = 0; @@ -2283,7 +2283,7 @@ VbaStorageObject::VbaStorageObject( const ObjectBase& rParent, const StorageRef& void VbaStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { - if( (rStrgPath.getLength() == 0) && rStrmName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "dir" ) ) ) + if( rStrgPath.isEmpty() && rStrmName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "dir" ) ) ) VbaDirStreamObject( *this, rxStrm, rSysFileName, mrVbaData ).dump(); else if( mrVbaData.isModuleStream( rStrmName ) ) VbaModuleStreamObject( *this, rxStrm, rSysFileName, mrVbaData, mrVbaData.getStreamOffset( rStrmName ) ).dump(); @@ -2317,7 +2317,7 @@ VbaProjectStorageObject::VbaProjectStorageObject( const ObjectBase& rParent, con void VbaProjectStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { - if( (rStrgPath.getLength() == 0) && rStrmName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PROJECT" ) ) ) + if( rStrgPath.isEmpty() && rStrmName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PROJECT" ) ) ) TextLineStreamObject( *this, rxStrm, maVbaData.meTextEnc, rSysFileName ).dump(); else OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName ); diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index e757b1ee9561..9996d1e84573 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -383,7 +383,7 @@ OUString lcl_flattenStringSequence( const Sequence< OUString > & rSequence ) bool bPrecedeWithSpace = false; for( sal_Int32 nIndex=0; nIndex<rSequence.getLength(); ++nIndex ) { - if( rSequence[nIndex].getLength()) + if( !rSequence[nIndex].isEmpty()) { if( bPrecedeWithSpace ) aResult.append( static_cast< sal_Unicode >( ' ' )); @@ -777,7 +777,7 @@ void ChartExport::InitRangeSegmentationProperties( const Reference< chart2::XCha // range, where every row number is noe too large, so that older // version can correctly read those files. msChartAddress = (bBrokenRangeAvailable ? sBrokenRange : sCellRange); - if( msChartAddress.getLength() > 0 ) + if( !msChartAddress.isEmpty() ) { // convert format to XML-conform one Reference< chart2::data::XRangeXMLConversion > xConversion( xDataProvider, uno::UNO_QUERY ); @@ -857,7 +857,7 @@ void ChartExport::_ExportContent() //maExportHelper.SetTableNumberList( sTableNumberList ); // do not include own table if there are external addresses - bIncludeTable = (sChartAddress.getLength() == 0); + bIncludeTable = sChartAddress.isEmpty(); } catch( beans::UnknownPropertyException & ) { @@ -1059,7 +1059,7 @@ void ChartExport::exportTitle( Reference< XShape > xShape ) { xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "String" ))) >>= sText; } - if( sText.getLength() == 0 ) + if( sText.isEmpty() ) return; FSHelperPtr pFS = GetFS(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 745c6c5def35..cfe4bf02b13e 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -620,7 +620,7 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, String sURLP DBG(printf ("URL: %s\n", OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() )); - if( !aURL.getLength() ) + if( aURL.isEmpty() ) return; mpFS->startElementNS( nXmlNamespace , XML_blipFill, FSEND ); @@ -762,7 +762,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs mAny >>= eLocale; OUStringBuffer usLanguageBuffer = eLocale.Language; - if( eLocale.Country.getLength() ) { + if( !eLocale.Country.isEmpty() ) { usLanguageBuffer.appendAscii( "-" ); usLanguageBuffer.append( eLocale.Country ); } @@ -774,7 +774,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs mpFS->startElementNS( XML_a, XML_rPr, XML_b, bold, XML_i, italic, - XML_lang, usLanguage.getLength() ? USS( usLanguage ) : NULL, + XML_lang, usLanguage.isEmpty() ? NULL : USS( usLanguage ), XML_sz, nSize == 1800 ? NULL : IS( nSize ), XML_u, underline, FSEND ); @@ -848,7 +848,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs OUString sURL; mAny >>= sURL; - if( sURL.getLength() ) { + if( !sURL.isEmpty() ) { OUString sRelId = mpFB->addRelation( mpFS->getOutputStream(), US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" ), sURL, true ); @@ -937,13 +937,13 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun ) sal_Bool bIsField = sal_False; OUString sText = rRun->getString(); - if( sText.getLength() < 1) { + if( sText.isEmpty()) { Reference< XPropertySet > xPropSet( rRun, UNO_QUERY ); try { if( !xPropSet.is() || !( xPropSet->getPropertyValue( S( "PlaceholderText" ) ) >>= sText ) ) return; - if( sText.getLength() < 1 ) + if( sText.isEmpty() ) return; } catch (const Exception &) { @@ -1100,7 +1100,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa const char* pAutoNumType = GetAutoNumType( nNumberingType, bSDot, bPBehind, bPBoth ); if( nLevel >= 0 ) { - if( aGraphicURL.getLength() > 0 ) { + if( !aGraphicURL.isEmpty() ) { OUString sRelId = WriteImage( aGraphicURL ); mpFS->startElementNS( XML_a, XML_buBlip, FSEND ); diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index 767c5711371e..2d7445037c77 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -172,49 +172,49 @@ OptValue< OUString > AttributeList::getXString( sal_Int32 nAttrToken ) const OptValue< double > AttributeList::getDouble( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); - bool bValid = aValue.getLength() > 0; + bool bValid = !aValue.isEmpty(); return OptValue< double >( bValid, bValid ? AttributeConversion::decodeDouble( aValue ) : 0.0 ); } OptValue< sal_Int32 > AttributeList::getInteger( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); - bool bValid = aValue.getLength() > 0; + bool bValid = !aValue.isEmpty(); return OptValue< sal_Int32 >( bValid, bValid ? AttributeConversion::decodeInteger( aValue ) : 0 ); } OptValue< sal_uInt32 > AttributeList::getUnsigned( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); - bool bValid = aValue.getLength() > 0; + bool bValid = !aValue.isEmpty(); return OptValue< sal_uInt32 >( bValid, AttributeConversion::decodeUnsigned( aValue ) ); } OptValue< sal_Int64 > AttributeList::getHyper( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); - bool bValid = aValue.getLength() > 0; + bool bValid = !aValue.isEmpty(); return OptValue< sal_Int64 >( bValid, bValid ? AttributeConversion::decodeHyper( aValue ) : 0 ); } OptValue< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); - bool bValid = aValue.getLength() > 0; + bool bValid = !aValue.isEmpty(); return OptValue< sal_Int32 >( bValid, bValid ? AttributeConversion::decodeIntegerHex( aValue ) : 0 ); } OptValue< sal_uInt32 > AttributeList::getUnsignedHex( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); - bool bValid = aValue.getLength() > 0; + bool bValid = !aValue.isEmpty(); return OptValue< sal_uInt32 >( bValid, bValid ? AttributeConversion::decodeUnsignedHex( aValue ) : 0 ); } OptValue< sal_Int64 > AttributeList::getHyperHex( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); - bool bValid = aValue.getLength() > 0; + bool bValid = !aValue.isEmpty(); return OptValue< sal_Int64 >( bValid, bValid ? AttributeConversion::decodeHyperHex( aValue ) : 0 ); } diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index 6ddb9860554c..ddca88f19e65 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -293,8 +293,8 @@ Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rG Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStreamName ) const { Reference< XGraphic > xGraphic; - OSL_ENSURE( rStreamName.getLength() > 0, "GraphicHelper::importEmbeddedGraphic - empty stream name" ); - if( rStreamName.getLength() > 0 ) + OSL_ENSURE( !rStreamName.isEmpty(), "GraphicHelper::importEmbeddedGraphic - empty stream name" ); + if( !rStreamName.isEmpty() ) { EmbeddedGraphicMap::const_iterator aIt = maEmbeddedGraphics.find( rStreamName ); if( aIt == maEmbeddedGraphics.end() ) diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx index 2268bfa551c0..f0c31f900f75 100644 --- a/oox/source/helper/modelobjecthelper.cxx +++ b/oox/source/helper/modelobjecthelper.cxx @@ -130,7 +130,7 @@ bool ModelObjectHelper::insertLineMarker( const OUString& rMarkerName, const Pol { OSL_ENSURE( rMarker.Coordinates.hasElements(), "ModelObjectHelper::insertLineMarker - line marker without coordinates" ); if( rMarker.Coordinates.hasElements() ) - return maMarkerContainer.insertObject( rMarkerName, Any( rMarker ), false ).getLength() > 0; + return !maMarkerContainer.insertObject( rMarkerName, Any( rMarker ), false ).isEmpty(); return false; } @@ -151,7 +151,7 @@ OUString ModelObjectHelper::insertTransGrandient( const Gradient& rGradient ) OUString ModelObjectHelper::insertFillBitmapUrl( const OUString& rGraphicUrl ) { - if( rGraphicUrl.getLength() > 0 ) + if( !rGraphicUrl.isEmpty() ) return maBitmapUrlContainer.insertObject( maBitmapUrlNameBase, Any( rGraphicUrl ), true ); return OUString(); } diff --git a/oox/source/helper/storagebase.cxx b/oox/source/helper/storagebase.cxx index 7e5b2d0f4966..38eacaf727a4 100644 --- a/oox/source/helper/storagebase.cxx +++ b/oox/source/helper/storagebase.cxx @@ -110,7 +110,7 @@ bool StorageBase::isStorage() const bool StorageBase::isRootStorage() const { - return implIsStorage() && (maStorageName.getLength() == 0); + return implIsStorage() && maStorageName.isEmpty(); } bool StorageBase::isReadOnly() const @@ -151,9 +151,9 @@ StorageRef StorageBase::openSubStorage( const OUString& rStorageName, bool bCrea { OUString aElement, aRemainder; lclSplitFirstElement( aElement, aRemainder, rStorageName ); - if( aElement.getLength() > 0 ) + if( !aElement.isEmpty() ) xSubStorage = getSubStorage( aElement, bCreateMissing ); - if( xSubStorage.get() && (aRemainder.getLength() > 0) ) + if( xSubStorage.get() && !aRemainder.isEmpty() ) xSubStorage = xSubStorage->openSubStorage( aRemainder, bCreateMissing ); } return xSubStorage; @@ -164,9 +164,9 @@ Reference< XInputStream > StorageBase::openInputStream( const OUString& rStreamN Reference< XInputStream > xInStream; OUString aElement, aRemainder; lclSplitFirstElement( aElement, aRemainder, rStreamName ); - if( aElement.getLength() > 0 ) + if( !aElement.isEmpty() ) { - if( aRemainder.getLength() > 0 ) + if( !aRemainder.isEmpty() ) { StorageRef xSubStorage = getSubStorage( aElement, false ); if( xSubStorage.get() ) @@ -192,9 +192,9 @@ Reference< XOutputStream > StorageBase::openOutputStream( const OUString& rStrea { OUString aElement, aRemainder; lclSplitFirstElement( aElement, aRemainder, rStreamName ); - if( aElement.getLength() > 0 ) + if( !aElement.isEmpty() ) { - if( aRemainder.getLength() > 0 ) + if( !aRemainder.isEmpty() ) { StorageRef xSubStorage = getSubStorage( aElement, true ); if( xSubStorage.get() ) @@ -216,8 +216,8 @@ Reference< XOutputStream > StorageBase::openOutputStream( const OUString& rStrea void StorageBase::copyToStorage( StorageBase& rDestStrg, const OUString& rElementName ) { OSL_ENSURE( rDestStrg.isStorage() && !rDestStrg.isReadOnly(), "StorageBase::copyToStorage - invalid destination" ); - OSL_ENSURE( rElementName.getLength() > 0, "StorageBase::copyToStorage - invalid element name" ); - if( rDestStrg.isStorage() && !rDestStrg.isReadOnly() && (rElementName.getLength() > 0) ) + OSL_ENSURE( !rElementName.isEmpty(), "StorageBase::copyToStorage - invalid element name" ); + if( rDestStrg.isStorage() && !rDestStrg.isReadOnly() && !rElementName.isEmpty() ) { StorageRef xSubStrg = openSubStorage( rElementName, false ); if( xSubStrg.get() ) diff --git a/oox/source/helper/textinputstream.cxx b/oox/source/helper/textinputstream.cxx index e98ed861ed83..f374cc920f81 100644 --- a/oox/source/helper/textinputstream.cxx +++ b/oox/source/helper/textinputstream.cxx @@ -181,7 +181,7 @@ OUString TextInputStream::readToChar( sal_Unicode cChar, bool bIncludeChar ) a character that has been buffered in the previous call. */ OUString aString = createFinalString( mxTextStrm->readString( aDelimiters, sal_False ) ); // remove last character from string and remember it for next call - if( !bIncludeChar && (aString.getLength() > 0) && (aString[ aString.getLength() - 1 ] == cChar) ) + if( !bIncludeChar && !aString.isEmpty() && (aString[ aString.getLength() - 1 ] == cChar) ) { mcPendingChar = cChar; aString = aString.copy( 0, aString.getLength() - 1 ); diff --git a/oox/source/mathml/importutils.cxx b/oox/source/mathml/importutils.cxx index 4a71d5616729..55eb1fa67cf6 100644 --- a/oox/source/mathml/importutils.cxx +++ b/oox/source/mathml/importutils.cxx @@ -155,7 +155,7 @@ sal_Unicode XmlStream::AttributeList::attribute( int token, sal_Unicode def ) co std::map< int, rtl::OUString >::const_iterator find = attrs.find( token ); if( find != attrs.end()) { - if( find->second.getLength() >= 1 ) + if( !find->second.isEmpty() ) { // if( find->second.getLength() != 1 ) // fprintf( stderr, "Cannot convert \'%s\' to sal_Unicode, stripping.\n", CSTR( find->second )); diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index c9bde1fd3e86..d6a0c620407e 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -292,7 +292,7 @@ void ControlConverter::convertPicture( PropertyMap& rPropMap, const StreamDataSe if( rPicData.hasElements() ) { OUString aGraphicUrl = mrGraphicHelper.importGraphicObject( rPicData ); - if( aGraphicUrl.getLength() > 0 ) + if( !aGraphicUrl.isEmpty() ) rPropMap.setProperty( PROP_ImageURL, aGraphicUrl ); } } @@ -337,7 +337,7 @@ void ControlConverter::bindToSources( const Reference< XControlModel >& rxCtrlMo const OUString& rCtrlSource, const OUString& rRowSource, sal_Int32 nRefSheet ) const { // value binding - if( rCtrlSource.getLength() > 0 ) try + if( !rCtrlSource.isEmpty() ) try { // first check if the XBindableValue interface is supported Reference< XBindableValue > xBindable( rxCtrlModel, UNO_QUERY_THROW ); @@ -369,7 +369,7 @@ void ControlConverter::bindToSources( const Reference< XControlModel >& rxCtrlMo } // list entry source - if( rRowSource.getLength() > 0 ) try + if( !rRowSource.isEmpty() ) try { // first check if the XListEntrySink interface is supported Reference< XListEntrySink > xEntrySink( rxCtrlModel, UNO_QUERY_THROW ); @@ -899,7 +899,7 @@ void AxFontDataModel::exportBinaryModel( BinaryOutputStream& rOutStrm ) void AxFontDataModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const { // font name - if( maFontData.maFontName.getLength() > 0 ) + if( !maFontData.maFontName.isEmpty() ) rPropMap.setProperty( PROP_FontName, maFontData.maFontName ); // font effects @@ -2637,7 +2637,7 @@ OUString EmbeddedControl::getServiceName() const bool EmbeddedControl::convertProperties( const Reference< XControlModel >& rxCtrlModel, const ControlConverter& rConv ) const { - if( mxModel.get() && rxCtrlModel.is() && (maName.getLength() > 0) ) + if( mxModel.get() && rxCtrlModel.is() && !maName.isEmpty() ) { PropertyMap aPropMap; aPropMap.setProperty( PROP_Name, maName ); @@ -2658,7 +2658,7 @@ bool EmbeddedControl::convertProperties( const Reference< XControlModel >& rxCtr bool EmbeddedControl::convertFromProperties( const Reference< XControlModel >& rxCtrlModel, const ControlConverter& rConv ) { - if( mxModel.get() && rxCtrlModel.is() && (maName.getLength() > 0) ) + if( mxModel.get() && rxCtrlModel.is() && !maName.isEmpty() ) { PropertySet aPropSet( rxCtrlModel ); aPropSet.getProperty( maName, PROP_Name ); diff --git a/oox/source/ole/axcontrolfragment.cxx b/oox/source/ole/axcontrolfragment.cxx index 7b985c5badec..53d21b3e7c2b 100644 --- a/oox/source/ole/axcontrolfragment.cxx +++ b/oox/source/ole/axcontrolfragment.cxx @@ -83,7 +83,7 @@ ContextHandlerRef AxControlPropertyContext::onCreateContext( sal_Int32 nElement, if( nElement == AX_TOKEN( picture ) ) { OUString aPicturePath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ); - if( aPicturePath.getLength() > 0 ) + if( !aPicturePath.isEmpty() ) { BinaryXInputStream aInStrm( getFilter().openInputStream( aPicturePath ), true ); mrModel.importPictureData( mnPropId, aInStrm ); @@ -117,7 +117,7 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const case XML_persistStreamInit: { OUString aFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ); - if( aFragmentPath.getLength() > 0 ) + if( !aFragmentPath.isEmpty() ) { BinaryXInputStream aInStrm( getFilter().openInputStream( aFragmentPath ), true ); if( !aInStrm.isEof() ) @@ -136,7 +136,7 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const case XML_persistStorage: { OUString aFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ); - if( aFragmentPath.getLength() > 0 ) + if( !aFragmentPath.isEmpty() ) { Reference< XInputStream > xStrgStrm = getFilter().openInputStream( aFragmentPath ); if( xStrgStrm.is() ) diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index a04a2c6ac8dc..012fc203a64b 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -676,7 +676,7 @@ sal_Bool MSConvertOCXControls::ReadOCXStorage( SotStorageRef& xOleStg, { OUString aName = aNameStream.readNulUnicodeArray(); Reference< XControlModel > xCtlModel( rxFormComp, UNO_QUERY ); - if ( aName.getLength() && xCtlModel.is() ) + if ( !aName.isEmpty() && xCtlModel.is() ) { PropertyMap aPropMap; aPropMap.setProperty( PROP_Name, aName ); diff --git a/oox/source/ole/oleobjecthelper.cxx b/oox/source/ole/oleobjecthelper.cxx index 30a1ce699ae8..98c46aa4c16c 100644 --- a/oox/source/ole/oleobjecthelper.cxx +++ b/oox/source/ole/oleobjecthelper.cxx @@ -95,7 +95,7 @@ bool OleObjectHelper::importOleObject( PropertyMap& rPropMap, const OleObjectInf if( rOleObject.mbLinked ) { // linked OLE object - set target URL - if( rOleObject.maTargetLink.getLength() > 0 ) + if( !rOleObject.maTargetLink.isEmpty() ) { rPropMap[ PROP_LinkURL ] <<= rOleObject.maTargetLink; bRet = true; @@ -116,7 +116,7 @@ bool OleObjectHelper::importOleObject( PropertyMap& rPropMap, const OleObjectInf OUString aUrl = mxResolver->resolveEmbeddedObjectURL( aObjectId ); OSL_ENSURE( aUrl.match( maEmbeddedObjScheme ), "OleObjectHelper::importOleObject - unexpected URL scheme" ); OUString aPersistName = aUrl.copy( maEmbeddedObjScheme.getLength() ); - if( aPersistName.getLength() > 0 ) + if( !aPersistName.isEmpty() ) { rPropMap[ PROP_PersistName ] <<= aPersistName; bRet = true; diff --git a/oox/source/ole/olestorage.cxx b/oox/source/ole/olestorage.cxx index 511b4ee81be5..490fc6f77ae1 100755 --- a/oox/source/ole/olestorage.cxx +++ b/oox/source/ole/olestorage.cxx @@ -324,7 +324,7 @@ void OleStorage::implGetElementNames( ::std::vector< OUString >& orElementNames StorageRef OleStorage::implOpenSubStorage( const OUString& rElementName, bool bCreateMissing ) { StorageRef xSubStorage; - if( mxStorage.is() && (rElementName.getLength() > 0) ) + if( mxStorage.is() && !rElementName.isEmpty() ) { try { @@ -376,7 +376,7 @@ Reference< XInputStream > OleStorage::implOpenInputStream( const OUString& rElem Reference< XOutputStream > OleStorage::implOpenOutputStream( const OUString& rElementName ) { Reference< XOutputStream > xOutStream; - if( mxStorage.is() && (rElementName.getLength() > 0) ) + if( mxStorage.is() && !rElementName.isEmpty() ) xOutStream.set( new OleOutputStream( mxContext, mxStorage, rElementName ) ); return xOutStream; } diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 048d4f8c737f..0a4b91baa490 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -125,7 +125,7 @@ VbaControlNamesSet::VbaControlNamesSet() : void VbaControlNamesSet::insertName( const VbaFormControl& rControl ) { OUString aName = rControl.getControlName(); - if( aName.getLength() > 0 ) + if( !aName.isEmpty() ) maCtrlNames.insert( aName ); } @@ -455,8 +455,8 @@ bool VbaFormControl::convertProperties( const Reference< XControlModel >& rxCtrl if( rxCtrlModel.is() && mxSiteModel.get() && mxCtrlModel.get() ) { const OUString& rCtrlName = mxSiteModel->getName(); - OSL_ENSURE( rCtrlName.getLength() > 0, "VbaFormControl::convertProperties - control without name" ); - if( rCtrlName.getLength() > 0 ) + OSL_ENSURE( !rCtrlName.isEmpty(), "VbaFormControl::convertProperties - control without name" ); + if( !rCtrlName.isEmpty() ) { // convert all properties PropertyMap aPropMap; @@ -785,7 +785,7 @@ bool lclEatKeyword( OUString& rCodeLine, const OUString& rKeyword ) { rCodeLine = rCodeLine.copy( rKeyword.getLength() ); // success, if code line ends after keyword, or if whitespace follows - return (rCodeLine.getLength() == 0) || lclEatWhitespace( rCodeLine ); + return rCodeLine.isEmpty() || lclEatWhitespace( rCodeLine ); } return false; } @@ -835,11 +835,11 @@ void VbaUserForm::importForm( // remaining line is the form name OUString aFormName = aLine.trim(); - OSL_ENSURE( aFormName.getLength() > 0, "VbaUserForm::importForm - missing form name" ); + OSL_ENSURE( !aFormName.isEmpty(), "VbaUserForm::importForm - missing form name" ); OSL_ENSURE( rModuleName.equalsIgnoreAsciiCase( aFormName ), "VbaUserForm::importFrameStream - form and module name mismatch" ); - if( aFormName.getLength() == 0 ) + if( aFormName.isEmpty() ) aFormName = rModuleName; - if( aFormName.getLength() == 0 ) + if( aFormName.isEmpty() ) return; mxSiteModel.reset( new VbaSiteModel ); mxSiteModel->importProperty( XML_Name, aFormName ); diff --git a/oox/source/ole/vbahelper.cxx b/oox/source/ole/vbahelper.cxx index 47bbacb40bae..e78ec21ff313 100644 --- a/oox/source/ole/vbahelper.cxx +++ b/oox/source/ole/vbahelper.cxx @@ -45,9 +45,9 @@ using ::rtl::OUStringBuffer; /*static*/ OUString VbaHelper::getBasicScriptUrl( const OUString& rLibraryName, const OUString& rModuleName, const OUString& rMacroName ) { - OSL_ENSURE( rLibraryName.getLength() > 0, "VbaHelper::getBasicScriptUrl - library name is empty" ); - OSL_ENSURE( rModuleName.getLength() > 0, "VbaHelper::getBasicScriptUrl - module name is empty" ); - OSL_ENSURE( rMacroName.getLength() > 0, "VbaHelper::getBasicScriptUrl - macro name is empty" ); + OSL_ENSURE( !rLibraryName.isEmpty(), "VbaHelper::getBasicScriptUrl - library name is empty" ); + OSL_ENSURE( !rModuleName.isEmpty(), "VbaHelper::getBasicScriptUrl - module name is empty" ); + OSL_ENSURE( !rMacroName.isEmpty(), "VbaHelper::getBasicScriptUrl - macro name is empty" ); const sal_Unicode cDot = '.'; return OUStringBuffer(). appendAscii( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.script:" ) ). @@ -78,7 +78,7 @@ using ::rtl::OUStringBuffer; { rKey = rKeyValue.copy( 0, nEqSignPos ).trim(); rValue = rKeyValue.copy( nEqSignPos + 1 ).trim(); - return (rKey.getLength() > 0) && (rValue.getLength() > 0); + return !rKey.isEmpty() && !rValue.isEmpty(); } return false; } diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx index cbd9744b03d0..d907051c8238 100644 --- a/oox/source/ole/vbamodule.cxx +++ b/oox/source/ole/vbamodule.cxx @@ -197,8 +197,8 @@ void VbaModule::importDirRecords( BinaryInputStream& rDirStrm ) #undef OOX_ENSURE_RECORDSIZE } } - OSL_ENSURE( maName.getLength() > 0, "VbaModule::importDirRecords - missing module name" ); - OSL_ENSURE( maStreamName.getLength() > 0, "VbaModule::importDirRecords - missing module stream name" ); + OSL_ENSURE( !maName.isEmpty(), "VbaModule::importDirRecords - missing module name" ); + OSL_ENSURE( !maStreamName.isEmpty(), "VbaModule::importDirRecords - missing module stream name" ); OSL_ENSURE( mnType != ModuleType::UNKNOWN, "VbaModule::importDirRecords - missing module type" ); OSL_ENSURE( mnOffset < SAL_MAX_UINT32, "VbaModule::importDirRecords - missing module stream offset" ); } @@ -218,7 +218,7 @@ void VbaModule::createEmptyModule( const Reference< XNameContainer >& rxBasicLib OUString VbaModule::readSourceCode( StorageBase& rVbaStrg, const Reference< XNameContainer >& rxOleNameOverrides ) const { OUStringBuffer aSourceCode; - if( (maStreamName.getLength() > 0) && (mnOffset != SAL_MAX_UINT32) ) + if( !maStreamName.isEmpty() && (mnOffset != SAL_MAX_UINT32) ) { BinaryXInputStream aInStrm( rVbaStrg.openInputStream( maStreamName ), true ); OSL_ENSURE( !aInStrm.isEof(), "VbaModule::readSourceCode - cannot open module stream" ); @@ -280,7 +280,7 @@ void VbaModule::extractOleOverrideFromAttr( const OUString& rAttribute, const Re void VbaModule::createModule( const OUString& rVBASourceCode, const Reference< XNameContainer >& rxBasicLib, const Reference< XNameAccess >& rxDocObjectNA ) const { - if( maName.getLength() == 0 ) + if( maName.isEmpty() ) return; // prepare the Basic module diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx index 3685c2db6186..4237d2a21cca 100644 --- a/oox/source/ole/vbaproject.cxx +++ b/oox/source/ole/vbaproject.cxx @@ -98,7 +98,7 @@ VbaFilterConfig::VbaFilterConfig( const Reference< XComponentContext >& rxContex OSL_ENSURE( rxContext.is(), "VbaFilterConfig::VbaFilterConfig - missing component context" ); if( rxContext.is() ) try { - OSL_ENSURE( rConfigCompName.getLength() > 0, "VbaFilterConfig::VbaFilterConfig - invalid configuration component name" ); + OSL_ENSURE( !rConfigCompName.isEmpty(), "VbaFilterConfig::VbaFilterConfig - invalid configuration component name" ); OUString aConfigPackage = CREATE_OUSTRING( "org.openoffice.Office." ) + rConfigCompName; Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); mxConfigAccess = ConfigurationHelper::openConfig( xFactory, aConfigPackage, ConfigurationHelper::E_READONLY ); @@ -133,7 +133,7 @@ bool VbaFilterConfig::isExportVba() const VbaMacroAttacherBase::VbaMacroAttacherBase( const OUString& rMacroName ) : maMacroName( rMacroName ) { - OSL_ENSURE( maMacroName.getLength() > 0, "VbaMacroAttacherBase::VbaMacroAttacherBase - empty macro name" ); + OSL_ENSURE( !maMacroName.isEmpty(), "VbaMacroAttacherBase::VbaMacroAttacherBase - empty macro name" ); } VbaMacroAttacherBase::~VbaMacroAttacherBase() @@ -231,7 +231,7 @@ bool VbaProject::hasDialog( const OUString& rDialogName ) const void VbaProject::addDummyModule( const OUString& rName, sal_Int32 nType ) { - OSL_ENSURE( rName.getLength() > 0, "VbaProject::addDummyModule - missing module name" ); + OSL_ENSURE( !rName.isEmpty(), "VbaProject::addDummyModule - missing module name" ); maDummyModules[ rName ] = nType; } @@ -335,8 +335,8 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap case VBA_ID_PROJECTNAME: { OUString aPrjName = aRecStrm.readCharArrayUC( nRecSize, eTextEnc ); - OSL_ENSURE( aPrjName.getLength() > 0, "VbaProject::importVba - invalid project name" ); - if( aPrjName.getLength() > 0 ) + OSL_ENSURE( !aPrjName.isEmpty(), "VbaProject::importVba - invalid project name" ); + if( !aPrjName.isEmpty() ) maPrjName = aPrjName; } break; @@ -348,7 +348,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap case VBA_ID_MODULENAME: { OUString aName = aRecStrm.readCharArrayUC( nRecSize, eTextEnc ); - OSL_ENSURE( aName.getLength() > 0, "VbaProject::importVba - invalid module name" ); + OSL_ENSURE( !aName.isEmpty(), "VbaProject::importVba - invalid module name" ); OSL_ENSURE( !aModules.has( aName ), "VbaProject::importVba - multiple modules with the same name" ); VbaModuleMap::mapped_type& rxModule = aModules[ aName ]; rxModule.reset( new VbaModule( mxContext, mxDocModel, aName, eTextEnc, bExecutable ) ); @@ -416,7 +416,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "BaseClass" ) ) ) nType = ModuleType::FORM; - if( (nType != ModuleType::UNKNOWN) && (aValue.getLength() > 0) ) + if( (nType != ModuleType::UNKNOWN) && !aValue.isEmpty() ) { OSL_ENSURE( aModules.has( aValue ), "VbaProject::importVba - module not found" ); if( VbaModule* pModule = aModules.get( aValue ).get() ) diff --git a/oox/source/ppt/pptgraphicshapecontext.cxx b/oox/source/ppt/pptgraphicshapecontext.cxx index dd5820aa9925..11a9a27f8f13 100644 --- a/oox/source/ppt/pptgraphicshapecontext.cxx +++ b/oox/source/ppt/pptgraphicshapecontext.cxx @@ -128,7 +128,7 @@ Reference< XFastContextHandler > PPTGraphicShapeContext::createFastChildContext( sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) ); mpShapePtr->setSubType( nSubType ); OUString sIdx( xAttribs->getOptionalValue( XML_idx ) ); - sal_Bool bHasIdx = sIdx.getLength() > 0; + sal_Bool bHasIdx = !sIdx.isEmpty(); sal_Int32 nIdx = sIdx.toInt32(); if( xAttribs->hasAttribute( XML_idx ) ) mpShapePtr->setSubTypeIndex( nIdx ); diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index e542e5353971..e64f89b6cb41 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -174,7 +174,7 @@ sal_Bool SAL_CALL PowerPointImport::filter( const Sequence< PropertyValue >& rDe const oox::drawingml::table::TableStyleListPtr PowerPointImport::getTableStyles() { - if ( !mpTableStyleList && maTableStyleListPath.getLength() ) + if ( !mpTableStyleList && !maTableStyleListPath.isEmpty() ) { mpTableStyleList = oox::drawingml::table::TableStyleListPtr( new oox::drawingml::table::TableStyleList() ); importFragment( new oox::drawingml::table::TableStyleListFragmentHandler( diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index 8ea04c422de0..dfb4a38c338c 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -133,7 +133,7 @@ void PPTShape::addShape( try { rtl::OUString sServiceName( msServiceName ); - if( sServiceName.getLength() ) + if( !sServiceName.isEmpty() ) { oox::drawingml::TextListStylePtr aMasterTextListStyle; Reference< lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW ); @@ -274,7 +274,7 @@ void PPTShape::addShape( OSL_TRACE("placeholder id: %s", pPlaceholder.get() ? rtl::OUStringToOString(pPlaceholder->getId(), RTL_TEXTENCODING_UTF8 ).getStr() : "not found"); } - if ( sServiceName.getLength() ) + if ( !sServiceName.isEmpty() ) { // use style from master slide for placeholders only, otherwise use slide's style, which might be the default style from presentation if ( !aMasterTextListStyle.get() ) @@ -301,7 +301,7 @@ void PPTShape::addShape( rtl::OUString aTitleText; Reference< XTextRange > xText( xShape, UNO_QUERY_THROW ); aTitleText = xText->getString(); - if ( aTitleText.getLength() && ( aTitleText.getLength() < 64 ) ) // just a magic value, but we don't want to set slide names which are too long + if ( !aTitleText.isEmpty() && ( aTitleText.getLength() < 64 ) ) // just a magic value, but we don't want to set slide names which are too long { Reference< container::XNamed > xName( rSlidePersist.getPage(), UNO_QUERY_THROW ); xName->setName( aTitleText ); @@ -312,7 +312,7 @@ void PPTShape::addShape( } } - if( pShapeMap && msId.getLength() ) + if( pShapeMap && !msId.isEmpty() ) { (*pShapeMap)[ msId ] = shared_from_this(); } diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 63d5f76e2219..cac49d835113 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -170,7 +170,7 @@ void PresentationFragmentHandler::finalizeImport() xSlide = xDrawPages->insertNewByIndex( nSlide ); OUString aSlideFragmentPath = getFragmentPathFromRelId( maSlidesVector[ nSlide ] ); - if( aSlideFragmentPath.getLength() > 0 ) + if( !aSlideFragmentPath.isEmpty() ) { SlidePersistPtr pMasterPersistPtr; SlidePersistPtr pSlidePersistPtr( new SlidePersist( rFilter, sal_False, sal_False, xSlide, @@ -180,12 +180,12 @@ void PresentationFragmentHandler::finalizeImport() // importing the corresponding masterpage/layout OUString aLayoutFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "slideLayout" ) ); - if ( aLayoutFragmentPath.getLength() > 0 ) + if ( !aLayoutFragmentPath.isEmpty() ) { // importing layout RelationsRef xLayoutRelations = rFilter.importRelations( aLayoutFragmentPath ); OUString aMasterFragmentPath = xLayoutRelations->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "slideMaster" ) ); - if( aMasterFragmentPath.getLength() ) + if( !aMasterFragmentPath.isEmpty() ) { // check if the corresponding masterpage+layout has already been imported std::vector< SlidePersistPtr >& rMasterPages( rFilter.getMasterPages() ); @@ -219,7 +219,7 @@ void PresentationFragmentHandler::finalizeImport() // set the correct theme OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "theme" ) ); - if( aThemeFragmentPath.getLength() > 0 ) + if( !aThemeFragmentPath.isEmpty() ) { std::map< OUString, oox::drawingml::ThemePtr >& rThemes( rFilter.getThemes() ); std::map< OUString, oox::drawingml::ThemePtr >::iterator aIter2( rThemes.find( aThemeFragmentPath ) ); @@ -268,7 +268,7 @@ void PresentationFragmentHandler::finalizeImport() // now importing the notes page OUString aNotesFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "notesSlide" ) ); - if( aNotesFragmentPath.getLength() > 0 ) + if( !aNotesFragmentPath.isEmpty() ) { Reference< XPresentationPage > xPresentationPage( xSlide, UNO_QUERY ); if ( xPresentationPage.is() ) diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 4652690e7765..a27e5e3ede50 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -64,7 +64,7 @@ SlideFragmentHandler::SlideFragmentHandler( XmlFilterBase& rFilter, const OUStri , meShapeLocation( eShapeLocation ) { OUString aVMLDrawingFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "vmlDrawing" ) ); - if( aVMLDrawingFragmentPath.getLength() > 0 ) + if( !aVMLDrawingFragmentPath.isEmpty() ) getFilter().importFragment( new oox::vml::DrawingFragment( getFilter(), aVMLDrawingFragmentPath, *pPersistPtr->getDrawing() ) ); } @@ -177,7 +177,7 @@ void SlideFragmentHandler::finalizeImport() Reference< XDrawPage > xSlide( mpSlidePersistPtr->getPage() ); PropertySet aSlideProp( xSlide ); aSlideProp.setProperties( maSlideProperties ); - if ( maSlideName.getLength() ) + if ( !maSlideName.isEmpty() ) { Reference< XNamed > xNamed( xSlide, UNO_QUERY ); if( xNamed.is() ) diff --git a/oox/source/ppt/soundactioncontext.cxx b/oox/source/ppt/soundactioncontext.cxx index 7b510beda983..72e8165c7899 100644 --- a/oox/source/ppt/soundactioncontext.cxx +++ b/oox/source/ppt/soundactioncontext.cxx @@ -67,7 +67,7 @@ namespace oox { namespace ppt { { OUString url; // TODO this is very wrong - if ( msSndName.getLength() != 0 ) + if ( !msSndName.isEmpty() ) { // try the builtIn version url = msSndName; @@ -83,7 +83,7 @@ namespace oox { namespace ppt { url = msLink; } #endif - if ( url.getLength() != 0 ) + if ( !url.isEmpty() ) { maSlideProperties[ PROP_Sound ] <<= url; maSlideProperties[ PROP_SoundOn ] <<= sal_True; diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx index fc28f72e7028..776e2bfe513a 100644 --- a/oox/source/ppt/timenode.cxx +++ b/oox/source/ppt/timenode.cxx @@ -232,7 +232,7 @@ namespace oox { namespace ppt { OSL_ENSURE( xNode.is(), "null node passed" ); try { - if( msId.getLength() ) + if( !msId.isEmpty() ) { pSlide->getAnimNodesMap()[ msId ] = xNode; } diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index ab250d98d10f..fa312d527b0c 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -557,17 +557,17 @@ namespace oox { namespace ppt { } OUString aStr; aStr = xAttribs->getOptionalValue( XML_from ); - if( aStr.getLength() ) + if( !aStr.isEmpty() ) { pNode->setFrom( makeAny( aStr ) ); } aStr = xAttribs->getOptionalValue( XML_by ); - if( aStr.getLength() ) + if( !aStr.isEmpty() ) { pNode->setBy( makeAny( aStr ) ); } aStr = xAttribs->getOptionalValue( XML_to ); - if( aStr.getLength() ) + if( !aStr.isEmpty() ) { pNode->setTo( makeAny( aStr ) ); } @@ -596,7 +596,7 @@ namespace oox { namespace ppt { OUString aTest; iter->maValue >>= aTest; - if( aTest.getLength() != 0 ) + if( !aTest.isEmpty() ) { aValues[i] = iter->maValue; } @@ -886,7 +886,7 @@ namespace oox { namespace ppt { // TODO // OUString sPrList = xAttribs->getOptionalValue( XML_prLst ); - if( sFilter.getLength() ) + if( !sFilter.isEmpty() ) { SlideTransition aFilter( sFilter ); aFilter.setMode( nDir == XML_out ? false : true ); diff --git a/oox/source/ppt/timetargetelementcontext.cxx b/oox/source/ppt/timetargetelementcontext.cxx index 93cbcf701625..2418430d52fb 100644 --- a/oox/source/ppt/timetargetelementcontext.cxx +++ b/oox/source/ppt/timetargetelementcontext.cxx @@ -121,7 +121,7 @@ namespace oox { namespace ppt { { mpTarget->mnType = XML_inkTgt; OUString aId = rAttribs.getString( XML_spid, OUString() ); - if( aId.getLength() ) + if( !aId.isEmpty() ) { mpTarget->msValue = aId; } diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx index 6483f2053a42..8c6207f7737d 100644 --- a/oox/source/vml/vmldrawing.cxx +++ b/oox/source/vml/vmldrawing.cxx @@ -132,15 +132,15 @@ void Drawing::registerBlockId( sal_Int32 nBlockId ) void Drawing::registerOleObject( const OleObjectInfo& rOleObject ) { - OSL_ENSURE( rOleObject.maShapeId.getLength() > 0, "Drawing::registerOleObject - missing OLE object shape id" ); + OSL_ENSURE( !rOleObject.maShapeId.isEmpty(), "Drawing::registerOleObject - missing OLE object shape id" ); OSL_ENSURE( maOleObjects.count( rOleObject.maShapeId ) == 0, "Drawing::registerOleObject - OLE object already registered" ); maOleObjects.insert( OleObjectInfoMap::value_type( rOleObject.maShapeId, rOleObject ) ); } void Drawing::registerControl( const ControlInfo& rControl ) { - OSL_ENSURE( rControl.maShapeId.getLength() > 0, "Drawing::registerControl - missing form control shape id" ); - OSL_ENSURE( rControl.maName.getLength() > 0, "Drawing::registerControl - missing form control name" ); + OSL_ENSURE( !rControl.maShapeId.isEmpty(), "Drawing::registerControl - missing form control shape id" ); + OSL_ENSURE( !rControl.maName.isEmpty(), "Drawing::registerControl - missing form control name" ); OSL_ENSURE( maControls.count( rControl.maShapeId ) == 0, "Drawing::registerControl - form control already registered" ); maControls.insert( ControlInfoMap::value_type( rControl.maShapeId, rControl ) ); } @@ -210,10 +210,10 @@ const ControlInfo* Drawing::getControlInfo( const OUString& rShapeId ) const Reference< XShape > Drawing::createAndInsertXShape( const OUString& rService, const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - OSL_ENSURE( rService.getLength() > 0, "Drawing::createAndInsertXShape - missing UNO shape service name" ); + OSL_ENSURE( !rService.isEmpty(), "Drawing::createAndInsertXShape - missing UNO shape service name" ); OSL_ENSURE( rxShapes.is(), "Drawing::createAndInsertXShape - missing XShapes container" ); Reference< XShape > xShape; - if( (rService.getLength() > 0) && rxShapes.is() ) try + if( !rService.isEmpty() && rxShapes.is() ) try { Reference< XMultiServiceFactory > xModelFactory( mrFilter.getModelFactory(), UNO_SET_THROW ); xShape.set( xModelFactory->createInstance( rService ), UNO_QUERY_THROW ); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 9faeb0463a39..11978299c163 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -81,7 +81,7 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r { orValue1 = rValue.trim(); } - return (orValue1.getLength() > 0) && (orValue2.getLength() > 0); + return !orValue1.isEmpty() && !orValue2.isEmpty(); } /*static*/ bool ConversionHelper::decodeBool( const OUString& rValue ) @@ -93,7 +93,7 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r /*static*/ double ConversionHelper::decodePercent( const OUString& rValue, double fDefValue ) { - if( rValue.getLength() == 0 ) + if( rValue.isEmpty() ) return fDefValue; double fValue = 0.0; @@ -115,7 +115,7 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ) { // default for missing values is 0 - if( rValue.getLength() == 0 ) + if( rValue.isEmpty() ) return 0; // TODO: according to spec, value may contain "auto" @@ -164,7 +164,7 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r { fValue *= nRefValue / 100.0; } - else if( bDefaultAsPixel || (aUnit.getLength() > 0) ) // default as EMU and no unit -> do nothing + else if( bDefaultAsPixel || !aUnit.isEmpty() ) // default as EMU and no unit -> do nothing { OSL_FAIL( "ConversionHelper::decodeMeasureToEmu - unknown measure unit" ); fValue = nRefValue; @@ -552,7 +552,7 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& case XML_tile: case XML_frame: { - if( moBitmapPath.has() && moBitmapPath.get().getLength() > 0 ) + if( moBitmapPath.has() && !moBitmapPath.get().isEmpty() ) { aFillProps.maBlipProps.mxGraphic = rGraphicHelper.importEmbeddedGraphic( moBitmapPath.get() ); if( aFillProps.maBlipProps.mxGraphic.is() ) diff --git a/oox/source/vml/vmlinputstream.cxx b/oox/source/vml/vmlinputstream.cxx index bec1654b2097..80d90309751f 100644 --- a/oox/source/vml/vmlinputstream.cxx +++ b/oox/source/vml/vmlinputstream.cxx @@ -392,7 +392,7 @@ OString InputStream::readToElementBegin() throw (IOException, RuntimeException) OString InputStream::readToElementEnd() throw (IOException, RuntimeException) { OString aText = OUStringToOString( mxTextStrm->readString( maClosingBracket, sal_False ), RTL_TEXTENCODING_ISO_8859_1 ); - OSL_ENSURE( (aText.getLength() > 0) && (aText[ aText.getLength() - 1 ] == '>'), "InputStream::readToElementEnd - missing closing bracket of XML element" ); + OSL_ENSURE( !aText.isEmpty() && (aText[ aText.getLength() - 1 ] == '>'), "InputStream::readToElementEnd - missing closing bracket of XML element" ); return aText; } diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 10bc407625e1..c2fbd65eb4f9 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -258,11 +258,11 @@ void ShapeBase::finalizeFragmentImport() OUString ShapeBase::getShapeName() const { - if( maTypeModel.maShapeName.getLength() > 0 ) + if( !maTypeModel.maShapeName.isEmpty() ) return maTypeModel.maShapeName; OUString aBaseName = mrDrawing.getShapeBaseName( *this ); - if( aBaseName.getLength() > 0 ) + if( !aBaseName.isEmpty() ) { sal_Int32 nShapeIdx = mrDrawing.getLocalShapeIndex( getShapeId() ); if( nShapeIdx > 0 ) @@ -470,7 +470,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes if( xShape.is() ) { // set the replacement graphic - if( aGraphicPath.getLength() > 0 ) + if( !aGraphicPath.isEmpty() ) { Reference< XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath ); if( xGraphic.is() ) @@ -487,11 +487,11 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes // try to find registered form control info const ControlInfo* pControlInfo = mrDrawing.getControlInfo( maTypeModel.maShapeId ); - if( pControlInfo && (pControlInfo->maFragmentPath.getLength() > 0) ) + if( pControlInfo && !pControlInfo->maFragmentPath.isEmpty() ) { OSL_ENSURE( nShapeType == VML_SHAPETYPE_HOSTCONTROL, "ComplexShape::implConvertAndInsert - unexpected shape type" ); OUString aShapeName = getShapeName(); - if( aShapeName.getLength() > 0 ) + if( !aShapeName.isEmpty() ) { OSL_ENSURE( aShapeName == pControlInfo->maName, "ComplexShape::implConvertAndInsert - control name mismatch" ); // load the control properties from fragment @@ -518,13 +518,13 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes } // try to create a picture object - if( aGraphicPath.getLength() > 0 ) + if( !aGraphicPath.isEmpty() ) { Reference< XShape > xShape = mrDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.GraphicObjectShape" ), rxShapes, rShapeRect ); if( xShape.is() ) { OUString aGraphicUrl = rFilter.getGraphicHelper().importEmbeddedGraphicObject( aGraphicPath ); - if( aGraphicUrl.getLength() > 0 ) + if( !aGraphicUrl.isEmpty() ) { PropertySet aPropSet( xShape ); aPropSet.setProperty( PROP_GraphicURL, aGraphicUrl ); diff --git a/oox/source/vml/vmlshapecontainer.cxx b/oox/source/vml/vmlshapecontainer.cxx index e8a8d025c7fd..0309839a9817 100644 --- a/oox/source/vml/vmlshapecontainer.cxx +++ b/oox/source/vml/vmlshapecontainer.cxx @@ -52,8 +52,8 @@ void lclMapShapesById( RefMap< OUString, ShapeType >& orMap, const RefVector< Sh for( typename RefVector< ShapeType >::const_iterator aIt = rVector.begin(), aEnd = rVector.end(); aIt != aEnd; ++aIt ) { const OUString& rShapeId = (*aIt)->getShapeId(); - OSL_ENSURE( rShapeId.getLength() > 0, "lclMapShapesById - missing shape identifier" ); - if( rShapeId.getLength() > 0 ) + OSL_ENSURE( !rShapeId.isEmpty(), "lclMapShapesById - missing shape identifier" ); + if( !rShapeId.isEmpty() ) { OSL_ENSURE( orMap.find( rShapeId ) == orMap.end(), "lclMapShapesById - shape identifier already used" ); orMap[ rShapeId ] = *aIt; diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 6980ce34541c..e0e38ce70264 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -106,7 +106,7 @@ OptValue< DoublePair > lclDecodePercentPair( const AttributeList& rAttribs, sal_ */ bool lclDecodeVmlxBool( const OUString& rValue, bool bDefaultForEmpty ) { - if( rValue.getLength() == 0 ) return bDefaultForEmpty; + if( rValue.isEmpty() ) return bDefaultForEmpty; sal_Int32 nToken = AttributeConversion::decodeToken( rValue ); // anything else than 't' or 'True' is considered to be false, as specified return (nToken == XML_t) || (nToken == XML_True); @@ -134,7 +134,7 @@ ContextHandlerRef ShapeLayoutContext::onCreateContext( sal_Int32 nElement, const while( nIndex >= 0 ) { OUString aToken = aBlockIds.getToken( 0, ' ', nIndex ).trim(); - if( aToken.getLength() > 0 ) + if( !aToken.isEmpty() ) mrDrawing.registerBlockId( aToken.toInt32() ); } } @@ -255,7 +255,7 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& r // shape identifier and shape name bool bHasOspid = rAttribs.hasAttribute( O_TOKEN( spid ) ); mrTypeModel.maShapeId = rAttribs.getXString( bHasOspid ? O_TOKEN( spid ) : XML_id, OUString() ); - OSL_ENSURE( mrTypeModel.maShapeId.getLength() > 0, "ShapeTypeContext::ShapeTypeContext - missing shape identifier" ); + OSL_ENSURE( !mrTypeModel.maShapeId.isEmpty(), "ShapeTypeContext::ShapeTypeContext - missing shape identifier" ); // if the o:spid attribute exists, the id attribute contains the user-defined shape name if( bHasOspid ) mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() ); 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; |