[Libreoffice-commits] core.git: sw/source

Takeshi Abe tabe at fixedpoint.jp
Mon Sep 1 06:19:30 PDT 2014


 sw/source/core/layout/laycache.cxx |    6 +++---
 sw/source/core/layout/layhelp.hxx  |   10 +++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit e62ec6d0499e6c517713e7d5b1855a9b2c518219
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Aug 28 11:21:59 2014 +0900

    fdo#75757: remove inheritance to std::vector
    
    from SwLayCacheImpl.
    
    Change-Id: I77520495aab1d6a572b25433396202b11e478636
    Reviewed-on: https://gerrit.libreoffice.org/11158
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 7a5ae59..14fe203 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -73,7 +73,7 @@ void SwLayoutCache::Read( SvStream &rStream )
 void SwLayCacheImpl::Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset )
 {
     aType.push_back( nType );
-    std::vector<sal_uLong>::push_back( nIndex );
+    mIndices.push_back( nIndex );
     aOffset.push_back( nOffset );
 }
 
@@ -486,7 +486,7 @@ SwLayHelper::SwLayHelper( SwDoc *pD, SwFrm* &rpF, SwFrm* &rpP, SwPageFrm* &rpPg,
                           ->GetIndex();
         nNodeIndex -= nStartOfContent;
         nIndex = 0;
-        while( nIndex < pImpl->size() && (*pImpl)[ nIndex ] < nNodeIndex )
+        while( nIndex < pImpl->size() && pImpl->GetBreakIndex( nIndex ) < nNodeIndex )
         {
             ++nIndex;
         }
@@ -881,7 +881,7 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
                 }
             }
         } while( bLongTab || ( pImpl && nIndex < pImpl->size() &&
-                 (*pImpl)[ nIndex ] == nNodeIndex ) );
+                 pImpl->GetBreakIndex( nIndex ) == nNodeIndex ) );
     }
     bFirst = false;
     return bRet;
diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx
index 493e409..306147f 100644
--- a/sw/source/core/layout/layhelp.hxx
+++ b/sw/source/core/layout/layhelp.hxx
@@ -49,8 +49,9 @@ class SvStream;
 class SwFlyCache;
 typedef boost::ptr_vector<SwFlyCache> SwPageFlyCache;
 
-class SwLayCacheImpl : public std::vector<sal_uLong>
+class SwLayCacheImpl
 {
+    std::vector<sal_uLong> mIndices;
     std::deque<sal_Int32> aOffset;
     std::vector<sal_uInt16> aType;
     SwPageFlyCache aFlyCache;
@@ -58,10 +59,13 @@ class SwLayCacheImpl : public std::vector<sal_uLong>
     void Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset );
 
 public:
-    SwLayCacheImpl() : bUseFlyCache(false) {}
+    SwLayCacheImpl() : mIndices(), aOffset(), aType(), aFlyCache(), bUseFlyCache(false) {}
+
+    size_t size() const { return mIndices.size(); }
+
     bool Read( SvStream& rStream );
 
-    sal_uLong GetBreakIndex( sal_uInt16 nIdx ) const { return std::vector<sal_uLong>::operator[]( nIdx ); }
+    sal_uLong GetBreakIndex( sal_uInt16 nIdx ) const { return mIndices[ nIdx ]; }
     sal_Int32 GetBreakOfst( size_t nIdx ) const { return aOffset[ nIdx ]; }
     sal_uInt16 GetBreakType( sal_uInt16 nIdx ) const { return aType[ nIdx ]; }
 


More information about the Libreoffice-commits mailing list