[Libreoffice-commits] .: 12 commits - sc/source xmloff/source

Michael Stahl mst at kemper.freedesktop.org
Wed Apr 18 06:31:40 PDT 2012


 sc/source/ui/unoobj/chart2uno.cxx            |  118 +++++++++++++--------------
 xmloff/source/core/xmlimp.cxx                |   26 ++---
 xmloff/source/core/xmltkmap.cxx              |   13 +-
 xmloff/source/style/xmlnumfe.cxx             |   24 ++---
 xmloff/source/style/xmlnumfi.cxx             |   49 +++++------
 xmloff/source/style/xmlnumi.cxx              |   14 +--
 xmloff/source/style/xmltabi.cxx              |   15 +--
 xmloff/source/text/XMLTextColumnsContext.cxx |   16 +--
 xmloff/source/text/txtparai.cxx              |   39 ++++----
 9 files changed, 144 insertions(+), 170 deletions(-)

New commits:
commit e53047ade900f18ad6c6c241ddfdef715c2172fd
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Apr 18 15:25:33 2012 +0200

    loop with erase(begin()) looks sort of inefficient

diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 255aa94..77a5b5b 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -72,7 +72,7 @@ struct SvXMLNumFmtEntry
         aName(rN), nKey(nK), bRemoveAfterUse(bR) {}
 };
 
-class SvXMLNumFmtEntryArr : public boost::ptr_vector<SvXMLNumFmtEntry> {};
+typedef ::boost::ptr_vector<SvXMLNumFmtEntry> SvXMLNumFmtEntryArr;
 
 struct SvXMLEmbeddedElement
 {
diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx
index e5c0750..8bb2065 100644
--- a/xmloff/source/text/XMLTextColumnsContext.cxx
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -342,11 +342,10 @@ XMLTextColumnsContext::~XMLTextColumnsContext()
 {
     if( pColumns )
     {
-        while( !pColumns->empty() )
+        for (XMLTextColumnsArray_Impl::iterator it = pColumns->begin();
+                it != pColumns->end(); ++it)
         {
-            XMLTextColumnContext_Impl *pColumn = *pColumns->begin();
-            pColumns->erase( pColumns->begin() );
-            pColumn->ReleaseRef();
+           (*it)->ReleaseRef();
         }
     }
     if( pColumnSep )
commit f36861d4a367672e1ec6fc44e9367996c7cc6405
Author: Noel Grandin <noel at peralex.com>
Date:   Sun Apr 15 00:28:11 2012 +0200

    Convert SV_DECL_PTRARR_SORT_DEL to boost::ptr_set

diff --git a/xmloff/source/core/xmltkmap.cxx b/xmloff/source/core/xmltkmap.cxx
index d9f291a..f85ba87 100644
--- a/xmloff/source/core/xmltkmap.cxx
+++ b/xmloff/source/core/xmltkmap.cxx
@@ -30,6 +30,7 @@
 #include <svl/svarray.hxx>
 #include <xmloff/xmltkmap.hxx>
 #include <xmloff/xmltoken.hxx>
+#include <boost/ptr_container/ptr_set.hpp>
 
 using namespace ::xmloff::token;
 
@@ -72,9 +73,7 @@ public:
     }
 };
 
-typedef SvXMLTokenMapEntry_Impl *SvXMLTokenMapEntry_ImplPtr;
-SV_DECL_PTRARR_SORT_DEL( SvXMLTokenMap_Impl, SvXMLTokenMapEntry_ImplPtr, 5 )
-SV_IMPL_OP_PTRARR_SORT( SvXMLTokenMap_Impl, SvXMLTokenMapEntry_ImplPtr )
+class SvXMLTokenMap_Impl : public boost::ptr_set<SvXMLTokenMapEntry_Impl> {};
 
 // ---------------------------------------------------------------------
 
@@ -84,10 +83,10 @@ SvXMLTokenMapEntry_Impl *SvXMLTokenMap::_Find( sal_uInt16 nKeyPrefix,
     SvXMLTokenMapEntry_Impl *pRet = 0;
     SvXMLTokenMapEntry_Impl aTst( nKeyPrefix, rLName );
 
-    sal_uInt16 nPos;
-    if( pImpl->Seek_Entry( &aTst, &nPos ) )
+    SvXMLTokenMap_Impl::iterator it = pImpl->find( aTst );
+    if( it != pImpl->end() )
     {
-        pRet = (*pImpl)[nPos];
+        pRet = &*it;
     }
 
     return pRet;
@@ -98,7 +97,7 @@ SvXMLTokenMap::SvXMLTokenMap( const SvXMLTokenMapEntry *pMap ) :
 {
     while( pMap->eLocalName != XML_TOKEN_INVALID )
     {
-        pImpl->Insert( new SvXMLTokenMapEntry_Impl( *pMap ) );
+        pImpl->insert( new SvXMLTokenMapEntry_Impl( *pMap ) );
         pMap++;
     }
 }
commit b06d5cc4c234e3495833263192e694c0e9fc0533
Author: Noel Grandin <noel at peralex.com>
Date:   Sun Apr 15 00:16:52 2012 +0200

    Convert SV_DECL_PTRARR_SORT_DEL to boost:ptr_set

diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 3bb00d1..255aa94 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -52,6 +52,7 @@
 #include <xmloff/xmltoken.hxx>
 
 #include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/ptr_container/ptr_set.hpp>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -86,8 +87,7 @@ struct SvXMLEmbeddedElement
     sal_Bool operator < ( const SvXMLEmbeddedElement& r ) const { return nFormatPos <  r.nFormatPos; }
 };
 
-typedef SvXMLEmbeddedElement* SvXMLEmbeddedElementPtr;
-SV_DECL_PTRARR_SORT_DEL( SvXMLEmbeddedElementArr, SvXMLEmbeddedElementPtr, 0 )
+typedef boost::ptr_set<SvXMLEmbeddedElement> SvXMLEmbeddedElementArr;
 
 //-------------------------------------------------------------------------
 
@@ -380,10 +380,6 @@ static SvXMLDefaultDateFormat aDefaultDateFormats[] =
 
 //-------------------------------------------------------------------------
 
