diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-10-02 11:35:04 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-10-02 20:40:44 +0200 |
commit | 7c70a59cd02a5b6111a9c39c74c8b6cd1585c4c2 (patch) | |
tree | f343040e275f0b6b3470afd32a6f34a433cb2c8d /sw | |
parent | d7d3c11357efb65bd9721e6fedae2486162d1a71 (diff) |
MSWordExportBase never passed a null SwDoc*
and drop redundant nullptr checks
Change-Id: I42b86461ad276089454b35a51651c5aa1e1280ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103850
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 46 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.cxx | 178 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.hxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexportfilter.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.cxx | 59 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexportfilter.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 36 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 54 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8num.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 38 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 157 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8gr.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 70 |
16 files changed, 344 insertions, 348 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 88b92ab460dd..451e4752aaa9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -331,9 +331,9 @@ static void checkAndWriteFloatingTables(DocxAttributeOutput& rDocxAttributeOutpu { const auto& rExport = rDocxAttributeOutput.GetExport(); // iterate though all SpzFrameFormats and check whether they are anchored to the current text node - for( sal_uInt16 nCnt = rExport.m_pDoc->GetSpzFrameFormats()->size(); nCnt; ) + for( sal_uInt16 nCnt = rExport.m_rDoc.GetSpzFrameFormats()->size(); nCnt; ) { - const SwFrameFormat* pFrameFormat = (*rExport.m_pDoc->GetSpzFrameFormats())[ --nCnt ]; + const SwFrameFormat* pFrameFormat = (*rExport.m_rDoc.GetSpzFrameFormats())[ --nCnt ]; const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor(); const SwPosition* pPosition = rAnchor.GetContentAnchor(); @@ -2800,8 +2800,8 @@ bool DocxAttributeOutput::FootnoteEndnoteRefTag() // output the character style for MS Word's benefit const SwEndNoteInfo& rInfo = m_footnoteEndnoteRefTag == XML_footnoteRef ? - m_rExport.m_pDoc->GetFootnoteInfo() : m_rExport.m_pDoc->GetEndNoteInfo(); - const SwCharFormat* pCharFormat = rInfo.GetCharFormat( *m_rExport.m_pDoc ); + m_rExport.m_rDoc.GetFootnoteInfo() : m_rExport.m_rDoc.GetEndNoteInfo(); + const SwCharFormat* pCharFormat = rInfo.GetCharFormat( m_rExport.m_rDoc ); if ( pCharFormat ) { const OString aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pCharFormat))); @@ -4151,7 +4151,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t // tdf#106742: since MS Word 2013 (compatibilityMode >= 15), top-level tables are handled the same as nested tables; // if no compatibilityMode is defined (which now should only happen on a new export to .docx), // LO uses a higher compatibility than 2010's 14. - sal_Int32 nMode = lcl_getWordCompatibilityMode( *m_rExport.m_pDoc ); + sal_Int32 nMode = lcl_getWordCompatibilityMode( m_rExport.m_rDoc ); const SwFrameFormat* pFrameFormat = pTableTextNodeInfoInner->getTableBox()->GetFrameFormat(); if ((0 < nMode && nMode <= 14) && m_tableReference->m_nTableDepth == 0) @@ -4306,7 +4306,7 @@ void DocxAttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t const SwTableLine * pTabLine = pTabBox->GetUpper(); // search next Redline - const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetExtraRedlineTable(); + const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetExtraRedlineTable(); for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < aExtraRedlineTable.GetSize(); ++nCurRedlinePos ) { SwExtraRedline* pExtraRedline = aExtraRedlineTable.GetRedline(nCurRedlinePos); @@ -4350,7 +4350,7 @@ void DocxAttributeOutput::TableCellRedline( ww8::WW8TableNodeInfoInner::Pointer_ const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); // search next Redline - const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetExtraRedlineTable(); + const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetExtraRedlineTable(); for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < aExtraRedlineTable.GetSize(); ++nCurRedlinePos ) { SwExtraRedline* pExtraRedline = aExtraRedlineTable.GetRedline(nCurRedlinePos); @@ -4548,7 +4548,7 @@ DocxStringTokenMap const aExceptionTokens[] = { void DocxAttributeOutput::LatentStyles() { // Do we have latent styles available? - uno::Reference<beans::XPropertySet> xPropertySet(m_rExport.m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet(m_rExport.m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW); uno::Sequence<beans::PropertyValue> aInteropGrabBag; xPropertySet->getPropertyValue("InteropGrabBag") >>= aInteropGrabBag; uno::Sequence<beans::PropertyValue> aLatentStyles; @@ -4781,7 +4781,7 @@ void DocxAttributeOutput::DocDefaults( ) StartStyleProperties(false, 0); for (int i = int(RES_CHRATR_BEGIN); i < int(RES_CHRATR_END); ++i) - OutputDefaultItem(m_rExport.m_pDoc->GetDefault(i)); + OutputDefaultItem(m_rExport.m_rDoc.GetDefault(i)); EndStyleProperties(false); @@ -4793,7 +4793,7 @@ void DocxAttributeOutput::DocDefaults( ) StartStyleProperties(true, 0); for (int i = int(RES_PARATR_BEGIN); i < int(RES_PARATR_END); ++i) - OutputDefaultItem(m_rExport.m_pDoc->GetDefault(i)); + OutputDefaultItem(m_rExport.m_rDoc.GetDefault(i)); EndStyleProperties(true); @@ -5505,7 +5505,7 @@ bool DocxAttributeOutput::ExportAsActiveXControl(const SdrObject* pObject) const if (!xControlModel.is()) return false; - uno::Reference< css::frame::XModel > xModel( m_rExport.m_pDoc->GetDocShell() ? m_rExport.m_pDoc->GetDocShell()->GetModel() : nullptr ); + uno::Reference< css::frame::XModel > xModel( m_rExport.m_rDoc.GetDocShell() ? m_rExport.m_rDoc.GetDocShell()->GetModel() : nullptr ); if (!xModel.is()) return false; @@ -5554,7 +5554,7 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S OSL_ASSERT(pFlyFrameFormat); // get interoperability information about embedded objects - uno::Reference< beans::XPropertySet > xPropSet( m_rExport.m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rExport.m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Sequence< beans::PropertyValue > aGrabBag, aObjectsInteropList,aObjectInteropAttributes; xPropSet->getPropertyValue( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) >>= aGrabBag; auto pProp = std::find_if(aGrabBag.begin(), aGrabBag.end(), @@ -6135,7 +6135,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj) // Write paragraph properties. StartParagraphProperties(); aAttrIter.OutParaAttr(false); - SfxItemSet aParagraphMarkerProperties(m_rExport.m_pDoc->GetAttrPool()); + SfxItemSet aParagraphMarkerProperties(m_rExport.m_rDoc.GetAttrPool()); EndParagraphProperties(aParagraphMarkerProperties, nullptr, nullptr, nullptr); do { @@ -6521,7 +6521,7 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, bool bBreakAfter, const WW // document: the last section is written explicitly in // DocxExport::WriteMainText(), don't duplicate that here. SwNodeIndex aCurrentNode(m_rExport.m_pCurPam->GetNode()); - SwNodeIndex aLastNode(m_rExport.m_pDoc->GetNodes().GetEndOfContent(), -1); + SwNodeIndex aLastNode(m_rExport.m_rDoc.GetNodes().GetEndOfContent(), -1); bool bEmit = aCurrentNode != aLastNode; if (!bEmit) @@ -6981,7 +6981,7 @@ void DocxAttributeOutput::FontPitchType( FontPitch ePitch ) const void DocxAttributeOutput::EmbedFont( const OUString& name, FontFamily family, FontPitch pitch ) { - if( !m_rExport.m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) + if( !m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) return; // no font embedding with this document EmbedFontStyle( name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch ); EmbedFontStyle( name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch ); @@ -8122,10 +8122,10 @@ void DocxAttributeOutput::WriteAnnotationMarks_Impl( std::vector< OUString >& rS void DocxAttributeOutput::TextFootnote_Impl( const SwFormatFootnote& rFootnote ) { const SwEndNoteInfo& rInfo = rFootnote.IsEndNote()? - m_rExport.m_pDoc->GetEndNoteInfo(): m_rExport.m_pDoc->GetFootnoteInfo(); + m_rExport.m_rDoc.GetEndNoteInfo(): m_rExport.m_rDoc.GetFootnoteInfo(); // footnote/endnote run properties - const SwCharFormat* pCharFormat = rInfo.GetAnchorCharFormat( *m_rExport.m_pDoc ); + const SwCharFormat* pCharFormat = rInfo.GetAnchorCharFormat( m_rExport.m_rDoc ); OString aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pCharFormat))); @@ -8134,7 +8134,7 @@ void DocxAttributeOutput::TextFootnote_Impl( const SwFormatFootnote& rFootnote ) // remember the footnote/endnote to // 1) write the footnoteReference/endnoteReference in EndRunProperties() // 2) be able to dump them all to footnotes.xml/endnotes.xml - if ( !rFootnote.IsEndNote() && m_rExport.m_pDoc->GetFootnoteInfo().m_ePos != FTNPOS_CHAPTER ) + if ( !rFootnote.IsEndNote() && m_rExport.m_rDoc.GetFootnoteInfo().m_ePos != FTNPOS_CHAPTER ) m_pFootnotesList->add( rFootnote ); else m_pEndnotesList->add( rFootnote ); @@ -8210,7 +8210,7 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes ) SwTwips nHeight(0); if (bFootnotes) { - const SwPageFootnoteInfo& rFootnoteInfo = m_rExport.m_pDoc->GetPageDesc(0).GetFootnoteInfo(); + const SwPageFootnoteInfo& rFootnoteInfo = m_rExport.m_rDoc.GetPageDesc(0).GetFootnoteInfo(); // Request separator only if both width and thickness are non-zero. bSeparator = rFootnoteInfo.GetLineStyle() != SvxBorderLineStyle::NONE && rFootnoteInfo.GetLineWidth() > 0 @@ -8338,9 +8338,9 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr void DocxAttributeOutput::SectFootnoteEndnotePr() { if( HasFootnotes()) - WriteFootnoteEndnotePr( m_pSerializer, XML_footnotePr, m_rExport.m_pDoc->GetFootnoteInfo(), 0 ); + WriteFootnoteEndnotePr( m_pSerializer, XML_footnotePr, m_rExport.m_rDoc.GetFootnoteInfo(), 0 ); if( HasEndnotes()) - WriteFootnoteEndnotePr( m_pSerializer, XML_endnotePr, m_rExport.m_pDoc->GetEndNoteInfo(), 0 ); + WriteFootnoteEndnotePr( m_pSerializer, XML_endnotePr, m_rExport.m_rDoc.GetEndNoteInfo(), 0 ); } void DocxAttributeOutput::ParaLineSpacing_Impl( short nSpace, short nMulti ) @@ -8519,7 +8519,7 @@ void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop ) // In DOCX, w:pos specifies the position of the current custom tab stop with respect to the current page margins. // But in ODT, zero position could be page margins or paragraph indent according to used settings. long tabsOffset = 0; - if (m_rExport.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT)) + if (m_rExport.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT)) tabsOffset = m_rExport.GetItem(RES_LR_SPACE).GetTextLeft(); // clear unused inherited tabs - otherwise the style will add them back in @@ -9839,7 +9839,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, const FSHelperPtr m_nextFontId( 1 ), m_tableReference(new TableReference()), m_bIgnoreNextFill(false), - m_pTableStyleExport(std::make_shared<DocxTableStyleExport>(rExport.m_pDoc, pSerializer)), + m_pTableStyleExport(std::make_shared<DocxTableStyleExport>(&rExport.m_rDoc, pSerializer)), m_bParaBeforeAutoSpacing(false), m_bParaAfterAutoSpacing(false), m_nParaBeforeSpacing(0), diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index f1870277a7fd..7115e4e2d664 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -218,7 +218,7 @@ void DocxExport::ExportGrfBullet(const SwTextNode&) OString DocxExport::AddRelation( const OUString& rType, const OUString& rTarget ) { - OUString sId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + OUString sId = m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), rType, rTarget, true ); return sId.toUtf8(); @@ -376,15 +376,15 @@ void DocxExport::DoFormText(const SwInputField* pField) OString DocxExport::OutputChart( uno::Reference< frame::XModel > const & xModel, sal_Int32 nCount, ::sax_fastparser::FSHelperPtr const & m_pSerializer ) { OUString aFileName = "charts/chart" + OUString::number(nCount) + ".xml"; - OUString sId = m_pFilter->addRelation( m_pSerializer->getOutputStream(), + OUString sId = m_rFilter.addRelation( m_pSerializer->getOutputStream(), oox::getRelationship(Relationship::CHART), aFileName ); aFileName = "word/charts/chart" + OUString::number(nCount) + ".xml"; ::sax_fastparser::FSHelperPtr pChartFS = - m_pFilter->openFragmentStreamWithSerializer( aFileName, + m_rFilter.openFragmentStreamWithSerializer( aFileName, "application/vnd.openxmlformats-officedocument.drawingml.chart+xml" ); - oox::drawingml::ChartExport aChartExport(XML_w, pChartFS, xModel, m_pFilter, oox::drawingml::DOCUMENT_DOCX); + oox::drawingml::ChartExport aChartExport(XML_w, pChartFS, xModel, &m_rFilter, oox::drawingml::DOCUMENT_DOCX); css::uno::Reference<css::util::XModifiable> xModifiable(xModel, css::uno::UNO_QUERY); const bool bOldModified = xModifiable && xModifiable->isModified(); aChartExport.ExportContent(); @@ -433,7 +433,7 @@ OString DocxExport::WriteOLEObject(SwOLEObj& rObject, OUString & io_rProgID) return OString(); } - OUString const sId = m_pFilter->addRelation( GetFS()->getOutputStream(), + OUString const sId = m_rFilter.addRelation( GetFS()->getOutputStream(), sRelationType, sFileName ); if (pProgID) { @@ -453,12 +453,12 @@ std::pair<OString, OString> DocxExport::WriteActiveXObject(const uno::Reference< OString sGUID; OString sName; - uno::Reference<io::XStream> xOutStorage(m_pFilter->openFragmentStream(sBinaryFileName, "application/vnd.ms-office.activeX"), uno::UNO_QUERY); + uno::Reference<io::XStream> xOutStorage(m_rFilter.openFragmentStream(sBinaryFileName, "application/vnd.ms-office.activeX"), uno::UNO_QUERY); if(xOutStorage.is()) { - oox::ole::OleStorage aOleStorage(m_pFilter->getComponentContext(), xOutStorage, false); + oox::ole::OleStorage aOleStorage(m_rFilter.getComponentContext(), xOutStorage, false); uno::Reference<io::XOutputStream> xOutputStream(aOleStorage.openOutputStream("contents"), uno::UNO_SET_THROW); - uno::Reference< css::frame::XModel > xModel( m_pDoc->GetDocShell() ? m_pDoc->GetDocShell()->GetModel() : nullptr ); + uno::Reference< css::frame::XModel > xModel( m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetModel() : nullptr ); oox::ole::OleFormCtrlExportHelper exportHelper(comphelper::getProcessComponentContext(), xModel, rxControlModel); if ( !exportHelper.isValid() ) return std::make_pair<OString, OString>(OString(), OString()); @@ -470,20 +470,20 @@ std::pair<OString, OString> DocxExport::WriteActiveXObject(const uno::Reference< // Write out ActiveX fragment const OUString sXMLFileName = "word/activeX/activeX" + OUString::number( m_nActiveXControls ) + ".xml"; - ::sax_fastparser::FSHelperPtr pActiveXFS = m_pFilter->openFragmentStreamWithSerializer(sXMLFileName, "application/vnd.ms-office.activeX+xml" ); + ::sax_fastparser::FSHelperPtr pActiveXFS = m_rFilter.openFragmentStreamWithSerializer(sXMLFileName, "application/vnd.ms-office.activeX+xml" ); - const OUString sBinaryId = m_pFilter->addRelation( pActiveXFS->getOutputStream(), + const OUString sBinaryId = m_rFilter.addRelation( pActiveXFS->getOutputStream(), oox::getRelationship(Relationship::ACTIVEXCONTROLBINARY), sBinaryFileName.copy(sBinaryFileName.lastIndexOf("/") + 1) ); pActiveXFS->singleElementNS(XML_ax, XML_ocx, - FSNS(XML_xmlns, XML_ax), m_pFilter->getNamespaceURL(OOX_NS(ax)), - FSNS(XML_xmlns, XML_r), m_pFilter->getNamespaceURL(OOX_NS(officeRel)), + FSNS(XML_xmlns, XML_ax), m_rFilter.getNamespaceURL(OOX_NS(ax)), + FSNS(XML_xmlns, XML_r), m_rFilter.getNamespaceURL(OOX_NS(officeRel)), FSNS(XML_ax, XML_classid), "{" + sGUID + "}", FSNS(XML_ax, XML_persistence), "persistStorage", FSNS(XML_r, XML_id), sBinaryId); - OString sXMLId = OUStringToOString(m_pFilter->addRelation(m_pDocumentFS->getOutputStream(), + OString sXMLId = OUStringToOString(m_rFilter.addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::CONTROL), sXMLFileName.copy(sBinaryFileName.indexOf("/") + 1)), RTL_TEXTENCODING_UTF8); @@ -499,7 +499,7 @@ void DocxExport::OutputDML(uno::Reference<drawing::XShape> const & xShape) nNamespace = XML_wpg; else if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape")) nNamespace = XML_pic; - oox::drawingml::ShapeExport aExport(nNamespace, m_pAttrOutput->GetSerializer(), nullptr, m_pFilter, oox::drawingml::DOCUMENT_DOCX, m_pAttrOutput.get()); + oox::drawingml::ShapeExport aExport(nNamespace, m_pAttrOutput->GetSerializer(), nullptr, &m_rFilter, oox::drawingml::DOCUMENT_DOCX, m_pAttrOutput.get()); aExport.WriteShape(xShape); } @@ -646,12 +646,12 @@ void DocxExport::InitStyles() m_pStyles.reset(new MSWordStyles( *this, /*bListStyles =*/ true )); // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::STYLES), "styles.xml" ); ::sax_fastparser::FSHelperPtr pStylesFS = - m_pFilter->openFragmentStreamWithSerializer( "word/styles.xml", + m_rFilter.openFragmentStreamWithSerializer( "word/styles.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" ); // switch the serializer to redirect the output to word/styles.xml @@ -669,12 +669,12 @@ void DocxExport::WriteFootnotesEndnotes() if ( m_pAttrOutput->HasFootnotes() ) { // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::FOOTNOTES), "footnotes.xml" ); ::sax_fastparser::FSHelperPtr pFootnotesFS = - m_pFilter->openFragmentStreamWithSerializer( "word/footnotes.xml", + m_rFilter.openFragmentStreamWithSerializer( "word/footnotes.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" ); // switch the serializer to redirect the output to word/footnotes.xml @@ -697,12 +697,12 @@ void DocxExport::WriteFootnotesEndnotes() return; // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::ENDNOTES), "endnotes.xml" ); ::sax_fastparser::FSHelperPtr pEndnotesFS = - m_pFilter->openFragmentStreamWithSerializer( "word/endnotes.xml", + m_rFilter.openFragmentStreamWithSerializer( "word/endnotes.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" ); // switch the serializer to redirect the output to word/endnotes.xml @@ -726,12 +726,12 @@ void DocxExport::WritePostitFields() if ( !m_pAttrOutput->HasPostitFields() ) return; - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::COMMENTS), "comments.xml" ); ::sax_fastparser::FSHelperPtr pPostitFS = - m_pFilter->openFragmentStreamWithSerializer( "word/comments.xml", + m_rFilter.openFragmentStreamWithSerializer( "word/comments.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" ); pPostitFS->startElementNS( XML_w, XML_comments, MainXmlNamespaces()); @@ -746,11 +746,11 @@ void DocxExport::WriteNumbering() if ( !m_pUsedNumTable ) return; // no numbering is used - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::NUMBERING), "numbering.xml" ); - ::sax_fastparser::FSHelperPtr pNumberingFS = m_pFilter->openFragmentStreamWithSerializer( "word/numbering.xml", + ::sax_fastparser::FSHelperPtr pNumberingFS = m_rFilter.openFragmentStreamWithSerializer( "word/numbering.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" ); // switch the serializer to redirect the output to word/numbering.xml @@ -758,12 +758,12 @@ void DocxExport::WriteNumbering() m_pDrawingML->SetFS( pNumberingFS ); pNumberingFS->startElementNS( XML_w, XML_numbering, - FSNS( XML_xmlns, XML_w ), m_pFilter->getNamespaceURL(OOX_NS(doc)), - FSNS( XML_xmlns, XML_o ), m_pFilter->getNamespaceURL(OOX_NS(vmlOffice)), - FSNS( XML_xmlns, XML_r ), m_pFilter->getNamespaceURL(OOX_NS(officeRel)), - FSNS( XML_xmlns, XML_v ), m_pFilter->getNamespaceURL(OOX_NS(vml)), - FSNS( XML_xmlns, XML_mc ), m_pFilter->getNamespaceURL(OOX_NS(mce)), - FSNS( XML_xmlns, XML_w14 ), m_pFilter->getNamespaceURL(OOX_NS(w14)), + FSNS( XML_xmlns, XML_w ), m_rFilter.getNamespaceURL(OOX_NS(doc)), + FSNS( XML_xmlns, XML_o ), m_rFilter.getNamespaceURL(OOX_NS(vmlOffice)), + FSNS( XML_xmlns, XML_r ), m_rFilter.getNamespaceURL(OOX_NS(officeRel)), + FSNS( XML_xmlns, XML_v ), m_rFilter.getNamespaceURL(OOX_NS(vml)), + FSNS( XML_xmlns, XML_mc ), m_rFilter.getNamespaceURL(OOX_NS(mce)), + FSNS( XML_xmlns, XML_w14 ), m_rFilter.getNamespaceURL(OOX_NS(w14)), FSNS( XML_mc, XML_Ignorable ), "w14" ); BulletDefinitions(); @@ -788,11 +788,11 @@ void DocxExport::WriteHeaderFooter( const SwFormat* pFormat, bool bHeader, const { OUString aName( "header" + OUString::number( ++m_nHeaders ) + ".xml" ); - aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + aRelId = m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::HEADER), aName ); - pFS = m_pFilter->openFragmentStreamWithSerializer( "word/" + aName, + pFS = m_rFilter.openFragmentStreamWithSerializer( "word/" + aName, "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" ); pFS->startElementNS( XML_w, XML_hdr, MainXmlNamespaces()); @@ -801,11 +801,11 @@ void DocxExport::WriteHeaderFooter( const SwFormat* pFormat, bool bHeader, const { OUString aName( "footer" + OUString::number( ++m_nFooters ) + ".xml" ); - aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + aRelId = m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::FOOTER), aName ); - pFS = m_pFilter->openFragmentStreamWithSerializer( "word/" + aName, + pFS = m_rFilter.openFragmentStreamWithSerializer( "word/" + aName, "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" ); pFS->startElementNS( XML_w, XML_ftr, MainXmlNamespaces()); @@ -857,17 +857,17 @@ void DocxExport::WriteHeaderFooter( const SwFormat* pFormat, bool bHeader, const void DocxExport::WriteFonts() { - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::FONTTABLE), "fontTable.xml" ); - ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer( + ::sax_fastparser::FSHelperPtr pFS = m_rFilter.openFragmentStreamWithSerializer( "word/fontTable.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" ); pFS->startElementNS( XML_w, XML_fonts, - FSNS( XML_xmlns, XML_w ), m_pFilter->getNamespaceURL(OOX_NS(doc)), - FSNS( XML_xmlns, XML_r ), m_pFilter->getNamespaceURL(OOX_NS(officeRel)) ); + FSNS( XML_xmlns, XML_w ), m_rFilter.getNamespaceURL(OOX_NS(doc)), + FSNS( XML_xmlns, XML_r ), m_rFilter.getNamespaceURL(OOX_NS(officeRel)) ); // switch the serializer to redirect the output to word/styles.xml m_pAttrOutput->SetSerializer( pFS ); @@ -884,7 +884,7 @@ void DocxExport::WriteFonts() void DocxExport::WriteProperties( ) { // Write the core properties - SwDocShell* pDocShell( m_pDoc->GetDocShell( ) ); + SwDocShell* pDocShell( m_rDoc.GetDocShell( ) ); uno::Reference<document::XDocumentProperties> xDocProps; bool bSecurityOptOpenReadOnly = false; if ( pDocShell ) @@ -895,12 +895,12 @@ void DocxExport::WriteProperties( ) bSecurityOptOpenReadOnly = pDocShell->IsSecurityOptOpenReadOnly(); } - m_pFilter->exportDocumentProperties( xDocProps, bSecurityOptOpenReadOnly ); + m_rFilter.exportDocumentProperties( xDocProps, bSecurityOptOpenReadOnly ); } void DocxExport::WriteDocVars(const sax_fastparser::FSHelperPtr& pFS) { - SwDocShell* pDocShell = m_pDoc->GetDocShell(); + SwDocShell* pDocShell = m_rDoc.GetDocShell(); if (!pDocShell) { return; @@ -971,20 +971,20 @@ WriteCompat(SwDoc const& rDoc, ::sax_fastparser::FSHelperPtr const& rpFS, void DocxExport::WriteSettings() { - SwViewShell *pViewShell(m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); + SwViewShell *pViewShell(m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()); if( !pViewShell && !m_aSettings.hasData() && !m_pAttrOutput->HasFootnotes() && !m_pAttrOutput->HasEndnotes()) return; - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::SETTINGS), "settings.xml" ); - ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer( + ::sax_fastparser::FSHelperPtr pFS = m_rFilter.openFragmentStreamWithSerializer( "word/settings.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" ); pFS->startElementNS( XML_w, XML_settings, - FSNS( XML_xmlns, XML_w ), m_pFilter->getNamespaceURL(OOX_NS(doc)) ); + FSNS( XML_xmlns, XML_w ), m_rFilter.getNamespaceURL(OOX_NS(doc)) ); // View if (pViewShell && pViewShell->GetViewOptions()->getBrowseMode()) @@ -1040,11 +1040,11 @@ void DocxExport::WriteSettings() pFS->singleElementNS(XML_w, XML_mirrorMargins); // Embed Fonts - if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) + if( m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) pFS->singleElementNS(XML_w, XML_embedTrueTypeFonts); // Embed System Fonts - if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_SYSTEM_FONTS )) + if( m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_SYSTEM_FONTS )) pFS->singleElementNS(XML_w, XML_embedSystemFonts); // Default Tab Stop @@ -1053,7 +1053,7 @@ void DocxExport::WriteSettings() OString::number(m_aSettings.defaultTabStop) ); // export current mail merge database and table names - SwDBData aData = m_pDoc->GetDBData(); + SwDBData aData = m_rDoc.GetDBData(); if ( !aData.sDataSource.isEmpty() && aData.nCommandType == css::sdb::CommandType::TABLE && !aData.sCommand.isEmpty() ) { OUString sDataSource = @@ -1077,7 +1077,7 @@ void DocxExport::WriteSettings() pFS->singleElementNS(XML_w, XML_autoHyphenation, FSNS(XML_w, XML_val), "true"); // Hyphenation details set depending on default style - SwTextFormatColl* pColl = m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false); + SwTextFormatColl* pColl = m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false); const SfxPoolItem* pItem; if (pColl && SfxItemState::SET == pColl->GetItemState(RES_PARATR_HYPHENZONE, false, &pItem)) { @@ -1091,14 +1091,14 @@ void DocxExport::WriteSettings() // Has Footnotes if( m_pAttrOutput->HasFootnotes()) - DocxAttributeOutput::WriteFootnoteEndnotePr( pFS, XML_footnotePr, m_pDoc->GetFootnoteInfo(), XML_footnote ); + DocxAttributeOutput::WriteFootnoteEndnotePr( pFS, XML_footnotePr, m_rDoc.GetFootnoteInfo(), XML_footnote ); // Has Endnotes if( m_pAttrOutput->HasEndnotes()) - DocxAttributeOutput::WriteFootnoteEndnotePr( pFS, XML_endnotePr, m_pDoc->GetEndNoteInfo(), XML_endnote ); + DocxAttributeOutput::WriteFootnoteEndnotePr( pFS, XML_endnotePr, m_rDoc.GetEndNoteInfo(), XML_endnote ); // Has themeFontLang information - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); bool bUseGrabBagProtection = false; bool bWriterWantsToProtect = false; @@ -1107,7 +1107,7 @@ void DocxExport::WriteSettings() bool bHasDummyRedlineProtectionKey = false; bool bReadOnlyStatusUnchanged = true; uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); - if ( m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) || + if ( m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) || m_pSections->DocumentIsProtected() ) { bWriterWantsToProtect = bWriterWantsToProtectForm = true; @@ -1170,7 +1170,7 @@ void DocxExport::WriteSettings() { pFS->startElementNS(XML_w, XML_compat); - WriteCompat(*m_pDoc, pFS, nTargetCompatibilityMode); + WriteCompat(m_rDoc, pFS, nTargetCompatibilityMode); uno::Sequence< beans::PropertyValue > aCompatSettingsSequence; rProp.Value >>= aCompatSettingsSequence; @@ -1258,7 +1258,7 @@ void DocxExport::WriteSettings() else if ( nToken == XML_edit && sValue == "readOnly" ) { // Ignore the case where read-only was not enforced, but now is. That is handled by _MarkAsFinal - bReadOnlyStatusUnchanged = m_pDoc->GetDocShell()->IsSecurityOptOpenReadOnly(); + bReadOnlyStatusUnchanged = m_rDoc.GetDocShell()->IsSecurityOptOpenReadOnly(); } else if ( nToken == XML_enforcement ) bEnforced = sValue.toBoolean(); @@ -1301,7 +1301,7 @@ void DocxExport::WriteSettings() { pFS->startElementNS(XML_w, XML_compat); - WriteCompat(*m_pDoc, pFS, nTargetCompatibilityMode); + WriteCompat(m_rDoc, pFS, nTargetCompatibilityMode); pFS->singleElementNS( XML_w, XML_compatSetting, FSNS( XML_w, XML_name ), "compatibilityMode", @@ -1341,7 +1341,7 @@ void DocxExport::WriteSettings() void DocxExport::WriteTheme() { - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; @@ -1360,7 +1360,7 @@ void DocxExport::WriteTheme() if ( !themeDom.is() ) return; - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::THEME), "theme/theme1.xml" ); @@ -1374,7 +1374,7 @@ void DocxExport::WriteTheme() void DocxExport::WriteGlossary() { - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; @@ -1407,7 +1407,7 @@ void DocxExport::WriteGlossary() if ( !glossaryDocDom.is() ) return; - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::GLOSSARYDOCUMENT), "glossary/document.xml" ); @@ -1433,7 +1433,7 @@ void DocxExport::WriteGlossary() PropertySet aProps(xOutputStream); aProps.setAnyProperty( PROP_RelId, uno::makeAny( gId.toInt32() )); - m_pFilter->addRelation( xOutputStream, gType, gTarget); + m_rFilter.addRelation( xOutputStream, gType, gTarget); uno::Reference< xml::sax::XSAXSerializable > gserializer( xDom, uno::UNO_QUERY ); writer->setOutputStream(GetFilter().openFragmentStream( "word/glossary/" + gTarget, contentType ) ); gserializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ), @@ -1443,7 +1443,7 @@ void DocxExport::WriteGlossary() void DocxExport::WriteCustomXml() { - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); static constexpr OUStringLiteral aName = u"" UNO_NAME_MISC_OBJ_INTEROPGRABBAG; @@ -1470,7 +1470,7 @@ void DocxExport::WriteCustomXml() uno::Reference<xml::dom::XDocument> customXmlDomProps = customXmlDomPropslist[j]; if (customXmlDom.is()) { - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::CUSTOMXML), "../customXml/item"+OUString::number((j+1))+".xml" ); @@ -1492,7 +1492,7 @@ void DocxExport::WriteCustomXml() uno::Sequence< beans::StringPair >() ); // Adding itemprops's relationship entry to item.xml.rels file - m_pFilter->addRelation( GetFilter().openFragmentStream( "customXml/item"+OUString::number((j+1))+".xml", + m_rFilter.addRelation( GetFilter().openFragmentStream( "customXml/item"+OUString::number((j+1))+".xml", "application/xml" ) , oox::getRelationship(Relationship::CUSTOMXMLPROPS), "itemProps"+OUString::number((j+1))+".xml" ); @@ -1502,7 +1502,7 @@ void DocxExport::WriteCustomXml() void DocxExport::WriteVBA() { - uno::Reference<document::XStorageBasedDocument> xStorageBasedDocument(m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY); + uno::Reference<document::XStorageBasedDocument> xStorageBasedDocument(m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY); if (!xStorageBasedDocument.is()) return; @@ -1529,7 +1529,7 @@ void DocxExport::WriteVBA() pOut->WriteStream(*pIn); // Write the relationship. - m_pFilter->addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), "vbaProject.bin"); + m_rFilter.addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), "vbaProject.bin"); } OUString aDataName("_MS_VBA_Macros_XML"); @@ -1556,12 +1556,12 @@ void DocxExport::WriteVBA() if (!xProjectStream.is()) return; - m_pFilter->addRelation(xProjectStream, oox::getRelationship(Relationship::WORDVBADATA), "vbaData.xml"); + m_rFilter.addRelation(xProjectStream, oox::getRelationship(Relationship::WORDVBADATA), "vbaData.xml"); } void DocxExport::WriteEmbeddings() { - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; @@ -1630,7 +1630,7 @@ void DocxExport::WriteEmbeddings() bool DocxExport::isMirroredMargin() { bool bMirroredMargins = false; - if ( UseOnPage::Mirror == (UseOnPage::Mirror & m_pDoc->GetPageDesc(0).ReadUseOn()) ) + if ( UseOnPage::Mirror == (UseOnPage::Mirror & m_rDoc.GetPageDesc(0).ReadUseOn()) ) { bMirroredMargins = true; } @@ -1644,7 +1644,7 @@ void DocxExport::WriteMainText() if ( getenv("SW_DEBUG_DOM") ) { - m_pDoc->dumpAsXml(); + m_rDoc.dumpAsXml(); } // reset the incrementing linked-textboxes chain ID before re-saving. @@ -1664,7 +1664,7 @@ void DocxExport::WriteMainText() // body m_pDocumentFS->startElementNS(XML_w, XML_body); - m_pCurPam->GetPoint()->nNode = m_pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); + m_pCurPam->GetPoint()->nNode = m_rDoc.GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); // the text WriteText(); @@ -1686,17 +1686,17 @@ void DocxExport::WriteMainText() XFastAttributeListRef DocxExport::MainXmlNamespaces() { FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); - pAttr->add( FSNS( XML_xmlns, XML_o ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vmlOffice)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_r ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(officeRel)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_v ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vml)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_w ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(doc)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_w10 ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vmlWord)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_wp ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(dmlWordDr)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_wps ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wps)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_wpg ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wpg)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_mc ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(mce)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_wp14 ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wp14)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_w14 ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(w14)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_o ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(vmlOffice)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_r ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(officeRel)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_v ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(vml)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_w ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(doc)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_w10 ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(vmlWord)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_wp ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(dmlWordDr)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_wps ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(wps)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_wpg ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(wpg)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_mc ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(mce)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_wp14 ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(wp14)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_w14 ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(w14)), RTL_TEXTENCODING_UTF8).getStr() ); pAttr->add( FSNS( XML_mc, XML_Ignorable ), "w14 wp14" ); return XFastAttributeListRef( pAttr ); } @@ -1763,11 +1763,11 @@ void DocxExport::SetFS( ::sax_fastparser::FSHelperPtr const & pFS ) mpFS = pFS; } -DocxExport::DocxExport(DocxExportFilter* pFilter, SwDoc* pDocument, +DocxExport::DocxExport(DocxExportFilter& rFilter, SwDoc& rDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, - SwPaM* pOriginalPam, bool bDocm, bool bTemplate) - : MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ), - m_pFilter( pFilter ), + SwPaM& rOriginalPam, bool bDocm, bool bTemplate) + : MSWordExportBase(rDocument, pCurrentPam, &rOriginalPam), + m_rFilter( rFilter ), m_nHeaders( 0 ), m_nFooters( 0 ), m_nOLEObjects( 0 ), @@ -1780,7 +1780,7 @@ DocxExport::DocxExport(DocxExportFilter* pFilter, SwDoc* pDocument, WriteProperties( ); // relations for the document - m_pFilter->addRelation( oox::getRelationship(Relationship::OFFICEDOCUMENT), + m_rFilter.addRelation( oox::getRelationship(Relationship::OFFICEDOCUMENT), "word/document.xml" ); // Set media type depending of document type @@ -1810,12 +1810,12 @@ DocxExport::DocxExport(DocxExportFilter* pFilter, SwDoc* pDocument, // the actual document - m_pDocumentFS = m_pFilter->openFragmentStreamWithSerializer( "word/document.xml", aMediaType ); + m_pDocumentFS = m_rFilter.openFragmentStreamWithSerializer( "word/document.xml", aMediaType ); SetFS(m_pDocumentFS); // the DrawingML access - m_pDrawingML.reset(new oox::drawingml::DrawingML(m_pDocumentFS, m_pFilter, oox::drawingml::DOCUMENT_DOCX)); + m_pDrawingML.reset(new oox::drawingml::DrawingML(m_pDocumentFS, &m_rFilter, oox::drawingml::DOCUMENT_DOCX)); // the attribute output for the document m_pAttrOutput.reset(new DocxAttributeOutput( *this, m_pDocumentFS, m_pDrawingML.get() )); diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 74336b72d454..5091b8f64979 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -66,7 +66,7 @@ struct DocxSettingsData class DocxExport : public MSWordExportBase { /// Pointer to the filter that owns us. - DocxExportFilter *m_pFilter; + DocxExportFilter& m_rFilter; /// Fast serializer for the document output. ::sax_fastparser::FSHelperPtr m_pDocumentFS; @@ -117,8 +117,8 @@ class DocxExport : public MSWordExportBase public: - DocxExportFilter& GetFilter() { return *m_pFilter; }; - const DocxExportFilter& GetFilter() const { return *m_pFilter; }; + DocxExportFilter& GetFilter() { return m_rFilter; }; + const DocxExportFilter& GetFilter() const { return m_rFilter; }; const ww8::Frame* GetFloatingTableFrame() const { return m_pFloatingTableFrame; } @@ -273,8 +273,8 @@ public: void WriteMainText(); /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class. - DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, - std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM* pOriginalPam, + DocxExport( DocxExportFilter& rFilter, SwDoc& rDocument, + std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM& rOriginalPam, bool bDocm, bool bTemplate); /// Destructor. diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx index ad44c9190931..b914cc1815ce 100644 --- a/sw/source/filter/ww8/docxexportfilter.cxx +++ b/sw/source/filter/ww8/docxexportfilter.cxx @@ -82,7 +82,7 @@ bool DocxExportFilter::exportDocument() // export the document // (in a separate block so that it's destructed before the commit) { - DocxExport aExport(this, pDoc, pCurPam, &aPam, bDocm, isExportTemplate()); + DocxExport aExport(*this, *pDoc, pCurPam, aPam, bDocm, isExportTemplate()); aExport.ExportDocument( true ); // FIXME support exporting selection only } diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9f6068bdf057..c91acb378f6d 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -272,7 +272,7 @@ void RtfAttributeOutput::EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t pTex { bool bLastPara = false; if (m_rExport.m_nTextTyp == TXT_FTN || m_rExport.m_nTextTyp == TXT_EDN - || m_rExport.m_pDoc->IsClipBoard()) + || m_rExport.m_rDoc.IsClipBoard()) { // We're ending a paragraph that is the last paragraph of a footnote or endnote, or of clipboard. bLastPara @@ -1364,8 +1364,8 @@ void RtfAttributeOutput::SectionType(sal_uInt8 nBreakCode) void RtfAttributeOutput::SectFootnoteEndnotePr() { - WriteFootnoteEndnotePr(true, m_rExport.m_pDoc->GetFootnoteInfo()); - WriteFootnoteEndnotePr(false, m_rExport.m_pDoc->GetEndNoteInfo()); + WriteFootnoteEndnotePr(true, m_rExport.m_rDoc.GetFootnoteInfo()); + WriteFootnoteEndnotePr(false, m_rExport.m_rDoc.GetEndNoteInfo()); } void RtfAttributeOutput::WriteFootnoteEndnotePr(bool bFootnote, const SwEndNoteInfo& rInfo) @@ -2849,7 +2849,7 @@ void RtfAttributeOutput::TextFootnote_Impl(const SwFormatFootnote& rFootnote) m_aRun->append(' '); WriteTextFootnoteNumStr(rFootnote); m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FOOTNOTE); - if (rFootnote.IsEndNote() || m_rExport.m_pDoc->GetFootnoteInfo().m_ePos == FTNPOS_CHAPTER) + if (rFootnote.IsEndNote() || m_rExport.m_rDoc.GetFootnoteInfo().m_ePos == FTNPOS_CHAPTER) m_aRun->append(OOO_STRING_SVTOOLS_RTF_FTNALT); m_aRun->append(' '); WriteTextFootnoteNumStr(rFootnote); @@ -2932,7 +2932,7 @@ void RtfAttributeOutput::ParaTabStop(const SvxTabStopItem& rTabStop) { long nOffset = 0; // Tabs are absolute by default. - if (m_rExport.m_pDoc->getIDocumentSettingAccess().get( + if (m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::TABS_RELATIVE_TO_INDENT)) nOffset = m_rExport.GetItem(RES_LR_SPACE).GetTextLeft(); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 8c3577ed7794..bc07a5c4d0ac 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -203,9 +203,9 @@ static bool IsExportNumRule(const SwNumRule& rRule) void RtfExport::BuildNumbering() { - const SwNumRuleTable& rListTable = m_pDoc->GetNumRuleTable(); + const SwNumRuleTable& rListTable = m_rDoc.GetNumRuleTable(); - SwNumRule* pOutlineRule = m_pDoc->GetOutlineNumRule(); + SwNumRule* pOutlineRule = m_rDoc.GetOutlineNumRule(); if (IsExportNumRule(*pOutlineRule)) GetNumberingId(*pOutlineRule); @@ -254,7 +254,7 @@ void RtfExport::WriteNumbering() void RtfExport::WriteRevTab() { - int nRevAuthors = m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); + int nRevAuthors = m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); if (nRevAuthors < 1) return; @@ -262,7 +262,7 @@ void RtfExport::WriteRevTab() // RTF always seems to use Unknown as the default first entry GetRedline("Unknown"); - for (SwRangeRedline* pRedl : m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()) + for (SwRangeRedline* pRedl : m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()) { GetRedline(SW_MOD()->GetRedlineAuthor(pRedl->GetAuthor())); } @@ -403,7 +403,7 @@ void RtfExport::WriteStyles() void RtfExport::WriteFootnoteSettings() { - const SwPageFootnoteInfo& rFootnoteInfo = m_pDoc->GetPageDesc(0).GetFootnoteInfo(); + const SwPageFootnoteInfo& rFootnoteInfo = m_rDoc.GetPageDesc(0).GetFootnoteInfo(); // Request a separator only in case the width is larger than zero. bool bSeparator = double(rFootnoteInfo.GetWidth()) > 0; @@ -454,7 +454,7 @@ void RtfExport::WriteMainText() else { m_pCurPam->GetPoint()->nNode - = m_pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); + = m_rDoc.GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); } WriteText(); @@ -472,7 +472,7 @@ void RtfExport::WriteInfo() .WriteChar('}'); Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_INFO); - SwDocShell* pDocShell(m_pDoc->GetDocShell()); + SwDocShell* pDocShell(m_rDoc.GetDocShell()); uno::Reference<document::XDocumentProperties> xDocProps; if (pDocShell) { @@ -538,7 +538,7 @@ void RtfExport::WriteUserProps() Strm().WriteChar('{').WriteCharPtr( OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_USERPROPS); - SwDocShell* pDocShell(m_pDoc->GetDocShell()); + SwDocShell* pDocShell(m_rDoc.GetDocShell()); uno::Reference<document::XDocumentProperties> xDocProps; if (pDocShell) { @@ -549,7 +549,7 @@ void RtfExport::WriteUserProps() else { // Clipboard document, read metadata from the meta field manager. - sw::MetaFieldManager& rManager = m_pDoc->GetMetaFieldManager(); + sw::MetaFieldManager& rManager = m_rDoc.GetMetaFieldManager(); xDocProps.set(rManager.getDocumentProperties()); } @@ -632,7 +632,7 @@ void RtfExport::WriteUserProps() void RtfExport::WritePageDescTable() { // Write page descriptions (page styles) - std::size_t nSize = m_pDoc->GetPageDescCnt(); + std::size_t nSize = m_rDoc.GetPageDescCnt(); if (!nSize) return; @@ -644,7 +644,7 @@ void RtfExport::WritePageDescTable() .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCTBL); for (std::size_t n = 0; n < nSize; ++n) { - const SwPageDesc& rPageDesc = m_pDoc->GetPageDesc(n); + const SwPageDesc& rPageDesc = m_rDoc.GetPageDesc(n); Strm() .WriteCharPtr(SAL_NEWLINE_STRING) @@ -658,7 +658,7 @@ void RtfExport::WritePageDescTable() // search for the next page description std::size_t i = nSize; while (i) - if (rPageDesc.GetFollow() == &m_pDoc->GetPageDesc(--i)) + if (rPageDesc.GetFollow() == &m_rDoc.GetPageDesc(--i)) break; Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCNXT); OutULong(i).WriteChar(' '); @@ -684,7 +684,7 @@ ErrCode RtfExport::ExportDocument_Impl() .WriteChar('1') .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSI); Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_DEFF); - OutULong(m_aFontHelper.GetId(m_pDoc->GetAttrPool().GetDefaultItem(RES_CHRATR_FONT))); + OutULong(m_aFontHelper.GetId(m_rDoc.GetAttrPool().GetDefaultItem(RES_CHRATR_FONT))); // If this not exist, MS don't understand our ansi characters (0x80-0xff). Strm().WriteCharPtr("\\adeflang1025"); @@ -714,7 +714,7 @@ ErrCode RtfExport::ExportDocument_Impl() OutULong(1); // Zoom - SwViewShell* pViewShell(m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); + SwViewShell* pViewShell(m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()); if (pViewShell && pViewShell->GetViewOptions()->GetZoomType() == SvxZoomType::PERCENT) { Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_VIEWSCALE); @@ -724,7 +724,7 @@ ErrCode RtfExport::ExportDocument_Impl() if (RedlineFlags::On & m_nOrigRedlineFlags) Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_REVISIONS); // Mirror margins? - if ((UseOnPage::Mirror & m_pDoc->GetPageDesc(0).ReadUseOn()) == UseOnPage::Mirror) + if ((UseOnPage::Mirror & m_rDoc.GetPageDesc(0).ReadUseOn()) == UseOnPage::Mirror) Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_MARGMIRROR); // Init sections m_pSections = new MSWordSections(*this); @@ -736,7 +736,7 @@ ErrCode RtfExport::ExportDocument_Impl() // enable it on a per-section basis. OTOH don't always enable it as it // breaks moving of drawings - so write it only in case there is really a // protected section in the document. - for (auto const& pSectionFormat : m_pDoc->GetSections()) + for (auto const& pSectionFormat : m_rDoc.GetSections()) { if (!pSectionFormat->IsInUndo() && pSectionFormat->GetProtect().IsContentProtected()) { @@ -749,13 +749,13 @@ ErrCode RtfExport::ExportDocument_Impl() Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FORMSHADE); // size and empty margins of the page - if (m_pDoc->GetPageDescCnt()) + if (m_rDoc.GetPageDescCnt()) { // Seeking the first SwFormatPageDesc. If no set, the default is valid const SwFormatPageDesc* pSttPgDsc = nullptr; { const SwNode& rSttNd - = *m_pDoc->GetNodes()[m_pDoc->GetNodes().GetEndOfExtras().GetIndex() + 2]; + = *m_rDoc.GetNodes()[m_rDoc.GetNodes().GetEndOfExtras().GetIndex() + 2]; const SfxItemSet* pSet = nullptr; if (rSttNd.IsContentNode()) @@ -772,7 +772,7 @@ ErrCode RtfExport::ExportDocument_Impl() pSttPgDsc = &pSet->Get(RES_PAGEDESC); if (!pSttPgDsc->GetPageDesc()) pSttPgDsc = nullptr; - else if (m_pDoc->FindPageDesc(pSttPgDsc->GetPageDesc()->GetName(), &nPosInDoc)) + else if (m_rDoc.FindPageDesc(pSttPgDsc->GetPageDesc()->GetName(), &nPosInDoc)) { Strm() .WriteChar('{') @@ -782,8 +782,7 @@ ErrCode RtfExport::ExportDocument_Impl() } } } - const SwPageDesc& rPageDesc - = pSttPgDsc ? *pSttPgDsc->GetPageDesc() : m_pDoc->GetPageDesc(0); + const SwPageDesc& rPageDesc = pSttPgDsc ? *pSttPgDsc->GetPageDesc() : m_rDoc.GetPageDesc(0); const SwFrameFormat& rFormatPage = rPageDesc.GetMaster(); { @@ -838,7 +837,7 @@ ErrCode RtfExport::ExportDocument_Impl() } // line numbering - const SwLineNumberInfo& rLnNumInfo = m_pDoc->GetLineNumberInfo(); + const SwLineNumberInfo& rLnNumInfo = m_rDoc.GetLineNumberInfo(); if (rLnNumInfo.IsPaintLineNumbers()) { sal_uLong nLnNumRestartNo = 0; @@ -850,7 +849,7 @@ ErrCode RtfExport::ExportDocument_Impl() { // write the footnotes and endnotes-out Info - const SwFootnoteInfo& rFootnoteInfo = m_pDoc->GetFootnoteInfo(); + const SwFootnoteInfo& rFootnoteInfo = m_rDoc.GetFootnoteInfo(); const char* pOut = FTNPOS_CHAPTER == rFootnoteInfo.m_ePos ? OOO_STRING_SVTOOLS_RTF_ENDDOC : OOO_STRING_SVTOOLS_RTF_FTNBJ; @@ -896,7 +895,7 @@ ErrCode RtfExport::ExportDocument_Impl() } Strm().WriteCharPtr(pOut); - const SwEndNoteInfo& rEndNoteInfo = m_pDoc->GetEndNoteInfo(); + const SwEndNoteInfo& rEndNoteInfo = m_rDoc.GetEndNoteInfo(); Strm() .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_AENDDOC) @@ -930,7 +929,7 @@ ErrCode RtfExport::ExportDocument_Impl() Strm().WriteCharPtr(pOut); } - if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX)) + if (!m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX)) // RTF default is true, so write compat flag if this should be false. Strm().WriteCharPtr(LO_STRING_SVTOOLS_RTF_HTMAUTSP); @@ -1021,10 +1020,10 @@ void RtfExport::AppendSection(const SwPageDesc* pPageDesc, const SwSectionFormat AttrOutput().SectionBreak(msword::PageBreak, false, m_pSections->CurrentSectionInfo()); } -RtfExport::RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, - std::shared_ptr<SwUnoCursor>& pCurrentPam, SwPaM* pOriginalPam, +RtfExport::RtfExport(RtfExportFilter* pFilter, SwDoc& rDocument, + std::shared_ptr<SwUnoCursor>& pCurrentPam, SwPaM& rOriginalPam, Writer* pWriter, bool bOutOutlineOnly) - : MSWordExportBase(pDocument, pCurrentPam, pOriginalPam) + : MSWordExportBase(rDocument, pCurrentPam, &rOriginalPam) , m_pFilter(pFilter) , m_pWriter(pWriter) , m_pSections(nullptr) @@ -1169,7 +1168,7 @@ void RtfExport::OutColorTable() { // Build the table from rPool since the colors provided to // RtfAttributeOutput callbacks are too late. - const SfxItemPool& rPool = m_pDoc->GetAttrPool(); + const SfxItemPool& rPool = m_rDoc.GetAttrPool(); // MSO Word uses a default color table with 16 colors (which is used e.g. for highlighting) InsColor(COL_BLACK); @@ -1460,7 +1459,7 @@ ErrCode SwRTFWriter::WriteStream() std::shared_ptr<SwUnoCursor> pCurPam(m_pDoc->CreateUnoCursor(*m_pCurrentPam->End(), false)); pCurPam->SetMark(); *pCurPam->GetPoint() = *m_pCurrentPam->Start(); - RtfExport aExport(nullptr, m_pDoc, pCurPam, m_pCurrentPam.get(), this, m_bOutOutlineOnly); + RtfExport aExport(nullptr, *m_pDoc, pCurPam, *m_pCurrentPam, this, m_bOutOutlineOnly); aExport.ExportDocument(true); return ERRCODE_NONE; } diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx index 0c0d35d1a97f..3b4f3b4b79d5 100644 --- a/sw/source/filter/ww8/rtfexport.hxx +++ b/sw/source/filter/ww8/rtfexport.hxx @@ -148,8 +148,8 @@ protected: public: /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class. - RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, std::shared_ptr<SwUnoCursor>& pCurrentPam, - SwPaM* pOriginalPam, Writer* pWriter, bool bOutOutlineOnly = false); + RtfExport(RtfExportFilter* pFilter, SwDoc& rDocument, std::shared_ptr<SwUnoCursor>& pCurrentPam, + SwPaM& rOriginalPam, Writer* pWriter, bool bOutOutlineOnly = false); RtfExport(const RtfExport&) = delete; diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx index f8c28d9f9bc6..8ae2b1c50fc7 100644 --- a/sw/source/filter/ww8/rtfexportfilter.cxx +++ b/sw/source/filter/ww8/rtfexportfilter.cxx @@ -77,7 +77,7 @@ sal_Bool RtfExportFilter::filter(const uno::Sequence<beans::PropertyValue>& aDes // export the document // (in a separate block so that it's destructed before the commit) { - RtfExport aExport(this, pDoc, pCurPam, &aPam, nullptr); + RtfExport aExport(this, *pDoc, pCurPam, aPam, nullptr); aExport.ExportDocument(true); } diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index fa8be14f70cc..426a0d094e13 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -582,7 +582,7 @@ void WW8Export::MiserableRTLFrameFormatHack(SwTwips &rLeft, SwTwips &rRight, const ww8::Frame &rFrameFormat) { //Require nasty bidi swap - if (SvxFrameDirection::Horizontal_RL_TB != m_pDoc->GetTextDirection(rFrameFormat.GetPosition())) + if (SvxFrameDirection::Horizontal_RL_TB != m_rDoc.GetTextDirection(rFrameFormat.GetPosition())) return; SwTwips nWidth = rRight - rLeft; @@ -828,8 +828,8 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const OSL_ENSURE(false, "Unsupported surround type for export"); break; } - if (pObj && (pObj->GetLayer() == rWrt.m_pDoc->getIDocumentDrawModelAccess().GetHellId() || - pObj->GetLayer() == rWrt.m_pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId())) + if (pObj && (pObj->GetLayer() == rWrt.m_rDoc.getIDocumentDrawModelAccess().GetHellId() || + pObj->GetLayer() == rWrt.m_rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId())) { nFlags |= 0x4000; } @@ -956,10 +956,10 @@ sal_uInt32 WW8Export::GetSdrOrdNum( const SwFrameFormat& rFormat ) const { // no Layout for this format, then recalc the ordnum SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(&rFormat); - nOrdNum = std::distance(m_pDoc->GetSpzFrameFormats()->begin(), - m_pDoc->GetSpzFrameFormats()->find( pFormat ) ); + nOrdNum = std::distance(m_rDoc.GetSpzFrameFormats()->begin(), + m_rDoc.GetSpzFrameFormats()->find( pFormat ) ); - const SwDrawModel* pModel = m_pDoc->getIDocumentDrawModelAccess().GetDrawModel(); + const SwDrawModel* pModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel(); if( pModel ) nOrdNum += pModel->GetPage( 0 )->GetObjCount(); } @@ -1142,7 +1142,7 @@ void MSWord_SdrAttrIter::OutAttr( sal_Int32 nSwPos ) m_rExport.m_pOutFormatNode = nullptr; const SfxItemPool* pSrcPool = pEditPool; - const SfxItemPool& rDstPool = m_rExport.m_pDoc->GetAttrPool(); + const SfxItemPool& rDstPool = m_rExport.m_rDoc.GetAttrPool(); nTmpSwPos = nSwPos; // Did we already produce a <w:sz> element? @@ -1212,7 +1212,7 @@ bool MSWord_SdrAttrIter::IsTextAttr(sal_Int32 nSwPos) const SfxPoolItem* MSWord_SdrAttrIter::HasTextItem(sal_uInt16 nWhich) const { nWhich = sw::hack::TransformWhichBetweenPools(*pEditPool, - m_rExport.m_pDoc->GetAttrPool(), nWhich); + m_rExport.m_rDoc.GetAttrPool(), nWhich); if (nWhich) { for (const auto& rTextAtr : aTextAtrArr) @@ -1233,7 +1233,7 @@ const SfxPoolItem& MSWord_SdrAttrIter::GetItem( sal_uInt16 nWhich ) const if (!pRet) { SfxItemSet aSet(pEditObj->GetParaAttribs(nPara)); - nWhich = GetSetWhichFromSwDocWhich(aSet, *m_rExport.m_pDoc, nWhich); + nWhich = GetSetWhichFromSwDocWhich(aSet, m_rExport.m_rDoc, nWhich); OSL_ENSURE(nWhich, "Impossible, catastrophic failure imminent"); pRet = &aSet.Get(nWhich); } @@ -1245,7 +1245,7 @@ const SfxPoolItem& MSWord_SdrAttrIter::GetItem( sal_uInt16 nWhich ) const //set any items which are not already set, but differ from "Normal". void MSWord_SdrAttrIter::SetItemsThatDifferFromStandard(bool bCharAttr, SfxItemSet& rSet) { - SwTextFormatColl* pC = m_rExport.m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool + SwTextFormatColl* pC = m_rExport.m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool (RES_POOLCOLL_STANDARD, false); SfxWhichIter aWhichIter(rSet); @@ -1253,7 +1253,7 @@ void MSWord_SdrAttrIter::SetItemsThatDifferFromStandard(bool bCharAttr, SfxItemS { if (SfxItemState::SET != rSet.GetItemState(nEEWhich, false)) { - sal_uInt16 nSwWhich = sw::hack::TransformWhichBetweenPools(m_rExport.m_pDoc->GetAttrPool(), + sal_uInt16 nSwWhich = sw::hack::TransformWhichBetweenPools(m_rExport.m_rDoc.GetAttrPool(), *pEditPool, nEEWhich); if (!nSwWhich) continue; @@ -1286,7 +1286,7 @@ void MSWord_SdrAttrIter::OutParaAttr(bool bCharAttr, const std::set<sal_uInt16>* const SfxPoolItem* pItem = aIter.GetCurItem(); const SfxItemPool* pSrcPool = pEditPool, - * pDstPool = &m_rExport.m_pDoc->GetAttrPool(); + * pDstPool = &m_rExport.m_rDoc.GetAttrPool(); do { @@ -1454,7 +1454,7 @@ void WinwordAnchoring::WriteData( EscherEx& rEx ) const void WW8Export::CreateEscher() { - SfxItemState eBackSet = m_pDoc->GetPageDesc(0).GetMaster(). + SfxItemState eBackSet = m_rDoc.GetPageDesc(0).GetMaster(). GetItemState(RES_BACKGROUND); if (m_pHFSdrObjs->size() || m_pSdrObjs->size() || SfxItemState::SET == eBackSet) { @@ -2137,7 +2137,7 @@ sal_Int32 SwEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, MSO_SPT eS void SwBasicEscherEx::Init() { MapUnit eMap = MapUnit::MapTwip; - if (SwDrawModel *pModel = rWrt.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel()) + if (SwDrawModel *pModel = rWrt.m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()) { // PPT works only with units of 576DPI // WW however is using twips, i.e 1440DPI. @@ -2153,7 +2153,7 @@ void SwBasicEscherEx::Init() mnEmuMul = aFact.GetNumerator(); mnEmuDiv = aFact.GetDenominator(); - SetHellLayerId(rWrt.m_pDoc->getIDocumentDrawModelAccess().GetHellId()); + SetHellLayerId(rWrt.m_rDoc.getIDocumentDrawModelAccess().GetHellId()); } sal_Int32 SwBasicEscherEx::ToFract16(sal_Int32 nVal, sal_uInt32 nMax) @@ -2179,7 +2179,7 @@ sal_Int32 SwBasicEscherEx::ToFract16(sal_Int32 nVal, sal_uInt32 nMax) SdrLayerID SwBasicEscherEx::GetInvisibleHellId() const { - return rWrt.m_pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId(); + return rWrt.m_rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId(); } void SwBasicEscherEx::WritePictures() @@ -2298,7 +2298,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) nSecondShapeId ); EscherPropertyContainer aPropOpt; - const SwFrameFormat &rFormat = rWrt.m_pDoc->GetPageDesc(0).GetMaster(); + const SwFrameFormat &rFormat = rWrt.m_rDoc.GetPageDesc(0).GetMaster(); const SfxPoolItem* pItem = nullptr; SfxItemState eState = rFormat.GetItemState(RES_BACKGROUND, true, &pItem); @@ -2927,7 +2927,7 @@ void SwEscherEx::WriteOCXControl( const SwFrameFormat& rFormat, sal_uInt32 nShap OpenContainer( ESCHER_SpContainer ); - SwDrawModel *pModel = rWrt.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel(); + SwDrawModel *pModel = rWrt.m_rDoc.getIDocumentDrawModelAccess().GetDrawModel(); OutputDevice *pDevice = Application::GetDefaultDevice(); OSL_ENSURE(pModel && pDevice, "no model or device"); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 2b5b66fab0cf..6b61fd14e519 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -192,7 +192,7 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTextNode& rTextNd) : { SwPosition aPos(rTextNd); - mbParaIsRTL = SvxFrameDirection::Horizontal_RL_TB == rWr.m_pDoc->GetTextDirection(aPos); + mbParaIsRTL = SvxFrameDirection::Horizontal_RL_TB == rWr.m_rDoc.GetTextDirection(aPos); maCharRunIter = maCharRuns.begin(); IterToCurrent(); @@ -218,10 +218,10 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTextNode& rTextNd) : maFlyIter = maFlyFrames.begin(); - if ( !m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() ) + if ( !m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) { SwPosition aPosition( rNd, SwIndex( const_cast<SwTextNode*>(&rNd) ) ); - pCurRedline = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedline( aPosition, &nCurRedlinePos ); + pCurRedline = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedline( aPosition, &nCurRedlinePos ); } nCurrentSwPos = SearchNext(1); @@ -279,16 +279,16 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos ) } } - if ( nCurRedlinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size() ) + if ( nCurRedlinePos < m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() ) { // nCurRedlinePos point to the next redline SwRedlineTable::size_type nRedLinePos = nCurRedlinePos; if( pCurRedline ) ++nRedLinePos; - for ( ; nRedLinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); ++nRedLinePos ) + for ( ; nRedLinePos < m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++nRedLinePos ) { - const SwRangeRedline* pRedl = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nRedLinePos ]; + const SwRangeRedline* pRedl = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nRedLinePos ]; const SwPosition* pStt = pRedl->Start(); const SwPosition* pEnd = pStt == pRedl->GetPoint() @@ -1410,9 +1410,9 @@ bool SwWW8AttrIter::IncludeEndOfParaCRInRedlineProperties( sal_Int32 nEnd ) cons { // search next Redline for( SwRedlineTable::size_type nPos = nCurRedlinePos; - nPos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); ++nPos ) + nPos < m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++nPos ) { - const SwRangeRedline *pRange = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[nPos]; + const SwRangeRedline *pRange = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[nPos]; const SwPosition* pEnd = pRange->End(); const SwPosition* pStart = pRange->Start(); bool bBreak = true; @@ -1467,7 +1467,7 @@ const SwRedlineData* SwWW8AttrIter::GetParagraphLevelRedline( ) pCurRedline = nullptr; // ToDo : this is not the most ideal ... should start maybe from 'nCurRedlinePos' - for(SwRangeRedline* pRedl : m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()) + for(SwRangeRedline* pRedl : m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()) { const SwPosition* pCheckedStt = pRedl->Start(); @@ -1512,10 +1512,10 @@ const SwRedlineData* SwWW8AttrIter::GetRunLevelRedline( sal_Int32 nPos ) assert(!pCurRedline); // search next Redline - for( ; nCurRedlinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); + for( ; nCurRedlinePos < m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++nCurRedlinePos ) { - const SwRangeRedline* pRedl = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nCurRedlinePos ]; + const SwRangeRedline* pRedl = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nCurRedlinePos ]; const SwPosition* pStt = pRedl->Start(); const SwPosition* pEnd = pStt == pRedl->GetPoint() @@ -1563,7 +1563,7 @@ SvxFrameDirection MSWordExportBase::GetCurrentPageDirection() const { const SwFrameFormat &rFormat = m_pCurrentPageDesc ? m_pCurrentPageDesc->GetMaster() - : m_pDoc->GetPageDesc( 0 ).GetMaster(); + : m_rDoc.GetPageDesc( 0 ).GetMaster(); return rFormat.GetFrameDir().GetValue(); } @@ -1583,7 +1583,7 @@ SvxFrameDirection MSWordExportBase::GetDefaultFrameDirection( ) const { const SwContentNode *pNd = static_cast<const SwContentNode *>(m_pOutFormatNode); SwPosition aPos( *pNd ); - nDir = m_pDoc->GetTextDirection( aPos ); + nDir = m_rDoc.GetTextDirection( aPos ); } else if ( dynamic_cast< const SwTextFormatColl *>( m_pOutFormatNode ) != nullptr ) { @@ -1643,7 +1643,7 @@ const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() const { const SwFrameFormat &rFormat = m_pCurrentPageDesc ? m_pCurrentPageDesc->GetMaster() - : m_pDoc->GetPageDesc(0).GetMaster(); + : m_rDoc.GetPageDesc(0).GetMaster(); const SfxPoolItem* pItem = nullptr; //If not set, or "no fill", get real bg @@ -1653,7 +1653,7 @@ const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() const if (SfxItemState::SET != eState || !pRet || (!pRet->GetGraphic() && pRet->GetColor() == COL_TRANSPARENT)) { - pRet = &(DefaultItemGet<SvxBrushItem>(*m_pDoc,RES_BACKGROUND)); + pRet = &(DefaultItemGet<SvxBrushItem>(m_rDoc,RES_BACKGROUND)); } return pRet; } @@ -1773,10 +1773,10 @@ OUString SwWW8AttrIter::GetSnippet(const OUString &rStr, sal_Int32 nCurrentPos, static SwTextFormatColl& lcl_getFormatCollection( MSWordExportBase& rExport, const SwTextNode* pTextNode ) { SwRedlineTable::size_type nPos = 0; - SwRedlineTable::size_type nMax = rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); + SwRedlineTable::size_type nMax = rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); while( nPos < nMax ) { - const SwRangeRedline* pRedl = rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nPos++ ]; + const SwRangeRedline* pRedl = rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nPos++ ]; const SwPosition* pStt = pRedl->Start(); const SwPosition* pEnd = pStt == pRedl->GetPoint() ? pRedl->GetMark() @@ -1890,7 +1890,7 @@ void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, sal_Int32 nCurr bool MSWordExportBase::GetBookmarks( const SwTextNode& rNd, sal_Int32 nStt, sal_Int32 nEnd, IMarkVector& rArr ) { - IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess(); sal_uLong nNd = rNd.GetIndex( ); const sal_Int32 nMarks = pMarkAccess->getAllMarksCount(); @@ -1938,7 +1938,7 @@ bool MSWordExportBase::GetBookmarks( const SwTextNode& rNd, sal_Int32 nStt, bool MSWordExportBase::GetAnnotationMarks( const SwWW8AttrIter& rAttrs, sal_Int32 nStt, sal_Int32 nEnd, IMarkVector& rArr ) { - IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess(); sal_uLong nNd = rAttrs.GetNode().GetIndex(); const sal_Int32 nMarks = pMarkAccess->getAnnotationMarksCount(); @@ -2397,7 +2397,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) || ch == CH_TXT_ATR_FORMELEMENT) ? 1 : 0; - IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess(); if ( ch == CH_TXT_ATR_FIELDSTART ) { SwPosition aPosition( rNode, SwIndex( &rNode, nCurrentPos ) ); @@ -2547,7 +2547,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) { // Allow MSO to emulate LO footnote text starting at left margin - only meaningful with hanging indent sal_Int32 nFirstLineIndent=0; - SfxItemSet aSet( m_pDoc->GetAttrPool(), svl::Items<RES_LR_SPACE, RES_LR_SPACE>{} ); + SfxItemSet aSet( m_rDoc.GetAttrPool(), svl::Items<RES_LR_SPACE, RES_LR_SPACE>{} ); const SwTextNode* pTextNode( rNode.GetTextNode() ); if ( pTextNode && pTextNode->GetAttr(aSet) ) { @@ -2784,13 +2784,13 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) pTmpSet = new SfxItemSet( rNode.GetSwAttrSet() ); SvxULSpaceItem aUL( *static_cast<const SvxULSpaceItem*>(pItem) ); // #i25901#- consider compatibility option - if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES)) + if (!m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES)) { if( !(ND_HAS_PREV_LAYNODE & nPrvNxtNd )) aUL.SetUpper( 0 ); } // #i25901# - consider compatibility option - if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS)) + if (!m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS)) { if( !(ND_HAS_NEXT_LAYNODE & nPrvNxtNd )) aUL.SetLower( 0 ); @@ -3077,7 +3077,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) // Exception: if there is a character style hint at the end of the // paragraph only, then still go with 2), as RES_TXTATR_CHARFMT is always // set as a hint. - SfxItemSet aParagraphMarkerProperties(m_pDoc->GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_TXTATR_END>{}); + SfxItemSet aParagraphMarkerProperties(m_rDoc.GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_TXTATR_END>{}); bool bCharFormatOnly = true; SwFormatAutoFormat const& rListAutoFormat(static_cast<SwFormatAutoFormat const&>(rNode.GetAttr(RES_PARATR_LIST_AUTOFMT))); @@ -3359,7 +3359,7 @@ void WW8AttributeOutput::OutputFlyFrame_Impl( const ww8::Frame& rFormat, const P { //Test to see if this textbox contains only a single graphic/ole SwTextNode* pParTextNode = rAnch.GetContentAnchor()->nNode.GetNode().GetTextNode(); - if ( pParTextNode && !m_rWW8Export.m_pDoc->GetNodes()[ nStt ]->IsNoTextNode() ) + if ( pParTextNode && !m_rWW8Export.m_rDoc.GetNodes()[ nStt ]->IsNoTextNode() ) bDone = true; } if( !bDone ) @@ -3385,7 +3385,7 @@ void WW8AttributeOutput::OutputFlyFrame_Impl( const ww8::Frame& rFormat, const P if ( m_rWW8Export.IsInTable() && (RndStdIds::FLY_AT_PAGE != rAnch.GetAnchorId()) && - !m_rWW8Export.m_pDoc->GetNodes()[ nStt ]->IsNoTextNode() + !m_rWW8Export.m_rDoc.GetNodes()[ nStt ]->IsNoTextNode() ) { // note: set Flag bOutTable again, @@ -3564,7 +3564,7 @@ WW8Ruby::WW8Ruby(const SwTextNode& rNode, const SwFormatRuby& rRuby, const MSWor /*Get defaults if no formatting on ruby text*/ const SfxItemPool* pPool = rNode.GetSwAttrSet().GetPool(); - pPool = pPool ? pPool : &rExport.m_pDoc->GetAttrPool(); + pPool = pPool ? pPool : &rExport.m_rDoc.GetAttrPool(); const auto& rFont diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 3c133772a68d..76fad21db51e 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -44,7 +44,7 @@ SwNumRule* MSWordExportBase::DuplicateNumRuleImpl(const SwNumRule *pRule) { const OUString sPrefix("WW8TempExport" + OUString::number( m_nUniqueList++ )); SwNumRule* pMyNumRule = - new SwNumRule( m_pDoc->GetUniqueNumRuleName( &sPrefix ), + new SwNumRule( m_rDoc.GetUniqueNumRuleName( &sPrefix ), SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); m_pUsedNumTable->push_back( pMyNumRule ); @@ -113,7 +113,7 @@ sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule ) if ( !m_pUsedNumTable ) { m_pUsedNumTable.reset(new SwNumRuleTable); - m_pUsedNumTable->insert( m_pUsedNumTable->begin(), m_pDoc->GetNumRuleTable().begin(), m_pDoc->GetNumRuleTable().end() ); + m_pUsedNumTable->insert( m_pUsedNumTable->begin(), m_rDoc.GetNumRuleTable().begin(), m_rDoc.GetNumRuleTable().end() ); // Check, if the outline rule is already inserted into <pUsedNumTable>. // If yes, do not insert it again. bool bOutlineRuleAdded( false ); @@ -124,7 +124,7 @@ sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule ) { m_pUsedNumTable->erase( m_pUsedNumTable->begin() + n ); } - else if ( &rRule == m_pDoc->GetOutlineNumRule() ) + else if ( &rRule == m_rDoc.GetOutlineNumRule() ) { bOutlineRuleAdded = true; } @@ -133,7 +133,7 @@ sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule ) if ( !bOutlineRuleAdded ) { // still need to paste the OutlineRule - SwNumRule* pR = m_pDoc->GetOutlineNumRule(); + SwNumRule* pR = m_rDoc.GetOutlineNumRule(); m_pUsedNumTable->push_back( pR ); } } @@ -545,7 +545,7 @@ void MSWordExportBase::NumberingLevel( const SfxItemSet* pOutSet = nullptr; // cbGrpprlChpx - SfxItemSet aSet( m_pDoc->GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, + SfxItemSet aSet( m_rDoc.GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END>{} ); if (rFormat.GetCharFormat() || bWriteBullet) { diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index f3f8e3db3912..3917f7ff2fa6 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -144,16 +144,16 @@ MSWordStyles::MSWordStyles( MSWordExportBase& rExport, bool bListStyles ) { // if exist any Foot-/End-Notes then get from the EndNoteInfo struct // the CharFormats. They will create it! - if ( !m_rExport.m_pDoc->GetFootnoteIdxs().empty() ) + if ( !m_rExport.m_rDoc.GetFootnoteIdxs().empty() ) { - m_rExport.m_pDoc->GetEndNoteInfo().GetAnchorCharFormat( *m_rExport.m_pDoc ); - m_rExport.m_pDoc->GetEndNoteInfo().GetCharFormat( *m_rExport.m_pDoc ); - m_rExport.m_pDoc->GetFootnoteInfo().GetAnchorCharFormat( *m_rExport.m_pDoc ); - m_rExport.m_pDoc->GetFootnoteInfo().GetCharFormat( *m_rExport.m_pDoc ); + m_rExport.m_rDoc.GetEndNoteInfo().GetAnchorCharFormat( m_rExport.m_rDoc ); + m_rExport.m_rDoc.GetEndNoteInfo().GetCharFormat( m_rExport.m_rDoc ); + m_rExport.m_rDoc.GetFootnoteInfo().GetAnchorCharFormat( m_rExport.m_rDoc ); + m_rExport.m_rDoc.GetFootnoteInfo().GetCharFormat( m_rExport.m_rDoc ); } - sal_uInt16 nAlloc = WW8_RESERVED_SLOTS + m_rExport.m_pDoc->GetCharFormats()->size() - 1 + - m_rExport.m_pDoc->GetTextFormatColls()->size() - 1 + - (bListStyles ? m_rExport.m_pDoc->GetNumRuleTable().size() - 1 : 0); + sal_uInt16 nAlloc = WW8_RESERVED_SLOTS + m_rExport.m_rDoc.GetCharFormats()->size() - 1 + + m_rExport.m_rDoc.GetTextFormatColls()->size() - 1 + + (bListStyles ? m_rExport.m_rDoc.GetNumRuleTable().size() - 1 : 0); // somewhat generous ( free for up to 15 ) m_pFormatA.reset( new SwFormat*[ nAlloc ] ); @@ -281,7 +281,7 @@ void MSWordStyles::BuildStylesTable() { m_nUsedSlots = WW8_RESERVED_SLOTS; // reserved slots for standard, headingX, and others - const SwCharFormats& rArr = *m_rExport.m_pDoc->GetCharFormats(); // first CharFormat + const SwCharFormats& rArr = *m_rExport.m_rDoc.GetCharFormats(); // first CharFormat // the default character style ( 0 ) will not be outputted ! for( size_t n = 1; n < rArr.size(); n++ ) { @@ -289,7 +289,7 @@ void MSWordStyles::BuildStylesTable() m_pFormatA[ BuildGetSlot( *pFormat ) ] = pFormat; } - const SwTextFormatColls& rArr2 = *m_rExport.m_pDoc->GetTextFormatColls(); // then TextFormatColls + const SwTextFormatColls& rArr2 = *m_rExport.m_rDoc.GetTextFormatColls(); // then TextFormatColls // the default character style ( 0 ) will not be outputted ! for( size_t n = 1; n < rArr2.size(); n++ ) { @@ -307,7 +307,7 @@ void MSWordStyles::BuildStylesTable() if (!m_bListStyles) return; - const SwNumRuleTable& rNumRuleTable = m_rExport.m_pDoc->GetNumRuleTable(); + const SwNumRuleTable& rNumRuleTable = m_rExport.m_rDoc.GetNumRuleTable(); for (size_t i = 0; i < rNumRuleTable.size(); ++i) { const SwNumRule* pNumRule = rNumRuleTable[i]; @@ -466,7 +466,7 @@ void MSWordStyles::SetStyleDefaults( const SwFormat& rFormat, bool bPap ) const SfxItemPool& rPool = *rFormat.GetAttrSet().GetPool(); for( n = nStt; n < nEnd; ++n ) aFlags[ n - RES_CHRATR_BEGIN ] = nullptr != rPool.GetPoolDefaultItem( n ) - || SfxItemState::SET == m_rExport.m_pDoc->GetDfltTextFormatColl()->GetItemState( n, false ); + || SfxItemState::SET == m_rExport.m_rDoc.GetDfltTextFormatColl()->GetItemState( n, false ); // static defaults, that differs between WinWord and SO if( bPap ) @@ -981,7 +981,7 @@ MSWordSections::MSWordSections( MSWordExportBase& rExport ) : mbDocumentIsProtected( false ) { const SwSectionFormat *pFormat = nullptr; - rExport.m_pCurrentPageDesc = &rExport.m_pDoc->GetPageDesc( 0 ); + rExport.m_pCurrentPageDesc = &rExport.m_rDoc.GetPageDesc( 0 ); const SfxPoolItem* pI; const SwNode* pNd = rExport.m_pCurPam->GetContentNode(); @@ -1139,7 +1139,7 @@ void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwFormatPageDesc& rPD, void WW8_WrPlcSepx::WriteFootnoteEndText( WW8Export& rWrt, sal_uLong nCpStt ) { sal_uInt8 nInfoFlags = 0; - const SwFootnoteInfo& rInfo = rWrt.m_pDoc->GetFootnoteInfo(); + const SwFootnoteInfo& rInfo = rWrt.m_rDoc.GetFootnoteInfo(); if( !rInfo.m_aErgoSum.isEmpty() ) nInfoFlags |= 0x02; if( !rInfo.m_aQuoVadis.isEmpty() ) nInfoFlags |= 0x04; @@ -1189,7 +1189,7 @@ void WW8_WrPlcSepx::WriteFootnoteEndText( WW8Export& rWrt, sal_uLong nCpStt ) // Endnote Info rDop.rncEdn = 0; // rncEdn: Don't Restart - const SwEndNoteInfo& rEndInfo = rWrt.m_pDoc->GetEndNoteInfo(); + const SwEndNoteInfo& rEndInfo = rWrt.m_rDoc.GetEndNoteInfo(); rDop.nfcEdnRef = WW8Export::GetNumId( rEndInfo.m_aFormat.GetNumberingType() ); rDop.nEdn = rEndInfo.m_nFootnoteOffset + 1; rDop.epc = rWrt.m_bEndAtTextEnd ? 3 : 0; @@ -1329,8 +1329,8 @@ void WW8AttributeOutput::StartSection() void WW8AttributeOutput::SectFootnoteEndnotePr() { - const SwFootnoteInfo& rInfo = m_rWW8Export.m_pDoc->GetFootnoteInfo(); - const SwEndNoteInfo& rEndNoteInfo = m_rWW8Export.m_pDoc->GetEndNoteInfo(); + const SwFootnoteInfo& rInfo = m_rWW8Export.m_rDoc.GetFootnoteInfo(); + const SwEndNoteInfo& rEndNoteInfo = m_rWW8Export.m_rDoc.GetEndNoteInfo(); m_rWW8Export.InsUInt16( NS_sprm::SRncFtn::val ); switch( rInfo.m_eNum ) { @@ -1597,7 +1597,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt const SwPageDesc* pPd = rSepInfo.pPageDesc; if ( rSepInfo.pSectionFormat && !pPd ) - pPd = &m_pDoc->GetPageDesc( 0 ); + pPd = &m_rDoc.GetPageDesc( 0 ); m_pCurrentPageDesc = pPd; @@ -1615,7 +1615,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt AttrOutput().SectionFormProtection( rSepInfo.IsProtected() ); // line numbers - const SwLineNumberInfo& rLnNumInfo = m_pDoc->GetLineNumberInfo(); + const SwLineNumberInfo& rLnNumInfo = m_rDoc.GetLineNumberInfo(); if ( rLnNumInfo.IsPaintLineNumbers() ) AttrOutput().SectionLineNumbering( rSepInfo.nLnNumRestartNo, rLnNumInfo ); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 8c2ac92789e9..90152ceca99c 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -453,19 +453,19 @@ static void WriteDop( WW8Export& rWrt ) WW8Dop& rDop = *rWrt.pDop; // i#78951#, store the value of unknown compatibility options - rDop.SetCompatibilityOptions( rWrt.m_pDoc->getIDocumentSettingAccess().Getn32DummyCompatibilityOptions1()); - rDop.SetCompatibilityOptions2( rWrt.m_pDoc->getIDocumentSettingAccess().Getn32DummyCompatibilityOptions2()); + rDop.SetCompatibilityOptions( rWrt.m_rDoc.getIDocumentSettingAccess().Getn32DummyCompatibilityOptions1()); + rDop.SetCompatibilityOptions2( rWrt.m_rDoc.getIDocumentSettingAccess().Getn32DummyCompatibilityOptions2()); - rDop.fNoLeading = !rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING); - rDop.fUsePrinterMetrics = !rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_VIRTUAL_DEVICE); + rDop.fNoLeading = !rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING); + rDop.fUsePrinterMetrics = !rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::USE_VIRTUAL_DEVICE); // write default TabStop const SvxTabStopItem& rTabStop = - DefaultItemGet<SvxTabStopItem>(*rWrt.m_pDoc, RES_PARATR_TABSTOP); + DefaultItemGet<SvxTabStopItem>(rWrt.m_rDoc, RES_PARATR_TABSTOP); rDop.dxaTab = static_cast<sal_uInt16>(rTabStop[0].GetTabPos()); // Zoom factor and type - SwViewShell *pViewShell(rWrt.m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); + SwViewShell *pViewShell(rWrt.m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()); if (pViewShell) { switch ( pViewShell->GetViewOptions()->GetZoomType() ) @@ -483,14 +483,14 @@ static void WriteDop( WW8Export& rWrt ) // for the DocStat fields) rDop.fWCFootnoteEdn = true; // because they are included in StarWriter - const SwDocStat& rDStat = rWrt.m_pDoc->getIDocumentStatistics().GetDocStat(); + const SwDocStat& rDStat = rWrt.m_rDoc.getIDocumentStatistics().GetDocStat(); rDop.cWords = rDStat.nWord; rDop.cCh = rDStat.nChar; rDop.cPg = static_cast< sal_Int16 >(rDStat.nPage); rDop.cParas = rDStat.nPara; rDop.cLines = rDStat.nPara; - SwDocShell *pDocShell(rWrt.m_pDoc->GetDocShell()); + SwDocShell *pDocShell(rWrt.m_rDoc.GetDocShell()); OSL_ENSURE(pDocShell, "no SwDocShell"); uno::Reference<document::XDocumentProperties> xDocProps; uno::Reference<beans::XPropertySet> xProps; @@ -502,7 +502,7 @@ static void WriteDop( WW8Export& rWrt ) } if ((rWrt.pSepx && rWrt.pSepx->DocumentIsProtected()) || - rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM ) || + rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM ) || rDop.lKeyProtDoc != 0) { rDop.fProtEnabled = true; @@ -543,9 +543,9 @@ static void WriteDop( WW8Export& rWrt ) rDop.cParasFootnoteEdn = rDStat.nPara; rDop.cLinesFootnoteEdn = rDStat.nPara; - rDop.fDontUseHTMLAutoSpacing = rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX); + rDop.fDontUseHTMLAutoSpacing = rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX); - rDop.fExpShRtn = !rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK); // #i56856# + rDop.fExpShRtn = !rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK); // #i56856# rDop.Write( *rWrt.pTableStrm, *rWrt.pFib ); } @@ -671,7 +671,7 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo) for (rTypo.m_reserved1=8;rTypo.m_reserved1>0;rTypo.m_reserved1-=2) { - pForbidden = m_pDoc->getIDocumentSettingAccess().getForbiddenCharacters(rTypo.GetConvertedLang(), + pForbidden = m_rDoc.getIDocumentSettingAccess().getForbiddenCharacters(rTypo.GetConvertedLang(), false); if (nullptr != pForbidden) { @@ -741,7 +741,7 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo) const IDocumentSettingAccess& rIDocumentSettingAccess = GetWriter().getIDocumentSettingAccess(); rTypo.m_fKerningPunct = sal_uInt16(rIDocumentSettingAccess.get(DocumentSettingId::KERN_ASIAN_PUNCTUATION)); - rTypo.m_iJustification = sal_uInt16(m_pDoc->getIDocumentSettingAccess().getCharacterCompressionType()); + rTypo.m_iJustification = sal_uInt16(m_rDoc.getIDocumentSettingAccess().getCharacterCompressionType()); } // It can only be found something with this method, if it is used within @@ -754,7 +754,7 @@ const SfxPoolItem* MSWordExportBase::HasItem( sal_uInt16 nWhich ) const // if write an EditEngine text, then the WhichIds are greater than // our own Ids. So the Id have to translate from our into the // EditEngine Range - nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, *m_pDoc, nWhich); + nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, m_rDoc, nWhich); if (nWhich && SfxItemState::SET != m_pISet->GetItemState(nWhich, true, &pItem)) pItem = nullptr; } @@ -776,7 +776,7 @@ const SfxPoolItem& MSWordExportBase::GetItem(sal_uInt16 nWhich) const // if write an EditEngine text, then the WhichIds are greater than // our own Ids. So the Id have to translate from our into the // EditEngine Range - nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, *m_pDoc, nWhich); + nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, m_rDoc, nWhich); OSL_ENSURE(nWhich != 0, "All broken, Impossible"); return m_pISet->Get(nWhich); } @@ -1495,7 +1495,7 @@ void WW8Export::AppendBookmarkEndWithCorrection( const OUString& rName ) std::unique_ptr<SvxBrushItem> MSWordExportBase::getBackground() { - const SwFrameFormat &rFormat = m_pDoc->GetPageDesc(0).GetMaster(); + const SwFrameFormat &rFormat = m_rDoc.GetPageDesc(0).GetMaster(); std::unique_ptr<SvxBrushItem> aBrush = std::make_unique<SvxBrushItem>(RES_BACKGROUND); SfxItemState eState = rFormat.GetBackgroundState(aBrush); @@ -1513,39 +1513,36 @@ int MSWordExportBase::CollectGrfsOfBullets() { m_vecBulletPic.clear(); - if ( m_pDoc ) + size_t nCountRule = m_rDoc.GetNumRuleTable().size(); + for (size_t n = 0; n < nCountRule; ++n) { - size_t nCountRule = m_pDoc->GetNumRuleTable().size(); - for (size_t n = 0; n < nCountRule; ++n) + const SwNumRule &rRule = *( m_rDoc.GetNumRuleTable().at(n) ); + sal_uInt16 nLevels = rRule.IsContinusNum() ? 1 : 9; + for (sal_uInt16 nLvl = 0; nLvl < nLevels; ++nLvl) { - const SwNumRule &rRule = *( m_pDoc->GetNumRuleTable().at(n) ); - sal_uInt16 nLevels = rRule.IsContinusNum() ? 1 : 9; - for (sal_uInt16 nLvl = 0; nLvl < nLevels; ++nLvl) + const SwNumFormat &rFormat = rRule.Get(nLvl); + if (SVX_NUM_BITMAP != rFormat.GetNumberingType()) { - const SwNumFormat &rFormat = rRule.Get(nLvl); - if (SVX_NUM_BITMAP != rFormat.GetNumberingType()) - { - continue; - } - const Graphic *pGraf = rFormat.GetBrush()? rFormat.GetBrush()->GetGraphic():nullptr; - if ( pGraf ) + continue; + } + const Graphic *pGraf = rFormat.GetBrush()? rFormat.GetBrush()->GetGraphic():nullptr; + if ( pGraf ) + { + bool bHas = false; + for (const Graphic* p : m_vecBulletPic) { - bool bHas = false; - for (const Graphic* p : m_vecBulletPic) - { - if (p->GetChecksum() == pGraf->GetChecksum()) - { - bHas = true; - break; - } - } - if (!bHas) + if (p->GetChecksum() == pGraf->GetChecksum()) { - Size aSize(pGraf->GetPrefSize()); - if (0 != aSize.Height() && 0 != aSize.Width()) - m_vecBulletPic.push_back(pGraf); + bHas = true; + break; } } + if (!bHas) + { + Size aSize(pGraf->GetPrefSize()); + if (0 != aSize.Height() && 0 != aSize.Width()) + m_vecBulletPic.push_back(pGraf); + } } } } @@ -1870,11 +1867,11 @@ void MSWordExportBase::SetCurPam(sal_uLong nStt, sal_uLong nEnd) { m_nCurStart = nStt; m_nCurEnd = nEnd; - m_pCurPam = Writer::NewUnoCursor( *m_pDoc, nStt, nEnd ); + m_pCurPam = Writer::NewUnoCursor( m_rDoc, nStt, nEnd ); // Recognize tables in special cases if ( nStt != m_pCurPam->GetMark()->nNode.GetIndex() && - m_pDoc->GetNodes()[ nStt ]->IsTableNode() ) + m_rDoc.GetNodes()[ nStt ]->IsTableNode() ) { m_pCurPam->GetMark()->nNode = nStt; } @@ -2389,7 +2386,7 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pBoxFormat = pTabBox1->GetFrameFormat(); sal_uInt16 nFlags = - lcl_TCFlags(*m_rWW8Export.m_pDoc, pTabBox1, *aItRowSpans); + lcl_TCFlags(m_rWW8Export.m_rDoc, pTabBox1, *aItRowSpans); m_rWW8Export.InsUInt16( nFlags ); static sal_uInt8 aNullBytes[] = { 0x0, 0x0 }; @@ -2466,7 +2463,7 @@ void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner const * p const SwFrameFormat* pParentFormat = GetExport().m_pParentFrame ? &(GetExport().m_pParentFrame->GetFrameFormat()) : - GetExport().m_pDoc->GetPageDesc(0).GetPageFormatOfNode(*pTextNd, false); + GetExport().m_rDoc.GetPageDesc(0).GetPageFormatOfNode(*pTextNd, false); aRect = pParentFormat->FindLayoutRect(true); nPageSize = aRect.Width(); if ( 0 == nPageSize ) @@ -2857,7 +2854,7 @@ void MSWordExportBase::WriteText() } // No need to create a "fake" section if this is the end of the document, // except to emulate balanced columns. - else if ( nColumnCount < 2 && aIdx == m_pDoc->GetNodes().GetEndOfContent() ) + else if ( nColumnCount < 2 && aIdx == m_rDoc.GetNodes().GetEndOfContent() ) bNeedExportBreakHere = false; } @@ -2923,7 +2920,7 @@ void WW8Export::WriteMainText() pFib->m_fcMin = Strm().Tell(); - m_pCurPam->GetPoint()->nNode = m_pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); + m_pCurPam->GetPoint()->nNode = m_rDoc.GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); WriteText(); @@ -3003,7 +3000,7 @@ void WW8Export::WriteFkpPlcUsw() m_pFieldTextBxs->Write( *this ); // Fields ( Textboxes ) m_pFieldHFTextBxs->Write( *this ); // Fields ( Head/Foot-Textboxes ) - if (m_pEscher || m_pDoc->ContainsMSVBasic()) + if (m_pEscher || m_rDoc.ContainsMSVBasic()) { /* Every time MS 2000 creates an escher stream there is always @@ -3053,7 +3050,7 @@ void WW8Export::WriteFkpPlcUsw() // Write SttbfAssoc WW8SttbAssoc * pSttbfAssoc = dynamic_cast<WW8SttbAssoc *> - (m_pDoc->getIDocumentExternalData().getExternalData(::sw::tExternalDataType::STTBF_ASSOC).get()); + (m_rDoc.getIDocumentExternalData().getExternalData(::sw::tExternalDataType::STTBF_ASSOC).get()); if ( pSttbfAssoc ) // #i106057# { @@ -3066,7 +3063,7 @@ void WW8Export::WriteFkpPlcUsw() // Reclaim stored FIB data from document. ::ww8::WW8FibData * pFibData = dynamic_cast<ww8::WW8FibData *> - (m_pDoc->getIDocumentExternalData().getExternalData(::sw::tExternalDataType::FIB).get()); + (m_rDoc.getIDocumentExternalData().getExternalData(::sw::tExternalDataType::FIB).get()); if ( pFibData ) { @@ -3141,7 +3138,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) // If we can find the outline this bookmark refers to // save the name of the bookmark and the // node index number of where it points to - if( m_pDoc->GotoOutline( aPos, aName ) ) + if( m_rDoc.GotoOutline( aPos, aName ) ) { nIdx = aPos.nNode.GetIndex(); noBookmark = true; @@ -3151,7 +3148,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) { SwNodeIndex* pIdx; OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); - const SwFlyFrameFormat* pFormat = m_pDoc->FindFlyByName(aName, SwNodeType::Grf); + const SwFlyFrameFormat* pFormat = m_rDoc.FindFlyByName(aName, SwNodeType::Grf); if (pFormat && nullptr != (pIdx = const_cast<SwNodeIndex*>(pFormat->GetContent().GetContentIdx()))) { nIdx = pIdx->GetNext()->GetIndex(); @@ -3162,7 +3159,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) { SwNodeIndex* pIdx; OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); - const SwFlyFrameFormat* pFormat = m_pDoc->FindFlyByName(aName, SwNodeType::Text); + const SwFlyFrameFormat* pFormat = m_rDoc.FindFlyByName(aName, SwNodeType::Text); if (pFormat && nullptr != (pIdx = const_cast<SwNodeIndex*>(pFormat->GetContent().GetContentIdx()))) { nIdx = pIdx->GetIndex() + 1; @@ -3173,7 +3170,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) { SwNodeIndex* pIdx; OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); - const SwFlyFrameFormat* pFormat = m_pDoc->FindFlyByName(aName, SwNodeType::Ole); + const SwFlyFrameFormat* pFormat = m_rDoc.FindFlyByName(aName, SwNodeType::Ole); if (pFormat && nullptr != (pIdx = const_cast<SwNodeIndex*>(pFormat->GetContent().GetContentIdx()))) { nIdx = pIdx->GetNext()->GetIndex(); @@ -3184,7 +3181,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) { SwNodeIndex* pIdx; OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); - for (const SwSectionFormat* pFormat : m_pDoc->GetSections()) + for (const SwSectionFormat* pFormat : m_rDoc.GetSections()) { if (aName == pFormat->GetSection()->GetSectionName() && nullptr != (pIdx = const_cast<SwNodeIndex*>(pFormat->GetContent().GetContentIdx()))) @@ -3198,7 +3195,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) else if( sCmp == "table" ) { OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); - const SwTable* pTable = SwTable::FindTable(m_pDoc->FindTableFormatByName(aName)); + const SwTable* pTable = SwTable::FindTable(m_rDoc.FindTableFormatByName(aName)); if (pTable) { SwTableNode* pTableNode = const_cast<SwTableNode*>(pTable->GetTabSortBoxes()[1]->GetSttNd()->FindTableNode()); @@ -3288,7 +3285,7 @@ namespace ErrCode MSWordExportBase::ExportDocument( bool bWriteAll ) { m_nCharFormatStart = DEFAULT_STYLES_COUNT; - m_nFormatCollStart = m_nCharFormatStart + m_pDoc->GetCharFormats()->size() - 1; + m_nFormatCollStart = m_nCharFormatStart + m_rDoc.GetCharFormats()->size() - 1; m_bStyDef = m_bBreakBefore = m_bOutKF = m_bOutFlyFrameAttrs = m_bOutPageDescs = m_bOutTable = m_bOutFirstPage = @@ -3325,21 +3322,21 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll ) m_pOLEExp.reset(new SvxMSExportOLEObjects( nSvxMSDffOLEConvFlags )); } - if ( !m_pOCXExp && m_pDoc->GetDocShell() ) - m_pOCXExp.reset(new SwMSConvertControls(m_pDoc->GetDocShell(), m_pCurPam.get())); + if ( !m_pOCXExp && m_rDoc.GetDocShell() ) + m_pOCXExp.reset(new SwMSConvertControls(m_rDoc.GetDocShell(), m_pCurPam.get())); // #i81405# - Collect anchored objects before changing the redline mode. - m_aFrames = GetFrames( *m_pDoc, bWriteAll? nullptr : m_pOrigPam ); + m_aFrames = GetFrames( m_rDoc, bWriteAll? nullptr : m_pOrigPam ); - m_nOrigRedlineFlags = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); + m_nOrigRedlineFlags = m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); - SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); + SwRootFrame const*const pLayout(m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout()); m_bOrigShowChanges = pLayout == nullptr || !pLayout->IsHideRedlines(); - if ( !m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() ) + if ( !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) { //restored to original state by SwWriter::Write - m_pDoc->getIDocumentRedlineAccess().SetRedlineFlags(m_nOrigRedlineFlags | + m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags(m_nOrigRedlineFlags | RedlineFlags::ShowDelete | RedlineFlags::ShowInsert); } @@ -3347,14 +3344,14 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll ) // fix the SwPositions in m_aFrames after SetRedlineFlags UpdateFramePositions(m_aFrames); - m_aFontHelper.InitFontTable(*m_pDoc); + m_aFontHelper.InitFontTable(m_rDoc); GatherChapterFields(); - CollectOutlineBookmarks(*m_pDoc); + CollectOutlineBookmarks(m_rDoc); // make unique OrdNums (Z-Order) for all drawing-/fly Objects - if ( m_pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) - m_pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )->RecalcObjOrdNums(); + if ( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() ) + m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )->RecalcObjOrdNums(); ErrCode err = ExportDocument_Impl(); @@ -3365,10 +3362,10 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll ) // ooo103014-1.odt to .doc // park m_pOrigPam as well, as needed for exporting abi9915-1.odt to doc m_pOrigPam->DeleteMark(); - *m_pOrigPam->GetPoint() = SwPosition(m_pDoc->GetNodes().GetEndOfContent()); + *m_pOrigPam->GetPoint() = SwPosition(m_rDoc.GetNodes().GetEndOfContent()); static_cast<SwPaM&>(*m_pCurPam) = *m_pOrigPam; - m_pDoc->getIDocumentRedlineAccess().SetRedlineFlags(m_nOrigRedlineFlags); + m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags(m_nOrigRedlineFlags); return err; } @@ -3503,14 +3500,14 @@ ErrCode WW8Export::ExportDocument_Impl() pDop.reset(new WW8Dop); pDop->fRevMarking = bool( RedlineFlags::On & m_nOrigRedlineFlags ); - SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); + SwRootFrame const*const pLayout(m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout()); pDop->fRMView = pLayout == nullptr || !pLayout->IsHideRedlines(); pDop->fRMPrint = pDop->fRMView; // set AutoHyphenation flag if found in default para style const SfxPoolItem* pItem; SwTextFormatColl* pStdTextFormatColl = - m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, false); + m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, false); if (pStdTextFormatColl && SfxItemState::SET == pStdTextFormatColl->GetItemState( RES_PARATR_HYPHENZONE, false, &pItem)) { @@ -3645,7 +3642,7 @@ void WW8Export::PrepareStorage() tools::SvRef<SotStorageStream> xStor( GetWriter().GetStorage().OpenSotStream(sCompObj) ); xStor->WriteBytes(pData, sizeof(pData)); - SwDocShell* pDocShell = m_pDoc->GetDocShell (); + SwDocShell* pDocShell = m_rDoc.GetDocShell (); OSL_ENSURE(pDocShell, "no SwDocShell"); if (!pDocShell) return; @@ -3793,7 +3790,7 @@ ErrCode SwWW8Writer::WriteStorageImpl() ErrCode err = ERRCODE_NONE; { bool bDot = mpMedium->GetFilter()->GetName().endsWith("Vorlage"); - WW8Export aExport(this, m_pDoc, m_pCurrentPam, m_pOrigPam, bDot); + WW8Export aExport(this, *m_pDoc, m_pCurrentPam, m_pOrigPam, bDot); m_pExport = &aExport; err = aExport.ExportDocument( m_bWriteAll ); m_pExport = nullptr; @@ -3817,7 +3814,7 @@ ErrCode SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, return nRet; } -MSWordExportBase::MSWordExportBase( SwDoc *pDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM *pOriginalPam ) +MSWordExportBase::MSWordExportBase( SwDoc& rDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM* pOriginalPam ) : m_aMainStg(sMainStream) , m_pISet(nullptr) , m_pPiece(nullptr) @@ -3870,7 +3867,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, std::shared_ptr<SwUnoCurso , m_bExportModeRTF(false) , m_bFontSizeWritten(false) , m_bAddFootnoteTab(false) - , m_pDoc(pDocument) + , m_rDoc(rDocument) , m_nCurStart(pCurrentPam->GetPoint()->nNode.GetIndex()) , m_nCurEnd(pCurrentPam->GetMark()->nNode.GetIndex()) , m_pCurPam(pCurrentPam) @@ -3893,9 +3890,9 @@ MSWordExportBase::~MSWordExportBase() } WW8Export::WW8Export( SwWW8Writer *pWriter, - SwDoc *pDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM *pOriginalPam, + SwDoc& rDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM* pOriginalPam, bool bDot ) - : MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ) + : MSWordExportBase( rDocument, pCurrentPam, pOriginalPam ) , pTableStrm(nullptr) , pDataStrm(nullptr) , m_bDot(bDot) @@ -4019,7 +4016,7 @@ void WW8Export::RestoreMacroCmds() { pFib->m_fcCmds = pTableStrm->Tell(); - uno::Reference < embed::XStorage > xSrcRoot(m_pDoc->GetDocShell()->GetStorage()); + uno::Reference < embed::XStorage > xSrcRoot(m_rDoc.GetDocShell()->GetStorage()); try { uno::Reference < io::XStream > xSrcStream = diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 58ee45650598..c7c1e3b14d05 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -565,7 +565,7 @@ public: bool m_bFontSizeWritten; bool m_bAddFootnoteTab; // only one aesthetic spacing tab per footnote - SwDoc *m_pDoc; + SwDoc& m_rDoc; sal_uLong m_nCurStart, m_nCurEnd; std::shared_ptr<SwUnoCursor> & m_pCurPam; SwPaM *m_pOrigPam; @@ -906,7 +906,7 @@ protected: std::vector<const Graphic*> m_vecBulletPic; ///< Vector to record all the graphics of bullets public: - MSWordExportBase( SwDoc *pDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM *pOriginalPam ); + MSWordExportBase(SwDoc& rDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM* pOriginalPam); virtual ~MSWordExportBase(); // TODO move as much as possible here from WW8Export! ;-) @@ -1147,7 +1147,7 @@ public: /// Setup the exporter. WW8Export( SwWW8Writer *pWriter, - SwDoc *pDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM *pOriginalPam, + SwDoc& rDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM* pOriginalPam, bool bDot ); virtual ~WW8Export() override; diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 3645b519619e..e0600d4cb33d 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -131,10 +131,10 @@ bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet, tools::SvRef<SotStora if ( pOLENd ) nAspect = pOLENd->GetAspect(); SdrOle2Obj *pRet = SvxMSDffManager::CreateSdrOLEFromStorage( - *m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(), + *m_rDoc.getIDocumentDrawModelAccess().GetOrCreateDrawModel(), rStorageName, xObjStg, - m_pDoc->GetDocStorage(), + m_rDoc.GetDocStorage(), aGraph, aRect, tools::Rectangle(), @@ -150,7 +150,7 @@ bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet, tools::SvRef<SotStora if ( xObj.is() ) { std::unique_ptr<SvStream> pGraphicStream; - comphelper::EmbeddedObjectContainer aCnt( m_pDoc->GetDocStorage() ); + comphelper::EmbeddedObjectContainer aCnt( m_rDoc.GetDocStorage() ); try { uno::Reference< embed::XEmbedPersist > xPersist( @@ -319,7 +319,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) void WW8Export::OutputLinkedOLE( const OUString& rOleId ) { - uno::Reference< embed::XStorage > xDocStg = m_pDoc->GetDocStorage(); + uno::Reference< embed::XStorage > xDocStg = m_rDoc.GetDocStorage(); uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement( "OLELinks", embed::ElementModes::READ ); tools::SvRef<SotStorage> xObjSrc = SotStorage::OpenOLEStorage( xOleStg, rOleId, StreamMode::READ ); @@ -405,7 +405,7 @@ void WW8Export::OutGrf(const ww8::Frame &rFrame) { const SwTextNode* pTextNd = static_cast<const SwTextNode*>(m_pOutFormatNode); SwPosition aPos(*pTextNd); - bVert = m_pDoc->IsInVerticalText(aPos); + bVert = m_rDoc.IsInVerticalText(aPos); } if (!bVert) { diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 3af3d1f0e6bd..1f2c6f99364c 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -225,7 +225,7 @@ void MSWordExportBase::ExportPoolItemsToCHP( ww8::PoolItems &rItems, sal_uInt16 if (pINetItem) { const SwCharFormat* pFormat = static_cast<const SwFormatCharFormat&>(*pItem).GetCharFormat(); - const SwCharFormat* pINetFormat = m_pDoc->FindCharFormatByName( + const SwCharFormat* pINetFormat = m_rDoc.FindCharFormatByName( static_cast<const SwFormatINetFormat&>(*pINetItem).GetINetFormat()); ww8::PoolItems aCharItems, aINetItems; GetPoolItems(pFormat->GetAttrSet(), aCharItems, false); @@ -366,7 +366,7 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFormat, b void MSWordExportBase::GatherChapterFields() { //If the header/footer contains a chapter field - SwFieldType* pType = m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter ); + SwFieldType* pType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter ); pType->GatherNodeIndex(m_aChapterFieldLocs); } @@ -722,7 +722,7 @@ void WW8AttributeOutput::OutlineNumbering(sal_uInt8 nLvl) m_rWW8Export.pO->push_back( nLvl ); SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::PIlfo::val ); SwWW8Writer::InsUInt16( *m_rWW8Export.pO, - 1 + m_rWW8Export.GetNumberingId(*m_rWW8Export.m_pDoc->GetOutlineNumRule()) ); + 1 + m_rWW8Export.GetNumberingId(*m_rWW8Export.m_rDoc.GetOutlineNumRule()) ); } // #i77805# @@ -774,7 +774,7 @@ void MSWordExportBase::OutputFormat( const SwFormat& rFormat, bool bPapFormat, b { //if outline numbered // if Write StyleDefinition then write the OutlineRule - const SwNumFormat& rNFormat = m_pDoc->GetOutlineNumRule()->Get( static_cast<sal_uInt16>( nLvl ) ); + const SwNumFormat& rNFormat = m_rDoc.GetOutlineNumRule()->Get( static_cast<sal_uInt16>( nLvl ) ); if ( m_bStyDef ) AttrOutput().OutlineNumbering(static_cast<sal_uInt8>(nLvl)); @@ -828,7 +828,7 @@ void MSWordExportBase::OutputFormat( const SwFormat& rFormat, bool bPapFormat, b { const SwFrameFormat &rFrameFormat = m_pParentFrame->GetFrameFormat(); - SfxItemSet aSet(m_pDoc->GetAttrPool(), svl::Items<RES_FRMATR_BEGIN, + SfxItemSet aSet(m_rDoc.GetAttrPool(), svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); aSet.Set(rFrameFormat.GetAttrSet()); @@ -891,7 +891,7 @@ void MSWordExportBase::OutputFormat( const SwFormat& rFormat, bool bPapFormat, b bool MSWordExportBase::HasRefToAttr(const OUString& rName) { - SwFieldType* pType = m_pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::GetRef); + SwFieldType* pType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::GetRef); std::vector<SwGetRefField*> vpRFields; pType->GatherRefFields(vpRFields, REF_SETREFATTR); return std::any_of(vpRFields.begin(), vpRFields.end(), @@ -900,7 +900,7 @@ bool MSWordExportBase::HasRefToAttr(const OUString& rName) bool MSWordExportBase::HasRefToFootOrEndnote(const bool isEndNote, const sal_uInt16 nSeqNo) { - SwFieldType* pType = m_pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::GetRef); + SwFieldType* pType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::GetRef); std::vector<SwGetRefField*> vpRFields; pType->GatherRefFields(vpRFields, isEndNote ? REF_ENDNOTE : REF_FOOTNOTE); return std::any_of(vpRFields.begin(), vpRFields.end(), @@ -945,7 +945,7 @@ void WW8AttributeOutput::RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript ) { if (bIsRTL) { - if( m_rWW8Export.m_pDoc->GetDocumentType() != SwDoc::DOCTYPE_MSWORD ) + if( m_rWW8Export.m_rDoc.GetDocumentType() != SwDoc::DOCTYPE_MSWORD ) { m_rWW8Export.InsUInt16( NS_sprm::CFBiDi::val ); m_rWW8Export.pO->push_back( sal_uInt8(1) ); @@ -1601,8 +1601,8 @@ void WW8AttributeOutput::TextINetFormat( const SwFormatINetFormat& rINet ) } const SwCharFormat* pFormat = IsPoolUserFormat( nId ) - ? m_rWW8Export.m_pDoc->FindCharFormatByName( rStr ) - : m_rWW8Export.m_pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( nId ); + ? m_rWW8Export.m_rDoc.FindCharFormatByName( rStr ) + : m_rWW8Export.m_rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool( nId ); m_rWW8Export.InsUInt16( NS_sprm::CIstd::val ); @@ -2002,7 +2002,7 @@ void AttributeOutputBase::GenerateBookmarksForSequenceField(const SwTextNode& rN { const sal_uInt16 nSeqFieldNumber = static_cast<const SwSetExpField*>(pField)->GetSeqNumber(); const OUString sObjectName = static_cast<const SwSetExpFieldType*>(pField->GetTyp())->GetName(); - const SwFieldTypes* pFieldTypes = GetExport().m_pDoc->getIDocumentFieldsAccess().GetFieldTypes(); + const SwFieldTypes* pFieldTypes = GetExport().m_rDoc.getIDocumentFieldsAccess().GetFieldTypes(); bool bHaveFullBkm = false; bool bHaveLabelAndNumberBkm = false; bool bHaveCaptionOnlyBkm = false; @@ -2042,7 +2042,7 @@ void AttributeOutputBase::GenerateBookmarksForSequenceField(const SwTextNode& rN sal_Int32 nRefTextPos = 0; if(nSeparatorPos < aText.getLength()) { - nRefTextPos = SwGetExpField::GetReferenceTextPos(pHt->GetFormatField(), *GetExport().m_pDoc, nSeparatorPos); + nRefTextPos = SwGetExpField::GetReferenceTextPos(pHt->GetFormatField(), GetExport().m_rDoc, nSeparatorPos); if(nRefTextPos != nSeparatorPos) { if(!bRunSplittedAtSep) @@ -2178,7 +2178,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) if( GetExport().AddSectionBreaksForTOX() ) { SwSection *pParent = rSect.GetParent(); - WW8_SepInfo rInfo(&GetExport( ).m_pDoc->GetPageDesc(0), + WW8_SepInfo rInfo(&GetExport().m_rDoc.GetPageDesc(0), pParent ? pParent->GetFormat() : nullptr, 0/*nRstLnNum*/); GetExport( ).AttrOutput().SectionBreak( msword::PageBreak, false, &rInfo ); } @@ -2313,7 +2313,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) // non-standard style for that level, i.e. ignore headline // styles 1-9 and find the lowest valid outline level sal_uInt8 nPosOfLowestNonStandardLvl = MAXLEVEL; - const SwTextFormatColls& rColls = *GetExport().m_pDoc->GetTextFormatColls(); + const SwTextFormatColls& rColls = *GetExport().m_rDoc.GetTextFormatColls(); for( n = rColls.size(); n; ) { const SwTextFormatColl* pColl = rColls[ --n ]; @@ -2383,7 +2383,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) const OUString sStyle( rStyles.getToken( 0, TOX_STYLE_DELIMITER, nPos )); if( !sStyle.isEmpty() ) { - SwTextFormatColl* pColl = GetExport().m_pDoc->FindTextFormatCollByName(sStyle); + SwTextFormatColl* pColl = GetExport().m_rDoc.FindTextFormatCollByName(sStyle); if (pColl) { if (!pColl->IsAssignedToListLevelOfOutlineStyle() || pColl->GetAssignedOutlineStyleLevel() < nTOXLvl) @@ -2495,7 +2495,7 @@ void AttributeOutputBase::EndTOX( const SwSection& rSect,bool bCareEnd ) if ( 0 < nCol ) { - WW8_SepInfo rInfo( &GetExport( ).m_pDoc->GetPageDesc( 0 ), rSect.GetFormat(), 0/*nRstLnNum*/ ); + WW8_SepInfo rInfo( &GetExport().m_rDoc.GetPageDesc( 0 ), rSect.GetFormat(), 0/*nRstLnNum*/ ); GetExport( ).AttrOutput().SectionBreak( msword::PageBreak, false, &rInfo ); } } @@ -2510,7 +2510,7 @@ bool MSWordExportBase::GetNumberFormat(const SwField& rField, OUString& rStr) { // Returns a date or time format string by using the US NfKeywordTable bool bHasFormat = false; - SvNumberFormatter* pNFormatr = m_pDoc->GetNumberFormatter(); + SvNumberFormatter* pNFormatr = m_rDoc.GetNumberFormatter(); sal_uInt32 nFormatIdx = rField.GetFormat(); const SvNumberformat* pNumFormat = pNFormatr->GetEntry( nFormatIdx ); if( pNumFormat ) @@ -2796,7 +2796,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) break; case SwFieldIds::DatabaseName: { - SwDBData aData = GetExport().m_pDoc->GetDBData(); + SwDBData aData = GetExport().m_rDoc.GetDBData(); const OUString sStr = FieldString(ww::eDATABASE) + aData.sDataSource + OUStringChar(DB_DELIM) @@ -3354,12 +3354,12 @@ void WW8Export::WriteFootnoteBegin( const SwFormatFootnote& rFootnote, ww::bytes // sprmCIstd const SwEndNoteInfo* pInfo; if( rFootnote.IsEndNote() ) - pInfo = &m_pDoc->GetEndNoteInfo(); + pInfo = &m_rDoc.GetEndNoteInfo(); else - pInfo = &m_pDoc->GetFootnoteInfo(); + pInfo = &m_rDoc.GetFootnoteInfo(); const SwCharFormat* pCFormat = pOutArr - ? pInfo->GetAnchorCharFormat( *m_pDoc ) - : pInfo->GetCharFormat( *m_pDoc ); + ? pInfo->GetAnchorCharFormat( m_rDoc ) + : pInfo->GetCharFormat( m_rDoc ); SwWW8Writer::InsUInt16( aAttrArr, NS_sprm::CIstd::val ); SwWW8Writer::InsUInt16( aAttrArr, GetId( pCFormat ) ); @@ -3393,10 +3393,10 @@ void WW8Export::WriteFootnoteBegin( const SwFormatFootnote& rFootnote, ww::bytes { std::unique_ptr<ww::bytes> pOld = std::move(pO); pO = std::move(pOwnOutArr); - SfxItemSet aSet( m_pDoc->GetAttrPool(), svl::Items<RES_CHRATR_FONT, + SfxItemSet aSet( m_rDoc.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{} ); - pCFormat = pInfo->GetCharFormat( *m_pDoc ); + pCFormat = pInfo->GetCharFormat( m_rDoc ); pTextFootnote->GetTextNode().GetParaAttr(aSet, pTextFootnote->GetStart(), pTextFootnote->GetStart() + 1, true); @@ -3471,7 +3471,7 @@ void AttributeOutputBase::TextFootnote( const SwFormatFootnote& rFootnote ) void WW8AttributeOutput::TextFootnote_Impl( const SwFormatFootnote& rFootnote ) { WW8_WrPlcFootnoteEdn* pFootnoteEnd; - if ( rFootnote.IsEndNote() || GetExport().m_pDoc->GetFootnoteInfo().m_ePos == FTNPOS_CHAPTER ) + if ( rFootnote.IsEndNote() || GetExport().m_rDoc.GetFootnoteInfo().m_ePos == FTNPOS_CHAPTER ) pFootnoteEnd = m_rWW8Export.pEdn.get(); else pFootnoteEnd = m_rWW8Export.pFootnote.get(); @@ -3544,7 +3544,7 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule ) ParaNumRule_Impl(pTextNd, 0, 0); return; } - const SwNumRule* pRule = GetExport().m_pDoc->FindNumRulePtr( + const SwNumRule* pRule = GetExport().m_rDoc.FindNumRulePtr( rNumRule.GetValue() ); if (!pRule) return; @@ -3584,11 +3584,11 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule ) ) { SwList const*const pList( - GetExport().m_pDoc->getIDocumentListsAccess().getListByName(listId)); + GetExport().m_rDoc.getIDocumentListsAccess().getListByName(listId)); if (pList) { SwNumRule const*const pAbstractRule( - GetExport().m_pDoc->FindNumRulePtr( + GetExport().m_rDoc.FindNumRulePtr( pList->GetDefaultListStyleName())); assert(pAbstractRule); if (pAbstractRule == pRule && !pTextNd->IsListRestart()) @@ -3841,8 +3841,8 @@ void AttributeOutputBase::FormatBreak( const SvxFormatBreakItem& rBreak ) [[fallthrough]]; case SvxBreak::ColumnAfter: case SvxBreak::ColumnBoth: - if ( GetExport().m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK ) - || GetExport().Sections().CurrentNumberOfColumns( *GetExport().m_pDoc ) > 1 ) + if ( GetExport().m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK ) + || GetExport().Sections().CurrentNumberOfColumns( GetExport().m_rDoc ) > 1 ) { nC = msword::ColumnBreak; } @@ -4547,7 +4547,7 @@ void WW8AttributeOutput::FormatBox( const SvxBoxItem& rBox ) SwTwips WW8Export::CurrentPageWidth(SwTwips &rLeft, SwTwips &rRight) const { const SwFrameFormat* pFormat = m_pCurrentPageDesc ? &m_pCurrentPageDesc->GetMaster() - : &m_pDoc->GetPageDesc(0).GetMaster(); + : &m_rDoc.GetPageDesc(0).GetMaster(); const SvxLRSpaceItem& rLR = pFormat->GetLRSpace(); SwTwips nPageSize = pFormat->GetFrameSize().GetWidth(); @@ -4609,7 +4609,7 @@ void AttributeOutputBase::FormatColumns( const SwFormatCol& rCol ) // get the page width without borders !! - const SwFrameFormat* pFormat = GetExport( ).m_pCurrentPageDesc ? &GetExport( ).m_pCurrentPageDesc->GetMaster() : &const_cast<const SwDoc *>(GetExport( ).m_pDoc)->GetPageDesc(0).GetMaster(); + const SwFrameFormat* pFormat = GetExport( ).m_pCurrentPageDesc ? &GetExport( ).m_pCurrentPageDesc->GetMaster() : &const_cast<const SwDoc&>(GetExport().m_rDoc).GetPageDesc(0).GetMaster(); const SvxFrameDirectionItem &frameDirection = pFormat->GetFrameDir(); SwTwips nPageSize; if ( frameDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB || frameDirection.GetValue() == SvxFrameDirection::Vertical_LR_TB ) @@ -4730,7 +4730,7 @@ void AttributeOutputBase::ParaLineSpacing( const SvxLineSpacingItem& rSpacing ) OSL_ENSURE( pSet, "No attrset for lineheight :-(" ); if ( pSet ) { - nSpace = nSpace + static_cast<short>( AttrSetToLineHeight( GetExport().m_pDoc->getIDocumentSettingAccess(), + nSpace = nSpace + static_cast<short>( AttrSetToLineHeight( GetExport().m_rDoc.getIDocumentSettingAccess(), *pSet, *Application::GetDefaultDevice(), nScript ) ); } } @@ -4791,7 +4791,7 @@ void WW8AttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust ) if (dynamic_cast<const SwTextNode*>(m_rWW8Export.m_pOutFormatNode) != nullptr) { SwPosition aPos(*static_cast<const SwContentNode*>(m_rWW8Export.m_pOutFormatNode)); - nDirection = m_rWW8Export.m_pDoc->GetTextDirection(aPos); + nDirection = m_rWW8Export.m_rDoc.GetTextDirection(aPos); } else if (dynamic_cast<const SwTextFormatColl*>(m_rWW8Export.m_pOutFormatNode) != nullptr) { @@ -5525,7 +5525,7 @@ void AttributeOutputBase::FormatCharBorder( const SvxBoxItem& rBox ) const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTextNode& rNode, RedlineType aRedlineType) { // ToDo : this is not the most ideal ... should start maybe from 'nCurRedlinePos' - for(SwRangeRedline* pRedl : GetExport().m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()) + for(SwRangeRedline* pRedl : GetExport().m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()) { // Only check redlines that are of type 'Delete' if ( pRedl->GetRedlineData().GetType() != aRedlineType ) |