From e42166098b13d1bf4f66291550ab326b750bcbed Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 30 Jul 2020 10:37:55 +0200 Subject: loplugin:flatten in sw/filter/ww8 Change-Id: Ia296fc6e6c8f78edf533dedf52996560ae62d143 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99853 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/filter/ww8/docxexport.cxx | 104 ++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'sw/source/filter/ww8/docxexport.cxx') diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 160cc8c385d3..e603d2deb3a2 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -693,52 +693,52 @@ void DocxExport::WriteFootnotesEndnotes() m_pAttrOutput->SetSerializer( m_pDocumentFS ); } - if ( m_pAttrOutput->HasEndnotes() ) - { - // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - oox::getRelationship(Relationship::ENDNOTES), - "endnotes.xml" ); + if ( !m_pAttrOutput->HasEndnotes() ) + return; - ::sax_fastparser::FSHelperPtr pEndnotesFS = - m_pFilter->openFragmentStreamWithSerializer( "word/endnotes.xml", - "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" ); + // setup word/styles.xml and the relations + content type + m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + oox::getRelationship(Relationship::ENDNOTES), + "endnotes.xml" ); - // switch the serializer to redirect the output to word/endnotes.xml - m_pAttrOutput->SetSerializer( pEndnotesFS ); - // tdf#99227 - m_pSdrExport->setSerializer( pEndnotesFS ); - // tdf#107969 - m_pVMLExport->SetFS(pEndnotesFS); + ::sax_fastparser::FSHelperPtr pEndnotesFS = + m_pFilter->openFragmentStreamWithSerializer( "word/endnotes.xml", + "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" ); - // do the work - m_pAttrOutput->FootnotesEndnotes( false ); + // switch the serializer to redirect the output to word/endnotes.xml + m_pAttrOutput->SetSerializer( pEndnotesFS ); + // tdf#99227 + m_pSdrExport->setSerializer( pEndnotesFS ); + // tdf#107969 + m_pVMLExport->SetFS(pEndnotesFS); - // switch the serializer back - m_pVMLExport->SetFS(m_pDocumentFS); - m_pSdrExport->setSerializer( m_pDocumentFS ); - m_pAttrOutput->SetSerializer( m_pDocumentFS ); - } + // do the work + m_pAttrOutput->FootnotesEndnotes( false ); + + // switch the serializer back + m_pVMLExport->SetFS(m_pDocumentFS); + m_pSdrExport->setSerializer( m_pDocumentFS ); + m_pAttrOutput->SetSerializer( m_pDocumentFS ); } void DocxExport::WritePostitFields() { - if ( m_pAttrOutput->HasPostitFields() ) - { - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - oox::getRelationship(Relationship::COMMENTS), - "comments.xml" ); + if ( !m_pAttrOutput->HasPostitFields() ) + return; - ::sax_fastparser::FSHelperPtr pPostitFS = - m_pFilter->openFragmentStreamWithSerializer( "word/comments.xml", - "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" ); + m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + oox::getRelationship(Relationship::COMMENTS), + "comments.xml" ); - pPostitFS->startElementNS( XML_w, XML_comments, MainXmlNamespaces()); - m_pAttrOutput->SetSerializer( pPostitFS ); - m_pAttrOutput->WritePostitFields(); - m_pAttrOutput->SetSerializer( m_pDocumentFS ); - pPostitFS->endElementNS( XML_w, XML_comments ); - } + ::sax_fastparser::FSHelperPtr pPostitFS = + m_pFilter->openFragmentStreamWithSerializer( "word/comments.xml", + "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" ); + + pPostitFS->startElementNS( XML_w, XML_comments, MainXmlNamespaces()); + m_pAttrOutput->SetSerializer( pPostitFS ); + m_pAttrOutput->WritePostitFields(); + m_pAttrOutput->SetSerializer( m_pDocumentFS ); + pPostitFS->endElementNS( XML_w, XML_comments ); } void DocxExport::WriteNumbering() @@ -1538,26 +1538,26 @@ void DocxExport::WriteVBA() return; uno::Reference xDataStream = xDocumentStorage->openStreamElement(aDataName, nOpenMode); - if (xDataStream.is()) - { - // Then the data stream, which wants to work with an already set - // xProjectStream. - std::unique_ptr pIn(utl::UcbStreamHelper::CreateStream(xDataStream)); + if (!xDataStream.is()) + return; - uno::Reference xOutputStream(GetFilter().openFragmentStream("word/vbaData.xml", "application/vnd.ms-word.vbaData+xml"), uno::UNO_QUERY); - if (!xOutputStream.is()) - return; - std::unique_ptr pOut(utl::UcbStreamHelper::CreateStream(xOutputStream)); + // Then the data stream, which wants to work with an already set + // xProjectStream. + std::unique_ptr pIn(utl::UcbStreamHelper::CreateStream(xDataStream)); - // Write the stream. - pOut->WriteStream(*pIn); + uno::Reference xOutputStream(GetFilter().openFragmentStream("word/vbaData.xml", "application/vnd.ms-word.vbaData+xml"), uno::UNO_QUERY); + if (!xOutputStream.is()) + return; + std::unique_ptr pOut(utl::UcbStreamHelper::CreateStream(xOutputStream)); - // Write the relationship. - if (!xProjectStream.is()) - return; + // Write the stream. + pOut->WriteStream(*pIn); - m_pFilter->addRelation(xProjectStream, oox::getRelationship(Relationship::WORDVBADATA), "vbaData.xml"); - } + // Write the relationship. + if (!xProjectStream.is()) + return; + + m_pFilter->addRelation(xProjectStream, oox::getRelationship(Relationship::WORDVBADATA), "vbaData.xml"); } void DocxExport::WriteEmbeddings() -- cgit