-SV_IMPL_OP_PTRARR_SORT( SvXMLEmbeddedElementArr, SvXMLEmbeddedElementPtr );
-
-//-------------------------------------------------------------------------
-
 //
 //  SvXMLNumImpData
 //
@@ -1047,15 +1043,15 @@ void SvXMLNumFmtElementContext::AddEmbeddedElement( sal_Int32 nFormatPos, const
     if ( !rContent.isEmpty() )
     {
         SvXMLEmbeddedElement* pObj = new SvXMLEmbeddedElement( nFormatPos, rContent );
-        if ( !aNumInfo.aEmbeddedElements.Insert( pObj ) )
+        if ( !aNumInfo.aEmbeddedElements.insert( pObj ).second )
         {
             //  there's already an element at this position - append text to existing element
 
             delete pObj;
-            sal_uInt16 nElementCount = aNumInfo.aEmbeddedElements.Count();
-            for (sal_uInt16 i=0; i<nElementCount; i++)
+            for (SvXMLEmbeddedElementArr::iterator it = aNumInfo.aEmbeddedElements.begin();
+                 it != aNumInfo.aEmbeddedElements.end(); ++it)
             {
-                pObj = aNumInfo.aEmbeddedElements[i];
+                pObj = &*it;
                 if ( pObj->nFormatPos == nFormatPos )
                 {
                     pObj->aText += rContent;
@@ -1754,7 +1750,7 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
         nGenPrec = 0;               // generate format without decimals...
 
     sal_Bool bGrouping = rInfo.bGrouping;
-    sal_uInt16 nEmbeddedCount = rInfo.aEmbeddedElements.Count();
+    sal_uInt16 nEmbeddedCount = rInfo.aEmbeddedElements.size();
     if ( nEmbeddedCount )
         bGrouping = sal_False;      // grouping and embedded characters can't be used together
 
@@ -1782,7 +1778,7 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
             nZeroPos = aNumStr.Len();
 
         //  aEmbeddedElements is sorted - last entry has the largest position (leftmost)
-        const SvXMLEmbeddedElement* pLastObj = rInfo.aEmbeddedElements[nEmbeddedCount - 1];
+        const SvXMLEmbeddedElement* pLastObj = &*rInfo.aEmbeddedElements.rbegin();
         sal_Int32 nLastFormatPos = pLastObj->nFormatPos;
         if ( nLastFormatPos >= nZeroPos )
         {
@@ -1797,9 +1793,10 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
         }
 
         //  aEmbeddedElements is sorted with ascending positions - loop is from right to left
-        for (sal_uInt16 nElement = 0; nElement < nEmbeddedCount; nElement++)
+        for (SvXMLEmbeddedElementArr::const_iterator it = rInfo.aEmbeddedElements.begin();
+             it != rInfo.aEmbeddedElements.end(); ++it)
         {
-            const SvXMLEmbeddedElement* pObj = rInfo.aEmbeddedElements[nElement];
+            const SvXMLEmbeddedElement* pObj = &*it;
             sal_Int32 nFormatPos = pObj->nFormatPos;
             sal_Int32 nInsertPos = nZeroPos - nFormatPos;
             if ( nFormatPos >= 0 && nInsertPos >= 0 )
commit a1a6e8e28515570dc7c002349d7f11285552dcb0
Author: Noel Grandin <noel at peralex.com>
Date:   Sun Apr 15 00:00:08 2012 +0200

    Convert SV_DECL_PTRARR to std::vector

diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 67fdd83..1c50276 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -220,9 +220,7 @@ public:
     ::comphelper::UnoInterfaceToUniqueIdentifierMapper  maInterfaceToIdentifierMapper;
 };
 
-typedef SvXMLImportContext *SvXMLImportContextPtr;
-SV_DECL_PTRARR( SvXMLImportContexts_Impl, SvXMLImportContextPtr, 20 )
-SV_IMPL_PTRARR( SvXMLImportContexts_Impl, SvXMLImportContextPtr )
+class SvXMLImportContexts_Impl : public std::vector<SvXMLImportContext *> {};
 
 SvXMLImportContext *SvXMLImport::CreateContext( sal_uInt16 nPrefix,
                                          const OUString& rLocalName,
@@ -378,11 +376,10 @@ SvXMLImport::~SvXMLImport() throw ()
     delete mpEventImportHelper;
     if( mpContexts )
     {
-        while( mpContexts->Count() )
+        while( !mpContexts->empty() )
         {
-            sal_uInt16 n = mpContexts->Count() - 1;
-            SvXMLImportContext *pContext = (*mpContexts)[n];
-            mpContexts->Remove( n, 1 );
+            SvXMLImportContext *pContext = mpContexts->back();
+            mpContexts->pop_back();
             if( pContext )
                 pContext->ReleaseRef();
         }
@@ -636,7 +633,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
     // If there are contexts already, call a CreateChildContext at the topmost
     // context. Otherwise, create a default context.
     SvXMLImportContext *pContext;
-    sal_uInt16 nCount = mpContexts->Count();
+    sal_uInt16 nCount = mpContexts->size();
     if( nCount > 0 )
     {
         pContext = (*mpContexts)[nCount - 1]->CreateChildContext( nPrefix,
@@ -684,7 +681,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
     pContext->StartElement( xAttrList );
 
     // Push context on stack.
-    mpContexts->Insert( pContext, nCount );
+    mpContexts->push_back( pContext );
 }
 
 void SAL_CALL SvXMLImport::endElement( const OUString&
@@ -694,13 +691,13 @@ rName
 )
     throw(xml::sax::SAXException, uno::RuntimeException)
 {
-    sal_uInt16 nCount = mpContexts->Count();
+    sal_uInt16 nCount = mpContexts->size();
     DBG_ASSERT( nCount, "SvXMLImport::endElement: no context left" );
     if( nCount > 0 )
     {
         // Get topmost context and remove it from the stack.
-        SvXMLImportContext *pContext = (*mpContexts)[nCount-1];
-        mpContexts->Remove( nCount-1, 1 );
+        SvXMLImportContext *pContext = mpContexts->back();
+        mpContexts->pop_back();
 
 #ifdef DBG_UTIL
         // Non product only: check if endElement call matches startELement call.
@@ -735,10 +732,9 @@ rName
 void SAL_CALL SvXMLImport::characters( const OUString& rChars )
     throw(xml::sax::SAXException, uno::RuntimeException)
 {
-    sal_uInt16 nCount = mpContexts->Count();
-    if( nCount > 0 )
+    if( !mpContexts->empty() )
     {
-        (*mpContexts)[nCount - 1]->Characters( rChars );
+        mpContexts->back()->Characters( rChars );
     }
 }
 
commit 888954167d24a1ba55ed442ecd55df7e84d10438
Author: Noel Grandin <noel at peralex.com>
Date:   Sat Apr 14 23:50:34 2012 +0200

    Convert SV_DECL_PTRARR_DEL to boost::ptr_vector

diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 714dcda..e44afb5 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -54,6 +54,7 @@
 #include <xmloff/xmlexp.hxx>
 
 #include <set>
+#include <boost/ptr_container/ptr_vector.hpp>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -114,12 +115,7 @@ struct SvXMLEmbeddedTextEntry
         nSourcePos(nSP), nFormatPos(nFP), aText(rT) {}
 };
 
-typedef SvXMLEmbeddedTextEntry* SvXMLEmbeddedTextEntryPtr;
-SV_DECL_PTRARR_DEL( SvXMLEmbeddedTextEntryArr, SvXMLEmbeddedTextEntryPtr, 4 )
-
-//-------------------------------------------------------------------------
-
-SV_IMPL_PTRARR( SvXMLEmbeddedTextEntryArr, SvXMLEmbeddedTextEntryPtr );
+class SvXMLEmbeddedTextEntryArr : public boost::ptr_vector<SvXMLEmbeddedTextEntry> {};
 
 //-------------------------------------------------------------------------
 
@@ -614,10 +610,10 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl(
 
     //  number:embedded-text as child elements
 
-    sal_uInt16 nEntryCount = rEmbeddedEntries.Count();
+    sal_uInt16 nEntryCount = rEmbeddedEntries.size();
     for (sal_uInt16 nEntry=0; nEntry<nEntryCount; nEntry++)
     {
-        SvXMLEmbeddedTextEntry* pObj = rEmbeddedEntries[nEntry];
+        const SvXMLEmbeddedTextEntry* pObj = &rEmbeddedEntries[nEntry];
 
         //  position attribute
         rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_POSITION,
@@ -627,12 +623,12 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl(
 
         //  text as element content
         rtl::OUString aContent( pObj->aText );
-        while ( nEntry+1 < nEntryCount && rEmbeddedEntries[nEntry+1]->nFormatPos == pObj->nFormatPos )
+        while ( nEntry+1 < nEntryCount && rEmbeddedEntries[nEntry+1].nFormatPos == pObj->nFormatPos )
         {
             // The array can contain several elements for the same position in the number
             // (for example, literal text and space from underscores). They must be merged
             // into a single embedded-text element.
-            aContent += rEmbeddedEntries[nEntry+1]->aText;
+            aContent += rEmbeddedEntries[nEntry+1].aText;
             ++nEntry;
         }
         rExport.Characters( aContent );
@@ -861,9 +857,9 @@ OUString lcl_GetDefaultCalendar( SvNumberFormatter* pFormatter, LanguageType nLa
 
 sal_Bool lcl_IsInEmbedded( const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries, sal_uInt16 nPos )
 {
-    sal_uInt16 nCount = rEmbeddedEntries.Count();
+    sal_uInt16 nCount = rEmbeddedEntries.size();
     for (sal_uInt16 i=0; i<nCount; i++)
-        if ( rEmbeddedEntries[i]->nSourcePos == nPos )
+        if ( rEmbeddedEntries[i].nSourcePos == nPos )
             return sal_True;
 
     return sal_False;       // not found
@@ -1133,7 +1129,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
     //  format elements
     //
 
-    SvXMLEmbeddedTextEntryArr aEmbeddedEntries(0);
+    SvXMLEmbeddedTextEntryArr aEmbeddedEntries;
     if ( eBuiltIn == NF_NUMBER_STANDARD )
     {
         //  default number format contains just one number element
@@ -1259,7 +1255,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
                             sal_Int32 nEmbedPos = nIntegerSymbols - nDigitsPassed;
 
                             SvXMLEmbeddedTextEntry* pObj = new SvXMLEmbeddedTextEntry( nPos, nEmbedPos, aEmbeddedStr );
-                            aEmbeddedEntries.Insert( pObj, aEmbeddedEntries.Count() );
+                            aEmbeddedEntries.push_back( pObj );
                         }
                         break;
                 }
commit 9013644f99950a348d8406352d0696443e6be659
Author: Noel Grandin <noel at peralex.com>
Date:   Sat Apr 14 23:44:25 2012 +0200

    Convert SV_DECL_PTRARR_DEL to boost::ptr_vector

diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index bd953a3..3bb00d1 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -51,6 +51,8 @@
 #include <xmloff/families.hxx>
 #include <xmloff/xmltoken.hxx>
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
 
@@ -69,8 +71,7 @@ struct SvXMLNumFmtEntry
         aName(rN), nKey(nK), bRemoveAfterUse(bR) {}
 };
 
-typedef SvXMLNumFmtEntry* SvXMLNumFmtEntryPtr;
-SV_DECL_PTRARR_DEL( SvXMLNumFmtEntryArr, SvXMLNumFmtEntryPtr, 4 )
+class SvXMLNumFmtEntryArr : public boost::ptr_vector<SvXMLNumFmtEntry> {};
 
 struct SvXMLEmbeddedElement
 {
@@ -379,7 +380,6 @@ static SvXMLDefaultDateFormat aDefaultDateFormats[] =
 
 //-------------------------------------------------------------------------
 
-SV_IMPL_PTRARR( SvXMLNumFmtEntryArr, SvXMLNumFmtEntryPtr );
 SV_IMPL_OP_PTRARR_SORT( SvXMLEmbeddedElementArr, SvXMLEmbeddedElementPtr );
 
 //-------------------------------------------------------------------------
@@ -414,10 +414,10 @@ SvXMLNumImpData::~SvXMLNumImpData()
 
 sal_uInt32 SvXMLNumImpData::GetKeyForName( const rtl::OUString& rName )
 {
-    sal_uInt16 nCount = aNameEntries.Count();
+    sal_uInt16 nCount = aNameEntries.size();
     for (sal_uInt16 i=0; i<nCount; i++)
     {
-        const SvXMLNumFmtEntry* pObj = aNameEntries[i];
+        const SvXMLNumFmtEntry* pObj = &aNameEntries[i];
         if ( pObj->aName == rName )
             return pObj->nKey;              // found
     }
@@ -431,10 +431,10 @@ void SvXMLNumImpData::AddKey( sal_uInt32 nKey, const rtl::OUString& rName, sal_B
         //  if there is already an entry for this key without the bRemoveAfterUse flag,
         //  clear the flag for this entry, too
 
-        sal_uInt16 nCount = aNameEntries.Count();
+        sal_uInt16 nCount = aNameEntries.size();
         for (sal_uInt16 i=0; i<nCount; i++)
         {
-            SvXMLNumFmtEntry* pObj = aNameEntries[i];
+            SvXMLNumFmtEntry* pObj = &aNameEntries[i];
             if ( pObj->nKey == nKey && !pObj->bRemoveAfterUse )
             {
                 bRemoveAfterUse = sal_False;        // clear flag for new entry
@@ -449,15 +449,15 @@ void SvXMLNumImpData::AddKey( sal_uInt32 nKey, const rtl::OUString& rName, sal_B
     }
 
     SvXMLNumFmtEntry* pObj = new SvXMLNumFmtEntry( rName, nKey, bRemoveAfterUse );
-    aNameEntries.Insert( pObj, aNameEntries.Count() );
+    aNameEntries.push_back( pObj );
 }
 
 void SvXMLNumImpData::SetUsed( sal_uInt32 nKey )
 {
-    sal_uInt16 nCount = aNameEntries.Count();
+    sal_uInt16 nCount = aNameEntries.size();
     for (sal_uInt16 i=0; i<nCount; i++)
     {
-        SvXMLNumFmtEntry* pObj = aNameEntries[i];
+        SvXMLNumFmtEntry* pObj = &aNameEntries[i];
         if ( pObj->nKey == nKey )
         {
             pObj->bRemoveAfterUse = sal_False;      // used -> don't remove
@@ -478,10 +478,10 @@ void SvXMLNumImpData::RemoveVolatileFormats()
     if ( !pFormatter )
         return;
 
-    sal_uInt16 nCount = aNameEntries.Count();
+    sal_uInt16 nCount = aNameEntries.size();
     for (sal_uInt16 i=0; i<nCount; i++)
     {
-        const SvXMLNumFmtEntry* pObj = aNameEntries[i];
+        const SvXMLNumFmtEntry* pObj = &aNameEntries[i];
         if ( pObj->bRemoveAfterUse )
         {
             const SvNumberformat* pFormat = pFormatter->GetEntry(pObj->nKey);
commit 850bfeeda8ceae207417c2a1733c2304056fdcb2
Author: Noel Grandin <noel at peralex.com>
Date:   Sat Apr 14 23:32:56 2012 +0200

    Convert SV_DECL_PTRARR to std::vector

diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 7f13c15..eddf113 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -1085,8 +1085,7 @@ SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::~SvxXMLListLevelStyleLabelAl
 
 // ---------------------------------------------------------------------
 
-typedef SvxXMLListLevelStyleContext_Impl *SvxXMLListLevelStyleContext_ImplPtr;
-SV_DECL_PTRARR( SvxXMLListStyle_Impl, SvxXMLListLevelStyleContext_ImplPtr, 10 )
+class SvxXMLListStyle_Impl : public std::vector<SvxXMLListLevelStyleContext_Impl *> {};
 
 void SvxXMLListStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
                                            const OUString& rLocalName,
@@ -1125,11 +1124,10 @@ SvxXMLListStyleContext::~SvxXMLListStyleContext()
 {
     if( pLevelStyles )
     {
-        while( pLevelStyles->Count() )
+        while( !pLevelStyles->empty() )
         {
-            sal_uInt16 n = pLevelStyles->Count() - 1;
-            SvxXMLListLevelStyleContext_Impl *pStyle = (*pLevelStyles)[n];
-            pLevelStyles->Remove( n, 1 );
+            SvxXMLListLevelStyleContext_Impl *pStyle = pLevelStyles->back();
+            pLevelStyles->pop_back();
             pStyle->ReleaseRef();
         }
     }
@@ -1158,7 +1156,7 @@ SvXMLImportContext *SvxXMLListStyleContext::CreateChildContext(
                                                   rLocalName, xAttrList );
         if( !pLevelStyles )
             pLevelStyles = new SvxXMLListStyle_Impl;
-        pLevelStyles->Insert( pLevelStyle, pLevelStyles->Count() );
+        pLevelStyles->push_back( pLevelStyle );
         pLevelStyle->AddRef();
 
         pContext = pLevelStyle;
@@ -1179,7 +1177,7 @@ void SvxXMLListStyleContext::FillUnoNumRule(
     {
         if( pLevelStyles && rNumRule.is() )
         {
-            sal_uInt16 nCount = pLevelStyles->Count();
+            sal_uInt16 nCount = pLevelStyles->size();
             sal_Int32 l_nLevels = rNumRule->getCount();
             for( sal_uInt16 i=0; i < nCount; i++ )
             {
commit 96a36b917a1f69e672bcb273df0513dba8d8a379
Author: Noel Grandin <noel at peralex.com>
Date:   Sat Apr 14 23:28:36 2012 +0200

    Convert SV_DECL_PTRARR to std::vector

diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx
index c613825..8c93259 100644
--- a/xmloff/source/style/xmltabi.cxx
+++ b/xmloff/source/style/xmltabi.cxx
@@ -184,8 +184,7 @@ SvXMLImportContext *SvxXMLTabStopContext_Impl::CreateChildContext(
 
 
 
-typedef SvxXMLTabStopContext_Impl *SvxXMLTabStopContext_Impl_ImplPtr;
-SV_DECL_PTRARR( SvxXMLTabStopArray_Impl, SvxXMLTabStopContext_Impl_ImplPtr, 20 )
+class SvxXMLTabStopArray_Impl : public std::vector<SvxXMLTabStopContext_Impl *> {};
 
 
 // ---
@@ -206,12 +205,10 @@ SvxXMLTabStopImportContext::~SvxXMLTabStopImportContext()
 {
     if( mpTabStops )
     {
-        sal_uInt16 nCount = mpTabStops->Count();
-        while( nCount )
+        while( !mpTabStops->empty() )
         {
-            nCount--;
-            SvxXMLTabStopContext_Impl *pTabStop = (*mpTabStops)[nCount];
-            mpTabStops->Remove( nCount, 1 );
+            SvxXMLTabStopContext_Impl *pTabStop = mpTabStops->back();
+            mpTabStops->pop_back();
             pTabStop->ReleaseRef();
         }
     }
@@ -237,7 +234,7 @@ SvXMLImportContext *SvxXMLTabStopImportContext::CreateChildContext(
         if( !mpTabStops )
             mpTabStops = new SvxXMLTabStopArray_Impl;
 
-        mpTabStops->Insert( pTabStopContext, mpTabStops->Count() );
+        mpTabStops->push_back( pTabStopContext );
         pTabStopContext->AddRef();
 
         pContext = pTabStopContext;
@@ -252,7 +249,7 @@ SvXMLImportContext *SvxXMLTabStopImportContext::CreateChildContext(
 
 void SvxXMLTabStopImportContext::EndElement( )
 {
-    sal_uInt16 nCount = mpTabStops ? mpTabStops->Count() : 0;
+    sal_uInt16 nCount = mpTabStops ? mpTabStops->size() : 0;
     uno::Sequence< style::TabStop> aSeq( nCount );
 
     if( mpTabStops )
commit 8c40de809ac06670b1af1359b4eb355843a77282
Author: Noel Grandin <noel at peralex.com>
Date:   Sat Apr 14 23:19:17 2012 +0200

    Convert SV_DECL_PTRARR to std::vector

diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx
index dcd3ab5..e5c0750 100644
--- a/xmloff/source/text/XMLTextColumnsContext.cxx
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -284,8 +284,7 @@ XMLTextColumnSepContext_Impl::~XMLTextColumnSepContext_Impl()
 
 // --------------------------------------------------------------------------
 
-typedef XMLTextColumnContext_Impl *XMLTextColumnContext_ImplPtr;
-SV_DECL_PTRARR( XMLTextColumnsArray_Impl, XMLTextColumnContext_ImplPtr, 5 )
+class XMLTextColumnsArray_Impl : public std::vector<XMLTextColumnContext_Impl *> {};
 
 TYPEINIT1( XMLTextColumnsContext, XMLElementPropertyContext );
 
@@ -343,12 +342,10 @@ XMLTextColumnsContext::~XMLTextColumnsContext()
 {
     if( pColumns )
     {
-        sal_uInt16 nColCount = pColumns->Count();
-        while( nColCount )
+        while( !pColumns->empty() )
         {
-            nColCount--;
-            XMLTextColumnContext_Impl *pColumn = (*pColumns)[nColCount];
-            pColumns->Remove( nColCount, 1 );
+            XMLTextColumnContext_Impl *pColumn = *pColumns->begin();
+            pColumns->erase( pColumns->begin() );
             pColumn->ReleaseRef();
         }
     }
@@ -378,7 +375,7 @@ SvXMLImportContext *XMLTextColumnsContext::CreateChildContext(
         if( !pColumns )
             pColumns = new XMLTextColumnsArray_Impl;
 
-        pColumns->Insert( pColumn, pColumns->Count() );
+        pColumns->push_back( pColumn );
         pColumn->AddRef();
 
         pContext = pColumn;
@@ -419,7 +416,7 @@ void XMLTextColumnsContext::EndElement( )
         xColumns->setColumnCount( 1 );
     }
     else if( !bAutomatic && pColumns &&
-             pColumns->Count() == (sal_uInt16)nCount )
+             pColumns->size() == (sal_uInt16)nCount )
     {
         // if we have column descriptions, one per column, and we don't use
         // automatic width, then set the column widths
commit 759c5373e04f797f656999995c60918c384f6ca0
Author: Noel Grandin <noel at peralex.com>
Date:   Sat Apr 14 23:12:29 2012 +0200

    Convert SV_DECL_PTRARR_DEL to boost::ptr_vector

diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 73b681e..87040a7 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -30,6 +30,7 @@
 #include <rtl/ustring.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <tools/debug.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
 
 #include <svl/svarray.hxx>
 #include <com/sun/star/text/XTextFrame.hpp>
@@ -64,9 +65,7 @@
 
 // OD 2004-04-21 #i26791#
 #include <txtparaimphint.hxx>
-typedef XMLHint_Impl *XMLHint_ImplPtr;
-SV_DECL_PTRARR_DEL( XMLHints_Impl, XMLHint_ImplPtr, 5 )
-SV_IMPL_PTRARR( XMLHints_Impl, XMLHint_ImplPtr )
+class XMLHints_Impl : public boost::ptr_vector<XMLHint_Impl> {};
 // OD 2004-04-21 #i26791#
 
 using ::rtl::OUString;
@@ -211,7 +210,7 @@ XMLStartReferenceContext_Impl::XMLStartReferenceContext_Impl(
         // degenerates to point reference, if no end is found!
         pHint->SetEnd(rImport.GetTextImport()->GetCursor()->getStart() );
 
-        rHints.Insert(pHint, rHints.Count());
+        rHints.push_back(pHint);
     }
 }
 
@@ -275,10 +274,10 @@ XMLEndReferenceContext_Impl::XMLEndReferenceContext_Impl(
     if (XMLStartReferenceContext_Impl::FindName(GetImport(), xAttrList, sName))
     {
         // search for reference start
-        sal_uInt16 nCount = rHints.Count();
+        sal_uInt16 nCount = rHints.size();
         for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
         {
-            XMLHint_Impl *pHint = rHints[nPos];
+            XMLHint_Impl *pHint = &rHints[nPos];
             if ( pHint->IsReference() &&
                  sName.equals( ((XMLReferenceHint_Impl *)pHint)->GetRefName()) )
             {
@@ -426,7 +425,7 @@ XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl(
             pHint->SetTargetFrameName(
                     OUString( RTL_CONSTASCII_USTRINGPARAM("_self" ) ) );
     }
-    rHints.Insert( pHint, rHints.Count() );
+    rHints.push_back( pHint );
 }
 
 XMLImpHyperlinkContext_Impl::~XMLImpHyperlinkContext_Impl()
@@ -1127,7 +1126,7 @@ void XMLIndexMarkImportContext_Impl::StartElement(
             {
                 ProcessAttributes(xAttrList, xMark);
                 XMLHint_Impl* pHint = new XMLIndexMarkHint_Impl(xMark, xPos);
-                rHints.Insert(pHint, rHints.Count());
+                rHints.push_back(pHint);
             }
             // else: can't create mark -> ignore
             break;
@@ -1148,7 +1147,7 @@ void XMLIndexMarkImportContext_Impl::StartElement(
                     // process only if we find an ID
                     XMLHint_Impl* pHint =
                         new XMLIndexMarkHint_Impl(xMark, xPos, sID);
-                    rHints.Insert(pHint, rHints.Count());
+                    rHints.push_back(pHint);
                 }
                 // else: no ID -> we'll never find the end -> ignore
             }
@@ -1167,10 +1166,10 @@ void XMLIndexMarkImportContext_Impl::StartElement(
             if (!sID.isEmpty())
             {
                 // if we have an ID, find the hint and set the end position
-                sal_uInt16 nCount = rHints.Count();
+                sal_uInt16 nCount = rHints.size();
                 for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
                 {
-                    XMLHint_Impl *pHint = rHints[nPos];
+                    XMLHint_Impl *pHint = &rHints[nPos];
                     if ( pHint->IsIndexMark() &&
                          sID.equals(
                              ((XMLIndexMarkHint_Impl *)pHint)->GetID()) )
@@ -1599,7 +1598,7 @@ XMLImpSpanContext_Impl::XMLImpSpanContext_Impl(
     {
         pHint = new XMLStyleHint_Impl( aStyleName,
                   GetImport().GetTextImport()->GetCursorAsRange()->getStart() );
-            rHints.Insert( pHint, rHints.Count() );
+            rHints.push_back( pHint );
     }
 }
 
@@ -1749,9 +1748,8 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
             if( TextContentAnchorType_AT_CHARACTER ==
                                             pTextFrameContext->GetAnchorType() )
             {
-                rHints.Insert( new XMLTextFrameHint_Impl(
-                    pTextFrameContext, xAnchorPos ),
-                    rHints.Count() );
+                rHints.push_back( new XMLTextFrameHint_Impl(
+                    pTextFrameContext, xAnchorPos ) );
             }
             pContext = pTextFrameContext;
             rIgnoreLeadingSpace = sal_False;
@@ -1766,7 +1764,7 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
                                         TextContentAnchorType_AS_CHARACTER );
             XMLTextFrameHint_Impl *pHint =
                 new XMLTextFrameHint_Impl( pContext, xAnchorPos);
-            rHints.Insert( pHint, rHints.Count() );
+            rHints.push_back( pHint );
         }
         break;
 
@@ -1839,8 +1837,7 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
             // adjust its anchor position, if its at-character anchored
             Reference < XTextRange > xAnchorPos =
                 rImport.GetTextImport()->GetCursor()->getStart();
-            rHints.Insert( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ),
-                           rHints.Count() );
+            rHints.push_back( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ) );
         }
         if( !pContext )
         {
@@ -2135,11 +2132,11 @@ XMLParaContext::~XMLParaContext()
         }
     }
 
-    if( pHints && pHints->Count() )
+    if( pHints && !pHints->empty() )
     {
-        for( sal_uInt16 i=0; i<pHints->Count(); i++ )
+        for( sal_uInt16 i=0; i<pHints->size(); i++ )
         {
-            XMLHint_Impl *pHint = (*pHints)[i];
+            XMLHint_Impl *pHint = &(*pHints)[i];
             xAttrCursor->gotoRange( pHint->GetStart(), sal_False );
             xAttrCursor->gotoRange( pHint->GetEnd(), sal_True );
             switch( pHint->GetType() )
commit 8b229762d31e2f8c860a586fb939beea8ac452ed
Author: Noel Grandin <noel at peralex.com>
Date:   Sat Apr 14 21:23:28 2012 +0200

    Convert from tools/table.hxx to std::map

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index ae4b61b..03028fc 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -47,7 +47,6 @@
 #include "formula/opcode.hxx"
 
 #include <sfx2/objsh.hxx>
-#include <tools/table.hxx>
 #include <vcl/svapp.hxx>
 
 #include <com/sun/star/beans/UnknownPropertyException.hpp>
@@ -250,11 +249,14 @@ vector<ScTokenRef>* TokenTable::getAllRanges() const
 
 // ============================================================================
 
+typedef std::map<sal_uInt32, FormulaToken*> FormulaTokenMap;
+typedef std::map<sal_uInt32, FormulaTokenMap*> FormulaTokenMapMap;
+
 class Chart2PositionMap
 {
 public:
     Chart2PositionMap(SCCOL nColCount, SCROW nRowCount,
-                      bool bFillRowHeader, bool bFillColumnHeader, Table& rCols,
+                      bool bFillRowHeader, bool bFillColumnHeader, FormulaTokenMapMap& rCols,
                       ScDocument* pDoc );
     ~Chart2PositionMap();
 
@@ -282,7 +284,7 @@ private:
 };
 
 Chart2PositionMap::Chart2PositionMap(SCCOL nAllColCount,  SCROW nAllRowCount,
-                                     bool bFillRowHeader, bool bFillColumnHeader, Table& rCols, ScDocument* pDoc)
+                                     bool bFillRowHeader, bool bFillColumnHeader, FormulaTokenMapMap& rCols, ScDocument* pDoc)
 {
     // if bFillRowHeader is true, at least the first column serves as a row header.
     //  If more than one column is pure text all the first pure text columns are used as header.
@@ -299,16 +301,18 @@ Chart2PositionMap::Chart2PositionMap(SCCOL nAllColCount,  SCROW nAllRowCount,
         SCROW nSmallestValueRowIndex = nAllRowCount;
         bool bFoundValues = false;
         bool bFoundAnything = false;
-        Table* pCol = static_cast<Table*>(rCols.First());
+        FormulaTokenMapMap::const_iterator it1 = rCols.begin();
         for (SCCOL nCol = 0; !bFoundValues && nCol < nAllColCount; ++nCol)
         {
-            if (pCol && nCol>=nHeaderColCount)
+            if (it1 != rCols.end() && nCol>=nHeaderColCount)
             {
-                ScToken* pToken = static_cast<ScToken*>(pCol->First());
+                FormulaTokenMap* pCol = it1->second;
+                FormulaTokenMap::const_iterator it2 = pCol->begin();
                 for (SCROW nRow = 0; !bFoundValues && nRow < nSmallestValueRowIndex; ++nRow)
                 {
-                    if (pToken && nRow>=nHeaderRowCount)
+                    if (it2 != pCol->end() && nRow>=nHeaderRowCount)
                     {
+                        FormulaToken* pToken = it2->second;
                         ScRange aRange;
                         bool bExternal = false;
                         StackVar eType = pToken->GetType();
@@ -331,12 +335,12 @@ Chart2PositionMap::Chart2PositionMap(SCCOL nAllColCount,  SCROW nAllRowCount,
                                 bFoundAnything = true;
                         }
                     }
-                    pToken = static_cast<ScToken*>(pCol->Next());
+                    ++it2;
                 }
                 if(!bFoundValues && nHeaderColCount>0)
                     nHeaderColCount++;
             }
-            pCol = static_cast<Table*>(rCols.Next());
+            ++it1;
         }
         if( bFoundAnything )
         {
@@ -360,15 +364,22 @@ Chart2PositionMap::Chart2PositionMap(SCCOL nAllColCount,  SCROW nAllRowCount,
     maRowHeaders.init(nHeaderColCount,mnDataRowCount);
     maData.init(mnDataColCount,mnDataRowCount);
 
-    Table* pCol = static_cast<Table*>(rCols.First());
-    FormulaToken* pToken = NULL;
+    FormulaTokenMapMap::const_iterator it1 = rCols.begin();
     for (SCCOL nCol = 0; nCol < nAllColCount; ++nCol)
     {
-        if (pCol)
+        if (it1 != rCols.end())
         {
-            pToken = static_cast<FormulaToken*>(pCol->First());
+            FormulaTokenMap* pCol = it1->second;
+            FormulaTokenMap::const_iterator it2 = pCol->begin();
             for (SCROW nRow = 0; nRow < nAllRowCount; ++nRow)
             {
+                FormulaToken* pToken = NULL;
+                if (it2 != pCol->end())
+                {
+                    pToken = it2->second;
+                    ++it2;
+                }
+
                 if( nCol < nHeaderColCount )
                 {
                     if( nRow < nHeaderRowCount )
@@ -380,11 +391,9 @@ Chart2PositionMap::Chart2PositionMap(SCCOL nAllColCount,  SCROW nAllRowCount,
                     maColHeaders.push_back(pToken);
                 else
                     maData.push_back(pToken);
-
-                pToken = static_cast<FormulaToken*>(pCol->Next());
             }
+            ++it1;
         }
-        pCol = static_cast<Table*>(rCols.Next());
     }
 }
 
@@ -716,9 +725,9 @@ void Chart2Positioner::createPositionMap()
 
     bool bNoGlue = (meGlue == GLUETYPE_NONE);
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
-    auto_ptr<Table> pCols(new Table);
+    auto_ptr<FormulaTokenMapMap> pCols(new FormulaTokenMapMap);
     SAL_WNODEPRECATED_DECLARATIONS_POP
-    Table* pCol = NULL;
+    FormulaTokenMap* pCol = NULL;
     SCROW nNoGlueRow = 0;
     for (vector<ScTokenRef>::const_iterator itr = mrRefTokens.begin(), itrEnd = mrRefTokens.end();
           itr != itrEnd; ++itr)
@@ -748,12 +757,14 @@ void Chart2Positioner::createPositionMap()
 
             for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol, ++nInsCol)
             {
-                pCol = static_cast<Table*>(pCols->Get(nInsCol));
-                if (!pCol)
+                FormulaTokenMapMap::const_iterator it = pCols->find(nInsCol);
+                if (it == pCols->end())
                 {
-                    pCol = new Table;
-                    pCols->Insert(nInsCol, pCol);
+                    pCol = new FormulaTokenMap;
+                    (*pCols)[ nInsCol ] = pCol;
                 }
+                else
+                    pCol = it->second;
 
                 sal_uInt32 nInsRow = static_cast<sal_uInt32>(bNoGlue ? nNoGlueRow : nRow1);
                 for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow, ++nInsRow)
@@ -768,12 +779,12 @@ void Chart2Positioner::createPositionMap()
                     aCellData.nRow = nRow;
                     aCellData.nTab = nTab;
 
-                    if (!pCol->Get(nInsRow))
+                    if (pCol->find(nInsRow) == pCol->end())
                     {
                         if (bExternal)
-                            pCol->Insert(nInsRow, new ScExternalSingleRefToken(nFileId, aTabName, aCellData));
+                            (*pCol)[ nInsRow ] = new ScExternalSingleRefToken(nFileId, aTabName, aCellData);
                         else
-                            pCol->Insert(nInsRow, new ScSingleRefToken(aCellData));
+                            (*pCol)[ nInsRow ] = new ScSingleRefToken(aCellData);
                     }
                 }
             }
@@ -784,29 +795,31 @@ void Chart2Positioner::createPositionMap()
     bool bFillRowHeader = mbRowHeaders;
     bool bFillColumnHeader = mbColHeaders;
 
-    SCSIZE nAllColCount = static_cast<SCSIZE>(pCols->Count());
+    SCSIZE nAllColCount = static_cast<SCSIZE>(pCols->size());
     SCSIZE nAllRowCount = 0;
-    pCol = static_cast<Table*>(pCols->First());
-    if (pCol)
+    if (!pCols->empty())
     {
+        pCol = pCols->begin()->second;
         if (mbDummyUpperLeft)
-            pCol->Insert(0, NULL);        // Dummy fuer Beschriftung
-        nAllRowCount = static_cast<SCSIZE>(pCol->Count());
+            if (pCol->find(0) == pCol->end())
+                (*pCol)[ 0 ] = NULL;        // Dummy fuer Beschriftung
+        nAllRowCount = static_cast<SCSIZE>(pCol->size());
     }
 
     if( nAllColCount!=0 && nAllRowCount!=0 )
     {
         if (bNoGlue)
         {
-            Table* pFirstCol = static_cast<Table*>(pCols->First());
-            sal_uInt32 nCount = pFirstCol->Count();
-            pFirstCol->First();
-            for (sal_uInt32 n = 0; n < nCount; ++n, pFirstCol->Next())
+            FormulaTokenMap* pFirstCol = pCols->begin()->second;
+            for (FormulaTokenMap::const_iterator it1 = pFirstCol->begin(); it1 != pFirstCol->end(); ++it1)
             {
-                sal_uInt32 nKey = pFirstCol->GetCurKey();
-                pCols->First();
-                for (pCol = static_cast<Table*>(pCols->Next()); pCol; pCol = static_cast<Table*>(pCols->Next()))
-                    pCol->Insert(nKey, NULL);
+                sal_uInt32 nKey = it1->first;
+                for (FormulaTokenMapMap::const_iterator it2 = pCols->begin(); it2 != pCols->end(); ++it2)
+                {
+                    pCol = it2->second;
+                    if (pCol->find(nKey) == pCol->end())
+                        (*pCol)[ nKey ] = NULL;
+                }
             }
         }
     }
@@ -816,8 +829,11 @@ void Chart2Positioner::createPositionMap()
             bFillRowHeader, bFillColumnHeader, *pCols, mpDoc));
 
     // Destroy all column instances.
-    for (pCol = static_cast<Table*>(pCols->First()); pCol; pCol = static_cast<Table*>(pCols->Next()))
+    for (FormulaTokenMapMap::const_iterator it = pCols->begin(); it != pCols->end(); ++it)
+    {
+        pCol = it->second;
         delete pCol;
+    }
 }
 
 // ============================================================================
commit 19111e1da5acc428c0a82f95eb539c5606a1b6b8
Author: Noel Grandin <noel at peralex.com>
Date:   Sat Apr 14 01:33:26 2012 +0200

    Remove unnecessary auto_ptr complexity
    
    This is a precursor patch to converting this code from
    tools/table.hxx to std::map

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index bbfdce7..ae4b61b 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -717,8 +717,6 @@ void Chart2Positioner::createPositionMap()
     bool bNoGlue = (meGlue == GLUETYPE_NONE);
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     auto_ptr<Table> pCols(new Table);
-    auto_ptr<FormulaToken> pNewAddress;
-    auto_ptr<Table> pNewRowTable(new Table);
     SAL_WNODEPRECATED_DECLARATIONS_POP
     Table* pCol = NULL;
     SCROW nNoGlueRow = 0;
@@ -750,25 +748,11 @@ void Chart2Positioner::createPositionMap()
 
             for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol, ++nInsCol)
             {
-                if (bNoGlue || meGlue == GLUETYPE_ROWS)
+                pCol = static_cast<Table*>(pCols->Get(nInsCol));
+                if (!pCol)
                 {
-                    pCol = static_cast<Table*>(pCols->Get(nInsCol));
-                    if (!pCol)
-                    {
-                        pCol = pNewRowTable.get();
-                        pCols->Insert(nInsCol, pNewRowTable.release());
-                        pNewRowTable.reset(new Table);
-                    }
-                }
-                else
-                {
-                    if (pCols->Insert(nInsCol, pNewRowTable.get()))
-                    {
-                        pCol = pNewRowTable.release();
-                        pNewRowTable.reset(new Table);
-                    }
-                    else
-                        pCol = static_cast<Table*>(pCols->Get(nInsCol));
+                    pCol = new Table;
+                    pCols->Insert(nInsCol, pCol);
                 }
 
                 sal_uInt32 nInsRow = static_cast<sal_uInt32>(bNoGlue ? nNoGlueRow : nRow1);
@@ -784,20 +768,18 @@ void Chart2Positioner::createPositionMap()
                     aCellData.nRow = nRow;
                     aCellData.nTab = nTab;
 
-                    if (bExternal)
-                        pNewAddress.reset(new ScExternalSingleRefToken(nFileId, aTabName, aCellData));
-                    else
-                        pNewAddress.reset(new ScSingleRefToken(aCellData));
-
-                    if (pCol->Insert(nInsRow, pNewAddress.get()))
-                        pNewAddress.release(); // To prevent the instance from being destroyed.
+                    if (!pCol->Get(nInsRow))
+                    {
+                        if (bExternal)
+                            pCol->Insert(nInsRow, new ScExternalSingleRefToken(nFileId, aTabName, aCellData));
+                        else
+                            pCol->Insert(nInsRow, new ScSingleRefToken(aCellData));
+                    }
                 }
             }
         }
         nNoGlueRow += nRow2 - nRow1 + 1;
     }
-    pNewAddress.reset(NULL);
-    pNewRowTable.reset(NULL);
 
     bool bFillRowHeader = mbRowHeaders;
     bool bFillColumnHeader = mbColHeaders;


More information about the Libreoffice-commits mailing list