[Libreoffice-commits] core.git: sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Mar 24 01:03:41 PDT 2015
sw/source/filter/ww8/docxattributeoutput.cxx | 24 ++++++------------------
sw/source/filter/ww8/docxattributeoutput.hxx | 6 +++---
2 files changed, 9 insertions(+), 21 deletions(-)
New commits:
commit 2754e16702b45362c3291b65af028f9c648894dc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 24 09:02:50 2015 +0100
DocxAttributeOutput::m_pSdtPrDataBindingAttrs: use std::unique_ptr
Change-Id: I13a9a2130b3d5cc4c1e6e2d299e0c7227cf80544
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 15c4c62..737a80c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -326,17 +326,12 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
m_bIsFirstParagraph = false;
}
-static void lcl_deleteAndResetTheLists( std::unique_ptr<sax_fastparser::FastAttributeList> &pSdtPrTokenChildren, ::sax_fastparser::FastAttributeList* &pSdtPrDataBindingAttrs, OUString& rSdtPrAlias)
+static void lcl_deleteAndResetTheLists( std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren, std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias)
{
if( pSdtPrTokenChildren )
- {
pSdtPrTokenChildren.reset(0);
- }
if( pSdtPrDataBindingAttrs )
- {
- delete pSdtPrDataBindingAttrs;
- pSdtPrDataBindingAttrs = NULL;
- }
+ pSdtPrDataBindingAttrs.reset(0);
if (!rSdtPrAlias.isEmpty())
rSdtPrAlias.clear();
}
@@ -603,7 +598,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
::sax_fastparser::FastAttributeList*& pSdtPrTokenAttributes,
- ::sax_fastparser::FastAttributeList*& pSdtPrDataBindingAttrs,
+ std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
OUString& rSdtPrAlias,
bool bPara )
{
@@ -659,7 +654,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
if(( pSdtPrDataBindingAttrs ) && !m_rExport.SdrExporter().IsParagraphHasDrawing())
{
- XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs );
+ XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs.release() );
m_pSerializer->singleElementNS( XML_w, XML_dataBinding, xAttrList );
}
@@ -693,10 +688,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
nSdtPrToken = 0;
pSdtPrTokenChildren.reset(0);
if( pSdtPrDataBindingAttrs )
- {
- // do not delete yet; it's in xAttrList inside the parser
- pSdtPrDataBindingAttrs = NULL;
- }
+ pSdtPrDataBindingAttrs.reset(0);
rSdtPrAlias.clear();
}
}
@@ -8226,7 +8218,7 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ).getStr() );
}
}
- else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && m_pRunSdtPrDataBindingAttrs == NULL)
+ else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && !m_pRunSdtPrDataBindingAttrs)
{
uno::Sequence<beans::PropertyValue> aGrabBag;
aPropertyValue.Value >>= aGrabBag;
@@ -8326,10 +8318,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_setFootnote(false)
, m_nParagraphSdtPrToken(0)
, m_pParagraphSdtPrTokenAttributes(NULL)
- , m_pParagraphSdtPrDataBindingAttrs(NULL)
, m_nRunSdtPrToken(0)
, m_nStateOfFlyFrame( FLY_NOT_PROCESSED )
- , m_pRunSdtPrDataBindingAttrs(NULL)
, m_bParagraphSdtHasId(false)
{
}
@@ -8338,8 +8328,6 @@ DocxAttributeOutput::~DocxAttributeOutput()
{
delete m_pTableWrt, m_pTableWrt = NULL;
delete m_pParagraphSdtPrTokenAttributes; m_pParagraphSdtPrTokenAttributes = NULL;
- delete m_pParagraphSdtPrDataBindingAttrs; m_pParagraphSdtPrDataBindingAttrs = NULL;
- delete m_pRunSdtPrDataBindingAttrs; m_pRunSdtPrDataBindingAttrs = NULL;
}
DocxExport& DocxAttributeOutput::GetExport()
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index c2cf6c7..a96bb22 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -706,7 +706,7 @@ private:
void WriteSdtBlock(sal_Int32& nSdtPrToken,
std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
::sax_fastparser::FastAttributeList*& pSdtPrTokenAttributes,
- ::sax_fastparser::FastAttributeList*& pSdtPrDataBindingAttrs,
+ std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
OUString& rSdtPrAlias,
bool bPara);
/// Closes a currently open SDT block.
@@ -911,13 +911,13 @@ private:
sal_Int32 m_nParagraphSdtPrToken;
std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSdtPrTokenChildren;
::sax_fastparser::FastAttributeList *m_pParagraphSdtPrTokenAttributes;
- ::sax_fastparser::FastAttributeList *m_pParagraphSdtPrDataBindingAttrs;
+ std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSdtPrDataBindingAttrs;
/// members to control the existence of grabbagged SDT properties in the text run
sal_Int32 m_nRunSdtPrToken;
/// State of the Fly at current position
FlyProcessingState m_nStateOfFlyFrame;
std::unique_ptr<sax_fastparser::FastAttributeList> m_pRunSdtPrTokenChildren;
- ::sax_fastparser::FastAttributeList *m_pRunSdtPrDataBindingAttrs;
+ std::unique_ptr<sax_fastparser::FastAttributeList> m_pRunSdtPrDataBindingAttrs;
/// Value of the <w:alias> paragraph SDT element.
OUString m_aParagraphSdtPrAlias;
/// Same as m_aParagraphSdtPrAlias, but its content is aviailable till the SDT is closed.
More information about the Libreoffice-commits
mailing list