convert include/svx/xit.hxx from String to OUString

Change-Id: Ib5ba87a934fbe9220427145eb54e3de3c49b03ad
This commit is contained in:
Noel Grandin
2013-08-29 16:28:00 +02:00
parent 10407bdad8
commit c8375ca155
7 changed files with 32 additions and 32 deletions

View File

@@ -47,7 +47,7 @@ public:
NameOrIndex() { nPalIndex = -1; } NameOrIndex() { nPalIndex = -1; }
NameOrIndex(sal_uInt16 nWhich, sal_Int32 nIndex); NameOrIndex(sal_uInt16 nWhich, sal_Int32 nIndex);
NameOrIndex(sal_uInt16 nWhich, NameOrIndex(sal_uInt16 nWhich,
const String& rName= String()); const OUString& rName = OUString());
NameOrIndex(sal_uInt16 nWhich, SvStream& rIn); NameOrIndex(sal_uInt16 nWhich, SvStream& rIn);
NameOrIndex(const NameOrIndex& rNameOrIndex); NameOrIndex(const NameOrIndex& rNameOrIndex);
~NameOrIndex() {}; ~NameOrIndex() {};
@@ -57,18 +57,18 @@ public:
virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const; virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const; virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
String GetName() const { return GetValue(); } OUString GetName() const { return GetValue(); }
void SetName(const String& rName) { SetValue(rName); } void SetName(const OUString& rName) { SetValue(rName); }
sal_Int32 GetIndex() const { return nPalIndex; } sal_Int32 GetIndex() const { return nPalIndex; }
void SetIndex(sal_Int32 nIndex) { nPalIndex = nIndex; } void SetIndex(sal_Int32 nIndex) { nPalIndex = nIndex; }
sal_Bool IsIndex() const { return (nPalIndex >= 0); } sal_Bool IsIndex() const { return (nPalIndex >= 0); }
/** this static checks if the given NameOrIndex item has a unique name for its value. /** this static checks if the given NameOrIndex item has a unique name for its value.
The returned String is a unique name for an item with this value in both given pools. The returned String is a unique name for an item with this value in both given pools.
Argument pPool2 can be null. Argument pPool2 can be null.
If returned string equals NameOrIndex->GetName(), the name was already unique. If returned string equals NameOrIndex->GetName(), the name was already unique.
*/ */
static String CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* pPool2, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, const XPropertyListRef &pDefaults ); static OUString CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* pPool2, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, const XPropertyListRef &pDefaults );
}; };
#endif #endif

View File

@@ -1281,7 +1281,7 @@ PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyN
case XATTR_LINEDASH: case XATTR_LINEDASH:
{ {
NameOrIndex* pItem = (NameOrIndex*)rStyleSet.GetItem((sal_uInt16)pEntry->nWID); NameOrIndex* pItem = (NameOrIndex*)rStyleSet.GetItem((sal_uInt16)pEntry->nWID);
if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) ) if( ( pItem == NULL ) || pItem->GetName().isEmpty() )
eState = PropertyState_DEFAULT_VALUE; eState = PropertyState_DEFAULT_VALUE;
} }
} }

View File

@@ -1444,7 +1444,7 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) th
case XATTR_LINEDASH: case XATTR_LINEDASH:
{ {
NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID); NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) ) if( ( pItem == NULL ) || pItem->GetName().isEmpty() )
eState = PropertyState_DEFAULT_VALUE; eState = PropertyState_DEFAULT_VALUE;
} }
break; break;

View File

@@ -53,7 +53,7 @@ SvxUnoNameItemTable::~SvxUnoNameItemTable() throw()
bool SvxUnoNameItemTable::isValid( const NameOrIndex* pItem ) const bool SvxUnoNameItemTable::isValid( const NameOrIndex* pItem ) const
{ {
return pItem && (pItem->GetName().Len() != 0); return pItem && !pItem->GetName().isEmpty();
} }
void SvxUnoNameItemTable::dispose() void SvxUnoNameItemTable::dispose()

View File

@@ -347,7 +347,7 @@ static void createNamesForPool( SfxItemPool* pPool, sal_uInt16 nWhich, std::set<
{ {
NameOrIndex* pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate ); NameOrIndex* pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate );
if( pItem == NULL || pItem->GetName().Len() == 0 ) if( pItem == NULL || pItem->GetName().isEmpty() )
continue; continue;
OUString aName = SvxUnogetApiNameForItem(XATTR_LINEEND, pItem->GetName()); OUString aName = SvxUnogetApiNameForItem(XATTR_LINEEND, pItem->GetName());
@@ -435,7 +435,7 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasElements( )
for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ ) for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ )
{ {
pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate); pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate);
if( pItem && pItem->GetName().Len() != 0 ) if( pItem && !pItem->GetName().isEmpty() )
return sal_True; return sal_True;
} }
@@ -443,7 +443,7 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasElements( )
for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ ) for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ )
{ {
pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate); pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate);
if( pItem && pItem->GetName().Len() != 0 ) if( pItem && !pItem->GetName().isEmpty() )
return sal_True; return sal_True;
} }

View File

