Hi!
Partial fix for Easy Hack FDO43460 (part XIV) for review. Mentoring by
Olivier Hallot (thanks for the tips Olivier!).
Part XVI
Modules drawinglayer, dtrans and editeng
Best regards
Gustavo Pacheco.
From cc89c387a1f9a1e1f338b33819b0c32d91f6cd2e Mon Sep 17 00:00:00 2001
From: Gustavo Buzzatti Pacheco <gbpacheco@gmail.com>
Date: Fri, 23 Dec 2011 10:25:18 -0200
Subject: [PATCH]
Fix for fdo43460 Part XIV getLength() to isEmpty()
Part XIV
Modules
drawinglayer, dtrans, editeng
---
.../source/primitive2d/controlprimitive2d.cxx | 2 +-
dtrans/source/cnttype/mcnttype.cxx | 18 +++++++++---------
dtrans/source/test/test_dtrans.cxx | 2 +-
editeng/source/editeng/editview.cxx | 4 ++--
editeng/source/editeng/impedit2.cxx | 2 +-
editeng/source/editeng/impedit4.cxx | 2 +-
editeng/source/editeng/textconv.cxx | 2 +-
editeng/source/items/frmitems.cxx | 4 ++--
editeng/source/items/textitem.cxx | 6 +++---
editeng/source/items/xmlcnitm.cxx | 2 +-
editeng/source/misc/hangulhanja.cxx | 8 ++++----
editeng/source/misc/unolingu.cxx | 8 ++++----
editeng/source/rtf/rtfgrf.cxx | 2 +-
editeng/source/uno/unofield.cxx | 4 ++--
editeng/source/uno/unonrule.cxx | 2 +-
15 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 178e170..3d7f8d1 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -69,7 +69,7 @@ namespace drawinglayer
if(aValue >>= aUnoControlTypeName)
{
- if(aUnoControlTypeName.getLength())
+ if(!aUnoControlTypeName.isEmpty())
{
uno::Reference< lang::XMultiServiceFactory > xFactory(
comphelper::getProcessServiceFactory() );
diff --git a/dtrans/source/cnttype/mcnttype.cxx b/dtrans/source/cnttype/mcnttype.cxx
index 66d7376..52fdbe6 100644
--- a/dtrans/source/cnttype/mcnttype.cxx
+++ b/dtrans/source/cnttype/mcnttype.cxx
@@ -140,7 +140,7 @@ OUString SAL_CALL CMimeContentType::getParameterValue( const OUString& aName ) t
void SAL_CALL CMimeContentType::init( const OUString& aCntType ) throw( IllegalArgumentException )
{
- if ( !aCntType.getLength( ) )
+ if ( aCntType.isEmpty( ) )
throw IllegalArgumentException( );
m_nPos = 0;
@@ -200,7 +200,7 @@ void SAL_CALL CMimeContentType::type( void )
throw IllegalArgumentException( );
// parse
- while( m_nxtSym.getLength( ) )
+ while( !m_nxtSym.isEmpty( ) )
{
if ( isInRange( m_nxtSym, TOKEN ) )
m_MediaType += m_nxtSym;
@@ -230,7 +230,7 @@ void SAL_CALL CMimeContentType::subtype( void )
if ( !isInRange( m_nxtSym, TOKEN ) )
throw IllegalArgumentException( );
- while( m_nxtSym.getLength( ) )
+ while( !m_nxtSym.isEmpty( ) )
{
if ( isInRange( m_nxtSym, TOKEN ) )
m_MediaSubtype += m_nxtSym;
@@ -252,7 +252,7 @@ void SAL_CALL CMimeContentType::subtype( void )
void SAL_CALL CMimeContentType::trailer( void )
{
- while( m_nxtSym.getLength( ) )
+ while( !m_nxtSym.isEmpty( ) )
{
if ( m_nxtSym == OUString(RTL_CONSTASCII_USTRINGPARAM("(")) )
{
@@ -298,7 +298,7 @@ OUString SAL_CALL CMimeContentType::pName( )
{
OUString pname;
- while( m_nxtSym.getLength( ) )
+ while( !m_nxtSym.isEmpty( ) )
{
if ( isInRange( m_nxtSym, TOKEN ) )
pname += m_nxtSym;
@@ -332,7 +332,7 @@ OUString SAL_CALL CMimeContentType::pValue( )
// remove the last quote-sign
pvalue = pvalue.copy(0, pvalue.getLength() - 1);
- if ( !pvalue.getLength( ) )
+ if ( pvalue.isEmpty( ) )
throw IllegalArgumentException( );
}
else if ( isInRange( m_nxtSym, TOKEN ) ) // unquoted pvalue
@@ -356,7 +356,7 @@ OUString SAL_CALL CMimeContentType::quotedPValue( )
OUString pvalue;
sal_Bool bAfterQuoteSign = sal_False;
- while ( m_nxtSym.getLength( ) )
+ while ( !m_nxtSym.isEmpty( ) )
{
if ( bAfterQuoteSign && ((m_nxtSym == SPACE)||(m_nxtSym == SEMICOLON) ) )
break;
@@ -384,7 +384,7 @@ OUString SAL_CALL CMimeContentType::nonquotedPValue( )
{
OUString pvalue;
- while ( m_nxtSym.getLength( ) )
+ while ( !m_nxtSym.isEmpty( ) )
{
if ( isInRange( m_nxtSym, TOKEN ) )
pvalue += m_nxtSym;
@@ -404,7 +404,7 @@ OUString SAL_CALL CMimeContentType::nonquotedPValue( )
void SAL_CALL CMimeContentType::comment( void )
{
- while ( m_nxtSym.getLength( ) )
+ while ( !m_nxtSym.isEmpty( ) )
{
if ( isInRange( m_nxtSym, TOKEN + SPACE ) )
getSym( );
diff --git a/dtrans/source/test/test_dtrans.cxx b/dtrans/source/test/test_dtrans.cxx
index 802236d..4b53d8d 100644
--- a/dtrans/source/test/test_dtrans.cxx
+++ b/dtrans/source/test/test_dtrans.cxx
@@ -337,7 +337,7 @@ int SAL_CALL main( int argc, const char* argv[] )
}
}
- if( aRegistry.getLength() == 0 )
+ if( aRegistry.isEmpty( ) )
fprintf( stderr, "Usage: %s -r full-path-to-applicat.rdb\n", app );
//------------------------------------------------------------------
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index ada459e..ee9f749 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -105,7 +105,7 @@ LanguageType lcl_CheckLanguage(
// if the result from language guessing does not provide a 'Country' part
// try to get it by looking up the locale setting of the office.
- if (aLocale.Country.getLength() == 0)
+ if ( aLocale.Country.isEmpty( ) )
{
lang::Locale aTmpLocale = SvxCreateLocale( nTmpLang );
if (aTmpLocale.Language == aLocale.Language)
@@ -1056,7 +1056,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
{
OUString aDictionaryImageUrl(
aCfg.GetSpellAndGrammarContextDictionaryImage(
xSvcInfo->getImplementationName()) );
- if (aDictionaryImageUrl.getLength() > 0)
+ if (!aDictionaryImageUrl.isEmpty() )
{
Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) );
pInsertMenu->SetItemImage( nPos, aImage );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 0e326ca..674491e 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1689,7 +1689,7 @@ void ImpEditEngine::InitScriptTypes( sal_uInt16 nPara )
while ( pField )
{
::rtl::OUString aFldText( ((EditCharAttribField*)pField)->GetFieldValue() );
- if ( aFldText.getLength() )
+ if ( !aFldText.isEmpty() )
{
aText.SetChar( pField->GetStart(), aFldText.getStr()[0] );
short nFldScriptType = _xBI->getScriptType( aFldText, 0 );
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index ff441f1..6bdbba6 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1796,7 +1796,7 @@ void ImpEditEngine::ImpConvert( rtl::OUString &rConvTxt, LanguageType
&rConvTxtL
pEditView->ShowCursor( sal_True, sal_False );
rConvTxt = aRes;
- if (rConvTxt.getLength())
+ if ( !rConvTxt.isEmpty() )
rConvTxtLang = nResLang;
}
diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx
index 81f85a5..a8f46c0 100644
--- a/editeng/source/editeng/textconv.cxx
+++ b/editeng/source/editeng/textconv.cxx
@@ -252,7 +252,7 @@ sal_Bool TextConvWrapper::ConvContinue_impl()
pEditView->GetImpEditEngine()->ImpConvert( aConvText, nConvTextLang,
pEditView, GetSourceLanguage(), aConvSel,
bAllowChange, GetTargetLanguage(), GetTargetFont() );
- return aConvText.getLength() != 0;
+ return !aConvText.isEmpty();
}
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index addb3f6..84c4303 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3649,9 +3649,9 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
SetGraphicLink(sLink);
}
- if ( sLink.getLength() && eGraphicPos == GPOS_NONE )
+ if ( !sLink.isEmpty() && eGraphicPos == GPOS_NONE )
eGraphicPos = GPOS_MM;
- else if( !sLink.getLength() )
+ else if( sLink.isEmpty() )
eGraphicPos = GPOS_NONE;
}
}
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 4f5dc8d..66332ae 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -2653,7 +2653,7 @@ bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(!(rVal >>= aLocale))
return sal_False;
- if (aLocale.Language.getLength() || aLocale.Country.getLength())
+ if (!(aLocale.Language.isEmpty() || aLocale.Country.isEmpty()))
SetValue(MsLangId::convertLocaleToLanguage( aLocale ));
else
SetValue(LANGUAGE_NONE);
@@ -3078,14 +3078,14 @@ bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal,
case MID_START_BRACKET:
if( rVal >>= s )
{
- cStartBracket = s.getLength() ? s[ 0 ] : 0;
+ cStartBracket = s.isEmpty() ? 0 : s[ 0 ];
bRet = sal_True;
}
break;
case MID_END_BRACKET:
if( rVal >>= s )
{
- cEndBracket = s.getLength() ? s[ 0 ] : 0;
+ cEndBracket = s.isEmpty() ? 0 : s[ 0 ];
bRet = sal_True;
}
break;
diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx
index b7c91f9..15b4dff 100644
--- a/editeng/source/items/xmlcnitm.cxx
+++ b/editeng/source/items/xmlcnitm.cxx
@@ -147,7 +147,7 @@ bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, sal
const ::rtl::OUString aPrefix( aName.copy( 0, pos ));
const ::rtl::OUString aLName( aName.copy( pos+1 ));
- if( pData->Namespace.getLength() == 0 )
+ if( pData->Namespace.isEmpty() )
{
if( !pNewImpl->AddAttr( aPrefix, aLName, pData->Value ) )
break;
diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx
index 1c7a809..6e0eb21 100644
--- a/editeng/source/misc/hangulhanja.cxx
+++ b/editeng/source/misc/hangulhanja.cxx
@@ -496,7 +496,7 @@ namespace editeng
m_nReplacementBaseIndex = 0;
m_nCurrentStartIndex = m_nCurrentEndIndex = 0;
- bool bRet = 0 != m_sCurrentPortion.getLength();
+ bool bRet = !m_sCurrentPortion.isEmpty();
if (m_eConvType == HHC::eConvHangulHanja && m_bTryBothDirections)
implGetConversionDirectionForCurrentPortion( m_eCurrentConversionDirection );
@@ -528,7 +528,7 @@ namespace editeng
return sal_True;
}
}
- while ( m_sCurrentPortion.getLength() );
+ while ( !m_sCurrentPortion.isEmpty() );
// no more portions
return sal_False;
@@ -730,7 +730,7 @@ namespace editeng
void HangulHanjaConversion_Impl::implChange( const ::rtl::OUString& _rChangeInto )
{
- if( !_rChangeInto.getLength() )
+ if( _rChangeInto.isEmpty() )
return;
// translate the conversion format into a replacement action
@@ -900,7 +900,7 @@ namespace editeng
::rtl::OUString sCurrentUnit( m_pConversionDialog->GetCurrentString() );
::rtl::OUString sChangeInto( m_pConversionDialog->GetCurrentSuggestion( ) );
- if( sChangeInto.getLength() )
+ if( !sChangeInto.isEmpty() )
{
// change the current occurrence
implChange( sChangeInto );
diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
index ba14ec5..d95a54b 100644
--- a/editeng/source/misc/unolingu.cxx
+++ b/editeng/source/misc/unolingu.cxx
@@ -116,7 +116,7 @@ Sequence< OUString > lcl_RemoveMissingEntries(
const OUString *pEntry = rCfgSvcs.getConstArray();
for (sal_Int32 i = 0; i < nEntries; ++i)
{
- if (pEntry[i].getLength() && lcl_FindEntry( pEntry[i], rAvailSvcs ))
+ if (!pEntry[i].isEmpty() && lcl_FindEntry( pEntry[i], rAvailSvcs ))
pRes[ nCnt++ ] = pEntry[i];
}
@@ -175,7 +175,7 @@ Sequence< OUString > lcl_GetNewEntries(
const OUString *pEntry = rAvailSvcs.getConstArray();
for (sal_Int32 i = 0; i < nLen; ++i)
{
- if (pEntry[i].getLength() && !lcl_FindEntry( pEntry[i], rLastFoundSvcs ))
+ if (!pEntry[i].isEmpty() && !lcl_FindEntry( pEntry[i], rLastFoundSvcs ))
pRes[ nCnt++ ] = pEntry[i];
}
@@ -202,7 +202,7 @@ Sequence< OUString > lcl_MergeSeq(
const OUString *pEntry = rSeq.getConstArray();
for (sal_Int32 i = 0; i < nLen; ++i)
{
- if (pEntry[i].getLength() && !lcl_FindEntry( pEntry[i], aRes ))
+ if (!pEntry[i].isEmpty() && !lcl_FindEntry( pEntry[i], aRes ))
pRes[ nCnt++ ] = pEntry[i];
}
}
@@ -1272,7 +1272,7 @@ short SvxDicError( Window *pParent, sal_Int16 nError )
LanguageType SvxLocaleToLanguage( const Locale& rLocale )
{
- if ( rLocale.Language.getLength() == 0 )
+ if ( rLocale.Language.isEmpty() )
return LANGUAGE_NONE;
return MsLangId::convertLocaleToLanguage( rLocale );
diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx
index b4d5c87..0434bf7 100644
--- a/editeng/source/rtf/rtfgrf.cxx
+++ b/editeng/source/rtf/rtfgrf.cxx
@@ -297,7 +297,7 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
if( nShapePropertyBracket > 0 && nShapePropertyBracket > _nOpenBrakets )
{
nShapePropertyBracket = -1;
- if( sShapePropertyName.getLength() )
+ if( !sShapePropertyName.isEmpty() )
{
rPicType.aPropertyPairs.push_back( ::std::pair< OUString, OUString >(
sShapePropertyName, sShapePropertyValue ) );
sShapePropertyName = sShapePropertyValue = ::rtl::OUString();
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 1f3cee7..1798b07 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -434,7 +434,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
break;
case ID_URLFIELD:
- pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1,
mpImpl->msString1.getLength() ? SVXURLFORMAT_REPR : SVXURLFORMAT_URL );
+ pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1,
!mpImpl->msString1.isEmpty() ? SVXURLFORMAT_REPR : SVXURLFORMAT_URL );
((SvxURLField*)pData)->SetTargetFrame( mpImpl->msString2 );
if( mpImpl->mnInt16 >= SVXURLFORMAT_APPDEFAULT && mpImpl->mnInt16 <= SVXURLFORMAT_REPR )
((SvxURLField*)pData)->SetFormat( (SvxURLFormat)mpImpl->mnInt16 );
@@ -476,7 +476,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
// mimic behaviour of writer, which means:
// prefer CurrentPresentation over Content
// if both are given.
- if( mpImpl->msString1.getLength() )
+ if( !mpImpl->msString1.isEmpty() )
aContent = mpImpl->msString1;
else
aContent = mpImpl->msString2;
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index a0f9771..fa5275f 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -350,7 +350,7 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex( const Sequence< beans::Prope
OUString aStr;
if( aVal >>= aStr )
{
- if(aStr.getLength())
+ if(!aStr.isEmpty())
{
aFmt.SetBulletChar(aStr[0]);
}
--
1.7.7
Context
- [Libreoffice] [PATCH] Fix for fdo43460 Part XIV getLength() to isEmpty() · Gustavo Pacheco
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.