Kaydet (Commit) e62ec6d0 authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) David Tardon

fdo#75757: remove inheritance to std::vector

from SwLayCacheImpl.

Change-Id: I77520495aab1d6a572b25433396202b11e478636
Reviewed-on: https://gerrit.libreoffice.org/11158Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst edf7c73d
...@@ -73,7 +73,7 @@ void SwLayoutCache::Read( SvStream &rStream ) ...@@ -73,7 +73,7 @@ void SwLayoutCache::Read( SvStream &rStream )
void SwLayCacheImpl::Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset ) void SwLayCacheImpl::Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset )
{ {
aType.push_back( nType ); aType.push_back( nType );
std::vector<sal_uLong>::push_back( nIndex ); mIndices.push_back( nIndex );
aOffset.push_back( nOffset ); aOffset.push_back( nOffset );
} }
...@@ -486,7 +486,7 @@ SwLayHelper::SwLayHelper( SwDoc *pD, SwFrm* &rpF, SwFrm* &rpP, SwPageFrm* &rpPg, ...@@ -486,7 +486,7 @@ SwLayHelper::SwLayHelper( SwDoc *pD, SwFrm* &rpF, SwFrm* &rpP, SwPageFrm* &rpPg,
->GetIndex(); ->GetIndex();
nNodeIndex -= nStartOfContent; nNodeIndex -= nStartOfContent;
nIndex = 0; nIndex = 0;
while( nIndex < pImpl->size() && (*pImpl)[ nIndex ] < nNodeIndex ) while( nIndex < pImpl->size() && pImpl->GetBreakIndex( nIndex ) < nNodeIndex )
{ {
++nIndex; ++nIndex;
} }
...@@ -881,7 +881,7 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex ) ...@@ -881,7 +881,7 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
} }
} }
} while( bLongTab || ( pImpl && nIndex < pImpl->size() && } while( bLongTab || ( pImpl && nIndex < pImpl->size() &&
(*pImpl)[ nIndex ] == nNodeIndex ) ); pImpl->GetBreakIndex( nIndex ) == nNodeIndex ) );
} }
bFirst = false; bFirst = false;
return bRet; return bRet;
......
...@@ -49,8 +49,9 @@ class SvStream; ...@@ -49,8 +49,9 @@ class SvStream;
class SwFlyCache; class SwFlyCache;
typedef boost::ptr_vector<SwFlyCache> SwPageFlyCache; 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::deque<sal_Int32> aOffset;
std::vector<sal_uInt16> aType; std::vector<sal_uInt16> aType;
SwPageFlyCache aFlyCache; SwPageFlyCache aFlyCache;
...@@ -58,10 +59,13 @@ class SwLayCacheImpl : public std::vector<sal_uLong> ...@@ -58,10 +59,13 @@ class SwLayCacheImpl : public std::vector<sal_uLong>
void Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset ); void Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset );
public: public:
SwLayCacheImpl() : bUseFlyCache(false) {} SwLayCacheImpl() : mIndices(), aOffset(), aType(), aFlyCache(), bUseFlyCache(false) {}
size_t size() const { return mIndices.size(); }
bool Read( SvStream& rStream ); 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_Int32 GetBreakOfst( size_t nIdx ) const { return aOffset[ nIdx ]; }
sal_uInt16 GetBreakType( sal_uInt16 nIdx ) const { return aType[ nIdx ]; } sal_uInt16 GetBreakType( sal_uInt16 nIdx ) const { return aType[ nIdx ]; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment