sw/source/filter/ww8/ww8par.cxx | 79 +++++++++++++++++++-------------------- sw/source/filter/ww8/ww8par.hxx | 2 sw/source/filter/ww8/ww8par2.cxx | 10 ++-- sw/source/filter/ww8/ww8par6.cxx | 16 +++---- 4 files changed, 53 insertions(+), 54 deletions(-)
New commits: commit d69b1b05fd72e47b8b14816e21e1c4bd38ee66a1 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jul 6 10:12:38 2017 +0100 ofz: fix some leaks Change-Id: I14a0a2ad39d388d8d96d2100be46b8b4c239e644 Reviewed-on: https://gerrit.libreoffice.org/39635 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index d1ef61ae9c4e..322d14e22b2a 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1792,7 +1792,7 @@ void SwWW8ImplReader::ImportDop() if (xDocuProps.is()) { DateTime aLastPrinted( - msfilter::util::DTTM2DateTime(m_pWDop->dttmLastPrint)); + msfilter::util::DTTM2DateTime(m_xWDop->dttmLastPrint)); ::util::DateTime uDT = aLastPrinted.GetUNODateTime(); xDocuProps->setPrintDate(uDT); } @@ -1801,12 +1801,12 @@ void SwWW8ImplReader::ImportDop() // #i78951# - remember the unknown compatibility options // so as to export them out - m_rDoc.getIDocumentSettingAccess().Setn32DummyCompatibilityOptions1( m_pWDop->GetCompatibilityOptions()); - m_rDoc.getIDocumentSettingAccess().Setn32DummyCompatibilityOptions2( m_pWDop->GetCompatibilityOptions2()); + m_rDoc.getIDocumentSettingAccess().Setn32DummyCompatibilityOptions1(m_xWDop->GetCompatibilityOptions()); + m_rDoc.getIDocumentSettingAccess().Setn32DummyCompatibilityOptions2(m_xWDop->GetCompatibilityOptions2()); // The distance between two paragraphs is the sum of the bottom distance of // the first paragraph and the top distance of the second one - m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PARA_SPACE_MAX, m_pWDop->fDontUseHTMLAutoSpacing); + m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PARA_SPACE_MAX, m_xWDop->fDontUseHTMLAutoSpacing); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES, true ); // move tabs on alignment m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::TAB_COMPAT, true); @@ -1814,7 +1814,7 @@ void SwWW8ImplReader::ImportDop() m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::TABS_RELATIVE_TO_INDENT, false); // Import Default Tabs - long nDefTabSiz = m_pWDop->dxaTab; + long nDefTabSiz = m_xWDop->dxaTab; if( nDefTabSiz < 56 ) nDefTabSiz = 709; @@ -1825,18 +1825,18 @@ void SwWW8ImplReader::ImportDop() m_rDoc.GetAttrPool().SetPoolDefaultItem( aNewTab ); // Import zoom factor - if (m_pWDop->wScaleSaved) + if (m_xWDop->wScaleSaved) { //Import zoom type sal_Int16 nZoomType; - switch (m_pWDop->zkSaved) { + switch (m_xWDop->zkSaved) { case 1: nZoomType = sal_Int16(SvxZoomType::WHOLEPAGE); break; case 2: nZoomType = sal_Int16(SvxZoomType::PAGEWIDTH); break; case 3: nZoomType = sal_Int16(SvxZoomType::OPTIMAL); break; default: nZoomType = sal_Int16(SvxZoomType::PERCENT); break; } uno::Sequence<beans::PropertyValue> aViewProps( comphelper::InitPropertySequence({ - { "ZoomFactor", uno::Any(sal_Int16(m_pWDop->wScaleSaved)) }, + { "ZoomFactor", uno::Any(sal_Int16(m_xWDop->wScaleSaved)) }, { "VisibleBottom", uno::Any(sal_Int32(0)) }, { "ZoomType", uno::Any(nZoomType) } })); @@ -1849,13 +1849,13 @@ void SwWW8ImplReader::ImportDop() xViewDataSupplier->setViewData(xIndexAccess); } - m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::USE_VIRTUAL_DEVICE, !m_pWDop->fUsePrinterMetrics); + m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::USE_VIRTUAL_DEVICE, !m_xWDop->fUsePrinterMetrics); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::ADD_FLY_OFFSETS, true ); - m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::ADD_EXT_LEADING, !m_pWDop->fNoLeading); + m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::ADD_EXT_LEADING, !m_xWDop->fNoLeading); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::OLD_NUMBERING, false); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, false); // #i47448# - m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, !m_pWDop->fExpShRtn); // #i49277#, #i56856# + m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, !m_xWDop->fExpShRtn); // #i49277#, #i56856# m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, false); // #i53199# m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::OLD_LINE_SPACING, false); @@ -1890,7 +1890,7 @@ void SwWW8ImplReader::ImportDop() // Import magic doptypography information, if its there if (m_pWwFib->m_nFib > 105) - ImportDopTypography(m_pWDop->doptypography); + ImportDopTypography(m_xWDop->doptypography); // disable form design mode to be able to use imported controls directly // #i31239# always disable form design mode, not only in protected docs @@ -1914,12 +1914,12 @@ void SwWW8ImplReader::ImportDop() } // Still allow editing of form fields. - if (!m_pWDop->fProtEnabled) - m_pDocShell->SetModifyPasswordHash(m_pWDop->lKeyProtDoc); + if (!m_xWDop->fProtEnabled) + m_pDocShell->SetModifyPasswordHash(m_xWDop->lKeyProtDoc); const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); if (rOpt.IsUseEnhancedFields()) - m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FORM, m_pWDop->fProtEnabled ); + m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FORM, m_xWDop->fProtEnabled ); } void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo) @@ -2381,7 +2381,7 @@ void SwWW8ImplReader::AppendTextNode(SwPosition& rPos) pRule = sw::util::GetNumRuleFromTextNode(*pText); if ( - pRule && !m_pWDop->fDontUseHTMLAutoSpacing && + pRule && !m_xWDop->fDontUseHTMLAutoSpacing && (m_bParaAutoBefore || m_bParaAutoAfter) ) { @@ -2397,7 +2397,7 @@ void SwWW8ImplReader::AppendTextNode(SwPosition& rPos) // If the previous numbering rule was different we need // to insert a space after the previous paragraph if((pRule != m_pPrevNumRule) && m_pPreviousNumPaM) - SetLowerSpacing(*m_pPreviousNumPaM, GetParagraphAutoSpace(m_pWDop->fDontUseHTMLAutoSpacing)); + SetLowerSpacing(*m_pPreviousNumPaM, GetParagraphAutoSpace(m_xWDop->fDontUseHTMLAutoSpacing)); // cache current paragraph if(m_pPreviousNumPaM) @@ -2413,7 +2413,7 @@ void SwWW8ImplReader::AppendTextNode(SwPosition& rPos) { // If the previous paragraph has numbering but the current one does not // we need to add a space after the previous paragraph - SetLowerSpacing(*m_pPreviousNumPaM, GetParagraphAutoSpace(m_pWDop->fDontUseHTMLAutoSpacing)); + SetLowerSpacing(*m_pPreviousNumPaM, GetParagraphAutoSpace(m_xWDop->fDontUseHTMLAutoSpacing)); delete m_pPreviousNumPaM; m_pPreviousNumPaM = nullptr; m_pPrevNumRule = nullptr; @@ -2432,7 +2432,7 @@ void SwWW8ImplReader::AppendTextNode(SwPosition& rPos) // If this is the first paragraph in the document and // Auto-spacing before paragraph is set, // set the upper spacing value to 0 - if(m_bParaAutoBefore && m_bFirstPara && !m_pWDop->fDontUseHTMLAutoSpacing) + if(m_bParaAutoBefore && m_bFirstPara && !m_xWDop->fDontUseHTMLAutoSpacing) SetUpperSpacing(*m_pPaM, 0); m_bFirstPara = false; @@ -4142,7 +4142,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage, , m_pPrevNumRule(nullptr) , m_pPostProcessAttrsInfo(nullptr) , m_pWwFib(nullptr) - , m_pWDop(nullptr) , m_pLstManager(nullptr) , m_pSBase(nullptr) , m_aTextNodesHavingFirstLineOfstSet() @@ -4266,10 +4265,10 @@ void wwSectionManager::SetSegmentToPageDesc(const wwSection &rSection, SwFrameFormat &rFormat = rPage.GetMaster(); - if(mrReader.m_pWDop->fUseBackGroundInAllmodes) // #i56806# Make sure mrReader is initialized + if(mrReader.m_xWDop->fUseBackGroundInAllmodes) // #i56806# Make sure mrReader is initialized mrReader.GrafikCtor(); - if (mrReader.m_pWDop->fUseBackGroundInAllmodes && mrReader.m_pMSDffManager) + if (mrReader.m_xWDop->fUseBackGroundInAllmodes && mrReader.m_pMSDffManager) { tools::Rectangle aRect(0, 0, 100, 100); // A dummy, we don't care about the size SvxMSDffImportData aData(aRect); @@ -4305,12 +4304,12 @@ void wwSectionManager::SetSegmentToPageDesc(const wwSection &rSection, void wwSectionManager::SetUseOn(wwSection &rSection) { - bool bMirror = mrReader.m_pWDop->fMirrorMargins || - mrReader.m_pWDop->doptypography.f2on1; + bool bMirror = mrReader.m_xWDop->fMirrorMargins || + mrReader.m_xWDop->doptypography.f2on1; UseOnPage eUseBase = bMirror ? UseOnPage::Mirror : UseOnPage::All; UseOnPage eUse = eUseBase; - if (!mrReader.m_pWDop->fFacingPages) + if (!mrReader.m_xWDop->fFacingPages) eUse |= UseOnPage::HeaderShare | UseOnPage::FooterShare; if (!rSection.HasTitlePage()) eUse |= UseOnPage::FirstShare; @@ -4427,7 +4426,7 @@ void wwSectionManager::InsertSegments() || aIter->maSep.dxaLeft != aPrev->maSep.dxaLeft || aIter->maSep.dxaRight != aPrev->maSep.dxaRight ) bInsertPageDesc = true; bool bProtected = SectionIsProtected(*aIter); // do we really need this ?? I guess I have a different logic in editshell which disables this... - if (bUseEnhFields && mrReader.m_pWDop->fProtEnabled && aIter->IsNotProtected()) + if (bUseEnhFields && mrReader.m_xWDop->fProtEnabled && aIter->IsNotProtected()) { // here we have the special case that the whole document is protected, with the exception of this section. // I want to address this when I do the section rework, so for the moment we disable the overall protection then... @@ -4580,7 +4579,7 @@ void wwSectionManager::InsertSegments() if (pRet) { // Set the columns to be UnBalanced if that compatibility option is set - if (mrReader.m_pWDop->fNoColumnBalance) + if (mrReader.m_xWDop->fNoColumnBalance) pRet->SetFormatAttr(SwFormatNoBalancedColumns(true)); else { @@ -4949,8 +4948,8 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) m_xFonts.reset(new WW8Fonts(*m_pTableStream, *m_pWwFib)); // Document Properties - m_pWDop = new WW8Dop( *m_pTableStream, m_pWwFib->m_nFib, m_pWwFib->m_fcDop, - m_pWwFib->m_lcbDop ); + m_xWDop.reset(new WW8Dop(*m_pTableStream, m_pWwFib->m_nFib, m_pWwFib->m_fcDop, + m_pWwFib->m_lcbDop)); if (m_bNewDoc) ImportDop(); @@ -5034,26 +5033,26 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) aInfo = m_rDoc.GetFootnoteInfo(); // Copy-Ctor private aInfo.ePos = FTNPOS_PAGE; - aInfo.eNum = eNumA[m_pWDop->rncFootnote]; - sal_uInt16 nfcFootnoteRef = m_pWDop->nfcFootnoteRef & 0xF; + aInfo.eNum = eNumA[m_xWDop->rncFootnote]; + sal_uInt16 nfcFootnoteRef = m_xWDop->nfcFootnoteRef & 0xF; aInfo.aFormat.SetNumberingType( eNumTA[nfcFootnoteRef] ); - if( m_pWDop->nFootnote ) - aInfo.nFootnoteOffset = m_pWDop->nFootnote - 1; + if( m_xWDop->nFootnote ) + aInfo.nFootnoteOffset = m_xWDop->nFootnote - 1; m_rDoc.SetFootnoteInfo( aInfo ); } if( m_pSBase->AreThereEndnotes() ) { SwEndNoteInfo aInfo; aInfo = m_rDoc.GetEndNoteInfo(); // Same as for Footnote - sal_uInt16 nfcEdnRef = m_pWDop->nfcEdnRef & 0xF; + sal_uInt16 nfcEdnRef = m_xWDop->nfcEdnRef & 0xF; aInfo.aFormat.SetNumberingType( eNumTA[nfcEdnRef] ); - if( m_pWDop->nEdn ) - aInfo.nFootnoteOffset = m_pWDop->nEdn - 1; + if( m_xWDop->nEdn ) + aInfo.nFootnoteOffset = m_xWDop->nEdn - 1; m_rDoc.SetEndNoteInfo( aInfo ); } if( m_pWwFib->m_lcbPlcfhdd ) - m_xHdFt.reset(new WW8PLCF_HdFt(m_pTableStream, *m_pWwFib, *m_pWDop)); + m_xHdFt.reset(new WW8PLCF_HdFt(m_pTableStream, *m_pWwFib, *m_xWDop)); if (!m_bNewDoc) { @@ -5227,9 +5226,9 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) if (m_bNewDoc) { - if( m_pWDop->fRevMarking ) + if( m_xWDop->fRevMarking ) eMode |= RedlineFlags::On; - if( m_pWDop->fRMView ) + if( m_xWDop->fRMView ) eMode |= RedlineFlags::ShowDelete; } @@ -5246,7 +5245,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) DELETEZ( m_pMSDffManager ); m_xHdFt.reset(); DELETEZ( m_pSBase ); - delete m_pWDop; + m_xWDop.reset(); m_xFonts.reset(); delete m_pAtnNames; m_xSprmParser.reset(); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 448bd152381c..5c4e29f40979 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1195,7 +1195,7 @@ private: WW8Fib* m_pWwFib; std::unique_ptr<WW8Fonts> m_xFonts; - WW8Dop* m_pWDop; + std::unique_ptr<WW8Dop> m_xWDop; WW8ListManager* m_pLstManager; WW8ScannerBase* m_pSBase; std::shared_ptr<WW8PLCFMan> m_xPlcxMan; diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 8cda8394a965..d7fb08669837 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2999,7 +2999,7 @@ void WW8TabDesc::SetPamInCell(short nWwCol, bool bPam) // spacing set to 0 if ( m_pIo->m_bParaAutoBefore && m_pIo->m_bFirstPara && - !m_pIo->m_pWDop->fDontUseHTMLAutoSpacing + !m_pIo->m_xWDop->fDontUseHTMLAutoSpacing ) { m_pIo->SetUpperSpacing(*m_pIo->m_pPaM, 0); @@ -3007,7 +3007,7 @@ void WW8TabDesc::SetPamInCell(short nWwCol, bool bPam) // The last paragraph in a cell with lower autospacing has lower // spacing set to 0 - if (m_pIo->m_bParaAutoAfter && !m_pIo->m_pWDop->fDontUseHTMLAutoSpacing) + if (m_pIo->m_bParaAutoAfter && !m_pIo->m_xWDop->fDontUseHTMLAutoSpacing) m_pIo->SetLowerSpacing(*m_pIo->m_pPaM, 0); ParkPaM(); @@ -3027,11 +3027,11 @@ void WW8TabDesc::SetPamInCell(short nWwCol, bool bPam) m_pAktWWCell = &m_pActBand->pTCs[ nWwCol ]; // The first paragraph in a cell with upper autospacing has upper spacing set to 0 - if(m_pIo->m_bParaAutoBefore && m_pIo->m_bFirstPara && !m_pIo->m_pWDop->fDontUseHTMLAutoSpacing) + if(m_pIo->m_bParaAutoBefore && m_pIo->m_bFirstPara && !m_pIo->m_xWDop->fDontUseHTMLAutoSpacing) m_pIo->SetUpperSpacing(*m_pIo->m_pPaM, 0); // The last paragraph in a cell with lower autospacing has lower spacing set to 0 - if(m_pIo->m_bParaAutoAfter && !m_pIo->m_pWDop->fDontUseHTMLAutoSpacing) + if(m_pIo->m_bParaAutoAfter && !m_pIo->m_xWDop->fDontUseHTMLAutoSpacing) m_pIo->SetLowerSpacing(*m_pIo->m_pPaM, 0); //We need to set the pPaM on the first cell, invalid @@ -4620,7 +4620,7 @@ void WW8RStyle::Import() // set Hyphenation flag on BASIC para-style if (pIo->m_bNewDoc && pIo->m_pStandardFormatColl) { - if (pIo->m_pWDop->fAutoHyphen + if (pIo->m_xWDop->fAutoHyphen && SfxItemState::SET != pIo->m_pStandardFormatColl->GetItemState( RES_PARATR_HYPHENZONE, false) ) { diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 2e02896b2c6f..a88248dd30de 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -385,7 +385,7 @@ void wwSectionManager::SetLeftRight(wwSection &rSection) */ if (rSection.maSep.fRTLGutter) nWWRi += nWWGu; - else if (!mrReader.m_pWDop->iGutterPos) + else if (!mrReader.m_xWDop->iGutterPos) nWWLe += nWWGu; // Left / Right @@ -526,7 +526,7 @@ void wwSectionManager::GetPageULData(const wwSection &rSection, even pages, something we cannot do. So we will put it on top of all pages, that way the pages are at least the right size. */ - if (!mrReader.m_bVer67 && mrReader.m_pWDop->iGutterPos && + if (!mrReader.m_bVer67 && mrReader.m_xWDop->iGutterPos && rSection.maSep.fRTLGutter) { nWWUp += rSection.maSep.dzaGutter; @@ -651,9 +651,9 @@ SwSectionFormat *wwSectionManager::InsertSection( aSet.Put(SvxFrameDirectionItem( bRTLPgn ? SvxFrameDirection::Horizontal_RL_TB : SvxFrameDirection::Horizontal_LR_TB, RES_FRAMEDIR)); - if (2 == mrReader.m_pWDop->fpc) + if (2 == mrReader.m_xWDop->fpc) aSet.Put( SwFormatFootnoteAtTextEnd(FTNEND_ATTXTEND)); - if (0 == mrReader.m_pWDop->epc) + if (0 == mrReader.m_xWDop->epc) aSet.Put( SwFormatEndAtTextEnd(FTNEND_ATTXTEND)); aSection.SetProtectFlag(SectionIsProtected(rSection)); @@ -1025,7 +1025,7 @@ void wwSectionManager::CreateSep(const long nTextPos) // #i31806# but only swap if 2page in 1sheet is enabled. // it's not clear if dmOrientPage is the correct member to // decide on this. - if(mrReader.m_pWDop->doptypography.f2on1 && + if(mrReader.m_xWDop->doptypography.f2on1 && aNewSection.maSep.dmOrientPage == 2) std::swap(aNewSection.maSep.dxaLeft, aNewSection.maSep.dxaRight); @@ -1155,7 +1155,7 @@ void wwSectionManager::CreateSep(const long nTextPos) // but aNewSection.HasTitlePage() will be false. // Likewise for first page footer. - if (mrReader.m_pWDop->fFacingPages) + if (mrReader.m_xWDop->fFacingPages) aNewSection.maSep.grpfIhdt |= WW8_HEADER_EVEN | WW8_FOOTER_EVEN; //See if we have a header or footer for each enabled possibility @@ -4248,7 +4248,7 @@ void SwWW8ImplReader::Read_ParaAutoBefore(sal_uInt16, const sal_uInt8 *pData, sh if (*pData) { SvxULSpaceItem aUL(*static_cast<const SvxULSpaceItem*>(GetFormatAttr(RES_UL_SPACE))); - aUL.SetUpper(GetParagraphAutoSpace(m_pWDop->fDontUseHTMLAutoSpacing)); + aUL.SetUpper(GetParagraphAutoSpace(m_xWDop->fDontUseHTMLAutoSpacing)); NewAttr(aUL); if (m_pAktColl && m_nAktColl < m_vColl.size()) m_vColl[m_nAktColl].m_bParaAutoBefore = true; @@ -4275,7 +4275,7 @@ void SwWW8ImplReader::Read_ParaAutoAfter(sal_uInt16, const sal_uInt8 *pData, sho if (*pData) { SvxULSpaceItem aUL(*static_cast<const SvxULSpaceItem*>(GetFormatAttr(RES_UL_SPACE))); - aUL.SetLower(GetParagraphAutoSpace(m_pWDop->fDontUseHTMLAutoSpacing)); + aUL.SetLower(GetParagraphAutoSpace(m_xWDop->fDontUseHTMLAutoSpacing)); NewAttr(aUL); if (m_pAktColl && m_nAktColl < m_vColl.size()) m_vColl[m_nAktColl].m_bParaAutoAfter = true;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits