[Libreoffice-commits] .: 6 commits - sfx2/inc sfx2/source svtools/inc svtools/source sw/source

August Sodora augsod at kemper.freedesktop.org
Fri Jan 20 22:54:27 PST 2012


 sfx2/inc/arrdecl.hxx                      |    8 -----
 sfx2/inc/sfx2/docfac.hxx                  |    1 
 sfx2/source/control/dispatch.cxx          |   19 ++++--------
 svtools/inc/svtools/svparser.hxx          |    6 ++-
 svtools/source/config/fontsubstconfig.cxx |   47 ++++++++++++++----------------
 svtools/source/svrtf/svparser.cxx         |    9 +----
 sw/source/core/doc/doctxm.cxx             |   18 ++++-------
 7 files changed, 43 insertions(+), 65 deletions(-)

New commits:
commit 411d8c2dd1cb3a9a6dbd78f34852e46c6e80f904
Author: August Sodora <augsod at gmail.com>
Date:   Sat Jan 21 01:53:20 2012 -0500

    SV_DECL_PTRARR_DEL->boost::ptr_vector

diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx
index 7f9af4e..57ef122 100644
--- a/svtools/source/config/fontsubstconfig.cxx
+++ b/svtools/source/config/fontsubstconfig.cxx
@@ -26,17 +26,17 @@
  *
  ************************************************************************/
 
-
 #include <svtools/fontsubstconfig.hxx>
 #include <svl/svarray.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <tools/debug.hxx>
-
 #include <vcl/outdev.hxx>
 #include <rtl/logfile.hxx>
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 using namespace utl;
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
@@ -54,11 +54,8 @@ const sal_Char cSubstituteFont[]= "SubstituteFont";
 const sal_Char cOnScreenOnly[]  = "OnScreenOnly";
 const sal_Char cAlways[]        = "Always";
 
-//-----------------------------------------------------------------------------
-typedef SubstitutionStruct* SubstitutionStructPtr;
-SV_DECL_PTRARR_DEL(SubstitutionStructArr, SubstitutionStructPtr, 2, 2)
-SV_IMPL_PTRARR(SubstitutionStructArr, SubstitutionStructPtr);
-//-----------------------------------------------------------------------------
+typedef boost::ptr_vector<SubstitutionStruct> SubstitutionStructArr;
+
 struct SvtFontSubstConfig_Impl
 {
     SubstitutionStructArr   aSubstArr;
@@ -101,12 +98,12 @@ SvtFontSubstConfig::SvtFontSubstConfig() :
     nName = 0;
     for(nNode = 0; nNode < aNodeNames.getLength(); nNode++)
     {
-        SubstitutionStructPtr pInsert = new SubstitutionStruct;
+        SubstitutionStruct* pInsert = new SubstitutionStruct;
         pNodeValues[nName++] >>= pInsert->sFont;
         pNodeValues[nName++] >>= pInsert->sReplaceBy;
         pInsert->bReplaceAlways = *(sal_Bool*)pNodeValues[nName++].getValue();
         pInsert->bReplaceOnScreenOnly = *(sal_Bool*)pNodeValues[nName++].getValue();
-        pImpl->aSubstArr.Insert(pInsert, pImpl->aSubstArr.Count());
+        pImpl->aSubstArr.push_back(pInsert);
     }
 }
 
@@ -128,11 +125,11 @@ void SvtFontSubstConfig::Commit()
     PutProperties(aNames, aValues);
 
     OUString sNode(C2U(cFontPairs));
