diff options
Diffstat (limited to 'svx/source/xoutdev/xattr.cxx')
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 162 |
1 files changed, 78 insertions, 84 deletions
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 74912a9ded57..cafbe882ff37 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -1099,14 +1099,14 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const sal_uInt32 nCount, nSurrogate; - const SfxItemPool* pPool1 = &pModel->GetItemPool(); - if( !aUniqueName.isEmpty() && pPool1 ) + const SfxItemPool& rPool1 = pModel->GetItemPool(); + if (!aUniqueName.isEmpty()) { - nCount = pPool1->GetItemCount2( XATTR_LINESTART ); + nCount = rPool1.GetItemCount2(XATTR_LINESTART); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate ); + const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate); if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) { @@ -1124,11 +1124,11 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const if( !bForceNew ) { - nCount = pPool1->GetItemCount2( XATTR_LINEEND ); + nCount = rPool1.GetItemCount2(XATTR_LINEEND); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate ); + const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate); if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) { @@ -1200,53 +1200,50 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const sal_Int32 nUserIndex = 1; const OUString aUser(SvxResId(RID_SVXSTR_LINEEND)); - if( pPool1 ) + nCount = rPool1.GetItemCount2(XATTR_LINESTART); + sal_uInt32 nSurrogate2; + + for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++) { - nCount = pPool1->GetItemCount2( XATTR_LINESTART ); - sal_uInt32 nSurrogate2; + const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate2); - for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) + if (pItem && !pItem->GetName().isEmpty()) { - const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 ); - - if( pItem && !pItem->GetName().isEmpty() ) + if (!bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue()) { - if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() ) - { - aUniqueName = pItem->GetName(); - bFoundExisting = true; - break; - } + aUniqueName = pItem->GetName(); + bFoundExisting = true; + break; + } - if( pItem->GetName().startsWith( aUser ) ) - { - sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32(); - if( nThisIndex >= nUserIndex ) - nUserIndex = nThisIndex + 1; - } + if (pItem->GetName().startsWith(aUser)) + { + sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32(); + if (nThisIndex >= nUserIndex) + nUserIndex = nThisIndex + 1; } } + } - nCount = pPool1->GetItemCount2( XATTR_LINEEND ); - for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) - { - const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 ); + nCount = rPool1.GetItemCount2(XATTR_LINEEND); + for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++) + { + const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate2); - if( pItem && !pItem->GetName().isEmpty() ) + if (pItem && !pItem->GetName().isEmpty()) + { + if (!bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue()) { - if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() ) - { - aUniqueName = pItem->GetName(); - bFoundExisting = true; - break; - } + aUniqueName = pItem->GetName(); + bFoundExisting = true; + break; + } - if( pItem->GetName().startsWith( aUser ) ) - { - sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32(); - if( nThisIndex >= nUserIndex ) - nUserIndex = nThisIndex + 1; - } + if (pItem->GetName().startsWith(aUser)) + { + sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32(); + if (nThisIndex >= nUserIndex) + nUserIndex = nThisIndex + 1; } } } @@ -1353,14 +1350,14 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const sal_uInt16 nCount, nSurrogate; - const SfxItemPool* pPool1 = &pModel->GetItemPool(); - if( !aUniqueName.isEmpty() && pPool1 ) + const SfxItemPool& rPool1 = pModel->GetItemPool(); + if (!aUniqueName.isEmpty()) { - nCount = pPool1->GetItemCount2( XATTR_LINESTART ); + nCount = rPool1.GetItemCount2(XATTR_LINESTART); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate ); + const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate); if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) { @@ -1378,11 +1375,11 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const if( !bForceNew ) { - nCount = pPool1->GetItemCount2( XATTR_LINEEND ); + nCount = rPool1.GetItemCount2(XATTR_LINEEND); for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate ); + const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate); if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) { @@ -1454,53 +1451,50 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const sal_Int32 nUserIndex = 1; const OUString aUser(SvxResId(RID_SVXSTR_LINEEND)); - if( pPool1 ) + nCount = rPool1.GetItemCount2(XATTR_LINESTART); + sal_uInt32 nSurrogate2; + + for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++) { - nCount = pPool1->GetItemCount2( XATTR_LINESTART ); - sal_uInt32 nSurrogate2; + const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate2); - for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) + if (pItem && !pItem->GetName().isEmpty()) { - const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 ); - - if( pItem && !pItem->GetName().isEmpty() ) + if (!bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue()) { - if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() ) - { - aUniqueName = pItem->GetName(); - bFoundExisting = true; - break; - } + aUniqueName = pItem->GetName(); + bFoundExisting = true; + break; + } - if( pItem->GetName().startsWith( aUser ) ) - { - sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32(); - if( nThisIndex >= nUserIndex ) - nUserIndex = nThisIndex + 1; - } + if (pItem->GetName().startsWith(aUser)) + { + sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32(); + if (nThisIndex >= nUserIndex) + nUserIndex = nThisIndex + 1; } } + } - nCount = pPool1->GetItemCount2( XATTR_LINEEND ); - for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) - { - const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 ); + nCount = rPool1.GetItemCount2(XATTR_LINEEND); + for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++) + { + const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate2); - if( pItem && !pItem->GetName().isEmpty() ) + if (pItem && !pItem->GetName().isEmpty()) + { + if (!bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue()) { - if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() ) - { - aUniqueName = pItem->GetName(); - bFoundExisting = true; - break; - } + aUniqueName = pItem->GetName(); + bFoundExisting = true; + break; + } - if( pItem->GetName().startsWith( aUser ) ) - { - sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32(); - if( nThisIndex >= nUserIndex ) - nUserIndex = nThisIndex + 1; - } + if (pItem->GetName().startsWith(aUser)) + { + sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32(); + if (nThisIndex >= nUserIndex) + nUserIndex = nThisIndex + 1; } } } |