@@ -2131,7 +2131,7 @@ beans::PropertyState SAL_CALL SvxShape::_getPropertyState( const OUString& Prope
case XATTR_LINEDASH: case XATTR_LINEDASH:
{ {
NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID); NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) ) if( ( pItem == NULL ) || pItem->GetName().isEmpty() )
eState = beans::PropertyState_DEFAULT_VALUE; eState = beans::PropertyState_DEFAULT_VALUE;
} }
break; break;

View File

@@ -86,7 +86,7 @@ NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, sal_Int32 nIndex) :
{ {
} }
NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, const XubString& rName) : NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, const OUString& rName) :
SfxStringItem(_nWhich, rName), SfxStringItem(_nWhich, rName),
nPalIndex(-1) nPalIndex(-1)
{ {
@@ -133,7 +133,7 @@ SvStream& NameOrIndex::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
Argument pPool2 can be null. Argument pPool2 can be null.
If returned string equals NameOrIndex->GetName(), the name was already unique. If returned string equals NameOrIndex->GetName(), the name was already unique.
*/ */
String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, const XPropertyListRef &pDefaults ) OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, const XPropertyListRef &pDefaults )
{ {
bool bForceNew = false; bool bForceNew = false;
@@ -158,7 +158,7 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn
if( !pCompareValueFunc( pItem, pCheckItem ) ) if( !pCompareValueFunc( pItem, pCheckItem ) )
{ {
// same name but different value, we need a new name for this item // same name but different value, we need a new name for this item
aUniqueName = String(); aUniqueName = "";
bForceNew = true; bForceNew = true;
} }
break; break;
@@ -236,14 +236,14 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn
{ {
pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate ); pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate );
if( pItem && pItem->GetName().Len() ) if( pItem && !pItem->GetName().isEmpty() )
{ {
if( !bForceNew && pCompareValueFunc( pItem, pCheckItem ) ) if( !bForceNew && pCompareValueFunc( pItem, pCheckItem ) )
return pItem->GetName(); return pItem->GetName();
if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) if( pItem->GetName().startsWith( aUser ) )
{ {
sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); sal_Int32 nThisIndex = pItem->GetName().copy( aUser.Len() ).toInt32();
if( nThisIndex >= nUserIndex ) if( nThisIndex >= nUserIndex )
nUserIndex = nThisIndex + 1; nUserIndex = nThisIndex + 1;
} }
@@ -1558,7 +1558,7 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
{ {
const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 ); const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
if( pItem && pItem->GetName().Len() ) if( pItem && !pItem->GetName().isEmpty() )
{ {
if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() ) if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() )
{ {
@@ -1567,9 +1567,9 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
break; break;
} }
if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) if( pItem->GetName().startsWith( aUser ) )
{ {
sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); sal_Int32 nThisIndex = pItem->GetName().copy( aUser.Len() ).toInt32();
if( nThisIndex >= nUserIndex ) if( nThisIndex >= nUserIndex )
nUserIndex = nThisIndex + 1; nUserIndex = nThisIndex + 1;
} }
@@ -1581,7 +1581,7 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
{ {
const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 ); const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
if( pItem && pItem->GetName().Len() ) if( pItem && !pItem->GetName().isEmpty() )
{ {
if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() ) if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() )
{ {
@@ -1590,9 +1590,9 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
break; break;
} }
if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) if( pItem->GetName().startsWith( aUser ) )
{ {
sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); sal_Int32 nThisIndex = pItem->GetName().copy( aUser.Len() ).toInt32();
if( nThisIndex >= nUserIndex ) if( nThisIndex >= nUserIndex )
nUserIndex = nThisIndex + 1; nUserIndex = nThisIndex + 1;
} }
@@ -1847,7 +1847,7 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
{ {
const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 ); const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
if( pItem && pItem->GetName().Len() ) if( pItem && !pItem->GetName().isEmpty() )
{ {
if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() ) if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() )
{ {
@@ -1856,9 +1856,9 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
break; break;
} }
if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) if( pItem->GetName().startsWith( aUser ) )
{ {
sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); sal_Int32 nThisIndex = pItem->GetName().copy( aUser.Len() ).toInt32();
if( nThisIndex >= nUserIndex ) if( nThisIndex >= nUserIndex )
nUserIndex = nThisIndex + 1; nUserIndex = nThisIndex + 1;
} }
@@ -1870,7 +1870,7 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
{ {
const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 ); const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
if( pItem && pItem->GetName().Len() ) if( pItem && !pItem->GetName().isEmpty() )
{ {
if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() ) if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() )
{ {
@@ -1879,9 +1879,9 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
break; break;
} }
if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) if( pItem->GetName().startsWith( aUser ) )
{ {
sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); sal_Int32 nThisIndex = pItem->GetName().copy( aUser.Len() ).toInt32();
if( nThisIndex >= nUserIndex ) if( nThisIndex >= nUserIndex )
nUserIndex = nThisIndex + 1; nUserIndex = nThisIndex + 1;
} }
@@ -3025,7 +3025,7 @@ XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrM
else else
{ {
// #85953# if disabled, force name to empty string // #85953# if disabled, force name to empty string
if(GetName().Len()) if( !GetName().isEmpty() )
{ {
return new XFillFloatTransparenceItem(String(), GetGradientValue(), sal_False); return new XFillFloatTransparenceItem(String(), GetGradientValue(), sal_False);
} }