diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-07-06 09:40:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-06 13:45:13 +0200 |
commit | 741d0665da6eb77df708cbba2906041fb9a974f3 (patch) | |
tree | de3501b8216c37698bc6560b9ffde727a3fd2df8 /sw | |
parent | a5a3e82e99e7a60ec65c339dd0463af5c680cead (diff) |
ofz: fix leak
Change-Id: I4cb6f83d7c55f673f31a77efdbd65bcf1e00d741
Reviewed-on: https://gerrit.libreoffice.org/39630
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 26 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 97 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 46 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 20 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par4.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 50 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 54 |
8 files changed, 151 insertions, 156 deletions
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 82752a24f967..92564ddd4a3a 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -572,9 +572,9 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, paragraph mark as part of the paragraph text. */ WW8ReaderSave aSave(this); - m_pPlcxMan = new WW8PLCFMan(m_pSBase, eType, nStartCp, true); + m_xPlcxMan.reset(new WW8PLCFMan(m_pSBase, eType, nStartCp, true)); - WW8_CP nStart = m_pPlcxMan->Where(); + WW8_CP nStart = m_xPlcxMan->Where(); WW8_CP nNext, nStartReplace=0; bool bDoingSymbol = false; @@ -596,8 +596,8 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, nTextStart = nStartCp; // get position of next SPRM - bool bStartAttr = m_pPlcxMan->Get(&aRes); - m_nAktColl = m_pPlcxMan->GetColl(); + bool bStartAttr = m_xPlcxMan->Get(&aRes); + m_nAktColl = m_xPlcxMan->GetColl(); if (aRes.nSprmId) { if( bONLYnPicLocFc ) @@ -672,8 +672,8 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, } } - m_pPlcxMan->advance(); - nNext = m_pPlcxMan->Where(); + m_xPlcxMan->advance(); + nNext = m_xPlcxMan->Where(); const WW8_CP nEnd = ( nNext < nEndCp ) ? nNext : nEndCp; if (!bONLYnPicLocFc && nNext != nStart && nEnd >= nStartCp) @@ -766,7 +766,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, sal_uInt16 nTxBxS, sal_uInt16 nSequence) { // grab the TextBox-PLCF quickly - WW8PLCFspecial* pT = m_pPlcxMan ? m_pPlcxMan->GetTxbx() : nullptr; + WW8PLCFspecial* pT = m_xPlcxMan ? m_xPlcxMan->GetTxbx() : nullptr; if( !pT ) { OSL_ENSURE( false, "+where's the text graphic (1)?" ); @@ -816,7 +816,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, long nMinStartCp = rStartCp; long nMaxEndCp = rEndCp; // quickly grab the TextBox-Break-Deskriptor-PLCF - pT = m_pPlcxMan->GetTxbxBkd(); + pT = m_xPlcxMan->GetTxbxBkd(); if (!pT) // It can occur on occasion, Caolan return false; @@ -987,7 +987,7 @@ void SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj, SwFrameFormat* pFlyFormat = nullptr; sal_uLong nOld = m_pStrm->Tell(); - ManTypes eType = m_pPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX; + ManTypes eType = m_xPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX; rbEraseTextObj = false; @@ -1027,7 +1027,7 @@ void SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj, m_bEmbeddObj = true; // 1st look for OLE- or Graph-Indicator Sprms - WW8PLCFx_Cp_FKP* pChp = m_pPlcxMan->GetChpPLCF(); + WW8PLCFx_Cp_FKP* pChp = m_xPlcxMan->GetChpPLCF(); WW8PLCFxDesc aDesc; pChp->GetSprms( &aDesc ); WW8SprmIter aSprmIter(aDesc.pMemPos, aDesc.nSprmsLen, @@ -2442,11 +2442,11 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) ::SetProgressState(m_nProgress, m_pDocShell); // Update m_nDrawCpO = 0; - m_bDrawCpOValid = m_pWwFib->GetBaseCp(m_pPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX, &m_nDrawCpO); + m_bDrawCpOValid = m_pWwFib->GetBaseCp(m_xPlcxMan->GetManType() == MAN_HDFT ? MAN_TXBX_HDFT : MAN_TXBX, &m_nDrawCpO); GrafikCtor(); - WW8PLCFspecial* pPF = m_pPlcxMan->GetFdoa(); + WW8PLCFspecial* pPF = m_xPlcxMan->GetFdoa(); if( !pPF ) { OSL_ENSURE( false, "Where is the graphic (1) ?" ); @@ -2947,7 +2947,7 @@ SwFlyFrameFormat* SwWW8ImplReader::ConvertDrawTextToFly(SdrObject* &rpObject, // read in the text m_bTxbxFlySection = true; bool bJoined = ReadText(nStartCp, (nEndCp-nStartCp), - MAN_MAINTEXT == m_pPlcxMan->GetManType() ? + MAN_MAINTEXT == m_xPlcxMan->GetManType() ? MAN_TXBX : MAN_TXBX_HDFT); m_pWWZOrder->OutsideEscher(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 1567b40e4676..335f055be4d9 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1173,7 +1173,7 @@ SwFltStackEntry* SwWW8FltControlStack::SetAttr(const SwPosition& rPos, sal_uInt1 // Doing a textbox, and using the control stack only as a temporary // collection point for properties which will are not to be set into // the real document - if (rReader.m_pPlcxMan && rReader.m_pPlcxMan->GetDoingDrawTextBox()) + if (rReader.m_xPlcxMan && rReader.m_xPlcxMan->GetDoingDrawTextBox()) { size_t nCnt = size(); for (size_t i=0; i < nCnt; ++i) @@ -1967,7 +1967,7 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) : mpOldStck(pRdr->m_pCtrlStck), mpOldAnchorStck(pRdr->m_pAnchorStck), mpOldRedlines(pRdr->m_pRedlineStack), - mpOldPlcxMan(pRdr->m_pPlcxMan), + mxOldPlcxMan(pRdr->m_xPlcxMan), mpWFlyPara(pRdr->m_xWFlyPara.release()), mpSFlyPara(pRdr->m_xSFlyPara.release()), mpPreviousNumPaM(pRdr->m_pPreviousNumPaM), @@ -2007,13 +2007,13 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) : // Save the attribute manager: we need this as the newly created PLCFx Manager // access the same FKPs as the old one and their Start-End position changes. - if (pRdr->m_pPlcxMan) - pRdr->m_pPlcxMan->SaveAllPLCFx(maPLCFxSave); + if (pRdr->m_xPlcxMan) + pRdr->m_xPlcxMan->SaveAllPLCFx(maPLCFxSave); if (nStartCp != -1) { - pRdr->m_pPlcxMan = new WW8PLCFMan(pRdr->m_pSBase, - mpOldPlcxMan->GetManType(), nStartCp); + pRdr->m_xPlcxMan.reset(new WW8PLCFMan(pRdr->m_pSBase, + mxOldPlcxMan->GetManType(), nStartCp)); } maOldApos.push_back(false); @@ -2055,13 +2055,10 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr ) *pRdr->m_pPaM->GetPoint() = maTmpPos; - if (mpOldPlcxMan != pRdr->m_pPlcxMan) - { - delete pRdr->m_pPlcxMan; - pRdr->m_pPlcxMan = mpOldPlcxMan; - } - if (pRdr->m_pPlcxMan) - pRdr->m_pPlcxMan->RestoreAllPLCFx(maPLCFxSave); + if (mxOldPlcxMan != pRdr->m_xPlcxMan) + pRdr->m_xPlcxMan = mxOldPlcxMan; + if (pRdr->m_xPlcxMan) + pRdr->m_xPlcxMan->RestoreAllPLCFx(maPLCFxSave); pRdr->m_aApos.swap(maOldApos); pRdr->m_aFieldStack.swap(maOldFieldStack); } @@ -2085,7 +2082,7 @@ void SwWW8ImplReader::Read_HdFtFootnoteText( const SwNodeIndex* pSttIdx, */ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) { - WW8PLCFx_SubDoc* pSD = m_pPlcxMan->GetAtn(); + WW8PLCFx_SubDoc* pSD = m_xPlcxMan->GetAtn(); if (!pSD) return 0; @@ -2129,7 +2126,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) sal_uInt32 nDateTime = 0; - if (sal_uInt8 * pExtended = m_pPlcxMan->GetExtendedAtrds()) // Word < 2002 has no date data for comments + if (sal_uInt8 * pExtended = m_xPlcxMan->GetExtendedAtrds()) // Word < 2002 has no date data for comments { sal_uLong nIndex = pSD->GetIdx() & 0xFFFF; // Index is (stupidly) multiplexed for WW8PLCFx_SubDocs if (m_pWwFib->m_lcbAtrdExtra/18 > nIndex) @@ -2522,7 +2519,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) OSL_ENSURE(m_nInTable >= 0,"nInTable < 0!"); // TabRowEnd - bool bTableRowEnd = (m_pPlcxMan->HasParaSprm(m_bVer67 ? 25 : 0x2417).pSprm != nullptr); + bool bTableRowEnd = (m_xPlcxMan->HasParaSprm(m_bVer67 ? 25 : 0x2417).pSprm != nullptr); // Unfortunately, for every paragraph we need to check first whether // they contain a sprm 29 (0x261B), which starts an APO. @@ -2553,12 +2550,12 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) sal_uInt8 nCellLevel = 0; if (m_bVer67) - nCellLevel = int(nullptr != m_pPlcxMan->HasParaSprm(24).pSprm); + nCellLevel = int(nullptr != m_xPlcxMan->HasParaSprm(24).pSprm); else { - nCellLevel = int(nullptr != m_pPlcxMan->HasParaSprm(0x2416).pSprm); + nCellLevel = int(nullptr != m_xPlcxMan->HasParaSprm(0x2416).pSprm); if (!nCellLevel) - nCellLevel = int(nullptr != m_pPlcxMan->HasParaSprm(0x244B).pSprm); + nCellLevel = int(nullptr != m_xPlcxMan->HasParaSprm(0x244B).pSprm); } do { @@ -2567,12 +2564,12 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) if(nCellLevel && !m_bVer67) { WW8PLCFxSave1 aSave; - m_pPlcxMan->GetPap()->Save( aSave ); + m_xPlcxMan->GetPap()->Save( aSave ); rbReSync = true; - WW8PLCFx_Cp_FKP* pPap = m_pPlcxMan->GetPapPLCF(); + WW8PLCFx_Cp_FKP* pPap = m_xPlcxMan->GetPapPLCF(); WW8_CP nMyStartCp=nStartCp; - SprmResult aLevel = m_pPlcxMan->HasParaSprm(0x6649); + SprmResult aLevel = m_xPlcxMan->HasParaSprm(0x6649); if (aLevel.pSprm && aLevel.nRemainingData >= 1) nCellLevel = *aLevel.pSprm; @@ -2610,7 +2607,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) // be a multi-page one if necessary. pTabPos->bNoFly = true; } - m_pPlcxMan->GetPap()->Restore( aSave ); + m_xPlcxMan->GetPap()->Restore( aSave ); } // Then look if we are in an Apo @@ -2631,7 +2628,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) // Test for Anl (Numbering) and process all events in the right order if( m_bAnl && !bTableRowEnd ) { - SprmResult aSprm13 = m_pPlcxMan->HasParaSprm(13); + SprmResult aSprm13 = m_xPlcxMan->HasParaSprm(13); const sal_uInt8* pSprm13 = aSprm13.pSprm; if (pSprm13 && aSprm13.nRemainingData >= 1) { // Still Anl left? @@ -2674,7 +2671,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) if (bStartTab) { WW8PLCFxSave1 aSave; - m_pPlcxMan->GetPap()->Save( aSave ); + m_xPlcxMan->GetPap()->Save( aSave ); // Numbering for cell borders causes a crash -> no Anls in Tables if (m_bAnl) @@ -2694,7 +2691,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) // We need an ReSync after StartTable // (actually only if the Apo extends past a FKP border) rbReSync = true; - m_pPlcxMan->GetPap()->Restore( aSave ); + m_xPlcxMan->GetPap()->Restore( aSave ); } } } while (!m_bFootnoteEdn && (m_nInTable < nCellLevel)); @@ -3510,7 +3507,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) case 0x7: { bNewParaEnd = true; - WW8PLCFxDesc* pPap = m_pPlcxMan->GetPap(); + WW8PLCFxDesc* pPap = m_xPlcxMan->GetPap(); //The last paragraph of each cell is terminated by a special //paragraph mark called a cell mark. Following the cell mark //that ends the last cell of a table row, the table row is @@ -3635,7 +3632,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) set. I also think btw that the third byte of the 4 byte value is the level of the cell */ - WW8PLCFspecial* pTest = m_pPlcxMan->GetMagicTables(); + WW8PLCFspecial* pTest = m_xPlcxMan->GetMagicTables(); if (pTest && pTest->SeekPosExact(nPosCp+1+nCpOfs) && pTest->Where() == nPosCp+1+nCpOfs) { @@ -3687,7 +3684,7 @@ void SwWW8ImplReader::ProcessAktCollChange(WW8PLCFManResult& rRes, bool* pStartAttr, bool bCallProcessSpecial) { sal_uInt16 nOldColl = m_nAktColl; - m_nAktColl = m_pPlcxMan->GetColl(); + m_nAktColl = m_xPlcxMan->GetColl(); // Invalid Style-Id if (m_nAktColl >= m_vColl.size() || !m_vColl[m_nAktColl].m_pFormat || !m_vColl[m_nAktColl].m_bColl) @@ -3710,9 +3707,9 @@ void SwWW8ImplReader::ProcessAktCollChange(WW8PLCFManResult& rRes, { bool bReSync; // Frame/Table/Autonumbering List Level - bTabRowEnd = ProcessSpecial(bReSync, rRes.nAktCp+m_pPlcxMan->GetCpOfs()); + bTabRowEnd = ProcessSpecial(bReSync, rRes.nAktCp + m_xPlcxMan->GetCpOfs()); if( bReSync ) - *pStartAttr = m_pPlcxMan->Get( &rRes ); // Get Attribut-Pos again + *pStartAttr = m_xPlcxMan->Get( &rRes ); // Get Attribut-Pos again } if (!bTabRowEnd && StyleExists(m_nAktColl)) @@ -3730,7 +3727,7 @@ long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTextPos, long nTextEnd, bool& rbStar WW8PLCFManResult aRes; OSL_ENSURE(m_pPaM->GetNode().GetTextNode(), "Missing txtnode"); - bool bStartAttr = m_pPlcxMan->Get(&aRes); // Get Attribute position again + bool bStartAttr = m_xPlcxMan->Get(&aRes); // Get Attribute position again aRes.nAktCp = rTextPos; // Current Cp position bool bNewSection = (aRes.nFlags & MAN_MASK_NEW_SEP) && !m_bIgnoreText; @@ -3790,7 +3787,7 @@ long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTextPos, long nTextEnd, bool& rbStar } } - sal_Int32 nRequestedPos = m_pSBase->WW8Cp2Fc(m_pPlcxMan->GetCpOfs() + rTextPos, &m_bIsUnicode); + sal_Int32 nRequestedPos = m_pSBase->WW8Cp2Fc(m_xPlcxMan->GetCpOfs() + rTextPos, &m_bIsUnicode); bool bValidPos = checkSeek(*m_pStrm, nRequestedPos); SAL_WARN_IF(!bValidPos, "sw.ww8", "Document claimed to have text at an invalid position, skip attributes for region"); @@ -3805,8 +3802,8 @@ long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTextPos, long nTextEnd, bool& rbStar do { if( bDoPlcxManPlusPLus ) - m_pPlcxMan->advance(); - nNext = bValidPos ? m_pPlcxMan->Where() : nTextEnd; + m_xPlcxMan->advance(); + nNext = bValidPos ? m_xPlcxMan->Where() : nTextEnd; if (m_pPostProcessAttrsInfo && m_pPostProcessAttrsInfo->mnCpStart == nNext) @@ -3832,7 +3829,7 @@ long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTextPos, long nTextEnd, bool& rbStar if( nSkipChars ) { m_pCtrlStck->KillUnlockedAttrs( *m_pPaM->GetPoint() ); - if( nOldColl != m_pPlcxMan->GetColl() ) + if( nOldColl != m_xPlcxMan->GetColl() ) ProcessAktCollChange(aRes, nullptr, false); } @@ -3906,7 +3903,7 @@ void SwWW8ImplReader::CloseAttrEnds() // If there are any unclosed sprms then copy them to // another stack and close the ones that must be closed std::stack<sal_uInt16> aStack; - m_pPlcxMan->TransferOpenSprms(aStack); + m_xPlcxMan->TransferOpenSprms(aStack); while (!aStack.empty()) { @@ -3934,10 +3931,10 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType) m_bSpec = false; m_bPgSecBreak = false; - m_pPlcxMan = new WW8PLCFMan( m_pSBase, nType, nStartCp ); - long nCpOfs = m_pPlcxMan->GetCpOfs(); // Offset for Header/Footer, Footnote + m_xPlcxMan.reset(new WW8PLCFMan(m_pSBase, nType, nStartCp)); + long nCpOfs = m_xPlcxMan->GetCpOfs(); // Offset for Header/Footer, Footnote - WW8_CP nNext = m_pPlcxMan->Where(); + WW8_CP nNext = m_xPlcxMan->Where(); SwTextNode* pPreviousNode = nullptr; sal_uInt8 nDropLines = 0; SwCharFormat* pNewSwCharFormat = nullptr; @@ -4030,16 +4027,16 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType) SprmResult aDCS; if (m_bVer67) - aDCS = m_pPlcxMan->GetPapPLCF()->HasSprm(46); + aDCS = m_xPlcxMan->GetPapPLCF()->HasSprm(46); else - aDCS = m_pPlcxMan->GetPapPLCF()->HasSprm(0x442C); + aDCS = m_xPlcxMan->GetPapPLCF()->HasSprm(0x442C); if (aDCS.pSprm && aDCS.nRemainingData >= 1) nDropLines = (*aDCS.pSprm) >> 3; else // There is no Drop Cap Specifier hence no dropcap pPreviousNode = nullptr; - SprmResult aDistance = m_pPlcxMan->GetPapPLCF()->HasSprm(0x842F); + SprmResult aDistance = m_xPlcxMan->GetPapPLCF()->HasSprm(0x842F); if (aDistance.pSprm && aDistance.nRemainingData >= 2) nDistance = SVBT16ToShort(aDistance.pSprm); else @@ -4087,8 +4084,8 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType) // if it is there. WW8PLCFxDesc aTemp; aTemp.nStartPos = aTemp.nEndPos = WW8_CP_MAX; - if (m_pPlcxMan->GetSepPLCF()) - m_pPlcxMan->GetSepPLCF()->GetSprms(&aTemp); + if (m_xPlcxMan->GetSepPLCF()) + m_xPlcxMan->GetSepPLCF()->GetSprms(&aTemp); if ((aTemp.nStartPos != l) && (aTemp.nEndPos != l)) { // #i39251# - insert text node for page break, if no one inserted. @@ -4115,8 +4112,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType) CloseAttrEnds(); - delete m_pPlcxMan; - m_pPlcxMan = nullptr; + m_xPlcxMan.reset(); return bJoined; } @@ -4153,7 +4149,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage, , m_pWDop(nullptr) , m_pLstManager(nullptr) , m_pSBase(nullptr) - , m_pPlcxMan(nullptr) , m_aTextNodesHavingFirstLineOfstSet() , m_aTextNodesHavingLeftIndentSet() , m_pStyles(nullptr) @@ -6382,11 +6377,11 @@ bool SwMSDffManager::GetOLEStorageName(sal_uInt32 nOLEId, OUString& rStorageName { WW8PLCFxSaveAll aSave; memset( &aSave, 0, sizeof( aSave ) ); - rReader.m_pPlcxMan->SaveAllPLCFx( aSave ); + rReader.m_xPlcxMan->SaveAllPLCFx( aSave ); nStartCp += rReader.m_nDrawCpO; nEndCp += rReader.m_nDrawCpO; - WW8PLCFx_Cp_FKP* pChp = rReader.m_pPlcxMan->GetChpPLCF(); + WW8PLCFx_Cp_FKP* pChp = rReader.m_xPlcxMan->GetChpPLCF(); wwSprmParser aSprmParser(*rReader.m_pWwFib); while (nStartCp <= nEndCp && !nPictureId) { @@ -6421,7 +6416,7 @@ bool SwMSDffManager::GetOLEStorageName(sal_uInt32 nOLEId, OUString& rStorageName nStartCp = aDesc.nEndPos; } - rReader.m_pPlcxMan->RestoreAllPLCFx( aSave ); + rReader.m_xPlcxMan->RestoreAllPLCFx( aSave ); } } rReader.m_pStrm->Seek( nOldPos ); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index f64509bf1421..40933875eb73 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -583,7 +583,7 @@ private: SwWW8FltControlStack* mpOldStck; SwWW8FltAnchorStack* mpOldAnchorStck; sw::util::RedlineStack *mpOldRedlines; - WW8PLCFMan* mpOldPlcxMan; + std::shared_ptr<WW8PLCFMan> mxOldPlcxMan; WW8FlyPara* mpWFlyPara; WW8SwFlyPara* mpSFlyPara; SwPaM* mpPreviousNumPaM; @@ -1198,7 +1198,7 @@ private: WW8Dop* m_pWDop; WW8ListManager* m_pLstManager; WW8ScannerBase* m_pSBase; - WW8PLCFMan* m_pPlcxMan; + std::shared_ptr<WW8PLCFMan> m_xPlcxMan; std::map<short, OUString> m_aLinkStringMap; std::set<const SwNode*> m_aTextNodesHavingFirstLineOfstSet; // #i103711# diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index e86bdebe3718..d7c4da72d7f7 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -355,8 +355,8 @@ sal_uInt16 SwWW8ImplReader::End_Footnote() SwPosition aTmpPos( *m_pPaM->GetPoint() ); // remember old cursor position WW8PLCFxSaveAll aSave; - m_pPlcxMan->SaveAllPLCFx( aSave ); - WW8PLCFMan* pOldPlcxMan = m_pPlcxMan; + m_xPlcxMan->SaveAllPLCFx( aSave ); + std::shared_ptr<WW8PLCFMan> xOldPlcxMan = m_xPlcxMan; const SwNodeIndex* pSttIdx = static_cast<SwTextFootnote*>(pFN)->GetStartNode(); OSL_ENSURE(pSttIdx, "Problems creating footnote text"); @@ -406,8 +406,8 @@ sal_uInt16 SwWW8ImplReader::End_Footnote() *m_pPaM->GetPoint() = aTmpPos; // restore Cursor - m_pPlcxMan = pOldPlcxMan; // Restore attributes - m_pPlcxMan->RestoreAllPLCFx( aSave ); + m_xPlcxMan = xOldPlcxMan; // Restore attributes + m_xPlcxMan->RestoreAllPLCFx( aSave ); } if (bFtEdOk) @@ -434,14 +434,14 @@ long SwWW8ImplReader::Read_Footnote(WW8PLCFManResult* pRes) if (eEDN == pRes->nSprmId) { aDesc.meType = MAN_EDN; - if (m_pPlcxMan->GetEdn()) - aDesc.mbAutoNum = 0 != *static_cast<short const *>(m_pPlcxMan->GetEdn()->GetData()); + if (m_xPlcxMan->GetEdn()) + aDesc.mbAutoNum = 0 != *static_cast<short const *>(m_xPlcxMan->GetEdn()->GetData()); } else { aDesc.meType = MAN_FTN; - if (m_pPlcxMan->GetFootnote()) - aDesc.mbAutoNum = 0 != *static_cast<short const *>(m_pPlcxMan->GetFootnote()->GetData()); + if (m_xPlcxMan->GetFootnote()) + aDesc.mbAutoNum = 0 != *static_cast<short const *>(m_xPlcxMan->GetFootnote()->GetData()); } aDesc.mnStartCp = pRes->nCp2OrIdx; @@ -554,7 +554,7 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd, ApoTestResults aRet; // Frame in Style Definition (word appears to ignore them if inside an // text autoshape) - sal_uInt16 const nStyle(m_pPlcxMan->GetColl()); + sal_uInt16 const nStyle(m_xPlcxMan->GetColl()); if (!m_bTxbxFlySection && nStyle < m_vColl.size()) aRet.mpStyleApo = StyleExists(nStyle) ? m_vColl[nStyle].m_xWWFly.get() : nullptr; @@ -577,8 +577,8 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd, to see if we are still in that frame. */ - aRet.m_bHasSprm37 = m_pPlcxMan->HasParaSprm(m_bVer67 ? 37 : 0x2423).pSprm != nullptr; - SprmResult aSrpm29 = m_pPlcxMan->HasParaSprm(m_bVer67 ? 29 : 0x261B); + aRet.m_bHasSprm37 = m_xPlcxMan->HasParaSprm(m_bVer67 ? 37 : 0x2423).pSprm != nullptr; + SprmResult aSrpm29 = m_xPlcxMan->HasParaSprm(m_bVer67 ? 29 : 0x261B); const sal_uInt8 *pSrpm29 = aSrpm29.pSprm; aRet.m_bHasSprm29 = pSrpm29 != nullptr; aRet.m_nSprm29 = (pSrpm29 && aSrpm29.nRemainingData >= 1) ? *pSrpm29 : 0; @@ -1054,7 +1054,7 @@ void SwWW8ImplReader::StartAnl(const sal_uInt8* pSprm13) else { // this is ROW numbering ? - aS12 = m_pPlcxMan->HasParaSprm(m_bVer67 ? 12 : NS_sprm::LN_PAnld); // sprmAnld + aS12 = m_xPlcxMan->HasParaSprm(m_bVer67 ? 12 : NS_sprm::LN_PAnld); // sprmAnld if (aS12.pSprm && aS12.nRemainingData >= sal_Int32(sizeof(WW8_ANLD)) && 0 != reinterpret_cast<WW8_ANLD const *>(aS12.pSprm)->fNumberAcross) sNumRule.clear(); } @@ -1082,7 +1082,7 @@ void SwWW8ImplReader::StartAnl(const sal_uInt8* pSprm13) if (m_pTableDesc) { if (!aS12.pSprm) - aS12 = m_pPlcxMan->HasParaSprm(m_bVer67 ? 12 : NS_sprm::LN_PAnld); // sprmAnld + aS12 = m_xPlcxMan->HasParaSprm(m_bVer67 ? 12 : NS_sprm::LN_PAnld); // sprmAnld if (!aS12.pSprm || aS12.nRemainingData < sal_Int32(sizeof(WW8_ANLD)) || !reinterpret_cast<WW8_ANLD const *>(aS12.pSprm)->fNumberAcross) m_pTableDesc->SetNumRuleName(pNumRule->GetName()); } @@ -1117,7 +1117,7 @@ void SwWW8ImplReader::NextAnlLine(const sal_uInt8* pSprm13) { // not defined yet // sprmAnld o. 0 - SprmResult aS12 = m_pPlcxMan->HasParaSprm(m_bVer67 ? 12 : NS_sprm::LN_PAnld); + SprmResult aS12 = m_xPlcxMan->HasParaSprm(m_bVer67 ? 12 : NS_sprm::LN_PAnld); if (aS12.nRemainingData >= sal_Int32(sizeof(WW8_ANLD))) SetAnld(pNumRule, reinterpret_cast<WW8_ANLD const *>(aS12.pSprm), m_nSwNumLevel, false); } @@ -1142,7 +1142,7 @@ void SwWW8ImplReader::NextAnlLine(const sal_uInt8* pSprm13) else // no Olst -> use Anld { // sprmAnld - SprmResult aS12 = m_pPlcxMan->HasParaSprm(m_bVer67 ? 12 : NS_sprm::LN_PAnld); + SprmResult aS12 = m_xPlcxMan->HasParaSprm(m_bVer67 ? 12 : NS_sprm::LN_PAnld); if (aS12.nRemainingData >= sal_Int32(sizeof(WW8_ANLD))) SetAnld(pNumRule, reinterpret_cast<WW8_ANLD const *>(aS12.pSprm), m_nSwNumLevel, false); } @@ -1872,9 +1872,9 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) : WW8_TablePos aTabPos; WW8PLCFxSave1 aSave; - m_pIo->m_pPlcxMan->GetPap()->Save( aSave ); + m_pIo->m_xPlcxMan->GetPap()->Save( aSave ); - WW8PLCFx_Cp_FKP* pPap = m_pIo->m_pPlcxMan->GetPapPLCF(); + WW8PLCFx_Cp_FKP* pPap = m_pIo->m_xPlcxMan->GetPapPLCF(); m_eOri = text::HoriOrientation::LEFT; @@ -2113,8 +2113,8 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) : // PlcxMan currently points too far ahead so we need to bring // it back to where we are trying to make a table - m_pIo->m_pPlcxMan->GetPap()->nOrigStartPos = aRes.nStartPos; - m_pIo->m_pPlcxMan->GetPap()->nCpOfs = aRes.nCpOfs; + m_pIo->m_xPlcxMan->GetPap()->nOrigStartPos = aRes.nStartPos; + m_pIo->m_xPlcxMan->GetPap()->nCpOfs = aRes.nCpOfs; if (!(pPap->SeekPos(aRes.nStartPos))) { aRes.nEndPos = WW8_CP_MAX; @@ -2166,7 +2166,7 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) : } delete pNewBand; - m_pIo->m_pPlcxMan->GetPap()->Restore( aSave ); + m_pIo->m_xPlcxMan->GetPap()->Restore( aSave ); } WW8TabDesc::~WW8TabDesc() @@ -3490,15 +3490,15 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp) WW8_TablePos* pNestedTabPos( nullptr ); WW8_TablePos aNestedTabPos; WW8PLCFxSave1 aSave; - m_pPlcxMan->GetPap()->Save( aSave ); - WW8PLCFx_Cp_FKP* pPap = m_pPlcxMan->GetPapPLCF(); + m_xPlcxMan->GetPap()->Save( aSave ); + WW8PLCFx_Cp_FKP* pPap = m_xPlcxMan->GetPapPLCF(); WW8_CP nMyStartCp = nStartCp; if ( SearchRowEnd( pPap, nMyStartCp, m_nInTable ) && ParseTabPos( &aNestedTabPos, pPap ) ) { pNestedTabPos = &aNestedTabPos; } - m_pPlcxMan->GetPap()->Restore( aSave ); + m_xPlcxMan->GetPap()->Restore( aSave ); if ( pNestedTabPos ) { ApoTestResults aApo = TestApo( m_nInTable + 1, false, pNestedTabPos ); diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 28368e8dae7f..ff970a225727 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -124,7 +124,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr ) } else { - WW8PLCFx_Book* pB = m_pPlcxMan->GetBook(); + WW8PLCFx_Book* pB = m_xPlcxMan->GetBook(); OUString aBookmarkName; if (pB!=nullptr) { WW8_CP currentCP=pF->nSCode; @@ -176,7 +176,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, OUString& rStr ) } OUString aBookmarkName; - WW8PLCFx_Book* pB = m_pPlcxMan->GetBook(); + WW8PLCFx_Book* pB = m_xPlcxMan->GetBook(); if (pB!=nullptr) { WW8_CP currentCP=pF->nSCode; WW8_CP currentLen=pF->nLen; @@ -248,7 +248,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, OUString& rStr) { // TODO: review me OUString aBookmarkName; - WW8PLCFx_Book* pB = m_pPlcxMan->GetBook(); + WW8PLCFx_Book* pB = m_xPlcxMan->GetBook(); if (pB!=nullptr) { WW8_CP currentCP=pF->nSCode; @@ -1901,7 +1901,7 @@ void SwWW8ImplReader::RegisterNumFormat(sal_uInt16 nActLFO, sal_uInt8 nActLevel) void SwWW8ImplReader::Read_ListLevel(sal_uInt16, const sal_uInt8* pData, short nLen) { - if (m_pPlcxMan && m_pPlcxMan->GetDoingDrawTextBox()) + if (m_xPlcxMan && m_xPlcxMan->GetDoingDrawTextBox()) return; if( nLen < 0 ) @@ -1949,7 +1949,7 @@ void SwWW8ImplReader::Read_ListLevel(sal_uInt16, const sal_uInt8* pData, void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData, short nLen) { - if (m_pPlcxMan && m_pPlcxMan->GetDoingDrawTextBox()) + if (m_xPlcxMan && m_xPlcxMan->GetDoingDrawTextBox()) return; if( nLen < 0 ) @@ -2042,7 +2042,7 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData, m_nListLevel = WW8ListManager::nMaxLevel; } } - else if (m_pPlcxMan && m_pPlcxMan->HasParaSprm(NS_sprm::LN_PAnld).pSprm) + else if (m_xPlcxMan && m_xPlcxMan->HasParaSprm(NS_sprm::LN_PAnld).pSprm) { /* #i8114# Horrific backwards compatible ww7- lists in ww8+ @@ -2071,10 +2071,10 @@ bool SwWW8ImplReader::ImportFormulaControl(WW8FormulaControl &aFormula, WW8ReaderSave aSave(this,nStart); WW8PLCFManResult aRes; - nStart = m_pPlcxMan->Where(); + nStart = m_xPlcxMan->Where(); while(nStart <= nEndCp) { - if ( m_pPlcxMan->Get(&aRes) + if ( m_xPlcxMan->Get(&aRes) && aRes.pMemPos && aRes.nSprmId ) { //only interested in sprms which would set nPicLocFc @@ -2085,8 +2085,8 @@ bool SwWW8ImplReader::ImportFormulaControl(WW8FormulaControl &aFormula, break; } } - m_pPlcxMan->advance(); - nStart = m_pPlcxMan->Where(); + m_xPlcxMan->advance(); + nStart = m_xPlcxMan->Where(); } sal_uLong nOffset = m_nPicLocFc; aSave.Restore(this); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 4a859a7a09fb..8cd1dc4836de 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -471,7 +471,7 @@ void SwWW8ImplReader::Read_CRevisionMark(RedlineType_t eType, { // there *must* be a SprmCIbstRMark[Del] and a SprmCDttmRMark[Del] // pointing to the very same char position as our SprmCFRMark[Del] - if (!m_pPlcxMan) + if (!m_xPlcxMan) return; const sal_uInt8* pSprmCIbstRMark; const sal_uInt8* pSprmCDttmRMark; @@ -490,18 +490,18 @@ void SwWW8ImplReader::Read_CRevisionMark(RedlineType_t eType, bool bIns = (nsRedlineType_t::REDLINE_INSERT == eType); if( m_bVer67 ) { - m_pPlcxMan->HasCharSprm(69, aResult); + m_xPlcxMan->HasCharSprm(69, aResult); pSprmCIbstRMark = (aResult.empty() || aResult.back().nRemainingData < 2) ? nullptr : aResult.back().pSprm; aResult.clear(); - m_pPlcxMan->HasCharSprm(70, aResult); + m_xPlcxMan->HasCharSprm(70, aResult); pSprmCDttmRMark = (aResult.empty() || aResult.back().nRemainingData < 4) ? nullptr : aResult.back().pSprm; } else { - m_pPlcxMan->HasCharSprm( bIns ? 0x4804 : 0x4863, aResult); + m_xPlcxMan->HasCharSprm( bIns ? 0x4804 : 0x4863, aResult); pSprmCIbstRMark = (aResult.empty() || aResult.back().nRemainingData < 2) ? nullptr : aResult.back().pSprm; aResult.clear(); - m_pPlcxMan->HasCharSprm( bIns ? 0x6805 : NS_sprm::sprmCDttmRMarkDel, aResult); + m_xPlcxMan->HasCharSprm( bIns ? 0x6805 : NS_sprm::sprmCDttmRMarkDel, aResult); pSprmCDttmRMark = (aResult.empty() || aResult.back().nRemainingData < 4) ? nullptr : aResult.back().pSprm; } } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 95ce60bf6f69..64c61713168b 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -121,7 +121,7 @@ namespace long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) { // should also work via pRes.nCo2OrIdx - WW8PLCFx_Book* pB = m_pPlcxMan->GetBook(); + WW8PLCFx_Book* pB = m_xPlcxMan->GetBook(); if( !pB ) { OSL_ENSURE( pB, "WW8PLCFx_Book - Pointer does not exist" ); @@ -236,7 +236,7 @@ long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) long SwWW8ImplReader::Read_AtnBook(WW8PLCFManResult*) { - if (WW8PLCFx_AtnBook* pAtnBook = m_pPlcxMan->GetAtnBook()) + if (WW8PLCFx_AtnBook* pAtnBook = m_xPlcxMan->GetAtnBook()) { if (pAtnBook->getIsEnd()) m_pReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_ANNOTATIONMARK, true, pAtnBook->getHandle()); @@ -248,7 +248,7 @@ long SwWW8ImplReader::Read_AtnBook(WW8PLCFManResult*) long SwWW8ImplReader::Read_FactoidBook(WW8PLCFManResult*) { - if (WW8PLCFx_FactoidBook* pFactoidBook = m_pPlcxMan->GetFactoidBook()) + if (WW8PLCFx_FactoidBook* pFactoidBook = m_xPlcxMan->GetFactoidBook()) { if (pFactoidBook->getIsEnd()) m_pReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_RDFMARK, true, pFactoidBook->getHandle()); @@ -434,9 +434,9 @@ short SwWW8ImplReader::GetTimeDatePara(OUString& rStr, sal_uInt32& rFormat, LanguageType &rLang, int nWhichDefault, bool bHijri) { bool bRTL = false; - if (m_pPlcxMan && !m_bVer67) + if (m_xPlcxMan && !m_bVer67) { - SprmResult aResult = m_pPlcxMan->HasCharSprm(0x85A); + SprmResult aResult = m_xPlcxMan->HasCharSprm(0x85A); if (aResult.pSprm && aResult.nRemainingData >= 1 && *aResult.pSprm) bRTL = true; } @@ -506,7 +506,7 @@ void SwWW8ImplReader::UpdateFields() sal_uInt16 SwWW8ImplReader::End_Field() { sal_uInt16 nRet = 0; - WW8PLCFx_FLD* pF = m_pPlcxMan->GetField(); + WW8PLCFx_FLD* pF = m_xPlcxMan->GetField(); OSL_ENSURE(pF, "WW8PLCFx_FLD - Pointer not available"); WW8_CP nCP = 0; if (!pF || !pF->EndPosIsFieldEnd(nCP)) @@ -838,7 +838,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) }; OSL_ENSURE( SAL_N_ELEMENTS( aWW8FieldTab ) == eMax+1, "FeldFunc-Table not right" ); - WW8PLCFx_FLD* pF = m_pPlcxMan->GetField(); + WW8PLCFx_FLD* pF = m_xPlcxMan->GetField(); OSL_ENSURE(pF, "WW8PLCFx_FLD - Pointer not available"); if (!pF || !pF->StartPosIsFieldStart()) @@ -894,7 +894,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) } //Only one type of field (hyperlink) in drawing textboxes exists - if (aF.nId != 88 && m_pPlcxMan->GetDoingDrawTextBox()) + if (aF.nId != 88 && m_xPlcxMan->GetDoingDrawTextBox()) return aF.nLen; bool bHasHandler = aWW8FieldTab[aF.nId] != nullptr; @@ -904,7 +904,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) bHasHandler = false; sal_uInt64 nOldPos = m_pStrm->Tell(); OUString aStr; - aF.nLCode = m_pSBase->WW8ReadString(*m_pStrm, aStr, m_pPlcxMan->GetCpOfs() + aF.nSCode, aF.nLCode, m_eTextCharSet); + aF.nLCode = m_pSBase->WW8ReadString(*m_pStrm, aStr, m_xPlcxMan->GetCpOfs() + aF.nSCode, aF.nLCode, m_eTextCharSet); m_pStrm->Seek(nOldPos); WW8ReadFieldParams aReadParam(aStr); @@ -933,7 +933,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) long nOldPos = m_pStrm->Tell(); OUString aStr; - aF.nLCode = m_pSBase->WW8ReadString( *m_pStrm, aStr, m_pPlcxMan->GetCpOfs()+ + aF.nLCode = m_pSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs()+ aF.nSCode, aF.nLCode, m_eTextCharSet ); m_pStrm->Seek( nOldPos ); @@ -967,12 +967,12 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) if ( aF.nId == 6 && aF.bCodeNest ) { // TODO Extract the whole code string using the nested codes - aF.nLCode = m_pSBase->WW8ReadString( *m_pStrm, aStr, m_pPlcxMan->GetCpOfs() + + aF.nLCode = m_pSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs() + aF.nSCode, aF.nSRes - aF.nSCode - 1, m_eTextCharSet ); } else { - aF.nLCode = m_pSBase->WW8ReadString( *m_pStrm, aStr, m_pPlcxMan->GetCpOfs()+ + aF.nLCode = m_pSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs()+ aF.nSCode, aF.nLCode, m_eTextCharSet ); } @@ -1118,7 +1118,7 @@ long SwWW8ImplReader::Read_F_Tag( WW8FieldDesc* pF ) // max. 4 times as big OUString sFText; m_pSBase->WW8ReadString( *m_pStrm, sFText, - m_pPlcxMan->GetCpOfs() + nStart, nL, m_eStructCharSet); + m_xPlcxMan->GetCpOfs() + nStart, nL, m_eStructCharSet); OUString aTagText; MakeTagString( aTagText, sFText ); @@ -1181,7 +1181,7 @@ OUString SwWW8ImplReader::GetFieldResult( WW8FieldDesc* pF ) // max. 4 times as big OUString sRes; - m_pSBase->WW8ReadString( *m_pStrm, sRes, m_pPlcxMan->GetCpOfs() + nStart, + m_pSBase->WW8ReadString( *m_pStrm, sRes, m_xPlcxMan->GetCpOfs() + nStart, nL, m_eStructCharSet ); m_pStrm->Seek( nOldPos ); @@ -1232,26 +1232,26 @@ the appropriate set/ask field. long SwWW8ImplReader::MapBookmarkVariables(const WW8FieldDesc* pF, OUString &rOrigName, const OUString &rData) { - OSL_ENSURE(m_pPlcxMan,"No pPlcxMan"); + OSL_ENSURE(m_xPlcxMan.get(), "No pPlcxMan"); long nNo; /* If there was no bookmark associated with this set field, then we create a pseudo one and insert it in the document. */ sal_uInt16 nIndex; - m_pPlcxMan->GetBook()->MapName(rOrigName); - OUString sName = m_pPlcxMan->GetBook()->GetBookmark( + m_xPlcxMan->GetBook()->MapName(rOrigName); + OUString sName = m_xPlcxMan->GetBook()->GetBookmark( pF->nSCode, pF->nSCode + pF->nLen, nIndex); if (!sName.isEmpty()) { - m_pPlcxMan->GetBook()->SetStatus(nIndex, BOOK_IGNORE); + m_xPlcxMan->GetBook()->SetStatus(nIndex, BOOK_IGNORE); nNo = nIndex; } else { nNo = m_pReffingStck->aFieldVarNames.size()+1; sName = "WWSetBkmk" + OUString::number(nNo); - nNo += m_pPlcxMan->GetBook()->GetIMax(); + nNo += m_xPlcxMan->GetBook()->GetIMax(); } m_pReffedStck->NewAttr(*m_pPaM->GetPoint(), SwFltBookmark( BookmarkToWriter(sName), rData, nNo )); @@ -1295,8 +1295,8 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pField, OUString SwWW8ImplReader::GetMappedBookmark(const OUString &rOrigName) { OUString sName(BookmarkToWriter(rOrigName)); - OSL_ENSURE(m_pPlcxMan,"no pPlcxMan"); - m_pPlcxMan->GetBook()->MapName(sName); + OSL_ENSURE(m_xPlcxMan.get(), "no pPlcxMan"); + m_xPlcxMan->GetBook()->MapName(sName); //See if there has been a variable set with this name, if so get //the pseudo bookmark name that was set with it. @@ -2259,7 +2259,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, OUString& rStr) { m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); - WW8_CP nOldCp = m_pPlcxMan->Where(); + WW8_CP nOldCp = m_xPlcxMan->Where(); WW8_CP nCp = nOldCp + nOffset; SwPaM aPaM(*m_pPaM, m_pPaM); @@ -2514,7 +2514,7 @@ eF_ResT SwWW8ImplReader::Read_F_DBField( WW8FieldDesc* pF, OUString& rStr ) aField.SetFieldCode( rStr ); OUString aResult; - m_pSBase->WW8ReadString( *m_pStrm, aResult, m_pPlcxMan->GetCpOfs()+ + m_pSBase->WW8ReadString( *m_pStrm, aResult, m_xPlcxMan->GetCpOfs()+ pF->nSRes, pF->nLRes, m_eTextCharSet ); aResult = aResult.replace( '\xb', '\n' ); @@ -3610,7 +3610,7 @@ void SwWW8ImplReader::ImportTox( int nFieldId, const OUString& aStr ) void SwWW8ImplReader::Read_FieldVanish( sal_uInt16, const sal_uInt8*, short nLen ) { //Meaningless in a style - if (m_pAktColl || !m_pPlcxMan) + if (m_pAktColl || !m_xPlcxMan) return; const int nChunk = 64; //number of characters to read at one time @@ -3634,7 +3634,7 @@ void SwWW8ImplReader::Read_FieldVanish( sal_uInt16, const sal_uInt8*, short nLen m_bIgnoreText = true; long nOldPos = m_pStrm->Tell(); - WW8_CP nStartCp = m_pPlcxMan->Where() + m_pPlcxMan->GetCpOfs(); + WW8_CP nStartCp = m_xPlcxMan->Where() + m_xPlcxMan->GetCpOfs(); OUString sFieldName; sal_Int32 nFieldLen = m_pSBase->WW8ReadString( *m_pStrm, sFieldName, nStartCp, diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index bc244fe62acb..a428746f0132 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -795,7 +795,7 @@ void wwSectionManager::CreateSep(const long nTextPos) if (mrReader.m_nInTable || mrReader.m_bTxbxFlySection || mrReader.InLocalApo()) return; - WW8PLCFx_SEPX* pSep = mrReader.m_pPlcxMan->GetSepPLCF(); + WW8PLCFx_SEPX* pSep = mrReader.m_xPlcxMan->GetSepPLCF(); OSL_ENSURE(pSep, "impossible!"); if (!pSep) return; @@ -816,7 +816,7 @@ void wwSectionManager::CreateSep(const long nTextPos) // M.M. Create a linked section if the WkbPLCF // has an entry for one at this cp - WW8PLCFspecial* pWkb = mrReader.m_pPlcxMan->GetWkbPLCF(); + WW8PLCFspecial* pWkb = mrReader.m_xPlcxMan->GetWkbPLCF(); if (pWkb && pWkb->SeekPosExact(nTextPos) && pWkb->Where() == nTextPos) { @@ -1644,8 +1644,8 @@ void WW8FlyPara::Read(sal_uInt8 nOrigSp29, WW8PLCFx_Cp_FKP* pPap) void WW8FlyPara::ReadFull(sal_uInt8 nOrigSp29, SwWW8ImplReader* pIo) { - WW8PLCFMan* pPlcxMan = pIo->m_pPlcxMan; - WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF(); + std::shared_ptr<WW8PLCFMan> xPlcxMan = pIo->m_xPlcxMan; + WW8PLCFx_Cp_FKP* pPap = xPlcxMan->GetPapPLCF(); Read(nOrigSp29, pPap); // read Apo parameter @@ -1658,7 +1658,7 @@ void WW8FlyPara::ReadFull(sal_uInt8 nOrigSp29, SwWW8ImplReader* pIo) SvStream* pIoStrm = pIo->m_pStrm; sal_uLong nPos = pIoStrm->Tell(); WW8PLCFxSave1 aSave; - pPlcxMan->GetPap()->Save( aSave ); + xPlcxMan->GetPap()->Save( aSave ); bGrafApo = false; do{ // block for quick exit @@ -1702,7 +1702,7 @@ void WW8FlyPara::ReadFull(sal_uInt8 nOrigSp29, SwWW8ImplReader* pIo) } while( false ); // block for quick exit - pPlcxMan->GetPap()->Restore( aSave ); + xPlcxMan->GetPap()->Restore( aSave ); pIoStrm->Seek( nPos ); }while( false ); // block for quick exit } @@ -1787,7 +1787,7 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM, eSurround = ( rWW.nSp37 > 1 ) ? css::text::WrapTextMode_DYNAMIC : css::text::WrapTextMode_NONE; //#i119466 mapping "Around" wrap setting to "Parallel" for table - const bool bIsTable = rIo.m_pPlcxMan->HasParaSprm(0x2416).pSprm; + const bool bIsTable = rIo.m_xPlcxMan->HasParaSprm(0x2416).pSprm; if (bIsTable && rWW.nSp37 == 2) eSurround = css::text::WrapTextMode_PARALLEL; @@ -2309,14 +2309,14 @@ bool SwWW8ImplReader::IsDropCap() // Find the DCS (Drop Cap Specifier) for the paragraph // if does not exist or if the first three bits are 0 // then there is no dropcap on the paragraph - WW8PLCFx_Cp_FKP *pPap = m_pPlcxMan ? m_pPlcxMan->GetPapPLCF() : nullptr; + WW8PLCFx_Cp_FKP *pPap = m_xPlcxMan ? m_xPlcxMan->GetPapPLCF() : nullptr; if (pPap) { SprmResult aDCS; if (m_bVer67) aDCS = pPap->HasSprm(46); else - aDCS = m_pPlcxMan->GetPapPLCF()->HasSprm(0x442C); + aDCS = m_xPlcxMan->GetPapPLCF()->HasSprm(0x442C); if (aDCS.pSprm && aDCS.nRemainingData >= 2) { /* @@ -2621,7 +2621,7 @@ bool SwWW8ImplReader::TestSameApo(const ApoTestResults &rApo, WW8FlyPara aF(m_bVer67, rApo.mpStyleApo); // WWPara for current para if (rApo.HasFrame()) - aF.Read(rApo.m_nSprm29, m_pPlcxMan->GetPapPLCF()); + aF.Read(rApo.m_nSprm29, m_xPlcxMan->GetPapPLCF()); aF.ApplyTabPos(pTabPos); return aF == *m_xWFlyPara; @@ -2682,7 +2682,7 @@ const SfxPoolItem* SwWW8ImplReader::GetFormatAttr( sal_uInt16 nWhich ) if (!pRet) pRet = &m_rDoc.GetAttrPool().GetDefaultItem(nWhich); } - else if (m_pPlcxMan && m_pPlcxMan->GetDoingDrawTextBox()) + else if (m_xPlcxMan && m_xPlcxMan->GetDoingDrawTextBox()) { pRet = m_pCtrlStck->GetStackAttr(*m_pPaM->GetPoint(), nWhich); if (!pRet) @@ -2790,7 +2790,7 @@ void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen if (nLen < (m_bVer67 ? 3 : 4)) { //otherwise disable after we print the char - if (m_pPlcxMan && m_pPlcxMan->GetDoingDrawTextBox()) + if (m_xPlcxMan && m_xPlcxMan->GetDoingDrawTextBox()) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_FONT ); m_bSymbol = false; } @@ -2893,10 +2893,10 @@ void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const sal_uInt8* pData, shor // value: 0 = off, 1 = on, 128 = like style, 129 contrary to style bool bOn = *pData & 1; SwWW8StyInf* pSI = GetStyle(m_nAktColl); - if (m_pPlcxMan && eVersion > ww::eWW2) + if (m_xPlcxMan && eVersion > ww::eWW2) { SprmResult aCharIstd = - m_pPlcxMan->GetChpPLCF()->HasSprm(m_bVer67 ? 80 : 0x4A30); + m_xPlcxMan->GetChpPLCF()->HasSprm(m_bVer67 ? 80 : 0x4A30); if (aCharIstd.pSprm && aCharIstd.nRemainingData >= 2) pSI = GetStyle(SVBT16ToShort(aCharIstd.pSprm)); } @@ -3060,10 +3060,10 @@ void SwWW8ImplReader::Read_BoldBiDiUsw(sal_uInt16 nId, const sal_uInt8* pData, } bool bOn = *pData & 1; SwWW8StyInf* pSI = GetStyle(m_nAktColl); - if (m_pPlcxMan) + if (m_xPlcxMan) { SprmResult aCharIstd = - m_pPlcxMan->GetChpPLCF()->HasSprm(m_bVer67 ? 80 : 0x4A30); + m_xPlcxMan->GetChpPLCF()->HasSprm(m_bVer67 ? 80 : 0x4A30); if (aCharIstd.pSprm && aCharIstd.nRemainingData >= 2) pSI = GetStyle(SVBT16ToShort(aCharIstd.pSprm)); } @@ -3436,7 +3436,7 @@ void SwWW8ImplReader::Read_DoubleLine_Rotate( sal_uInt16, const sal_uInt8* pData void SwWW8ImplReader::Read_TextColor( sal_uInt16, const sal_uInt8* pData, short nLen ) { //Has newer colour variant, ignore this old variant - if (!m_bVer67 && m_pPlcxMan && m_pPlcxMan->GetChpPLCF()->HasSprm(NS_sprm::sprmCCv).pSprm) + if (!m_bVer67 && m_xPlcxMan && m_xPlcxMan->GetChpPLCF()->HasSprm(NS_sprm::sprmCCv).pSprm) return; if (nLen < 1) @@ -3921,7 +3921,7 @@ void SwWW8ImplReader::Read_FontKern( sal_uInt16, const sal_uInt8* pData, short n void SwWW8ImplReader::Read_CharShadow( sal_uInt16, const sal_uInt8* pData, short nLen ) { //Has newer colour variant, ignore this old variant - if (!m_bVer67 && m_pPlcxMan && m_pPlcxMan->GetChpPLCF()->HasSprm(0xCA71).pSprm) + if (!m_bVer67 && m_xPlcxMan && m_xPlcxMan->GetChpPLCF()->HasSprm(0xCA71).pSprm) return; if (nLen < 2) @@ -4111,9 +4111,9 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe been removed then we will factor the original list applied hanging into our calculation. */ - if (m_pPlcxMan && m_nAktColl < m_vColl.size() && m_vColl[m_nAktColl].m_bHasBrokenWW6List) + if (m_xPlcxMan && m_nAktColl < m_vColl.size() && m_vColl[m_nAktColl].m_bHasBrokenWW6List) { - SprmResult aIsZeroed = m_pPlcxMan->GetPapPLCF()->HasSprm(0x460B); + SprmResult aIsZeroed = m_xPlcxMan->GetPapPLCF()->HasSprm(0x460B); if (aIsZeroed.pSprm && aIsZeroed.nRemainingData >= 1 && *aIsZeroed.pSprm == 0) { const SvxLRSpaceItem &rLR = @@ -4131,7 +4131,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe { if ( const SwNumFormat *pNumFormat = GetNumFormatFromTextNode(*pNode) ) { - if (!lcl_HasExplicitLeft(m_pPlcxMan, m_bVer67)) + if (!lcl_HasExplicitLeft(m_xPlcxMan.get(), m_bVer67)) { aLR.SetTextLeft(pNumFormat->GetIndentAt()); @@ -4406,8 +4406,8 @@ bool SwWW8ImplReader::IsRightToLeft() { bool bRTL = false; SprmResult aDir; - if (m_pPlcxMan) - aDir = m_pPlcxMan->GetPapPLCF()->HasSprm(0x2441); + if (m_xPlcxMan) + aDir = m_xPlcxMan->GetPapPLCF()->HasSprm(0x2441); if (aDir.pSprm && aDir.nRemainingData >= 1) bRTL = *aDir.pSprm != 0; else @@ -4504,8 +4504,8 @@ void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short n //Only the cjk language setting seems to matter to word, the western //one is ignored SprmResult aLang; - if (m_pPlcxMan) - aLang = m_pPlcxMan->GetChpPLCF()->HasSprm(0x486E); + if (m_xPlcxMan) + aLang = m_xPlcxMan->GetChpPLCF()->HasSprm(0x486E); if (aLang.pSprm && aLang.nRemainingData >= 2) nLang = LanguageType(SVBT16ToShort(aLang.pSprm)); @@ -4749,7 +4749,7 @@ void SwWW8Shade::SetShade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex) void SwWW8ImplReader::Read_Shade( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if (!m_bVer67 && m_pPlcxMan && m_pPlcxMan->GetPapPLCF()->HasSprm(0xC64D).pSprm) + if (!m_bVer67 && m_xPlcxMan && m_xPlcxMan->GetPapPLCF()->HasSprm(0xC64D).pSprm) return; if (nLen < 2) @@ -4849,7 +4849,7 @@ void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8*, short nLen) if( m_pAktColl ) nBorder = ::lcl_ReadBorders(m_bVer67, aBrcs, nullptr, m_pStyles); else - nBorder = ::lcl_ReadBorders(m_bVer67, aBrcs, m_pPlcxMan ? m_pPlcxMan->GetPapPLCF() : nullptr); + nBorder = ::lcl_ReadBorders(m_bVer67, aBrcs, m_xPlcxMan ? m_xPlcxMan->GetPapPLCF() : nullptr); if( nBorder ) // Border { |