diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 134 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 60 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxtablestyleexport.cxx | 55 |
7 files changed, 111 insertions, 156 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bea87e4ad6ed..c9f78fd2c446 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -569,7 +569,7 @@ static void lcl_deleteAndResetTheLists( rtl::Reference<sax_fastparser::FastAttri void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFormat, const Size& rSize) { - sax_fastparser::FastAttributeList* attrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> attrList = FastSerializerHelper::createAttrList(); awt::Point aPos(pFrameFormat->GetHoriOrient().GetPos(), pFrameFormat->GetVertOrient().GetPos()); @@ -607,8 +607,7 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor attrList->add( FSNS( XML_w, XML_hAnchor), relativeFromH ); attrList->add( FSNS( XML_w, XML_hRule), "exact"); - sax_fastparser::XFastAttributeListRef xAttrList(attrList); - m_pSerializer->singleElementNS( XML_w, XML_framePr, xAttrList ); + m_pSerializer->singleElementNS( XML_w, XML_framePr, attrList ); } bool DocxAttributeOutput::TextBoxIsFramePr(const SwFrameFormat& rFrameFormat) @@ -836,8 +835,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, m_pSerializer->startElement(nSdtPrToken); else { - XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.get()); - pSdtPrTokenAttributes.clear(); + rtl::Reference<FastAttributeList> xAttrList = std::move(pSdtPrTokenAttributes); m_pSerializer->startElement(nSdtPrToken, xAttrList); } @@ -855,8 +853,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, m_pSerializer->singleElement(nSdtPrToken); else { - XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.get()); - pSdtPrTokenAttributes.clear(); + rtl::Reference<FastAttributeList> xAttrList = std::move(pSdtPrTokenAttributes); m_pSerializer->singleElement(nSdtPrToken, xAttrList); } } @@ -868,8 +865,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, if( pSdtPrDataBindingAttrs.is() && !m_rExport.SdrExporter().IsParagraphHasDrawing()) { - XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs.get() ); - pSdtPrDataBindingAttrs.clear(); + rtl::Reference<FastAttributeList> xAttrList = std::move( pSdtPrDataBindingAttrs ); m_pSerializer->singleElementNS(XML_w, XML_dataBinding, xAttrList); } @@ -1125,7 +1121,7 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties() { if ( m_rExport.SdrExporter().getFlyAttrList().is() ) { - XFastAttributeListRef xAttrList( m_rExport.SdrExporter().getFlyAttrList().get() ); + rtl::Reference<FastAttributeList> xAttrList( m_rExport.SdrExporter().getFlyAttrList().get() ); m_rExport.SdrExporter().getFlyAttrList().clear(); m_pSerializer->singleElementNS( XML_w, XML_framePr, xAttrList ); @@ -1133,17 +1129,13 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties() if ( m_pParagraphSpacingAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pParagraphSpacingAttrList.get() ); - m_pParagraphSpacingAttrList.clear(); - + rtl::Reference<FastAttributeList> xAttrList = std::move( m_pParagraphSpacingAttrList ); m_pSerializer->singleElementNS( XML_w, XML_spacing, xAttrList ); } if ( m_pBackgroundAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pBackgroundAttrList.get() ); - m_pBackgroundAttrList.clear(); - + rtl::Reference<FastAttributeList> xAttrList = std::move( m_pBackgroundAttrList ); m_pSerializer->singleElementNS( XML_w, XML_shd, xAttrList ); } } @@ -1490,8 +1482,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, sal_Int32 nPos, bool / } newStartedHyperlink = true; - XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList.get() ); - m_pHyperlinkAttrList.clear(); + rtl::Reference<FastAttributeList> xAttrList = std::move( m_pHyperlinkAttrList ); m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList ); m_startedHyperlink = true; @@ -2614,7 +2605,7 @@ std::optional<sal_Int32> lclGetElementIdForName(std::u16string_view rName) void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence<css::beans::PropertyValue>& rElements, sax_fastparser::FSHelperPtr const & pSerializer) { css::uno::Sequence<css::beans::PropertyValue> aAttributes; - FastAttributeList* pAttributes = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pAttributes = FastSerializerHelper::createAttrList(); for (const auto& rElement : rElements) { @@ -2643,9 +2634,7 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence<c pAttributes->add(*aSubElementId, aValue.getStr()); } - XFastAttributeListRef xAttributesList( pAttributes ); - - pSerializer->startElement(aElementId, xAttributesList); + pSerializer->startElement(aElementId, pAttributes.get()); for (const auto& rElement : rElements) { @@ -2669,29 +2658,26 @@ void DocxAttributeOutput::WriteCollectedRunProperties() // Write all differed properties if ( m_pFontsAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pFontsAttrList.get() ); - m_pFontsAttrList.clear(); + rtl::Reference<FastAttributeList> xAttrList = std::move( m_pFontsAttrList ); m_pSerializer->singleElementNS( XML_w, XML_rFonts, xAttrList ); } if ( m_pColorAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pColorAttrList.get() ); + rtl::Reference<FastAttributeList> xAttrList( m_pColorAttrList.get() ); m_pSerializer->singleElementNS( XML_w, XML_color, xAttrList ); } if ( m_pEastAsianLayoutAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pEastAsianLayoutAttrList.get() ); - m_pEastAsianLayoutAttrList.clear(); + rtl::Reference<FastAttributeList> xAttrList = std::move( m_pEastAsianLayoutAttrList ); m_pSerializer->singleElementNS( XML_w, XML_eastAsianLayout, xAttrList ); } if ( m_pCharLangAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pCharLangAttrList.get() ); - m_pCharLangAttrList.clear(); + rtl::Reference<FastAttributeList> xAttrList = std::move( m_pCharLangAttrList ); m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList ); } @@ -3359,7 +3345,7 @@ static void impl_borderLine( FSHelperPtr const & pSerializer, sal_Int32 elementT pBorderLine->GetWidth() == convertMm100ToTwip( rStyleProps->LineWidth ) ) return; - FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pAttr = FastSerializerHelper::createAttrList(); pAttr->add( FSNS( XML_w, XML_val ), OString( pVal ) ); if ( pBorderLine && !pBorderLine->isEmpty() ) @@ -3394,8 +3380,7 @@ static void impl_borderLine( FSHelperPtr const & pSerializer, sal_Int32 elementT pAttr->add( FSNS( XML_w, XML_shadow ), "1" ); } - XFastAttributeListRef xAttrs( pAttr ); - pSerializer->singleElementNS( XML_w, elementToken, xAttrs ); + pSerializer->singleElementNS( XML_w, elementToken, pAttr ); } static OutputBorderOptions lcl_getTableCellBorderOptions(bool bEcma) @@ -3963,7 +3948,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t = rGrabBagElement.second.get<table::BorderLine2>(); else if (rGrabBagElement.first == "TableStyleLook") { - FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pAttributeList = FastSerializerHelper::createAttrList(); const uno::Sequence<beans::PropertyValue> aAttributeList = rGrabBagElement.second.get< uno::Sequence<beans::PropertyValue> >(); for (const auto& rAttribute : aAttributeList) @@ -3988,12 +3973,11 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t } } - XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, XML_tblLook, xAttributeList); + m_pSerializer->singleElementNS(XML_w, XML_tblLook, pAttributeList); } else if (rGrabBagElement.first == "TablePosition" ) { - FastAttributeList *attrListTablePos = FastSerializerHelper::createAttrList( ); + rtl::Reference<FastAttributeList> attrListTablePos = FastSerializerHelper::createAttrList( ); const uno::Sequence<beans::PropertyValue> aTablePosition = rGrabBagElement.second.get<uno::Sequence<beans::PropertyValue> >(); // look for a surrounding frame and take it's position values const ww8::Frame* pFrame = m_rExport.GetFloatingTableFrame(); @@ -4122,9 +4106,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t } } - XFastAttributeListRef xAttrListTablePosRef( attrListTablePos ); - - m_pSerializer->singleElementNS( XML_w, XML_tblpPr, xAttrListTablePosRef); + m_pSerializer->singleElementNS( XML_w, XML_tblpPr, attrListTablePos); attrListTablePos = nullptr; } else @@ -4572,7 +4554,7 @@ void DocxAttributeOutput::LatentStyles() return; // Extract default attributes first. - sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = FastSerializerHelper::createAttrList(); uno::Sequence<beans::PropertyValue> aLsdExceptions; for (const auto& rLatentStyle : std::as_const(aLatentStyles)) { @@ -4582,8 +4564,7 @@ void DocxAttributeOutput::LatentStyles() rLatentStyle.Value >>= aLsdExceptions; } - XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->startElementNS(XML_w, XML_latentStyles, xAttributeList); + m_pSerializer->startElementNS(XML_w, XML_latentStyles, pAttributeList); pAttributeList = nullptr; // Then handle the exceptions. @@ -4597,8 +4578,7 @@ void DocxAttributeOutput::LatentStyles() if (sal_Int32 nToken = DocxStringGetToken(aExceptionTokens, rAttribute.Name)) pAttributeList->add(FSNS(XML_w, nToken), OUStringToOString(rAttribute.Value.get<OUString>(), RTL_TEXTENCODING_UTF8)); - xAttributeList = pAttributeList; - m_pSerializer->singleElementNS(XML_w, XML_lsdException, xAttributeList); + m_pSerializer->singleElementNS(XML_w, XML_lsdException, pAttributeList); pAttributeList = nullptr; } @@ -5056,14 +5036,13 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, aSize); // picture description (used for pic:cNvPr later too) - ::sax_fastparser::FastAttributeList* docPrattrList = FastSerializerHelper::createAttrList(); + rtl::Reference<::sax_fastparser::FastAttributeList> docPrattrList = FastSerializerHelper::createAttrList(); docPrattrList->add( XML_id, OString::number( m_anchorId++).getStr()); docPrattrList->add( XML_name, OUStringToOString( pFrameFormat->GetName(), RTL_TEXTENCODING_UTF8 ) ); docPrattrList->add( XML_descr, OUStringToOString( pGrfNode ? pGrfNode->GetDescription() : pOLEFrameFormat->GetObjDescription(), RTL_TEXTENCODING_UTF8 ).getStr()); if( GetExport().GetFilter().getVersion( ) != oox::core::ECMA_DIALECT ) docPrattrList->add( XML_title, OUStringToOString( pGrfNode ? pGrfNode->GetTitle() : pOLEFrameFormat->GetObjTitle(), RTL_TEXTENCODING_UTF8 ).getStr()); - XFastAttributeListRef docPrAttrListRef( docPrattrList ); - m_pSerializer->startElementNS( XML_wp, XML_docPr, docPrAttrListRef ); + m_pSerializer->startElementNS( XML_wp, XML_docPr, docPrattrList ); OUString sURL, sRelId; if (xShapePropSet) @@ -5105,7 +5084,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size m_pSerializer->startElementNS(XML_pic, XML_nvPicPr); // It seems pic:cNvpr and wp:docPr are pretty much the same thing with the same attributes - m_pSerializer->startElementNS(XML_pic, XML_cNvPr, docPrAttrListRef); + m_pSerializer->startElementNS(XML_pic, XML_cNvPr, docPrattrList); if(!sURL.isEmpty()) m_pSerializer->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), sRelId); @@ -5158,8 +5137,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size // TODO setup the right values below m_pSerializer->startElementNS(XML_pic, XML_spPr, XML_bwMode, "auto"); - m_pSerializer->startElementNS( - XML_a, XML_xfrm, uno::Reference<xml::sax::XFastAttributeList>(xFrameAttributes.get())); + m_pSerializer->startElementNS(XML_a, XML_xfrm, xFrameAttributes); m_pSerializer->singleElementNS(XML_a, XML_off, XML_x, "0", XML_y, "0"); OString aWidth( OString::number( TwipsToEMU( aSize.Width() ) ) ); @@ -5495,12 +5473,12 @@ void DocxAttributeOutput::WriteActiveXControl(const SdrObject* pObject, const Sw const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient(); const SwFormatVertOrient& rVertOri = rFrameFormat.GetVertOrient(); SwFormatSurround const& rSurround(rFrameFormat.GetSurround()); - std::unique_ptr<sax_fastparser::FastAttributeList> pAttrList(docx::SurroundToVMLWrap(rSurround)); + rtl::Reference<sax_fastparser::FastAttributeList> pAttrList(docx::SurroundToVMLWrap(rSurround)); sShapeId = m_rExport.VMLExporter().AddSdrObject(*pObject, rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(), rHoriOri.GetRelationOrient(), rVertOri.GetRelationOrient(), - std::move(pAttrList), + pAttrList.get(), true); } // Restore default values @@ -5684,7 +5662,7 @@ void DocxAttributeOutput::WriteOLEShape(const SwFlyFrameFormat& rFrameFormat, co assert(m_pSerializer); //Here is an attribute list where we collect the attributes what we want to export - FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pAttr = FastSerializerHelper::createAttrList(); pAttr->add(XML_id, rShapeId.getStr()); //export the fixed shape type for picture frame @@ -6370,7 +6348,7 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType, { bool bQFormat = false, bUnhideWhenUsed = false, bSemiHidden = false, bLocked = false, bDefault = false, bCustomStyle = false; OUString aLink, aRsid, aUiPriority; - FastAttributeList* pStyleAttributeList = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pStyleAttributeList = FastSerializerHelper::createAttrList(); uno::Any aAny; if (eType == STYLE_TYPE_PARA || eType == STYLE_TYPE_CHAR) { @@ -6427,8 +6405,7 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType, pStyleAttributeList->add(FSNS(XML_w, XML_default), "1"); if (bCustomStyle) pStyleAttributeList->add(FSNS(XML_w, XML_customStyle), "1"); - XFastAttributeListRef xStyleAttributeList(pStyleAttributeList); - m_pSerializer->startElementNS( XML_w, XML_style, xStyleAttributeList); + m_pSerializer->startElementNS( XML_w, XML_style, pStyleAttributeList); m_pSerializer->singleElementNS( XML_w, XML_name, FSNS( XML_w, XML_val ), pEnglishName ? pEnglishName : rName.toUtf8() ); @@ -6675,9 +6652,7 @@ void DocxAttributeOutput::EndSection() // Write the section properties if ( m_pSectionSpacingAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pSectionSpacingAttrList.get() ); - m_pSectionSpacingAttrList.clear(); - + rtl::Reference<FastAttributeList> xAttrList = std::move( m_pSectionSpacingAttrList ); m_pSerializer->singleElementNS( XML_w, XML_pgMar, xAttrList ); } @@ -6698,7 +6673,7 @@ void DocxAttributeOutput::SectionFormProtection( bool bProtected ) void DocxAttributeOutput::SectionLineNumbering( sal_uLong nRestartNo, const SwLineNumberInfo& rLnNumInfo ) { - FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pAttr = FastSerializerHelper::createAttrList(); pAttr->add( FSNS( XML_w, XML_countBy ), OString::number(rLnNumInfo.GetCountBy()).getStr()); pAttr->add( FSNS( XML_w, XML_restart ), rLnNumInfo.IsRestartEachPage() ? "newPage" : "continuous" ); if( rLnNumInfo.GetPosFromLeft()) @@ -6706,8 +6681,7 @@ void DocxAttributeOutput::SectionLineNumbering( sal_uLong nRestartNo, const SwLi if (nRestartNo > 0) // Writer is 1-based, Word is 0-based. pAttr->add(FSNS(XML_w, XML_start), OString::number(nRestartNo - 1).getStr()); - XFastAttributeListRef xAttrs( pAttr ); - m_pSerializer->singleElementNS( XML_w, XML_lnNumType, xAttrs ); + m_pSerializer->singleElementNS( XML_w, XML_lnNumType, pAttr ); } void DocxAttributeOutput::SectionTitlePage() @@ -6900,7 +6874,7 @@ void DocxAttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, const ::std { // FIXME Not called properly with page styles like "First Page" - FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pAttr = FastSerializerHelper::createAttrList(); // std::nullopt means no restart: then don't output that attribute if it is negative if ( oPageRestartNumber ) @@ -6911,8 +6885,7 @@ void DocxAttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, const ::std if ( !aFormat.isEmpty() ) pAttr->add( FSNS( XML_w, XML_fmt ), aFormat.getStr() ); - XFastAttributeListRef xAttrs( pAttr ); - m_pSerializer->singleElementNS( XML_w, XML_pgNumType, xAttrs ); + m_pSerializer->singleElementNS( XML_w, XML_pgNumType, pAttr ); // see 2.6.12 pgNumType (Page Numbering Settings) SAL_INFO("sw.ww8", "TODO DocxAttributeOutput::SectionPageNumbering()" ); @@ -6971,7 +6944,7 @@ void DocxAttributeOutput::FontAlternateName( const OUString& rName ) const void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEncoding ) const { - FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pAttr = FastSerializerHelper::createAttrList(); OString aCharSet( OString::number( nCharSet, 16 ) ); if ( aCharSet.getLength() == 1 ) @@ -6984,7 +6957,7 @@ void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEnc pAttr->add( FSNS( XML_w, XML_characterSet ), charset ); } - m_pSerializer->singleElementNS( XML_w, XML_charset, XFastAttributeListRef( pAttr )); + m_pSerializer->singleElementNS( XML_w, XML_charset, pAttr ); } void DocxAttributeOutput::FontFamilyType( FontFamily eFamily ) const @@ -8505,7 +8478,7 @@ void DocxAttributeOutput::ParaWidows( const SvxWidowsItem& rWidows ) static void impl_WriteTabElement( FSHelperPtr const & pSerializer, const SvxTabStop& rTab, tools::Long tabsOffset ) { - FastAttributeList *pTabElementAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pTabElementAttrList = FastSerializerHelper::createAttrList(); switch (rTab.GetAdjustment()) { @@ -8715,17 +8688,14 @@ void DocxAttributeOutput::FormatFrameSize( const SwFormatFrameSize& rSize ) } else if ( m_rExport.m_bOutPageDescs ) { - FastAttributeList *attrList = FastSerializerHelper::createAttrList( ); + rtl::Reference<FastAttributeList> attrList = FastSerializerHelper::createAttrList( ); if ( m_rExport.m_pCurrentPageDesc->GetLandscape( ) ) attrList->add( FSNS( XML_w, XML_orient ), "landscape" ); attrList->add( FSNS( XML_w, XML_w ), OString::number( rSize.GetWidth( ) ) ); attrList->add( FSNS( XML_w, XML_h ), OString::number( rSize.GetHeight( ) ) ); - XFastAttributeListRef xAttrList( attrList ); - attrList = nullptr; - - m_pSerializer->singleElementNS( XML_w, XML_pgSz, xAttrList ); + m_pSerializer->singleElementNS( XML_w, XML_pgSz, attrList ); } } @@ -8774,7 +8744,7 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace ) } else { - FastAttributeList *pLRSpaceAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pLRSpaceAttrList = FastSerializerHelper::createAttrList(); if((0 != rLRSpace.GetTextLeft()) || (rLRSpace.IsExplicitZeroMarginValLeft())) { pLRSpaceAttrList->add( FSNS( XML_w, ( bEcma ? XML_left : XML_start ) ), OString::number( rLRSpace.GetTextLeft() ) ); @@ -8910,9 +8880,9 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace ) namespace docx { -std::unique_ptr<FastAttributeList> SurroundToVMLWrap(SwFormatSurround const& rSurround) +rtl::Reference<FastAttributeList> SurroundToVMLWrap(SwFormatSurround const& rSurround) { - FastAttributeList * pAttrList(nullptr); + rtl::Reference<FastAttributeList> pAttrList; OString sType; OString sSide; switch (rSurround.GetSurround()) @@ -8953,7 +8923,7 @@ std::unique_ptr<FastAttributeList> SurroundToVMLWrap(SwFormatSurround const& rSu pAttrList->add(XML_side, sSide); } } - return std::unique_ptr<FastAttributeList>(pAttrList); + return pAttrList; } } // namespace docx @@ -8962,10 +8932,10 @@ void DocxAttributeOutput::FormatSurround( const SwFormatSurround& rSurround ) { if (m_rExport.SdrExporter().getTextFrameSyntax()) { - std::unique_ptr<FastAttributeList> pAttrList(docx::SurroundToVMLWrap(rSurround)); + rtl::Reference<FastAttributeList> pAttrList(docx::SurroundToVMLWrap(rSurround)); if (pAttrList) { - m_rExport.SdrExporter().setFlyWrapAttrList(pAttrList.release()); + m_rExport.SdrExporter().setFlyWrapAttrList(pAttrList); } } else if (m_rExport.SdrExporter().getDMLTextFrameSyntax()) @@ -9370,7 +9340,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox ) void DocxAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFormatCol& rCol, bool bEven, SwTwips nPageSize ) { // Get the columns attributes - FastAttributeList *pColsAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pColsAttrList = FastSerializerHelper::createAttrList(); pColsAttrList->add( FSNS( XML_w, XML_num ), OString::number( nCols ). getStr( ) ); @@ -9400,7 +9370,7 @@ void DocxAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFormatCo { for ( sal_uInt16 n = 0; n < nCols; ++n ) { - FastAttributeList *pColAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pColAttrList = FastSerializerHelper::createAttrList(); sal_uInt16 nWidth = rCol.CalcPrtColWidth( n, static_cast<sal_uInt16>(nPageSize) ); pColAttrList->add( FSNS( XML_w, XML_w ), OString::number( nWidth ).getStr( ) ); @@ -9427,7 +9397,7 @@ void DocxAttributeOutput::FormatKeep( const SvxFormatKeepItem& rItem ) void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid ) { - FastAttributeList *pGridAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pGridAttrList = FastSerializerHelper::createAttrList(); OString sGridType; switch ( rGrid.GetGridType( ) ) diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 20781b13ceb3..dc8da0c0f5aa 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -1064,7 +1064,7 @@ struct DocxTableExportContext namespace docx { -std::unique_ptr<sax_fastparser::FastAttributeList> SurroundToVMLWrap(SwFormatSurround const& rSurround); +rtl::Reference<sax_fastparser::FastAttributeList> SurroundToVMLWrap(SwFormatSurround const& rSurround); } diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 04db5fceda4c..4af84e1335b0 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1015,8 +1015,7 @@ void DocxExport::WriteSettings() OString aZoom(OString::number(pViewShell->GetViewOptions()->GetZoom())); pAttributeList->add(FSNS(XML_w, XML_percent), aZoom); - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList.get()); - pFS->singleElementNS(XML_w, XML_zoom, xAttributeList); + pFS->singleElementNS(XML_w, XML_zoom, pAttributeList); } // Display Background Shape @@ -1287,8 +1286,7 @@ void DocxExport::WriteSettings() if ( bUseGrabBagProtection ) { - sax_fastparser::XFastAttributeListRef xFastAttributeList(xAttributeList.get()); - pFS->singleElementNS(XML_w, XML_documentProtection, xFastAttributeList); + pFS->singleElementNS(XML_w, XML_documentProtection, xAttributeList); } } @@ -1688,9 +1686,9 @@ void DocxExport::WriteMainText() m_pDocumentFS->endElementNS( XML_w, XML_document ); } -XFastAttributeListRef DocxExport::MainXmlNamespaces() +rtl::Reference<FastAttributeList> DocxExport::MainXmlNamespaces() { - FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pAttr = FastSerializerHelper::createAttrList(); 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() ); @@ -1703,7 +1701,7 @@ XFastAttributeListRef DocxExport::MainXmlNamespaces() 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 ); + return pAttr; } bool DocxExport::ignoreAttributeForStyleDefaults( sal_uInt16 nWhich ) const diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 7a3c3a47424f..e75d8e3e7613 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -265,7 +265,7 @@ private: public: /// All xml namespaces to be used at the top of any text .xml file (main doc, headers, footers,...) - sax_fastparser::XFastAttributeListRef MainXmlNamespaces(); + rtl::Reference<sax_fastparser::FastAttributeList> MainXmlNamespaces(); /// FIXME this is temporary, remotely reminding the method of the same /// name in WW8Export. diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 98f7c2d98e28..a7b549066596 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -39,6 +39,7 @@ using namespace com::sun::star; using namespace oox; +using namespace sax_fastparser; namespace { @@ -144,8 +145,8 @@ private: bool m_bParagraphSdtOpen; bool m_bParagraphHasDrawing; ///Flag for checking drawing in a paragraph. rtl::Reference<sax_fastparser::FastAttributeList> m_pFlyFillAttrList; - sax_fastparser::FastAttributeList* m_pFlyWrapAttrList; - sax_fastparser::FastAttributeList* m_pBodyPrAttrList; + rtl::Reference<sax_fastparser::FastAttributeList> m_pFlyWrapAttrList; + rtl::Reference<sax_fastparser::FastAttributeList> m_pBodyPrAttrList; rtl::Reference<sax_fastparser::FastAttributeList> m_pDashLineStyleAttr; bool m_bDMLAndVMLDrawingOpen; /// List of TextBoxes in this document: they are exported as part of their shape, never alone. @@ -166,8 +167,6 @@ public: , m_bDrawingOpen(false) , m_bParagraphSdtOpen(false) , m_bParagraphHasDrawing(false) - , m_pFlyWrapAttrList(nullptr) - , m_pBodyPrAttrList(nullptr) , m_bDMLAndVMLDrawingOpen(false) { } @@ -246,19 +245,23 @@ public: return m_pFlyFillAttrList; } - void setFlyWrapAttrList(sax_fastparser::FastAttributeList* pFlyWrapAttrList) + void + setFlyWrapAttrList(rtl::Reference<sax_fastparser::FastAttributeList> const& pFlyWrapAttrList) { m_pFlyWrapAttrList = pFlyWrapAttrList; } - sax_fastparser::FastAttributeList* getFlyWrapAttrList() const { return m_pFlyWrapAttrList; } + sax_fastparser::FastAttributeList* getFlyWrapAttrList() const + { + return m_pFlyWrapAttrList.get(); + } void setBodyPrAttrList(sax_fastparser::FastAttributeList* pBodyPrAttrList) { m_pBodyPrAttrList = pBodyPrAttrList; } - sax_fastparser::FastAttributeList* getBodyPrAttrList() const { return m_pBodyPrAttrList; } + sax_fastparser::FastAttributeList* getBodyPrAttrList() const { return m_pBodyPrAttrList.get(); } rtl::Reference<sax_fastparser::FastAttributeList>& getDashLineStyleAttr() { @@ -341,7 +344,8 @@ rtl::Reference<sax_fastparser::FastAttributeList>& DocxSdrExport::getDashLineSty return m_pImpl->getDashLineStyleAttr(); } -void DocxSdrExport::setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrList) +void DocxSdrExport::setFlyWrapAttrList( + rtl::Reference<sax_fastparser::FastAttributeList> const& pAttrList) { m_pImpl->setFlyWrapAttrList(pAttrList); } @@ -422,7 +426,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons if (isAnchor) { - sax_fastparser::FastAttributeList* attrList + rtl::Reference<sax_fastparser::FastAttributeList> attrList = sax_fastparser::FastSerializerHelper::createAttrList(); bool bOpaque = pFrameFormat->GetOpaque().GetValue(); awt::Point aPos(pFrameFormat->GetHoriOrient().GetPos(), @@ -496,8 +500,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons attrList->addNS(XML_wp14, XML_anchorId, OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8)); } - sax_fastparser::XFastAttributeListRef xAttrList(attrList); - m_pImpl->getSerializer()->startElementNS(XML_wp, XML_anchor, xAttrList); + m_pImpl->getSerializer()->startElementNS(XML_wp, XML_anchor, attrList); m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_simplePos, XML_x, "0", XML_y, "0"); // required, unused const char* relativeFromH; @@ -680,7 +683,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons } else { - sax_fastparser::FastAttributeList* aAttrList + rtl::Reference<sax_fastparser::FastAttributeList> aAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); aAttrList->add(XML_distT, OString::number(TwipsToEMU(aULSpaceItem.GetUpper())).getStr()); aAttrList->add(XML_distB, OString::number(TwipsToEMU(aULSpaceItem.GetLower())).getStr()); @@ -917,11 +920,10 @@ void DocxSdrExport::writeVMLDrawing(const SdrObject* sdrObj, const SwFrameFormat const SwFormatVertOrient& rVertOri = rFrameFormat.GetVertOrient(); SwFormatSurround const& rSurround(rFrameFormat.GetSurround()); - std::unique_ptr<sax_fastparser::FastAttributeList> pAttrList( - docx::SurroundToVMLWrap(rSurround)); + rtl::Reference<sax_fastparser::FastAttributeList> pAttrList(docx::SurroundToVMLWrap(rSurround)); m_pImpl->getExport().VMLExporter().AddSdrObject( *sdrObj, rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(), rHoriOri.GetRelationOrient(), - rVertOri.GetRelationOrient(), std::move(pAttrList), true); + rVertOri.GetRelationOrient(), pAttrList.get(), true); m_pImpl->getSerializer()->endElementNS(XML_w, XML_pict); } @@ -951,7 +953,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFo Size aSize(pSdrObject->GetLogicRect().GetWidth(), pSdrObject->GetLogicRect().GetHeight()); startDMLAnchorInline(pFrameFormat, aSize); - sax_fastparser::FastAttributeList* pDocPrAttrList + rtl::Reference<sax_fastparser::FastAttributeList> pDocPrAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr()); pDocPrAttrList->add(XML_name, @@ -966,8 +968,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFo && pFrameFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR) pDocPrAttrList->add(XML_hidden, OString::number(1).getStr()); - sax_fastparser::XFastAttributeListRef xDocPrAttrListRef(pDocPrAttrList); - pFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef); + pFS->singleElementNS(XML_wp, XML_docPr, pDocPrAttrList); uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW); const char* pNamespace = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"; @@ -1238,7 +1239,7 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame) //Save data here and restore when out of scope ExportDataSaveRestore aDataGuard(m_pImpl->getExport(), nStt, nEnd, pParentFrame); - m_pImpl->setBodyPrAttrList(sax_fastparser::FastSerializerHelper::createAttrList()); + m_pImpl->setBodyPrAttrList(sax_fastparser::FastSerializerHelper::createAttrList().get()); ::comphelper::FlagRestorationGuard const g(m_pImpl->m_bFlyFrameGraphic, true); comphelper::ValueRestorationGuard vg(m_pImpl->getExport().m_nTextTyp, TXT_TXTBOX); m_pImpl->getExport().WriteText(); @@ -1316,7 +1317,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho if (xPropertySet.is()) xPropSetInfo = xPropertySet->getPropertySetInfo(); - m_pImpl->setBodyPrAttrList(sax_fastparser::FastSerializerHelper::createAttrList()); + m_pImpl->setBodyPrAttrList(sax_fastparser::FastSerializerHelper::createAttrList().get()); { drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP; if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("TextVerticalAdjust")) @@ -1329,13 +1330,12 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho { startDMLAnchorInline(&rFrameFormat, aSize); - sax_fastparser::FastAttributeList* pDocPrAttrList + rtl::Reference<sax_fastparser::FastAttributeList> pDocPrAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr()); pDocPrAttrList->add( XML_name, OUStringToOString(rFrameFormat.GetName(), RTL_TEXTENCODING_UTF8).getStr()); - sax_fastparser::XFastAttributeListRef xDocPrAttrListRef(pDocPrAttrList); - pFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef); + pFS->singleElementNS(XML_wp, XML_docPr, pDocPrAttrList); pFS->startElementNS(XML_a, XML_graphic, FSNS(XML_xmlns, XML_a), m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dml))); @@ -1526,7 +1526,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho m_pImpl->getBodyPrAttrList()->add(XML_bIns, OString::number(0)); } - sax_fastparser::XFastAttributeListRef xBodyPrAttrList(m_pImpl->getBodyPrAttrList()); + rtl::Reference<FastAttributeList> xBodyPrAttrList(m_pImpl->getBodyPrAttrList()); m_pImpl->setBodyPrAttrList(nullptr); if (!bTextBoxOnly) { @@ -1617,9 +1617,9 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText m_pImpl->getFlyAttrList()->addNS(XML_w14, XML_anchorId, OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8)); } - sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->getFlyAttrList().get()); + rtl::Reference<FastAttributeList> xFlyAttrList(m_pImpl->getFlyAttrList()); m_pImpl->getFlyAttrList().clear(); - sax_fastparser::XFastAttributeListRef xTextboxAttrList(m_pImpl->getTextboxAttrList().get()); + rtl::Reference<FastAttributeList> xTextboxAttrList(m_pImpl->getTextboxAttrList()); m_pImpl->getTextboxAttrList().clear(); m_pImpl->setTextFrameSyntax(false); m_pImpl->setFlyFrameSize(nullptr); @@ -1632,15 +1632,13 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText m_pImpl->textFrameShadow(rFrameFormat); if (m_pImpl->getFlyFillAttrList().is()) { - sax_fastparser::XFastAttributeListRef xFlyFillAttrList( - m_pImpl->getFlyFillAttrList().get()); + rtl::Reference<FastAttributeList> xFlyFillAttrList(m_pImpl->getFlyFillAttrList()); m_pImpl->getFlyFillAttrList().clear(); pFS->singleElementNS(XML_v, XML_fill, xFlyFillAttrList); } if (m_pImpl->getDashLineStyleAttr().is()) { - sax_fastparser::XFastAttributeListRef xDashLineStyleAttr( - m_pImpl->getDashLineStyleAttr().get()); + rtl::Reference<FastAttributeList> xDashLineStyleAttr(m_pImpl->getDashLineStyleAttr()); m_pImpl->getDashLineStyleAttr().clear(); pFS->singleElementNS(XML_v, XML_stroke, xDashLineStyleAttr); } @@ -1664,7 +1662,7 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText if (m_pImpl->getFlyWrapAttrList()) { - sax_fastparser::XFastAttributeListRef xFlyWrapAttrList(m_pImpl->getFlyWrapAttrList()); + rtl::Reference<FastAttributeList> xFlyWrapAttrList(m_pImpl->getFlyWrapAttrList()); m_pImpl->setFlyWrapAttrList(nullptr); pFS->singleElementNS(XML_w10, XML_wrap, xFlyWrapAttrList); } diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx index c1fa05eeb44f..f8c22167b11e 100644 --- a/sw/source/filter/ww8/docxsdrexport.hxx +++ b/sw/source/filter/ww8/docxsdrexport.hxx @@ -70,7 +70,7 @@ public: bool IsParagraphHasDrawing() const; void setParagraphHasDrawing(bool bParagraphHasDrawing); rtl::Reference<sax_fastparser::FastAttributeList>& getFlyFillAttrList(); - void setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrList); + void setFlyWrapAttrList(rtl::Reference<sax_fastparser::FastAttributeList> const & pAttrList); /// Attributes of <wps:bodyPr>, used during DML export of text frames. sax_fastparser::FastAttributeList* getBodyPrAttrList(); rtl::Reference<sax_fastparser::FastAttributeList>& getDashLineStyle(); diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx index 495a1bddc942..4ad89587eda1 100644 --- a/sw/source/filter/ww8/docxtablestyleexport.cxx +++ b/sw/source/filter/ww8/docxtablestyleexport.cxx @@ -89,7 +89,7 @@ public: void DocxTableStyleExport::CnfStyle(const uno::Sequence<beans::PropertyValue>& rAttributeList) { - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); for (const auto& rAttribute : rAttributeList) @@ -118,8 +118,7 @@ void DocxTableStyleExport::CnfStyle(const uno::Sequence<beans::PropertyValue>& r } } - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pImpl->getSerializer()->singleElementNS(XML_w, XML_cnfStyle, xAttributeList); + m_pImpl->getSerializer()->singleElementNS(XML_w, XML_cnfStyle, pAttributeList); } void DocxTableStyleExport::TableStyles(sal_Int32 nCountStylesToWrite) @@ -189,14 +188,13 @@ void DocxTableStyleExport::Impl::tableStyleTcBorder( if (!rTcBorder.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); for (const auto& rProp : rTcBorder) if (sal_Int32 nAttrToken = DocxStringGetToken(aTcBorderTokens, rProp.Name)) pAttributeList->add(FSNS(XML_w, nAttrToken), rProp.Value.get<OUString>().toUtf8()); - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, nToken, xAttributeList); + m_pSerializer->singleElementNS(XML_w, nToken, pAttributeList); } void DocxTableStyleExport::Impl::tableStyleTcBorders( @@ -230,7 +228,7 @@ void DocxTableStyleExport::Impl::tableStyleShd(const uno::Sequence<beans::Proper if (!rShd.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); for (const auto& rProp : rShd) { @@ -249,8 +247,7 @@ void DocxTableStyleExport::Impl::tableStyleShd(const uno::Sequence<beans::Proper pAttributeList->add(FSNS(XML_w, XML_themeFillTint), rProp.Value.get<OUString>().toUtf8()); } - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, XML_shd, xAttributeList); + m_pSerializer->singleElementNS(XML_w, XML_shd, pAttributeList); } void DocxTableStyleExport::Impl::tableStyleRColor(const uno::Sequence<beans::PropertyValue>& rColor) @@ -258,7 +255,7 @@ void DocxTableStyleExport::Impl::tableStyleRColor(const uno::Sequence<beans::Pro if (!rColor.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); for (const auto& rProp : rColor) { @@ -271,8 +268,7 @@ void DocxTableStyleExport::Impl::tableStyleRColor(const uno::Sequence<beans::Pro else if (rProp.Name == "themeShade") pAttributeList->add(FSNS(XML_w, XML_themeShade), rProp.Value.get<OUString>().toUtf8()); } - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, XML_color, xAttributeList); + m_pSerializer->singleElementNS(XML_w, XML_color, pAttributeList); } void DocxTableStyleExport::Impl::tableStyleRLang(const uno::Sequence<beans::PropertyValue>& rLang) @@ -280,7 +276,7 @@ void DocxTableStyleExport::Impl::tableStyleRLang(const uno::Sequence<beans::Prop if (!rLang.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); for (const auto& rProp : rLang) { @@ -291,8 +287,7 @@ void DocxTableStyleExport::Impl::tableStyleRLang(const uno::Sequence<beans::Prop else if (rProp.Name == "bidi") pAttributeList->add(FSNS(XML_w, XML_bidi), rProp.Value.get<OUString>().toUtf8()); } - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, XML_lang, xAttributeList); + m_pSerializer->singleElementNS(XML_w, XML_lang, pAttributeList); } void DocxTableStyleExport::Impl::tableStyleRRFonts( @@ -301,7 +296,7 @@ void DocxTableStyleExport::Impl::tableStyleRRFonts( if (!rRFonts.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); for (const auto& rRFont : rRFonts) { @@ -315,8 +310,7 @@ void DocxTableStyleExport::Impl::tableStyleRRFonts( else if (rRFont.Name == "hAnsiTheme") pAttributeList->add(FSNS(XML_w, XML_hAnsiTheme), rRFont.Value.get<OUString>().toUtf8()); } - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, XML_rFonts, xAttributeList); + m_pSerializer->singleElementNS(XML_w, XML_rFonts, pAttributeList); } void DocxTableStyleExport::Impl::tableStylePSpacing( @@ -325,7 +319,7 @@ void DocxTableStyleExport::Impl::tableStylePSpacing( if (!rSpacing.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); for (const auto& rProp : rSpacing) { @@ -348,8 +342,7 @@ void DocxTableStyleExport::Impl::tableStylePSpacing( // Auto spacing will be available in grab bag only if it was set to true pAttributeList->add(FSNS(XML_w, XML_afterAutospacing), "1"); } - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, XML_spacing, xAttributeList); + m_pSerializer->singleElementNS(XML_w, XML_spacing, pAttributeList); } void DocxTableStyleExport::Impl::tableStylePInd(const uno::Sequence<beans::PropertyValue>& rInd) @@ -357,7 +350,7 @@ void DocxTableStyleExport::Impl::tableStylePInd(const uno::Sequence<beans::Prope if (!rInd.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); for (const auto& rProp : rInd) { @@ -366,8 +359,7 @@ void DocxTableStyleExport::Impl::tableStylePInd(const uno::Sequence<beans::Prope else if (rProp.Name == "right") pAttributeList->add(FSNS(XML_w, XML_right), rProp.Value.get<OUString>().toUtf8()); } - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, XML_ind, xAttributeList); + m_pSerializer->singleElementNS(XML_w, XML_ind, pAttributeList); } void DocxTableStyleExport::Impl::tableStyleTableInd( @@ -376,7 +368,7 @@ void DocxTableStyleExport::Impl::tableStyleTableInd( if (!rTableInd.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); for (const auto& rProp : rTableInd) { @@ -385,20 +377,18 @@ void DocxTableStyleExport::Impl::tableStyleTableInd( else if (rProp.Name == "type") pAttributeList->add(FSNS(XML_w, XML_type), rProp.Value.get<OUString>().toUtf8()); } - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, XML_tblInd, xAttributeList); + m_pSerializer->singleElementNS(XML_w, XML_tblInd, pAttributeList); } void DocxTableStyleExport::Impl::handleBoolean(const OUString& aValue, sal_Int32 nToken) { if (aValue.isEmpty()) return; - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); if (aValue != "1") pAttributeList->add(FSNS(XML_w, XML_val), aValue.toUtf8()); - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->singleElementNS(XML_w, nToken, xAttributeList); + m_pSerializer->singleElementNS(XML_w, nToken, pAttributeList); } void DocxTableStyleExport::Impl::tableStyleRPr(const uno::Sequence<beans::PropertyValue>& rRPr) @@ -697,7 +687,7 @@ void DocxTableStyleExport::Impl::TableStyle(const uno::Sequence<beans::PropertyV aTableStylePrs.push_back(rProp.Value.get<uno::Sequence<beans::PropertyValue>>()); } - sax_fastparser::FastAttributeList* pAttributeList + rtl::Reference<sax_fastparser::FastAttributeList> pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); pAttributeList->add(FSNS(XML_w, XML_type), "table"); if (bDefault) @@ -706,8 +696,7 @@ void DocxTableStyleExport::Impl::TableStyle(const uno::Sequence<beans::PropertyV pAttributeList->add(FSNS(XML_w, XML_customStyle), "1"); if (!aStyleId.isEmpty()) pAttributeList->add(FSNS(XML_w, XML_styleId), aStyleId.toUtf8()); - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); - m_pSerializer->startElementNS(XML_w, XML_style, xAttributeList); + m_pSerializer->startElementNS(XML_w, XML_style, pAttributeList); m_pSerializer->singleElementNS(XML_w, XML_name, FSNS(XML_w, XML_val), aName); if (!aBasedOn.isEmpty()) |