diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-09 21:47:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-10 07:36:57 +0100 |
commit | 830e5e055760c31693e72e036ad473f4a3c43b55 (patch) | |
tree | 6e1cf0033f0a0ff60cc32b31f13e7af44ef38225 | |
parent | 09cb778b6eb7d3a5b9029965a1320b49c90e7295 (diff) |
pass FastAttributeList around by rtl::Reference
Change-Id: I958a22f60975c74dfaeb8469b4c0cd3759d40130
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110653
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/oox/export/vmlexport.hxx | 7 | ||||
-rw-r--r-- | include/sax/fshelper.hxx | 13 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 57 | ||||
-rw-r--r-- | oox/source/export/vmlexport.cxx | 79 | ||||
-rw-r--r-- | sax/source/tools/fshelper.cxx | 16 | ||||
-rw-r--r-- | sc/source/filter/excel/excrecds.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xepage.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/excel/xepivotxml.cxx | 13 | ||||
-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 |
15 files changed, 195 insertions, 264 deletions
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index a1c79fda73a8..4ee885fba6bd 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -34,6 +34,7 @@ #include <sal/types.h> #include <sax/fshelper.hxx> #include <vcl/checksum.hxx> +#include <rtl/ref.hxx> namespace com::sun::star { namespace drawing { @@ -83,14 +84,14 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx /// Anchoring - Writer specific properties sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel; - std::unique_ptr<sax_fastparser::FastAttributeList> m_pWrapAttrList; + rtl::Reference<sax_fastparser::FastAttributeList> m_pWrapAttrList; bool m_bInline; // css::text::TextContentAnchorType_AS_CHARACTER /// The object we're exporting. const SdrObject* m_pSdrObject; /// Fill the shape attributes as they come. - ::sax_fastparser::FastAttributeList *m_pShapeAttrList; + rtl::Reference<::sax_fastparser::FastAttributeList> m_pShapeAttrList; /// Remember the shape type. sal_uInt32 m_nShapeType; @@ -142,7 +143,7 @@ public: OString const & AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1, sal_Int16 eVOri = -1, sal_Int16 eHRel = -1, sal_Int16 eVRel = -1, - std::unique_ptr<sax_fastparser::FastAttributeList> m_pWrapAttrList = {}, + sax_fastparser::FastAttributeList* pWrapAttrList = nullptr, const bool bOOxmlExport = false ); OString const & AddInlineSdrObject( const SdrObject& rObj, const bool bOOxmlExport ); virtual void AddSdrObjectVMLObject( const SdrObject& rObj) override; diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx index 7a540ef6fddf..79f0e1a0f30f 100644 --- a/include/sax/fshelper.hxx +++ b/include/sax/fshelper.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> #include <sax/saxdllapi.h> #include <optional> #include <memory> @@ -39,8 +40,6 @@ namespace sax_fastparser { enum class MergeMarks { APPEND = 0, PREPEND = 1, POSTPONE = 2}; -typedef css::uno::Reference< css::xml::sax::XFastAttributeList > XFastAttributeListRef; - class FastSaxSerializer; class SAX_DLLPUBLIC FastSerializerHelper @@ -123,12 +122,12 @@ public: void endElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId) { endElement( FSNS( namespaceTokenId, elementTokenId ) ); } - void singleElement(sal_Int32 elementTokenId, const XFastAttributeListRef& xAttrList); - void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, XFastAttributeListRef const & xAttrList) + void singleElement(sal_Int32 elementTokenId, const rtl::Reference<FastAttributeList>& xAttrList); + void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, rtl::Reference<FastAttributeList> const & xAttrList) { singleElement(FSNS( namespaceTokenId, elementTokenId), xAttrList); } - void startElement(sal_Int32 elementTokenId, const XFastAttributeListRef& xAttrList); - void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, XFastAttributeListRef const & xAttrList) + void startElement(sal_Int32 elementTokenId, const rtl::Reference<FastAttributeList>& xAttrList); + void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, rtl::Reference<FastAttributeList> const & xAttrList) { startElement( FSNS( namespaceTokenId, elementTokenId ), xAttrList ); } FastSerializerHelper* write(const char* value); @@ -145,7 +144,7 @@ public: css::uno::Reference< css::io::XOutputStream > const & getOutputStream() const; - static FastAttributeList *createAttrList(); + static rtl::Reference<FastAttributeList> createAttrList(); void mark(sal_Int32 nTag, const css::uno::Sequence< sal_Int32 >& rOrder = diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index e2f0602017b6..7f7e6ec3525f 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -198,8 +198,7 @@ void WriteGradientPath(const awt::Gradient& rGradient, const FSHelperPtr& pFS, c pAttributeList->add(XML_r, OString::number(nRightPercent * PER_PERCENT)); sal_Int32 nBottomPercent = 100 - rGradient.YOffset; pAttributeList->add(XML_b, OString::number(nBottomPercent * PER_PERCENT)); - sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList.get()); - pFS->singleElementNS(XML_a, XML_fillToRect, xAttributeList); + pFS->singleElementNS(XML_a, XML_fillToRect, pAttributeList); pFS->endElementNS(XML_a, XML_path); } @@ -3946,8 +3945,7 @@ void DrawingML::WriteShapeEffect( std::u16string_view sName, const Sequence< Pro ::Color nRgbClr; sal_Int32 nAlpha = MAX_PERCENT; Sequence< PropertyValue > aTransformations; - sax_fastparser::FastAttributeList *aOuterShdwAttrList = FastSerializerHelper::createAttrList(); - sax_fastparser::XFastAttributeListRef xOuterShdwAttrList( aOuterShdwAttrList ); + rtl::Reference<sax_fastparser::FastAttributeList> aOuterShdwAttrList = FastSerializerHelper::createAttrList(); for( const auto& rEffectProp : aEffectProps ) { if( rEffectProp.Name == "Attribs" ) @@ -4079,7 +4077,7 @@ void DrawingML::WriteShapeEffect( std::u16string_view sName, const Sequence< Pro if( nEffectToken <= 0 ) return; - mpFS->startElement( nEffectToken, xOuterShdwAttrList ); + mpFS->startElement( nEffectToken, aOuterShdwAttrList ); if( bContainsColor ) { @@ -4389,10 +4387,8 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) return; bool bCameraRotationPresent = false; - sax_fastparser::FastAttributeList *aCameraAttrList = FastSerializerHelper::createAttrList(); - sax_fastparser::XFastAttributeListRef xCameraAttrList( aCameraAttrList ); - sax_fastparser::FastAttributeList *aCameraRotationAttrList = FastSerializerHelper::createAttrList(); - sax_fastparser::XFastAttributeListRef xRotAttrList( aCameraRotationAttrList ); + rtl::Reference<sax_fastparser::FastAttributeList> aCameraAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> aCameraRotationAttrList = FastSerializerHelper::createAttrList(); for( const auto& rEffectProp : std::as_const(aEffectProps) ) { if( rEffectProp.Name == "prst" ) @@ -4431,10 +4427,8 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) } bool bLightRigRotationPresent = false; - sax_fastparser::FastAttributeList *aLightRigAttrList = FastSerializerHelper::createAttrList(); - sax_fastparser::XFastAttributeListRef xLightAttrList( aLightRigAttrList ); - sax_fastparser::FastAttributeList *aLightRigRotationAttrList = FastSerializerHelper::createAttrList(); - sax_fastparser::XFastAttributeListRef xLightRotAttrList( aLightRigRotationAttrList ); + rtl::Reference<sax_fastparser::FastAttributeList> aLightRigAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> aLightRigRotationAttrList = FastSerializerHelper::createAttrList(); for( const auto& rLightRigProp : std::as_const(aLightRigProps) ) { if( rLightRigProp.Name == "rig" || rLightRigProp.Name == "dir" ) @@ -4469,10 +4463,10 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) if( aEffectProps.hasElements() ) { - mpFS->startElementNS( XML_a, XML_camera, xCameraAttrList ); + mpFS->startElementNS( XML_a, XML_camera, aCameraAttrList ); if( bCameraRotationPresent ) { - mpFS->singleElementNS( XML_a, XML_rot, xRotAttrList ); + mpFS->singleElementNS( XML_a, XML_rot, aCameraRotationAttrList ); } mpFS->endElementNS( XML_a, XML_camera ); } @@ -4484,10 +4478,10 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) if( aEffectProps.hasElements() ) { - mpFS->startElementNS( XML_a, XML_lightRig, xLightAttrList ); + mpFS->startElementNS( XML_a, XML_lightRig, aLightRigAttrList ); if( bLightRigRotationPresent ) { - mpFS->singleElementNS( XML_a, XML_rot, xLightRotAttrList ); + mpFS->singleElementNS( XML_a, XML_rot, aLightRigRotationAttrList ); } mpFS->endElementNS( XML_a, XML_lightRig ); } @@ -4504,11 +4498,9 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) bool bBevelTPresent = false, bBevelBPresent = false; Sequence< PropertyValue > aExtrusionColorProps, aContourColorProps; - sax_fastparser::FastAttributeList *aBevelTAttrList = FastSerializerHelper::createAttrList(); - sax_fastparser::XFastAttributeListRef xBevelTAttrList( aBevelTAttrList ); - sax_fastparser::FastAttributeList *aBevelBAttrList = FastSerializerHelper::createAttrList(); - sax_fastparser::XFastAttributeListRef xBevelBAttrList( aBevelBAttrList ); - sax_fastparser::FastAttributeList *aShape3DAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> aBevelTAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> aBevelBAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> aShape3DAttrList = FastSerializerHelper::createAttrList(); for( const auto& rShape3DProp : std::as_const(aShape3DProps) ) { if( rShape3DProp.Name == "extrusionH" || rShape3DProp.Name == "contourW" || rShape3DProp.Name == "z" ) @@ -4544,7 +4536,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) if ( !aBevelProps.hasElements() ) continue; - sax_fastparser::FastAttributeList *aBevelAttrList = nullptr; + rtl::Reference<sax_fastparser::FastAttributeList> aBevelAttrList; if( rShape3DProp.Name == "bevelT" ) { bBevelTPresent = true; @@ -4578,15 +4570,14 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) } } - sax_fastparser::XFastAttributeListRef xAttrList( aShape3DAttrList ); - mpFS->startElementNS( XML_a, XML_sp3d, xAttrList ); + mpFS->startElementNS( XML_a, XML_sp3d, aShape3DAttrList ); if( bBevelTPresent ) { - mpFS->singleElementNS( XML_a, XML_bevelT, xBevelTAttrList ); + mpFS->singleElementNS( XML_a, XML_bevelT, aBevelTAttrList ); } if( bBevelBPresent ) { - mpFS->singleElementNS( XML_a, XML_bevelB, xBevelBAttrList ); + mpFS->singleElementNS( XML_a, XML_bevelB, aBevelBAttrList ); } if( aExtrusionColorProps.hasElements() ) { @@ -4661,7 +4652,7 @@ void DrawingML::WriteArtisticEffect( const Reference< XPropertySet >& rXPropSet Sequence< PropertyValue > aAttrs; aEffect.Value >>= aAttrs; - sax_fastparser::FastAttributeList *aAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> aAttrList = FastSerializerHelper::createAttrList(); OString sRelId; for( const auto& rAttr : std::as_const(aAttrs) ) { @@ -4696,8 +4687,7 @@ void DrawingML::WriteArtisticEffect( const Reference< XPropertySet >& rXPropSet mpFS->startElementNS(XML_a14, XML_imgLayer, FSNS(XML_r, XML_embed), sRelId); mpFS->startElementNS(XML_a14, XML_imgEffect); - sax_fastparser::XFastAttributeListRef xAttrList( aAttrList ); - mpFS->singleElementNS( XML_a14, nEffectToken, xAttrList ); + mpFS->singleElementNS( XML_a14, nEffectToken, aAttrList ); mpFS->endElementNS( XML_a14, XML_imgEffect ); mpFS->endElementNS( XML_a14, XML_imgLayer ); @@ -4776,16 +4766,15 @@ void DrawingML::WriteDiagram(const css::uno::Reference<css::drawing::XShape>& rX return; // generate a unique id - sax_fastparser::FastAttributeList* pDocPrAttrList + rtl::Reference<sax_fastparser::FastAttributeList> pDocPrAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); pDocPrAttrList->add(XML_id, OString::number(nDiagramId).getStr()); OUString sName = "Diagram" + OUString::number(nDiagramId); pDocPrAttrList->add(XML_name, OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr()); - sax_fastparser::XFastAttributeListRef xDocPrAttrListRef(pDocPrAttrList); if (GetDocumentType() == DOCUMENT_DOCX) { - mpFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef); + mpFS->singleElementNS(XML_wp, XML_docPr, pDocPrAttrList); mpFS->singleElementNS(XML_wp, XML_cNvGraphicFramePr); mpFS->startElementNS(XML_a, XML_graphic, FSNS(XML_xmlns, XML_a), @@ -4795,7 +4784,7 @@ void DrawingML::WriteDiagram(const css::uno::Reference<css::drawing::XShape>& rX { mpFS->startElementNS(XML_p, XML_nvGraphicFramePr); - mpFS->singleElementNS(XML_p, XML_cNvPr, xDocPrAttrListRef); + mpFS->singleElementNS(XML_p, XML_cNvPr, pDocPrAttrList); mpFS->singleElementNS(XML_p, XML_cNvGraphicFramePr); mpFS->startElementNS(XML_p, XML_nvPr); diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 9aa51f583bd4..a9e5dcf6d20c 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -68,7 +68,6 @@ VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr const & pSerializer, VMLText , m_eVRel( 0 ) , m_bInline( false ) , m_pSdrObject( nullptr ) - , m_pShapeAttrList( nullptr ) , m_nShapeType( ESCHER_ShpInst_Nil ) , m_nShapeFlags(ShapeFlag::NONE) , m_ShapeStyle( 200 ) @@ -136,7 +135,7 @@ sal_uInt32 VMLExport::EnterGroup( const OUString& rShapeName, const tools::Recta sal_uInt32 nShapeId = GenerateShapeId(); OStringBuffer aStyle( 200 ); - FastAttributeList *pAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<FastAttributeList> pAttrList = FastSerializerHelper::createAttrList(); pAttrList->add( XML_id, ShapeIdString( nShapeId ) ); @@ -173,7 +172,7 @@ sal_uInt32 VMLExport::EnterGroup( const OUString& rShapeName, const tools::Recta .makeStringAndClear() ); } - m_pSerializer->startElementNS( XML_v, XML_group, XFastAttributeListRef( pAttrList ) ); + m_pSerializer->startElementNS( XML_v, XML_group, pAttrList ); mnGroupLevel++; return nShapeId; @@ -671,7 +670,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& case ESCHER_Prop_fillOpacity: // 386 { sal_uInt32 nValue; - sax_fastparser::FastAttributeList* pAttrList + rtl::Reference<sax_fastparser::FastAttributeList> pAttrList = FastSerializerHelper::createAttrList(); bool imageData = false; @@ -680,7 +679,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& if (pSdrGrafObj && pSdrGrafObj->isSignatureLine() && m_pTextExport) { - sax_fastparser::FastAttributeList* pAttrListSignatureLine + rtl::Reference<sax_fastparser::FastAttributeList> pAttrListSignatureLine = FastSerializerHelper::createAttrList(); pAttrListSignatureLine->add(XML_issignatureline, "t"); if (!pSdrGrafObj->getSignatureLineId().isEmpty()) @@ -731,7 +730,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& m_pSerializer->singleElementNS( XML_o, XML_signatureline, - XFastAttributeListRef(pAttrListSignatureLine)); + pAttrListSignatureLine); // Get signature line graphic const uno::Reference<graphic::XGraphic>& xGraphic @@ -773,10 +772,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& } if (rProps.GetOpt(ESCHER_Prop_fNoFillHitTest, nValue)) - impl_AddBool(pAttrList, FSNS(XML_o, XML_detectmouseclick), nValue != 0); + impl_AddBool(pAttrList.get(), FSNS(XML_o, XML_detectmouseclick), nValue != 0); if (imageData) - m_pSerializer->singleElementNS( XML_v, XML_imagedata, XFastAttributeListRef( pAttrList ) ); + m_pSerializer->singleElementNS( XML_v, XML_imagedata, pAttrList ); else { if ( rProps.GetOpt( ESCHER_Prop_fillType, nValue ) ) @@ -805,16 +804,16 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& pAttrList->add( XML_on, "false" ); if ( rProps.GetOpt( ESCHER_Prop_fillColor, nValue ) ) - impl_AddColor( m_pShapeAttrList, XML_fillcolor, nValue ); + impl_AddColor( m_pShapeAttrList.get(), XML_fillcolor, nValue ); if ( rProps.GetOpt( ESCHER_Prop_fillBackColor, nValue ) ) - impl_AddColor( pAttrList, XML_color2, nValue ); + impl_AddColor( pAttrList.get(), XML_color2, nValue ); if (rProps.GetOpt(ESCHER_Prop_fillOpacity, nValue)) // Partly undo the transformation at the end of EscherPropertyContainer::CreateFillProperties(): VML opacity is 0..1. pAttrList->add(XML_opacity, OString::number(double((nValue * 100) >> 16) / 100)); - m_pSerializer->singleElementNS( XML_v, XML_fill, XFastAttributeListRef( pAttrList ) ); + m_pSerializer->singleElementNS( XML_v, XML_fill, pAttrList ); } } @@ -839,13 +838,13 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& case ESCHER_Prop_lineEndCapStyle: // 471 { sal_uInt32 nValue; - sax_fastparser::FastAttributeList *pAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> pAttrList = FastSerializerHelper::createAttrList(); if ( rProps.GetOpt( ESCHER_Prop_lineColor, nValue ) ) - impl_AddColor( pAttrList, XML_color, nValue ); + impl_AddColor( pAttrList.get(), XML_color, nValue ); if ( rProps.GetOpt( ESCHER_Prop_lineWidth, nValue ) ) - impl_AddInt( pAttrList, XML_weight, nValue ); + impl_AddInt( pAttrList.get(), XML_weight, nValue ); if ( rProps.GetOpt( ESCHER_Prop_lineDashing, nValue ) ) { @@ -869,22 +868,22 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& } if ( rProps.GetOpt( ESCHER_Prop_lineStartArrowhead, nValue ) ) - impl_AddArrowHead( pAttrList, XML_startarrow, nValue ); + impl_AddArrowHead( pAttrList.get(), XML_startarrow, nValue ); if ( rProps.GetOpt( ESCHER_Prop_lineEndArrowhead, nValue ) ) - impl_AddArrowHead( pAttrList, XML_endarrow, nValue ); + impl_AddArrowHead( pAttrList.get(), XML_endarrow, nValue ); if ( rProps.GetOpt( ESCHER_Prop_lineStartArrowWidth, nValue ) ) - impl_AddArrowWidth( pAttrList, XML_startarrowwidth, nValue ); + impl_AddArrowWidth( pAttrList.get(), XML_startarrowwidth, nValue ); if ( rProps.GetOpt( ESCHER_Prop_lineStartArrowLength, nValue ) ) - impl_AddArrowLength( pAttrList, XML_startarrowlength, nValue ); + impl_AddArrowLength( pAttrList.get(), XML_startarrowlength, nValue ); if ( rProps.GetOpt( ESCHER_Prop_lineEndArrowWidth, nValue ) ) - impl_AddArrowWidth( pAttrList, XML_endarrowwidth, nValue ); + impl_AddArrowWidth( pAttrList.get(), XML_endarrowwidth, nValue ); if ( rProps.GetOpt( ESCHER_Prop_lineEndArrowLength, nValue ) ) - impl_AddArrowLength( pAttrList, XML_endarrowlength, nValue ); + impl_AddArrowLength( pAttrList.get(), XML_endarrowlength, nValue ); if ( rProps.GetOpt( ESCHER_Prop_lineJoinStyle, nValue ) ) { @@ -912,7 +911,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& pAttrList->add( XML_endcap, pEndCap ); } - m_pSerializer->singleElementNS( XML_v, XML_stroke, XFastAttributeListRef( pAttrList ) ); + m_pSerializer->singleElementNS( XML_v, XML_stroke, pAttrList ); } bAlreadyWritten[ ESCHER_Prop_lineColor ] = true; bAlreadyWritten[ ESCHER_Prop_lineWidth ] = true; @@ -944,14 +943,14 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& } if ( bShadow ) { - sax_fastparser::FastAttributeList *pAttrList = FastSerializerHelper::createAttrList(); - impl_AddBool( pAttrList, XML_on, bShadow ); - impl_AddBool( pAttrList, XML_obscured, bObscured ); + rtl::Reference<sax_fastparser::FastAttributeList> pAttrList = FastSerializerHelper::createAttrList(); + impl_AddBool( pAttrList.get(), XML_on, bShadow ); + impl_AddBool( pAttrList.get(), XML_obscured, bObscured ); if ( rProps.GetOpt( ESCHER_Prop_shadowColor, nValue ) ) - impl_AddColor( pAttrList, XML_color, nValue ); + impl_AddColor( pAttrList.get(), XML_color, nValue ); - m_pSerializer->singleElementNS( XML_v, XML_shadow, XFastAttributeListRef( pAttrList ) ); + m_pSerializer->singleElementNS( XML_v, XML_shadow, pAttrList ); bAlreadyWritten[ ESCHER_Prop_fshadowObscured ] = true; bAlreadyWritten[ ESCHER_Prop_shadowColor ] = true; } @@ -976,7 +975,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& m_pSerializer->singleElementNS(XML_v, XML_path, XML_textpathok, "t"); - sax_fastparser::FastAttributeList* pAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> pAttrList = FastSerializerHelper::createAttrList(); pAttrList->add(XML_on, "t"); pAttrList->add(XML_fitshape, "t"); pAttrList->add(XML_string, OUStringToOString(aTextPathString, RTL_TEXTENCODING_UTF8)); @@ -1001,7 +1000,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& if (!aStyle.isEmpty()) pAttrList->add(XML_style, OUStringToOString(aStyle, RTL_TEXTENCODING_UTF8)); - m_pSerializer->singleElementNS(XML_v, XML_textpath, XFastAttributeListRef(pAttrList)); + m_pSerializer->singleElementNS(XML_v, XML_textpath, pAttrList); } bAlreadyWritten[ESCHER_Prop_gtextUNICODE] = true; @@ -1018,7 +1017,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& case ESCHER_Prop_fNoLineDrawDash: { // See DffPropertyReader::ApplyLineAttributes(). - impl_AddBool( m_pShapeAttrList, XML_stroked, (opt.nPropValue & 8) != 0 ); + impl_AddBool( m_pShapeAttrList.get(), XML_stroked, (opt.nPropValue & 8) != 0 ); bAlreadyWritten[ESCHER_Prop_fNoLineDrawDash] = true; } break; @@ -1419,7 +1418,7 @@ sal_Int32 VMLExport::StartShape() } // start of the shape - m_pSerializer->startElementNS( XML_v, nShapeElement, XFastAttributeListRef( m_pShapeAttrList ) ); + m_pSerializer->startElementNS( XML_v, nShapeElement, m_pShapeAttrList ); OString const textboxStyle(m_TextboxStyle.makeStringAndClear()); @@ -1447,15 +1446,14 @@ sal_Int32 VMLExport::StartShape() if( pParaObj ) { - sax_fastparser::FastAttributeList* pTextboxAttrList = FastSerializerHelper::createAttrList(); - sax_fastparser::XFastAttributeListRef xTextboxAttrList(pTextboxAttrList); + rtl::Reference<sax_fastparser::FastAttributeList> pTextboxAttrList = FastSerializerHelper::createAttrList(); if (!textboxStyle.isEmpty()) { pTextboxAttrList->add(XML_style, textboxStyle); } // this is reached only in case some text is attached to the shape - m_pSerializer->startElementNS(XML_v, XML_textbox, xTextboxAttrList); + m_pSerializer->startElementNS(XML_v, XML_textbox, pTextboxAttrList); m_pTextExport->WriteOutliner(*pParaObj); m_pSerializer->endElementNS(XML_v, XML_textbox); if( bOwnParaObj ) @@ -1513,12 +1511,10 @@ void VMLExport::EndShape( sal_Int32 nShapeElement ) } } } - sax_fastparser::FastAttributeList* pTextboxAttrList = FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> pTextboxAttrList = FastSerializerHelper::createAttrList(); if (bBottomToTop) pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top"); - sax_fastparser::XFastAttributeListRef xTextboxAttrList(pTextboxAttrList); - pTextboxAttrList = nullptr; - m_pSerializer->startElementNS(XML_v, XML_textbox, xTextboxAttrList); + m_pSerializer->startElementNS(XML_v, XML_textbox, pTextboxAttrList); m_pTextExport->WriteVMLTextBox(uno::Reference<drawing::XShape>(xPropertySet, uno::UNO_QUERY_THROW)); @@ -1527,8 +1523,7 @@ void VMLExport::EndShape( sal_Int32 nShapeElement ) if (m_pWrapAttrList) { - sax_fastparser::XFastAttributeListRef const pWrapAttrList(m_pWrapAttrList.release()); - m_pSerializer->singleElementNS(XML_w10, XML_wrap, pWrapAttrList); + m_pSerializer->singleElementNS(XML_w10, XML_wrap, m_pWrapAttrList); } // end of the shape @@ -1536,7 +1531,7 @@ void VMLExport::EndShape( sal_Int32 nShapeElement ) } OString const & VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri, sal_Int16 eVOri, sal_Int16 eHRel, sal_Int16 eVRel, - std::unique_ptr<FastAttributeList> pWrapAttrList, + FastAttributeList* pWrapAttrList, const bool bOOxmlExport ) { m_pSdrObject = &rObj; @@ -1544,7 +1539,7 @@ OString const & VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri, m_eVOri = eVOri; m_eHRel = eHRel; m_eVRel = eVRel; - m_pWrapAttrList = std::move(pWrapAttrList); + m_pWrapAttrList = pWrapAttrList; m_bInline = false; EscherEx::AddSdrObject(rObj, bOOxmlExport); return m_sShapeId; @@ -1557,7 +1552,7 @@ OString const & VMLExport::AddInlineSdrObject( const SdrObject& rObj, const bool m_eVOri = -1; m_eHRel = -1; m_eVRel = -1; - m_pWrapAttrList.reset(); + m_pWrapAttrList.clear(); m_bInline = true; EscherEx::AddSdrObject(rObj, bOOxmlExport); return m_sShapeId; diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx index b285ba9f3219..a560e5bd1bad 100644 --- a/sax/source/tools/fshelper.cxx +++ b/sax/source/tools/fshelper.cxx @@ -60,18 +60,16 @@ void FastSerializerHelper::endElement(sal_Int32 elementTokenId) mpSerializer->endFastElement(elementTokenId); } -void FastSerializerHelper::startElement(sal_Int32 elementTokenId, const XFastAttributeListRef& xAttrList) +void FastSerializerHelper::startElement(sal_Int32 elementTokenId, const rtl::Reference<FastAttributeList>& xAttrList) { - FastAttributeList* pAttrList = dynamic_cast< FastAttributeList* >(xAttrList.get()); - assert(pAttrList); - mpSerializer->startFastElement(elementTokenId, pAttrList); + assert(xAttrList); + mpSerializer->startFastElement(elementTokenId, xAttrList.get()); } -void FastSerializerHelper::singleElement(sal_Int32 elementTokenId, const XFastAttributeListRef& xAttrList) +void FastSerializerHelper::singleElement(sal_Int32 elementTokenId, const rtl::Reference<FastAttributeList>& xAttrList) { - FastAttributeList* pAttrList = dynamic_cast< FastAttributeList* >(xAttrList.get()); - assert(pAttrList); - mpSerializer->singleFastElement(elementTokenId, pAttrList); + assert(xAttrList); + mpSerializer->singleFastElement(elementTokenId, xAttrList.get()); } FastSerializerHelper* FastSerializerHelper::write(const char* value) @@ -146,7 +144,7 @@ void FastSerializerHelper::mergeTopMarks( mpSerializer->mergeTopMarks(nTag, eMergeType); } -FastAttributeList * FastSerializerHelper::createAttrList() +rtl::Reference<FastAttributeList> FastSerializerHelper::createAttrList() { return new FastAttributeList( nullptr ); } diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index c31c81dba4db..4457aee5bea4 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -848,7 +848,7 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) } else { - sax_fastparser::FastAttributeList* pAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> pAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); sal_Int32 aDateGroup[3] = { XML_year, XML_month, XML_day }; sal_Int32 idx = 0; for (size_t i = 0; idx >= 0 && i < 3; i++) diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index 64d671a3acba..e2f51d706def 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -94,7 +94,7 @@ XclExpSetup::XclExpSetup( const XclPageData& rPageData ) : void XclExpSetup::SaveXml( XclExpXmlStream& rStrm ) { - sax_fastparser::FastAttributeList* pAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); + rtl::Reference<sax_fastparser::FastAttributeList> pAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); if( rStrm.getVersion() != oox::core::ISOIEC_29500_2008 || mrData.mnStrictPaperSize != EXC_PAPERSIZE_USER ) { @@ -130,8 +130,7 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm ) pAttrList->add( XML_copies, OString::number( mrData.mnCopies ).getStr() ); // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ), - css::uno::Reference< css::xml::sax::XFastAttributeList > aAttrs(pAttrList); - rStrm.GetCurrentStream()->singleElement( XML_pageSetup, aAttrs ); + rStrm.GetCurrentStream()->singleElement( XML_pageSetup, pAttrList ); } void XclExpSetup::WriteBody( XclExpStream& rStrm ) diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 98e983459144..c4cdce34ad45 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -458,9 +458,7 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr pAttList->add(XML_longText, ToPsz10(true)); } - sax_fastparser::XFastAttributeListRef xAttributeList(pAttList); - - pDefStrm->startElement(XML_sharedItems, xAttributeList); + pDefStrm->startElement(XML_sharedItems, pAttList); //if (bListItems) // see TODO above { @@ -1028,8 +1026,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP if(bDimInTabularMode) pAttList->add( XML_outline, ToPsz10(false)); - sax_fastparser::XFastAttributeListRef xAttributeList(pAttList); - pPivotStrm->startElement(XML_pivotField, xAttributeList); + pPivotStrm->startElement(XML_pivotField, pAttList); pPivotStrm->startElement(XML_items, XML_count, OString::number(static_cast<tools::Long>(aMemberSequence.size() + aSubtotalSequence.size()))); @@ -1040,8 +1037,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP if (nMember.second) pItemAttList->add(XML_h, ToPsz10(true)); pItemAttList->add(XML_x, OString::number(static_cast<tools::Long>(nMember.first))); - sax_fastparser::XFastAttributeListRef xItemAttributeList(pItemAttList); - pPivotStrm->singleElement(XML_item, xItemAttributeList); + pPivotStrm->singleElement(XML_item, pItemAttList); } for (const OString& sSubtotal : aSubtotalSequence) @@ -1154,8 +1150,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP // Just skip exporting number format } } - sax_fastparser::XFastAttributeListRef xItemAttributeList(pItemAttList); - pPivotStrm->singleElement(XML_dataField, xItemAttributeList); + pPivotStrm->singleElement(XML_dataField, pItemAttList); } pPivotStrm->endElement(XML_dataFields); 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()) |