From cea4e6c4d956c076f04aaba6d8bfc488921773a2 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 22 May 2018 09:07:35 +0200 Subject: sw: prefix members of WW8Style Change-Id: Ib42250d293b7dc5ae5f4dca8687d8052db8da21e Reviewed-on: https://gerrit.libreoffice.org/54653 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/source/filter/ww8/ww8par2.cxx | 74 +++++++++++++++++------------------ sw/source/filter/ww8/ww8scan.cxx | 84 ++++++++++++++++++++-------------------- sw/source/filter/ww8/ww8scan.hxx | 26 ++++++------- 3 files changed, 92 insertions(+), 92 deletions(-) diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 54704142bd4e..89e3950c6717 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -3721,21 +3721,21 @@ WW8RStyle::WW8RStyle(WW8Fib& _rFib, SwWW8ImplReader* pI) , mbFCTLSizeChanged(false) , mbWidowsChanged(false) { - mpIo->m_vColl.resize(cstd); + mpIo->m_vColl.resize(m_cstd); } void WW8RStyle::Set1StyleDefaults() { // see #i25247#, #i25561#, #i48064#, #i92341# for default font if (!mbCJKFontChanged) // Style no CJK Font? set the default - mpIo->SetNewFontAttr(ftcFE, true, RES_CHRATR_CJK_FONT); + mpIo->SetNewFontAttr(m_ftcFE, true, RES_CHRATR_CJK_FONT); if (!mbCTLFontChanged) // Style no CTL Font? set the default - mpIo->SetNewFontAttr(ftcBi, true, RES_CHRATR_CTL_FONT); + mpIo->SetNewFontAttr(m_ftcBi, true, RES_CHRATR_CTL_FONT); // western 2nd to make western charset conversion the default if (!mbFontChanged) // Style has no Font? set the default, - mpIo->SetNewFontAttr(ftcAsci, true, RES_CHRATR_FONT); + mpIo->SetNewFontAttr(m_ftcAsci, true, RES_CHRATR_FONT); if( !mpIo->m_bNoAttrImport ) { @@ -3815,7 +3815,7 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty // Set Based on style sal_uInt16 j = rSI.m_nBase; - if (j != nThisStyle && j < cstd ) + if (j != nThisStyle && j < m_cstd ) { SwWW8StyInf* pj = &mpIo->m_vColl[j]; if (rSI.m_pFormat && pj->m_pFormat && rSI.m_bColl == pj->m_bColl) @@ -3858,7 +3858,7 @@ void WW8RStyle::PostStyle(SwWW8StyInf const &rSI, bool bOldNoImp) mpIo->m_nCharFormat = -1; // if style is based on nothing or base ignored - if ((rSI.m_nBase >= cstd || mpIo->m_vColl[rSI.m_nBase].m_bImportSkipped) && rSI.m_bColl) + if ((rSI.m_nBase >= m_cstd || mpIo->m_vColl[rSI.m_nBase].m_bImportSkipped) && rSI.m_bColl) { // If Char-Styles does not work // -> set hard WW-Defaults @@ -3888,7 +3888,7 @@ void WW8RStyle::Import1Style( sal_uInt16 nNr ) // valid and not NUL and not yet imported - if( rSI.m_nBase < cstd && !mpIo->m_vColl[rSI.m_nBase].m_bImported ) + if( rSI.m_nBase < m_cstd && !mpIo->m_vColl[rSI.m_nBase].m_bImported ) Import1Style( rSI.m_nBase ); mpStStrm->Seek( rSI.m_nFilePos ); @@ -3940,7 +3940,7 @@ void WW8RStyle::RecursiveReg(sal_uInt16 nNr) rSI.m_bImported = true; - if( rSI.m_nBase < cstd && !mpIo->m_vColl[rSI.m_nBase].m_bImported ) + if( rSI.m_nBase < m_cstd && !mpIo->m_vColl[rSI.m_nBase].m_bImported ) RecursiveReg(rSI.m_nBase); mpIo->RegisterNumFormatOnStyle(nNr); @@ -3959,7 +3959,7 @@ void WW8RStyle::PostProcessStyles() Clear all imported flags so that we can recursively apply numbering formats and use it to mark handled ones */ - for (i=0; i < cstd; ++i) + for (i=0; i < m_cstd; ++i) mpIo->m_vColl[i].m_bImported = false; /* @@ -3973,7 +3973,7 @@ void WW8RStyle::PostProcessStyles() tabstops we don't get problems with doubly adjusting tabstops that are inheritied. */ - for (i=0; i < cstd; ++i) + for (i=0; i < m_cstd; ++i) { if (mpIo->m_vColl[i].m_bValid) { @@ -3984,7 +3984,7 @@ void WW8RStyle::PostProcessStyles() void WW8RStyle::ScanStyles() // investigate style dependencies { // and detect Filepos for each Style - for (sal_uInt16 i = 0; i < cstd; ++i) + for (sal_uInt16 i = 0; i < m_cstd; ++i) { SwWW8StyInf &rSI = mpIo->m_vColl[i]; @@ -4243,7 +4243,7 @@ namespace void WW8RStyle::ImportOldFormatStyles() { - for (sal_uInt16 i=0; i < cstd; ++i) + for (sal_uInt16 i=0; i < m_cstd; ++i) { mpIo->m_vColl[i].m_bColl = true; //every chain must end eventually at the null style (style code 222) @@ -4254,11 +4254,11 @@ void WW8RStyle::ImportOldFormatStyles() mpIo->m_xWwFib->m_chseTables, mpIo->m_xWwFib->m_lid); sal_uInt16 cstcStd(0); - rSt.ReadUInt16( cstcStd ); + m_rStream.ReadUInt16( cstcStd ); - size_t nMaxByteCount = rSt.remainingSize(); + size_t nMaxByteCount = m_rStream.remainingSize(); sal_uInt16 cbName(0); - rSt.ReadUInt16(cbName); + m_rStream.ReadUInt16(cbName); if (cbName > nMaxByteCount) { SAL_WARN("sw.ww8", "WW8RStyle::ImportOldFormatStyles: truncating out of range " @@ -4270,7 +4270,7 @@ void WW8RStyle::ImportOldFormatStyles() while (nByteCount < cbName) { sal_uInt8 nCount(0); - rSt.ReadUChar( nCount ); + m_rStream.ReadUChar( nCount ); nByteCount++; sal_uInt8 stc = static_cast< sal_uInt8 >((stcp - cstcStd) & 255); @@ -4284,7 +4284,7 @@ void WW8RStyle::ImportOldFormatStyles() { if (nCount != 0) // user style { - OString aTmp = read_uInt8s_ToOString(rSt, nCount); + OString aTmp = read_uInt8s_ToOString(m_rStream, nCount); nByteCount += aTmp.getLength(); sName = OStringToOUString(aTmp, eStructChrSet); } @@ -4308,9 +4308,9 @@ void WW8RStyle::ImportOldFormatStyles() sal_uInt16 nStyles=stcp; std::vector aCHPXOffsets(stcp); - nMaxByteCount = rSt.remainingSize(); + nMaxByteCount = m_rStream.remainingSize(); sal_uInt16 cbChpx(0); - rSt.ReadUInt16(cbChpx); + m_rStream.ReadUInt16(cbChpx); if (cbChpx > nMaxByteCount) { SAL_WARN("sw.ww8", "WW8RStyle::ImportOldFormatStyles: truncating out of range " @@ -4325,12 +4325,12 @@ void WW8RStyle::ImportOldFormatStyles() if (stcp == aCHPXOffsets.size()) { //more data than style slots, skip remainder - rSt.SeekRel(cbChpx-nByteCount); + m_rStream.SeekRel(cbChpx-nByteCount); break; } sal_uInt8 cb(0); - rSt.ReadUChar( cb ); + m_rStream.ReadUChar( cb ); nByteCount++; aCHPXOffsets[stcp].mnSize = 0; @@ -4339,10 +4339,10 @@ void WW8RStyle::ImportOldFormatStyles() { sal_uInt8 nRemainder = cb; - aCHPXOffsets[stcp].mnOffset = rSt.Tell(); + aCHPXOffsets[stcp].mnOffset = m_rStream.Tell(); aCHPXOffsets[stcp].mnSize = nRemainder; - Word2CHPX aChpx = ReadWord2Chpx(rSt, aCHPXOffsets[stcp].mnOffset, + Word2CHPX aChpx = ReadWord2Chpx(m_rStream, aCHPXOffsets[stcp].mnOffset, aCHPXOffsets[stcp].mnSize); aConvertedChpx.push_back( ChpxToSprms(aChpx) ); @@ -4355,9 +4355,9 @@ void WW8RStyle::ImportOldFormatStyles() } std::vector aPAPXOffsets(stcp); - nMaxByteCount = rSt.remainingSize(); + nMaxByteCount = m_rStream.remainingSize(); sal_uInt16 cbPapx(0); - rSt.ReadUInt16(cbPapx); + m_rStream.ReadUInt16(cbPapx); if (cbPapx > nMaxByteCount) { SAL_WARN("sw.ww8", "WW8RStyle::ImportOldFormatStyles: truncating out of range " @@ -4370,12 +4370,12 @@ void WW8RStyle::ImportOldFormatStyles() { if (stcp == aPAPXOffsets.size()) { - rSt.SeekRel(cbPapx-nByteCount); + m_rStream.SeekRel(cbPapx-nByteCount); break; } sal_uInt8 cb(0); - rSt.ReadUChar( cb ); + m_rStream.ReadUChar( cb ); nByteCount++; aPAPXOffsets[stcp].mnSize = 0; @@ -4383,15 +4383,15 @@ void WW8RStyle::ImportOldFormatStyles() if (cb != 0xFF) { sal_uInt8 stc2(0); - rSt.ReadUChar( stc2 ); - rSt.SeekRel(6); + m_rStream.ReadUChar( stc2 ); + m_rStream.SeekRel(6); nByteCount+=7; sal_uInt8 nRemainder = cb-7; - aPAPXOffsets[stcp].mnOffset = rSt.Tell(); + aPAPXOffsets[stcp].mnOffset = m_rStream.Tell(); aPAPXOffsets[stcp].mnSize = nRemainder; - rSt.SeekRel(nRemainder); + m_rStream.SeekRel(nRemainder); nByteCount += nRemainder; } @@ -4399,15 +4399,15 @@ void WW8RStyle::ImportOldFormatStyles() } sal_uInt16 iMac(0); - rSt.ReadUInt16( iMac ); + m_rStream.ReadUInt16( iMac ); if (iMac > nStyles) iMac = nStyles; for (stcp = 0; stcp < iMac; ++stcp) { sal_uInt8 stcNext(0), stcBase(0); - rSt.ReadUChar( stcNext ); - rSt.ReadUChar( stcBase ); + m_rStream.ReadUChar( stcNext ); + m_rStream.ReadUChar( stcBase ); sal_uInt8 stc = static_cast< sal_uInt8 >((stcp - cstcStd) & 255); @@ -4452,7 +4452,7 @@ void WW8RStyle::ImportNewFormatStyles() { ScanStyles(); // Scan Based On - for (sal_uInt16 i = 0; i < cstd; ++i) // import Styles + for (sal_uInt16 i = 0; i < m_cstd; ++i) // import Styles if (mpIo->m_vColl[i].m_bValid) Import1Style( i ); } @@ -4471,12 +4471,12 @@ void WW8RStyle::Import() else ImportNewFormatStyles(); - for (sal_uInt16 i = 0; i < cstd; ++i) + for (sal_uInt16 i = 0; i < m_cstd; ++i) { // Follow chain SwWW8StyInf* pi = &mpIo->m_vColl[i]; sal_uInt16 j = pi->m_nFollow; - if( j < cstd ) + if( j < m_cstd ) { SwWW8StyInf* pj = &mpIo->m_vColl[j]; if ( j != i // rational Index ? diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 64312c378894..a7e91b17aadd 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -6804,32 +6804,32 @@ void WW8SmartTagData::Write(WW8Export& rExport) } WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara) - : rFib(rFibPara), rSt(rStream), cstd(0), cbSTDBaseInFile(0), fStdStylenamesWritten(0) - , stiMaxWhenSaved(0), istdMaxFixedWhenSaved(0), nVerBuiltInNamesWhenSaved(0) - , ftcAsci(0), ftcFE(0), ftcOther(0), ftcBi(0) + : m_rFib(rFibPara), m_rStream(rStream), m_cstd(0), m_cbSTDBaseInFile(0), m_fStdStylenamesWritten(0) + , m_stiMaxWhenSaved(0), m_istdMaxFixedWhenSaved(0), m_nVerBuiltInNamesWhenSaved(0) + , m_ftcAsci(0), m_ftcFE(0), m_ftcOther(0), m_ftcBi(0) { - if (!checkSeek(rSt, rFib.m_fcStshf)) + if (!checkSeek(m_rStream, m_rFib.m_fcStshf)) return; sal_uInt16 cbStshi = 0; // 2 bytes size of the following STSHI structure - sal_uInt32 nRemaining = rFib.m_lcbStshf; + sal_uInt32 nRemaining = m_rFib.m_lcbStshf; const sal_uInt32 nMinValidStshi = 4; - if (rFib.GetFIBVersion() <= ww::eWW2) + if (m_rFib.GetFIBVersion() <= ww::eWW2) { cbStshi = 0; - cstd = 256; + m_cstd = 256; } else { - if (rFib.m_nFib < 67) // old Version ? (need to find this again to fix) + if (m_rFib.m_nFib < 67) // old Version ? (need to find this again to fix) cbStshi = nMinValidStshi; else // new version { if (nRemaining < sizeof(cbStshi)) return; // reads the length of the structure in the file - rSt.ReadUInt16( cbStshi ); + m_rStream.ReadUInt16( cbStshi ); nRemaining-=2; } } @@ -6841,42 +6841,42 @@ WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara) const sal_uInt16 nRead = cbStshi; do { - rSt.ReadUInt16( cstd ); + m_rStream.ReadUInt16( m_cstd ); - rSt.ReadUInt16( cbSTDBaseInFile ); + m_rStream.ReadUInt16( m_cbSTDBaseInFile ); if( 6 > nRead ) break; sal_uInt16 a16Bit; - rSt.ReadUInt16( a16Bit ); - fStdStylenamesWritten = a16Bit & 0x0001; + m_rStream.ReadUInt16( a16Bit ); + m_fStdStylenamesWritten = a16Bit & 0x0001; if( 8 > nRead ) break; - rSt.ReadUInt16( stiMaxWhenSaved ); + m_rStream.ReadUInt16( m_stiMaxWhenSaved ); if( 10 > nRead ) break; - rSt.ReadUInt16( istdMaxFixedWhenSaved ); + m_rStream.ReadUInt16( m_istdMaxFixedWhenSaved ); if( 12 > nRead ) break; - rSt.ReadUInt16( nVerBuiltInNamesWhenSaved ); + m_rStream.ReadUInt16( m_nVerBuiltInNamesWhenSaved ); if( 14 > nRead ) break; - rSt.ReadUInt16( ftcAsci ); + m_rStream.ReadUInt16( m_ftcAsci ); if( 16 > nRead ) break; - rSt.ReadUInt16( ftcFE ); + m_rStream.ReadUInt16( m_ftcFE ); if ( 18 > nRead ) break; - rSt.ReadUInt16( ftcOther ); + m_rStream.ReadUInt16( m_ftcOther ); - ftcBi = ftcOther; + m_ftcBi = m_ftcOther; if ( 20 > nRead ) break; - rSt.ReadUInt16( ftcBi ); + m_rStream.ReadUInt16( m_ftcBi ); // p.r.n. ignore the rest if( 20 < nRead ) - rSt.SeekRel( nRead-20 ); + m_rStream.SeekRel( nRead-20 ); } while( false ); // trick: the block above will be passed through exactly one time // and that's why we can early exit with "break". @@ -6888,9 +6888,9 @@ WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara) const sal_uInt32 nMinRecordSize = sizeof(sal_uInt16); const sal_uInt16 nMaxPossibleRecords = nRemaining/nMinRecordSize; - OSL_ENSURE(cstd <= nMaxPossibleRecords, + OSL_ENSURE(m_cstd <= nMaxPossibleRecords, "allegedly more styles that available data"); - cstd = std::min(cstd, nMaxPossibleRecords); + m_cstd = std::min(m_cstd, nMaxPossibleRecords); } // Read1STDFixed() reads a style. If the style is completely existent, @@ -6902,10 +6902,10 @@ WW8_STD* WW8Style::Read1STDFixed(sal_uInt16& rSkip) WW8_STD* pStd = nullptr; sal_uInt16 cbStd(0); - rSt.ReadUInt16(cbStd); // read length + m_rStream.ReadUInt16(cbStd); // read length - const sal_uInt16 nRead = cbSTDBaseInFile; - if( cbStd >= cbSTDBaseInFile ) + const sal_uInt16 nRead = m_cbSTDBaseInFile; + if( cbStd >= m_cbSTDBaseInFile ) { // Fixed part completely available @@ -6918,7 +6918,7 @@ WW8_STD* WW8Style::Read1STDFixed(sal_uInt16& rSkip) if( 2 > nRead ) break; sal_uInt16 a16Bit = 0; - rSt.ReadUInt16( a16Bit ); + m_rStream.ReadUInt16( a16Bit ); pStd->sti = a16Bit & 0x0fff ; pStd->fScratch = sal_uInt16(0 != ( a16Bit & 0x1000 )); pStd->fInvalHeight = sal_uInt16(0 != ( a16Bit & 0x2000 )); @@ -6927,47 +6927,47 @@ WW8_STD* WW8Style::Read1STDFixed(sal_uInt16& rSkip) if( 4 > nRead ) break; a16Bit = 0; - rSt.ReadUInt16( a16Bit ); + m_rStream.ReadUInt16( a16Bit ); pStd->sgc = a16Bit & 0x000f ; pStd->istdBase = ( a16Bit & 0xfff0 ) >> 4; if( 6 > nRead ) break; a16Bit = 0; - rSt.ReadUInt16( a16Bit ); + m_rStream.ReadUInt16( a16Bit ); pStd->cupx = a16Bit & 0x000f ; pStd->istdNext = ( a16Bit & 0xfff0 ) >> 4; if( 8 > nRead ) break; - rSt.ReadUInt16( pStd->bchUpe ); + m_rStream.ReadUInt16( pStd->bchUpe ); // from Ver8 this two fields should be added: if(10 > nRead ) break; a16Bit = 0; - rSt.ReadUInt16( a16Bit ); + m_rStream.ReadUInt16( a16Bit ); pStd->fAutoRedef = a16Bit & 0x0001 ; pStd->fHidden = ( a16Bit & 0x0002 ) >> 1; // You never know: cautionary skipped if (nRead > 10) { - auto nSkip = std::min(nRead - 10, rSt.remainingSize()); - rSt.Seek(rSt.Tell() + nSkip); + auto nSkip = std::min(nRead - 10, m_rStream.remainingSize()); + m_rStream.Seek(m_rStream.Tell() + nSkip); } } while( false ); // trick: the block above will passed through exactly one time // and can be left early with a "break" - if (!rSt.good() || !nRead) + if (!m_rStream.good() || !nRead) { delete pStd; pStd = nullptr; // report error with NULL } - rSkip = cbStd - cbSTDBaseInFile; + rSkip = cbStd - m_cbSTDBaseInFile; } else { // Fixed part too short if( cbStd ) - rSt.SeekRel( cbStd ); // skip leftovers + m_rStream.SeekRel( cbStd ); // skip leftovers rSkip = 0; } return pStd; @@ -6986,21 +6986,21 @@ WW8_STD* WW8Style::Read1Style(sal_uInt16& rSkip, OUString* pString) if ( pStd ) { sal_Int32 nLenStringBytes = 0; - switch( rFib.m_nVersion ) + switch( m_rFib.m_nVersion ) { case 6: case 7: // read pascal string - *pString = read_uInt8_BeltAndBracesString(rSt, RTL_TEXTENCODING_MS_1252); + *pString = read_uInt8_BeltAndBracesString(m_rStream, RTL_TEXTENCODING_MS_1252); // leading len and trailing zero --> 2 nLenStringBytes = pString->getLength() + 2; break; case 8: // handle Unicode-String with leading length short and // trailing zero - if (TestBeltAndBraces(rSt)) + if (TestBeltAndBraces(m_rStream)) { - *pString = read_uInt16_BeltAndBracesString(rSt); + *pString = read_uInt16_BeltAndBracesString(m_rStream); nLenStringBytes = (pString->getLength() + 2) * 2; } else @@ -7015,7 +7015,7 @@ WW8_STD* WW8Style::Read1Style(sal_uInt16& rSkip, OUString* pString) they are not corrupt. If they are then we try them as 8bit ones */ - *pString = read_uInt8_BeltAndBracesString(rSt,RTL_TEXTENCODING_MS_1252); + *pString = read_uInt8_BeltAndBracesString(m_rStream,RTL_TEXTENCODING_MS_1252); // leading len and trailing zero --> 2 nLenStringBytes = pString->getLength() + 2; } diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index a97ea13628fe..69ff529233a2 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -1546,24 +1546,24 @@ public: class WW8Style { protected: - WW8Fib& rFib; - SvStream& rSt; + WW8Fib& m_rFib; + SvStream& m_rStream; - sal_uInt16 cstd; // Count of styles in stylesheet - sal_uInt16 cbSTDBaseInFile; // Length of STD Base as stored in a file - sal_uInt16 fStdStylenamesWritten : 1; // Are built-in stylenames stored? + sal_uInt16 m_cstd; // Count of styles in stylesheet + sal_uInt16 m_cbSTDBaseInFile; // Length of STD Base as stored in a file + sal_uInt16 m_fStdStylenamesWritten : 1; // Are built-in stylenames stored? sal_uInt16 : 15; // Spare flags - sal_uInt16 stiMaxWhenSaved; // Max sti known when file was written - sal_uInt16 istdMaxFixedWhenSaved; // How many fixed-index istds are there? - sal_uInt16 nVerBuiltInNamesWhenSaved; // Current version of built-in stylenames + sal_uInt16 m_stiMaxWhenSaved; // Max sti known when file was written + sal_uInt16 m_istdMaxFixedWhenSaved; // How many fixed-index istds are there? + sal_uInt16 m_nVerBuiltInNamesWhenSaved; // Current version of built-in stylenames // ftc used by StandardChpStsh for this document - sal_uInt16 ftcAsci; + sal_uInt16 m_ftcAsci; // CJK ftc used by StandardChpStsh for this document - sal_uInt16 ftcFE; + sal_uInt16 m_ftcFE; // CTL/Other ftc used by StandardChpStsh for this document - sal_uInt16 ftcOther; + sal_uInt16 m_ftcOther; // CTL ftc used by StandardChpStsh for this document - sal_uInt16 ftcBi; + sal_uInt16 m_ftcBi; //No copying WW8Style(const WW8Style&); @@ -1573,7 +1573,7 @@ public: WW8Style( SvStream& rSt, WW8Fib& rFibPara ); WW8_STD* Read1STDFixed(sal_uInt16& rSkip); WW8_STD* Read1Style(sal_uInt16& rSkip, OUString* pString); - sal_uInt16 GetCount() const { return cstd; } + sal_uInt16 GetCount() const { return m_cstd; } }; class WW8Fonts final -- cgit v1.2.3