diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.hxx | 9 |
2 files changed, 21 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 422211a9abb3..a6db457c61e0 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2414,8 +2414,8 @@ void WW8PLCFx_Fc_FKP::WW8Fkp::FillEntry(WW8PLCFx_Fc_FKP::WW8Fkp::Entry &rEntry, WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(const WW8Fib& rFib, SvStream* pSt, SvStream* pDataSt, long _nFilePos, long nItemSiz, ePLCFT ePl, WW8_FC nStartFc) - : nItemSize(nItemSiz), nFilePos(_nFilePos), mnIdx(0), ePLCF(ePl) - , maSprmParser(rFib) + : nItemSize(nItemSiz), nFilePos(_nFilePos), mnIdx(0), ePLCF(ePl) + , mnMustRemainCached(0), maSprmParser(rFib) { memset(maRawData, 0, 512); @@ -2877,8 +2877,12 @@ bool WW8PLCFx_Fc_FKP::NewFkp() if (maFkpCache.size() > eMaxCache) { - delete maFkpCache.front(); - maFkpCache.pop_front(); + WW8Fkp* pCachedFkp = maFkpCache.front(); + if (!pCachedFkp->IsMustRemainCache()) + { + delete pCachedFkp; + maFkpCache.pop_front(); + } } } } @@ -5274,6 +5278,8 @@ void WW8PLCFx_Cp_FKP::SetIdx2( sal_uLong nIdx ) void WW8PLCFx_Cp_FKP::Save( WW8PLCFxSave1& rSave ) const { + if (pFkp) + pFkp->IncMustRemainCache(); WW8PLCFx::Save( rSave ); rSave.nAttrStart = nAttrStart; @@ -5288,6 +5294,9 @@ void WW8PLCFx_Cp_FKP::Restore( const WW8PLCFxSave1& rSave ) nAttrStart = rSave.nAttrStart; nAttrEnd = rSave.nAttrEnd; bLineEnd = rSave.bLineEnd; + + if (pFkp) + pFkp->DecMustRemainCache(); } void WW8PLCFxDesc::Save( WW8PLCFxSave1& rSave ) const diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 00ed18c625ce..2e7e1bca445b 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -525,6 +525,7 @@ public: sal_uInt8 mnIdx; // Pos marker ePLCFT ePLCF; sal_uInt8 mnIMax; // number of entries + int mnMustRemainCached; // after SaveAllPLCFx, before RestoreAllPLCFx wwSprmParser maSprmParser; @@ -565,13 +566,19 @@ public: void HasSprm(sal_uInt16 nId, std::vector<const sal_uInt8 *> &rResult); const wwSprmParser &GetSprmParser() const { return maSprmParser; } + + void IncMustRemainCache() { ++mnMustRemainCached; } + bool IsMustRemainCache() const { return mnMustRemainCached > 0; } + void DecMustRemainCache() { --mnMustRemainCached; } }; private: SvStream* pFKPStrm; // input file SvStream* pDataStrm; // input file WW8PLCF* pPLCF; +protected: WW8Fkp* pFkp; +private: /* Keep a cache of eMaxCache entries of previously seen pFkps, which @@ -587,7 +594,7 @@ private: */ typedef std::list<WW8Fkp*>::iterator myiter; std::list<WW8Fkp*> maFkpCache; - enum Limits {eMaxCache = 5}; + enum Limits {eMaxCache = 50000}; bool NewFkp(); |