diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-12-06 15:30:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-12-06 17:19:17 +0000 |
commit | 0e1528f1b4cd76804f5df0d75438a6f392a77d1b (patch) | |
tree | 5deeaacfddd2201add5d55ab76f9a44880c1f337 | |
parent | 4ee829af622a2932ffad8f9712e2563579746cf0 (diff) |
just use return value optimization
Change-Id: I2c7937c238d90192383e20923f62233821445c10
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 3 | ||||
-rw-r--r-- | svx/inc/svx/unoapi.hxx | 6 | ||||
-rw-r--r-- | svx/source/accessibility/DescriptionGenerator.cxx | 8 | ||||
-rw-r--r-- | svx/source/tbxctrls/linectrl.cxx | 5 | ||||
-rw-r--r-- | svx/source/unodraw/UnoNameItemTable.cxx | 42 | ||||
-rw-r--r-- | svx/source/unodraw/XPropertyTable.cxx | 30 | ||||
-rw-r--r-- | svx/source/unodraw/unomtabl.cxx | 33 | ||||
-rw-r--r-- | svx/source/unodraw/unoprov.cxx | 20 | ||||
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 8 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 33 | ||||
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 2 |
11 files changed, 73 insertions, 117 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index f27f2b90675c..c57ca80646e1 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -729,10 +729,9 @@ sal_Bool EscherPropertyContainer::GetLineArrow( const sal_Bool bLineStart, aAny, rXPropSet, sLineName, sal_False ) ) { String aArrowStartName = *(::rtl::OUString*)aAny.getValue(); - rtl::OUString aApiName; sal_Int16 nWhich = bLineStart ? XATTR_LINESTART : XATTR_LINEEND; - SvxUnogetApiNameForItem( nWhich, aArrowStartName, aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(nWhich, aArrowStartName); if ( !aApiName.isEmpty() ) { diff --git a/svx/inc/svx/unoapi.hxx b/svx/inc/svx/unoapi.hxx index 159c05231f8f..88708aa95c9c 100644 --- a/svx/inc/svx/unoapi.hxx +++ b/svx/inc/svx/unoapi.hxx @@ -83,12 +83,14 @@ SVX_DLLPUBLIC sal_Bool SvxFieldUnitToMeasureUnit( const short nVcl, short& eApi /** if the given name is a predefined name for the current language it is replaced by the corresponding api name. */ -SVX_DLLPUBLIC void SvxUnogetApiNameForItem( const sal_Int16 nWhich, const String& rInternalName, rtl::OUString& rApiName ) throw(); +SVX_DLLPUBLIC SAL_WARN_UNUSED_RESULT OUString + SvxUnogetApiNameForItem(const sal_Int16 nWhich, const OUString& rInternalName) throw(); /** if the given name is a predefined api name it is replaced by the predefined name for the current language. */ -SVX_DLLPUBLIC void SvxUnogetInternalNameForItem( const sal_Int16 nWhich, const rtl::OUString& rApiName, String& rInternalName ) throw(); +SVX_DLLPUBLIC SAL_WARN_UNUSED_RESULT OUString + SvxUnogetInternalNameForItem(const sal_Int16 nWhich, const OUString& rApiName) throw(); #endif // _SVX_UNOAPI_HXX_ diff --git a/svx/source/accessibility/DescriptionGenerator.cxx b/svx/source/accessibility/DescriptionGenerator.cxx index aee125a4cbdf..3a21d1eb5412 100644 --- a/svx/source/accessibility/DescriptionGenerator.cxx +++ b/svx/source/accessibility/DescriptionGenerator.cxx @@ -52,8 +52,6 @@ using namespace ::rtl; using namespace ::com::sun::star; -void SvxUnogetInternalNameForItem( const sal_Int16 nWhich, const rtl::OUString& rApiName, String& rInternalName ) throw(); - namespace accessibility { @@ -334,9 +332,9 @@ void DescriptionGenerator::AddString (const OUString& sPropertyName, if (nWhichId >= 0) { SolarMutexGuard aGuard; - String sLocalizedValue; - SvxUnogetInternalNameForItem (sal::static_int_cast<sal_Int16>(nWhichId), - sValue, sLocalizedValue); + OUString sLocalizedValue = + SvxUnogetInternalNameForItem(sal::static_int_cast<sal_Int16>(nWhichId), + sValue); msDescription.append (sLocalizedValue); } else diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 60f487e0850f..1827f9408dd3 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -158,9 +158,8 @@ void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState ) { if( pDashItem ) { - String aString; - SvxUnogetInternalNameForItem( - XATTR_LINEDASH, pDashItem->GetName(), aString ); + OUString aString = SvxUnogetInternalNameForItem( + XATTR_LINEDASH, pDashItem->GetName()); pBox->SelectEntry( aString ); } else diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx index e61f26433103..09fa72e774ab 100644 --- a/svx/source/unodraw/UnoNameItemTable.cxx +++ b/svx/source/unodraw/UnoNameItemTable.cxx @@ -110,8 +110,7 @@ void SAL_CALL SvxUnoNameItemTable::insertByName( const OUString& aApiName, const if( hasByName( aApiName ) ) throw container::ElementExistException(); - String aName; - SvxUnogetInternalNameForItem( mnWhich, aApiName, aName ); + OUString aName = SvxUnogetInternalNameForItem(mnWhich, aApiName); ImplInsertByName( aName, aElement ); } @@ -131,19 +130,17 @@ void SAL_CALL SvxUnoNameItemTable::removeByName( const OUString& aApiName ) return; } - String Name; - SvxUnogetInternalNameForItem( mnWhich, aApiName, Name ); + OUString sName = SvxUnogetInternalNameForItem(mnWhich, aApiName); ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); NameOrIndex *pItem; - const String aSearchName( Name ); while( aIter != aEnd ) { pItem = (NameOrIndex *)&((*aIter)->Get( mnWhich ) ); - if( pItem->GetName() == aSearchName ) + if (sName.equals(pItem->GetName())) { delete (*aIter); maItemSetVector.erase( aIter ); @@ -152,7 +149,7 @@ void SAL_CALL SvxUnoNameItemTable::removeByName( const OUString& aApiName ) ++aIter; } - if( !hasByName( Name ) ) + if (!hasByName(sName)) throw container::NoSuchElementException(); } @@ -162,22 +159,20 @@ void SAL_CALL SvxUnoNameItemTable::replaceByName( const OUString& aApiName, cons { SolarMutexGuard aGuard; - String aName; - SvxUnogetInternalNameForItem( mnWhich, aApiName, aName ); + OUString aName = SvxUnogetInternalNameForItem(mnWhich, aApiName); ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); NameOrIndex *pItem; - const String aSearchName( aName ); while( aIter != aEnd ) { pItem = (NameOrIndex *)&((*aIter)->Get( mnWhich ) ); - if( pItem->GetName() == aSearchName ) + if (aName.equals(pItem->GetName())) { NameOrIndex* pNewItem = createItem(); - pNewItem->SetName( aSearchName ); + pNewItem->SetName(aName); if( !pNewItem->PutValue( aElement, mnMemberId ) || !isValid( pNewItem ) ) throw lang::IllegalArgumentException(); @@ -195,7 +190,7 @@ void SAL_CALL SvxUnoNameItemTable::replaceByName( const OUString& aApiName, cons for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate); - if( pItem && pItem->GetName() == aSearchName ) + if (pItem && aName.equals(pItem->GetName())) { pItem->PutValue( aElement, mnMemberId ); bFound = sal_True; @@ -218,14 +213,12 @@ uno::Any SAL_CALL SvxUnoNameItemTable::getByName( const OUString& aApiName ) { SolarMutexGuard aGuard; - String aName; - SvxUnogetInternalNameForItem( mnWhich, aApiName, aName ); + OUString aName = SvxUnogetInternalNameForItem(mnWhich, aApiName); uno::Any aAny; - if( mpModelPool && aName.Len() != 0 ) + if (mpModelPool && !aName.isEmpty()) { - const String aSearchName( aName ); NameOrIndex *pItem; sal_uInt32 nSurrogate; @@ -234,7 +227,7 @@ uno::Any SAL_CALL SvxUnoNameItemTable::getByName( const OUString& aApiName ) { pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); - if( isValid( pItem ) && (pItem->GetName() == aSearchName) ) + if (isValid(pItem) && aName.equals(pItem->GetName())) { pItem->QueryValue( aAny, mnMemberId ); return aAny; @@ -253,7 +246,6 @@ uno::Sequence< OUString > SAL_CALL SvxUnoNameItemTable::getElementNames( ) std::set< OUString, comphelper::UStringLess > aNameSet; NameOrIndex *pItem; - OUString aApiName; const sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; sal_uInt32 nSurrogate; @@ -264,8 +256,8 @@ uno::Sequence< OUString > SAL_CALL SvxUnoNameItemTable::getElementNames( ) if( !isValid( pItem ) ) continue; - SvxUnogetApiNameForItem( mnWhich, pItem->GetName(), aApiName ); - aNameSet.insert( aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(mnWhich, pItem->GetName()); + aNameSet.insert(aApiName); } uno::Sequence< OUString > aSeq( aNameSet.size() ); @@ -287,13 +279,11 @@ sal_Bool SAL_CALL SvxUnoNameItemTable::hasByName( const OUString& aApiName ) { SolarMutexGuard aGuard; - String aName; - SvxUnogetInternalNameForItem( mnWhich, aApiName, aName ); + OUString aName = SvxUnogetInternalNameForItem(mnWhich, aApiName); - if( aName.Len() == 0 ) + if (aName.isEmpty()) return sal_False; - const String aSearchName( aName ); sal_uInt32 nSurrogate; const NameOrIndex *pItem; @@ -302,7 +292,7 @@ sal_Bool SAL_CALL SvxUnoNameItemTable::hasByName( const OUString& aApiName ) for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); - if( isValid( pItem ) && (pItem->GetName() == aSearchName) ) + if (isValid(pItem) && aName.equals(pItem->GetName())) return sal_True; } diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index 9675121c14c1..d64271462faf 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -121,8 +121,7 @@ void SAL_CALL SvxUnoXPropertyTable::insertByName( const OUString& aName, const if( hasByName( aName ) ) throw container::ElementExistException(); - String aInternalName; - SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName ); + OUString aInternalName = SvxUnogetInternalNameForItem(mnWhich, aName); XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement ); if( NULL == pNewEntry ) @@ -137,8 +136,7 @@ void SAL_CALL SvxUnoXPropertyTable::removeByName( const OUString& Name ) { SolarMutexGuard aGuard; - String aInternalName; - SvxUnogetInternalNameForItem( mnWhich, Name, aInternalName ); + OUString aInternalName = SvxUnogetInternalNameForItem(mnWhich, Name); const long nCount = getCount(); long i; @@ -146,7 +144,7 @@ void SAL_CALL SvxUnoXPropertyTable::removeByName( const OUString& Name ) for( i = 0; i < nCount; i++ ) { pEntry = get( i ); - if( pEntry && pEntry->GetName() == aInternalName ) + if (pEntry && aInternalName.equals(pEntry->GetName())) { if( mpList ) delete mpList->Remove( i ); @@ -163,8 +161,7 @@ void SAL_CALL SvxUnoXPropertyTable::replaceByName( const OUString& aName, const { SolarMutexGuard aGuard; - String aInternalName; - SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName ); + OUString aInternalName = SvxUnogetInternalNameForItem(mnWhich, aName); const long nCount = getCount(); long i; @@ -172,7 +169,7 @@ void SAL_CALL SvxUnoXPropertyTable::replaceByName( const OUString& aName, const for( i = 0; i < nCount; i++ ) { pEntry = get( i ); - if( pEntry && pEntry->GetName() == aInternalName ) + if (pEntry && aInternalName.equals(pEntry->GetName())) { XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement ); if( NULL == pNewEntry ) @@ -193,8 +190,7 @@ uno::Any SAL_CALL SvxUnoXPropertyTable::getByName( const OUString& aName ) { SolarMutexGuard aGuard; - String aInternalName; - SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName ); + OUString aInternalName = SvxUnogetInternalNameForItem(mnWhich, aName); const long nCount = getCount(); long i; @@ -203,7 +199,7 @@ uno::Any SAL_CALL SvxUnoXPropertyTable::getByName( const OUString& aName ) { pEntry = get( i ); - if( pEntry && pEntry->GetName() == aInternalName ) + if (pEntry && aInternalName.equals(pEntry->GetName())) return getAny( pEntry ); } @@ -224,11 +220,8 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXPropertyTable::getElementNames() { pEntry = get( i ); - if( pEntry ) - { - SvxUnogetApiNameForItem( mnWhich, pEntry->GetName(), *pNames ); - pNames++; - } + if (pEntry) + *pNames++ = SvxUnogetApiNameForItem(mnWhich, pEntry->GetName()); } return aNames; @@ -239,8 +232,7 @@ sal_Bool SAL_CALL SvxUnoXPropertyTable::hasByName( const OUString& aName ) { SolarMutexGuard aGuard; - String aInternalName; - SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName ); + OUString aInternalName = SvxUnogetInternalNameForItem(mnWhich, aName); const long nCount = mpList?mpList->Count():0; long i; @@ -248,7 +240,7 @@ sal_Bool SAL_CALL SvxUnoXPropertyTable::hasByName( const OUString& aName ) for( i = 0; i < nCount; i++ ) { pEntry = get( i ); - if( pEntry && pEntry->GetName() == aInternalName ) + if (pEntry && aInternalName.equals(pEntry->GetName())) return sal_True; } diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx index fba6aa98c114..ce70254b0303 100644 --- a/svx/source/unodraw/unomtabl.cxx +++ b/svx/source/unodraw/unomtabl.cxx @@ -181,8 +181,7 @@ void SAL_CALL SvxUnoMarkerTable::insertByName( const OUString& aApiName, const u if( hasByName( aApiName ) ) throw container::ElementExistException(); - String aName; - SvxUnogetInternalNameForItem( XATTR_LINEEND, aApiName, aName ); + OUString aName = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName); ImplInsertByName( aName, aElement ); } @@ -200,8 +199,7 @@ void SAL_CALL SvxUnoMarkerTable::removeByName( const OUString& aApiName ) return; } - String Name; - SvxUnogetInternalNameForItem( XATTR_LINEEND, aApiName, Name ); + OUString Name = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName); ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); @@ -231,8 +229,7 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const { SolarMutexGuard aGuard; - String aName; - SvxUnogetInternalNameForItem( XATTR_LINEEND, aApiName, aName ); + OUString aName = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName); ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); @@ -320,20 +317,18 @@ uno::Any SAL_CALL SvxUnoMarkerTable::getByName( const OUString& aApiName ) { SolarMutexGuard aGuard; - String aName; - SvxUnogetInternalNameForItem( XATTR_LINEEND, aApiName, aName ); + OUString aName = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName); uno::Any aAny; - if( mpModelPool && aName.Len() != 0 ) + if (mpModelPool && !aName.isEmpty()) { do { - const String aSearchName( aName ); - if( getByNameFromPool( aSearchName, mpModelPool, XATTR_LINESTART, aAny ) ) + if (getByNameFromPool(aName, mpModelPool, XATTR_LINESTART, aAny)) break; - if( getByNameFromPool( aSearchName, mpModelPool, XATTR_LINEEND, aAny ) ) + if (getByNameFromPool(aName, mpModelPool, XATTR_LINEEND, aAny)) break; throw container::NoSuchElementException(); @@ -347,19 +342,15 @@ uno::Any SAL_CALL SvxUnoMarkerTable::getByName( const OUString& aApiName ) static void createNamesForPool( SfxItemPool* pPool, sal_uInt16 nWhich, std::set< OUString, comphelper::UStringLess >& rNameSet ) { const sal_uInt32 nSuroCount = pPool->GetItemCount2( nWhich ); - sal_uInt32 nSurrogate; - - NameOrIndex* pItem; - OUString aName; - for( nSurrogate = 0; nSurrogate < nSuroCount; nSurrogate++ ) + for(sal_uInt32 nSurrogate = 0; nSurrogate < nSuroCount; ++nSurrogate) { - pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate ); + NameOrIndex* pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate ); if( pItem == NULL || pItem->GetName().Len() == 0 ) continue; - SvxUnogetApiNameForItem( XATTR_LINEEND, pItem->GetName(), aName ); + OUString aName = SvxUnogetApiNameForItem(XATTR_LINEEND, pItem->GetName()); rNameSet.insert( aName ); } } @@ -403,7 +394,7 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasByName( const OUString& aName ) NameOrIndex *pItem; - SvxUnogetInternalNameForItem( XATTR_LINESTART, aName, aSearchName ); + aSearchName = SvxUnogetInternalNameForItem(XATTR_LINESTART, aName); sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0; sal_uInt32 nSurrogate; for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ ) @@ -413,7 +404,7 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasByName( const OUString& aName ) return sal_True; } - SvxUnogetInternalNameForItem( XATTR_LINEEND, aName, aSearchName ); + aSearchName = SvxUnogetInternalNameForItem(XATTR_LINEEND, aName); sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0; for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ ) { diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index c6d4f584c28c..4e06a8057bb5 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -1327,7 +1327,7 @@ bool SvxUnoConvertResourceString( sal_uInt16* pSourceResIds, sal_uInt16* pDestRe /** if the given name is a predefined name for the current language it is replaced by the corresponding api name. */ -void SvxUnogetApiNameForItem( const sal_Int16 nWhich, const String& rInternalName, rtl::OUString& rApiName ) throw() +OUString SvxUnogetApiNameForItem(const sal_Int16 nWhich, const OUString& rInternalName) throw() { String aNew = rInternalName; @@ -1335,8 +1335,7 @@ void SvxUnogetApiNameForItem( const sal_Int16 nWhich, const String& rInternalNam { if( SvxUnoConvertResourceString( (sal_uInt16*)SvxUnoColorNameResId, (sal_uInt16*)SvxUnoColorNameDefResId, sizeof( SvxUnoColorNameResId ) / sizeof( sal_uInt16 ), aNew ) ) { - rApiName = aNew; - return; + return aNew; } } else @@ -1349,20 +1348,19 @@ void SvxUnogetApiNameForItem( const sal_Int16 nWhich, const String& rInternalNam { if(SvxUnoConvertResourceString( nIntResIds, nApiResIds, nCount, aNew ) ) { - rApiName = aNew; - return; + return aNew; } } } // just use previous name, if nothing else was found. - rApiName = rInternalName; + return rInternalName; } /** if the given name is a predefined api name it is replaced by the predefined name for the current language. */ -void SvxUnogetInternalNameForItem( const sal_Int16 nWhich, const rtl::OUString& rApiName, String& rInternalName ) throw() +OUString SvxUnogetInternalNameForItem(const sal_Int16 nWhich, const rtl::OUString& rApiName) throw() { String aNew = rApiName; @@ -1370,8 +1368,7 @@ void SvxUnogetInternalNameForItem( const sal_Int16 nWhich, const rtl::OUString& { if( SvxUnoConvertResourceString( (sal_uInt16*)SvxUnoColorNameDefResId, (sal_uInt16*)SvxUnoColorNameResId, sizeof( SvxUnoColorNameResId ) / sizeof( sal_uInt16 ), aNew ) ) { - rInternalName = aNew; - return; + return aNew; } } else @@ -1384,14 +1381,13 @@ void SvxUnogetInternalNameForItem( const sal_Int16 nWhich, const rtl::OUString& { if(SvxUnoConvertResourceString( nApiResIds, nIntResIds, nCount, aNew ) ) { - rInternalName = aNew; - return; + return aNew; } } } // just use previous name, if nothing else was found. - rInternalName = rApiName; + return rApiName; } /////////////////////////////////////////////////////////////////////// diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 511b94167118..6ba0969082ef 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1486,8 +1486,7 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUStr // we did not find such item in one of the pools, so we check // the property lists that are loaded for the model for items // that support such. - String aStrName; - SvxUnogetInternalNameForItem( (sal_Int16)nWID, rName, aStrName ); + OUString aStrName = SvxUnogetInternalNameForItem((sal_Int16)nWID, rName); switch( nWID ) { @@ -1611,10 +1610,9 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUStr sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName, SfxItemSet& rSet ) { - String aName; - SvxUnogetInternalNameForItem( (sal_Int16)nWID, rName, aName ); + OUString aName = SvxUnogetInternalNameForItem((sal_Int16)nWID, rName); - if( aName.Len() == 0 ) + if (aName.isEmpty()) { switch( nWID ) { diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index b36d05d9bd09..ce3f1de6c077 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -188,13 +188,12 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn { sal_Bool bForceNew = sal_False; - String aUniqueName; - SvxUnogetInternalNameForItem( nWhich, pCheckItem->GetName(), aUniqueName ); + OUString aUniqueName = SvxUnogetInternalNameForItem(nWhich, pCheckItem->GetName()); // 2. if we have a name check if there is already an item with the // same name in the documents pool with a different line end or start - if( aUniqueName.Len() && pPool1 ) + if (!aUniqueName.isEmpty() && pPool1) { const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich ); @@ -220,7 +219,7 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn // if we have no name yet, find existing item with same conent or // create a unique name - if( aUniqueName.Len() == 0 ) + if (aUniqueName.isEmpty()) { sal_Int32 nUserIndex = 1; const ResId aRes(SVX_RES(nPrefixResId)); @@ -276,7 +275,7 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn } } - if( (aUniqueName.Len() == 0) && pPool1 ) + if (aUniqueName.isEmpty() && pPool1) { const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich ); const NameOrIndex *pItem; @@ -989,8 +988,7 @@ bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMem aLineDash.DashLen = rXD.GetDashLen(); aLineDash.Distance = rXD.GetDistance(); - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName()); aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" )); aPropSeq[0].Value = uno::makeAny( aApiName ); aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineDash" )); @@ -1001,8 +999,7 @@ bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMem case MID_NAME: { - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName()); rVal <<= aApiName; break; } @@ -1696,8 +1693,7 @@ bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMe nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName()); rVal <<= aApiName; } else @@ -2344,8 +2340,7 @@ bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemb nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName()); rVal <<= aApiName; } else @@ -3370,8 +3365,7 @@ bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 aGradient2.EndIntensity = aXGradient.GetEndIntens(); aGradient2.StepCount = aXGradient.GetSteps(); - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName()); aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" )); aPropSeq[0].Value = uno::makeAny( aApiName ); aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" )); @@ -3402,8 +3396,7 @@ bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 case MID_NAME: { - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName()); rVal <<= aApiName; break; } @@ -3960,8 +3953,7 @@ bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMe aUnoHatch.Distance = aHatch.GetDistance(); aUnoHatch.Angle = aHatch.GetAngle(); - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName()); aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" )); aPropSeq[0].Value = uno::makeAny( aApiName ); aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" )); @@ -3984,8 +3976,7 @@ bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMe case MID_NAME: { - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName()); rVal <<= aApiName; break; } diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 6f6fe947363a..8b8a34dc5ea6 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -617,7 +617,7 @@ bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nM if( nMemberId == MID_NAME ) { - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + aApiName = SvxUnogetApiNameForItem(Which(), GetName()); } else if( nMemberId == 0 ) { |