-    if(!pImpl->aSubstArr.Count())
+    if(pImpl->aSubstArr.empty())
         ClearNodeSet(sNode);
     else
     {
-        Sequence<PropertyValue> aSetValues(4 * pImpl->aSubstArr.Count());
+        Sequence<PropertyValue> aSetValues(4 * pImpl->aSubstArr.size());
         PropertyValue* pSetValues = aSetValues.getArray();
         sal_Int32 nSetValue = 0;
 
@@ -142,22 +139,22 @@ void SvtFontSubstConfig::Commit()
         const OUString sOnScreenOnly(C2U(cOnScreenOnly));
 
         const uno::Type& rBoolType = ::getBooleanCppuType();
-        for(sal_uInt16 i = 0; i < pImpl->aSubstArr.Count(); i++)
+        for(size_t i = 0; i < pImpl->aSubstArr.size(); i++)
         {
             OUString sPrefix(sNode);
             sPrefix += C2U("/_");
             sPrefix += OUString::valueOf((sal_Int32)i);
             sPrefix += C2U("/");
 
-            SubstitutionStructPtr pSubst = pImpl->aSubstArr[i];
+            SubstitutionStruct& pSubst = pImpl->aSubstArr[i];
             pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sReplaceFont;
-            pSetValues[nSetValue++].Value <<= pSubst->sFont;
+            pSetValues[nSetValue++].Value <<= pSubst.sFont;
             pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sSubstituteFont;
-            pSetValues[nSetValue++].Value <<= pSubst->sReplaceBy;
+            pSetValues[nSetValue++].Value <<= pSubst.sReplaceBy;
             pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sAlways;
-            pSetValues[nSetValue++].Value.setValue(&pSubst->bReplaceAlways, rBoolType);
+            pSetValues[nSetValue++].Value.setValue(&pSubst.bReplaceAlways, rBoolType);
             pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sOnScreenOnly;
-            pSetValues[nSetValue++].Value.setValue(&pSubst->bReplaceOnScreenOnly, rBoolType);
+            pSetValues[nSetValue++].Value.setValue(&pSubst.bReplaceOnScreenOnly, rBoolType);
         }
         ReplaceSetProperties(sNode, aSetValues);
     }
@@ -165,26 +162,26 @@ void SvtFontSubstConfig::Commit()
 
 sal_Int32 SvtFontSubstConfig::SubstitutionCount() const
 {
-    return pImpl->aSubstArr.Count();
+    return pImpl->aSubstArr.size();
 }
 
 void SvtFontSubstConfig::ClearSubstitutions()
 {
-    pImpl->aSubstArr.DeleteAndDestroy(0, pImpl->aSubstArr.Count());
+    pImpl->aSubstArr.clear();
 }
 
 const SubstitutionStruct* SvtFontSubstConfig::GetSubstitution(sal_Int32 nPos)
 {
-    DBG_ASSERT(nPos >= 0 && nPos < pImpl->aSubstArr.Count(), "illegal array index");
-    if(nPos >= 0 && nPos < pImpl->aSubstArr.Count())
-        return pImpl->aSubstArr[(sal_uInt16)nPos];
-    return 0;
+    sal_Int32 nCount = static_cast<sal_Int32>(pImpl->aSubstArr.size());
+    DBG_ASSERT(nPos >= 0 && nPos < nCount, "illegal array index");
+    if(nPos >= 0 && nPos < nCount)
+        return &pImpl->aSubstArr[nPos];
+    return NULL;
 }
 
 void SvtFontSubstConfig::AddSubstitution(const SubstitutionStruct& rToAdd)
 {
-    SubstitutionStructPtr pInsert = new SubstitutionStruct(rToAdd);
-    pImpl->aSubstArr.Insert(pInsert, pImpl->aSubstArr.Count());
+    pImpl->aSubstArr.push_back(new SubstitutionStruct(rToAdd));
 }
 
 void SvtFontSubstConfig::Apply()
commit cba8c3b64ef1fbd7c1454546d1de1fb0a9fe1ebd
Author: August Sodora <augsod at gmail.com>
Date:   Sat Jan 21 01:45:37 2012 -0500

    SV_DECL_PTRARR_DEL->boost::ptr_vector

diff --git a/svtools/inc/svtools/svparser.hxx b/svtools/inc/svtools/svparser.hxx
index 340236d..ad30216 100644
--- a/svtools/inc/svtools/svparser.hxx
+++ b/svtools/inc/svtools/svparser.hxx
@@ -34,10 +34,10 @@
 #include <tools/string.hxx>
 #include <tools/ref.hxx>
 #include <rtl/textenc.h>
+#include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/utility.hpp>
 #include <vector>
 
-
 struct SvParser_Impl;
 class SvStream;
 
@@ -256,7 +256,9 @@ public:
  * SvKeyValueIterator.
  *
  *======================================================================*/
-class SvKeyValueList_Impl;
+
+typedef boost::ptr_vector<SvKeyValue> SvKeyValueList_Impl;
+
 class SVT_DLLPUBLIC SvKeyValueIterator : public SvRefBase,
     private boost::noncopyable
 {
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 6cacb7f..ff3ef7b 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -667,8 +667,6 @@ IMPL_STATIC_LINK( SvParser, NewDataRead, void*, EMPTYARG )
  * SvKeyValueIterator.
  *
  *======================================================================*/
-SV_DECL_PTRARR_DEL(SvKeyValueList_Impl, SvKeyValue*, 0, 4)
-SV_IMPL_PTRARR(SvKeyValueList_Impl, SvKeyValue*);
 
 /*
  * SvKeyValueIterator.
@@ -692,7 +690,7 @@ SvKeyValueIterator::~SvKeyValueIterator (void)
  */
 sal_Bool SvKeyValueIterator::GetFirst (SvKeyValue &rKeyVal)
 {
-    m_nPos = m_pList->Count();
+    m_nPos = m_pList->size();
     return GetNext (rKeyVal);
 }
 
@@ -703,7 +701,7 @@ sal_Bool SvKeyValueIterator::GetNext (SvKeyValue &rKeyVal)
 {
     if (m_nPos > 0)
     {
-        rKeyVal = *m_pList->GetObject(--m_nPos);
+        rKeyVal = (*m_pList)[--m_nPos];
         return sal_True;
     }
     else
@@ -718,8 +716,7 @@ sal_Bool SvKeyValueIterator::GetNext (SvKeyValue &rKeyVal)
  */
 void SvKeyValueIterator::Append (const SvKeyValue &rKeyVal)
 {
-    SvKeyValue *pKeyVal = new SvKeyValue (rKeyVal);
-    m_pList->C40_INSERT(SvKeyValue, pKeyVal, m_pList->Count());
+    m_pList->push_back(new SvKeyValue(rKeyVal));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 528aba3a9cf91da5ce70c6d631d7b82e203f8086
Author: August Sodora <augsod at gmail.com>
Date:   Sat Jan 21 01:18:35 2012 -0500

    SV_DECL_PTRARR_DEL->boost::ptr_vector

diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 7b26105..5ad8d58 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -72,21 +72,17 @@
 #include <rtl/strbuf.hxx>
 
 #include <deque>
+#include <boost/ptr_container/ptr_vector.hpp>
 
 namespace css = ::com::sun::star;
 
-//==================================================================
 DBG_NAME(SfxDispatcherFlush)
 DBG_NAME(SfxDispatcherFillState)
 
-//==================================================================
-typedef SfxRequest* SfxRequestPtr;
-SV_IMPL_PTRARR( SfxItemPtrArray, SfxPoolItemPtr );
-SV_DECL_PTRARR_DEL( SfxRequestPtrArray, SfxRequestPtr, 4, 4 )
-SV_IMPL_PTRARR( SfxRequestPtrArray, SfxRequestPtr );
+typedef boost::ptr_vector<SfxRequest> SfxRequestPtrArray;
 
+SV_IMPL_PTRARR( SfxItemPtrArray, SfxPoolItemPtr );
 DECL_PTRSTACK(SfxShellStack_Impl, SfxShell*, 8, 4 );
-//==================================================================
 
 struct SfxToDo_Impl
 {
@@ -1264,7 +1260,7 @@ IMPL_LINK( SfxDispatcher, PostMsgHandler, SfxRequest*, pReq )
         else
         {
             if ( pImp->bLocked )
-                pImp->aReqArr.Insert( new SfxRequest(*pReq), pImp->aReqArr.Count() );
+                pImp->aReqArr.push_back(new SfxRequest(*pReq));
             else
                 pImp->xPoster->Post(new SfxRequest(*pReq));
         }
@@ -2176,10 +2172,9 @@ void SfxDispatcher::Lock( sal_Bool bLock )
     pImp->bLocked = bLock;
     if ( !bLock )
     {
-        sal_uInt16 nCount = pImp->aReqArr.Count();
-        for ( sal_uInt16 i=0; i<nCount; i++ )
-            pImp->xPoster->Post( pImp->aReqArr[i] );
-        pImp->aReqArr.Remove( 0, nCount );
+        for(size_t i = 0; i < pImp->aReqArr.size(); ++i)
+            pImp->xPoster->Post(&pImp->aReqArr[i]);
+        pImp->aReqArr.clear();
     }
 }
 
commit 8904dce9758a48d2d627ebd5d755f0c2105b9ba0
Author: August Sodora <augsod at gmail.com>
Date:   Sat Jan 21 01:11:20 2012 -0500

    Remove unused SV_DECL_PTRARR

diff --git a/sfx2/inc/arrdecl.hxx b/sfx2/inc/arrdecl.hxx
index 029eb89..904cc62 100644
--- a/sfx2/inc/arrdecl.hxx
+++ b/sfx2/inc/arrdecl.hxx
@@ -41,10 +41,6 @@ SV_DECL_PTRARR( SfxViewFrameArr_Impl, SfxViewFrame*, 4, 4 )
 class SfxViewShell;
 SV_DECL_PTRARR( SfxViewShellArr_Impl, SfxViewShell*, 4, 4 )
 
-class SfxObjectFactory;
-typedef SfxObjectFactory* SfxObjectFactoryPtr;
-SV_DECL_PTRARR( SfxObjectFactoryArr_Impl, SfxObjectFactoryPtr, 3, 3 )
-
 struct SfxTbxCtrlFactory;
 SV_DECL_PTRARR_DEL( SfxTbxCtrlFactArr_Impl, SfxTbxCtrlFactory*, 8, 4 )
 
diff --git a/sfx2/inc/sfx2/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx
index db27031..b60d759 100644
--- a/sfx2/inc/sfx2/docfac.hxx
+++ b/sfx2/inc/sfx2/docfac.hxx
@@ -41,7 +41,6 @@
 #include <sfx2/objsh.hxx>
 #include <sfx2/sfxdefs.hxx>
 
-class SfxObjectFactoryArr_Impl;
 class SfxMedium;
 class SfxFilter;
 class SfxViewFactory;
commit f057a76585e1f2b5f36631883155743a3b88f92e
Author: August Sodora <augsod at gmail.com>
Date:   Sat Jan 21 01:08:32 2012 -0500

    Remove unused SV_DECL_PTRARR

diff --git a/sfx2/inc/arrdecl.hxx b/sfx2/inc/arrdecl.hxx
index 2bbd34a..029eb89 100644
--- a/sfx2/inc/arrdecl.hxx
+++ b/sfx2/inc/arrdecl.hxx
@@ -69,10 +69,6 @@ SV_DECL_PTRARR( SfxFrameArr_Impl, SfxFramePtr, 4, 4 )
 
 typedef ::std::vector< SfxFilter* > SfxFilterList_Impl;
 
-struct SfxExternalLib_Impl;
-typedef SfxExternalLib_Impl* SfxExternalLibPtr;
-SV_DECL_PTRARR_DEL( SfxExternalLibArr_Impl, SfxExternalLibPtr, 2, 2 )
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5a37be04ba5fec4f201984ab6d539c312c30fddc
Author: August Sodora <augsod at gmail.com>
Date:   Sat Jan 21 00:44:46 2012 -0500

    SV_DECL_PTRARR->std::vector

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 23f0387..1aebb16 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -95,9 +95,7 @@ struct LinkStruct
         nEndTextPos(nEnd) {}
 };
 
-typedef LinkStruct* LinkStructPtr;
-SV_DECL_PTRARR(LinkStructArr, LinkStructPtr, 0, 5 )
-SV_IMPL_PTRARR(LinkStructArr, LinkStructPtr)
+typedef std::vector<LinkStruct*> LinkStructArr;
 
 sal_uInt16 SwDoc::GetTOIKeys( SwTOIKeyType eTyp, std::vector<String>& rArr ) const
 {
@@ -1816,7 +1814,7 @@ void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx,
                         pNewLink->aINetFmt.SetVisitedFmtId(USHRT_MAX);
                         pNewLink->aINetFmt.SetINetFmtId(USHRT_MAX);
                     }
-                    aLinkArr.Insert( pNewLink, aLinkArr.Count() );
+                    aLinkArr.push_back(pNewLink);
                     nLinkStartPosition = STRING_NOTFOUND;
                     sLinkCharacterStyle.Erase();
                 }
@@ -1854,13 +1852,11 @@ void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx,
         pTOXNd->SetAttr( aTStops );
     }
 
-    if(aLinkArr.Count())
-        for(sal_uInt16 i = 0; i < aLinkArr.Count(); ++i )
-        {
-            LinkStruct* pTmp = aLinkArr.GetObject(i);
-            pTOXNd->InsertItem( pTmp->aINetFmt, pTmp->nStartTextPos,
-                            pTmp->nEndTextPos);
-        }
+    for(LinkStructArr::const_iterator i = aLinkArr.begin(); i != aLinkArr.end(); ++i)
+    {
+        pTOXNd->InsertItem((*i)->aINetFmt, (*i)->nStartTextPos,
+                           (*i)->nEndTextPos);
+    }
 }
 
 /*--------------------------------------------------------------------


More information about the Libreoffice-commits mailing list