diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-14 10:41:49 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-14 11:45:55 +0100 |
commit | f21e8575326430d29bfe3a5c17b923f8f38cc20c (patch) | |
tree | f6dc58573ce905708fe489cb1fc561e5eedb5eb6 /sw | |
parent | 05aa02a85d3f9ab6cd9d217ad2d1bef9ca28fd71 (diff) |
DocxSdrExport::Impl::m_pFlyAttrList: use unique_ptr
Change-Id: I3424af5e3c10eef454cb6a17ec6e84113fbe10f4
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.hxx | 3 |
3 files changed, 8 insertions, 19 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 99b4fbcb0fc0..6b125c0ab0a7 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -845,8 +845,7 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties() { if ( m_rExport.SdrExporter().getFlyAttrList() ) { - XFastAttributeListRef xAttrList( m_rExport.SdrExporter().getFlyAttrList() ); - m_rExport.SdrExporter().setFlyAttrList(NULL); + XFastAttributeListRef xAttrList( m_rExport.SdrExporter().getFlyAttrList().release() ); m_pSerializer->singleElementNS( XML_w, XML_framePr, xAttrList ); } @@ -2385,9 +2384,8 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) // to the DOCX when the function 'WriteCollectedParagraphProperties' gets called. // So we need to store the current status of these lists, so that we can revert back to them when // we are done exporting the redline attributes. - ::sax_fastparser::FastAttributeList *pFlyAttrList_Original = m_rExport.SdrExporter().getFlyAttrList(); + std::unique_ptr<sax_fastparser::FastAttributeList> pFlyAttrList_Original(m_rExport.SdrExporter().getFlyAttrList().release()); std::unique_ptr<sax_fastparser::FastAttributeList> pParagraphSpacingAttrList_Original(m_pParagraphSpacingAttrList.release()); - m_rExport.SdrExporter().setFlyAttrList(NULL); // Output the redline item set m_rExport.OutputItemSet( *pChangesSet, true, false, i18n::ScriptType::LATIN, m_rExport.mbExportModeRTF ); @@ -2396,7 +2394,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) WriteCollectedParagraphProperties(); // Revert back the original values that were stored in 'm_rExport.SdrExporter().getFlyAttrList()', 'm_pParagraphSpacingAttrList' - m_rExport.SdrExporter().setFlyAttrList(pFlyAttrList_Original); + m_rExport.SdrExporter().getFlyAttrList().reset(pFlyAttrList_Original.release()); m_pParagraphSpacingAttrList.reset(pParagraphSpacingAttrList_Original.release()); m_pSerializer->endElementNS( XML_w, XML_pPr ); diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 142e79c40e3e..a642b172e1c7 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -132,7 +132,7 @@ struct DocxSdrExport::Impl const Size* m_pFlyFrameSize; bool m_bTextFrameSyntax; bool m_bDMLTextFrameSyntax; - sax_fastparser::FastAttributeList* m_pFlyAttrList; + std::unique_ptr<sax_fastparser::FastAttributeList> m_pFlyAttrList; sax_fastparser::FastAttributeList* m_pTextboxAttrList; OStringBuffer m_aTextFrameStyle; bool m_bFrameBtLr; @@ -160,7 +160,6 @@ struct DocxSdrExport::Impl m_pFlyFrameSize(0), m_bTextFrameSyntax(false), m_bDMLTextFrameSyntax(false), - m_pFlyAttrList(0), m_pTextboxAttrList(0), m_bFrameBtLr(false), m_bDrawingOpen(false), @@ -181,7 +180,6 @@ struct DocxSdrExport::Impl ~Impl() { - delete m_pFlyAttrList, m_pFlyAttrList = NULL; delete m_pTextboxAttrList, m_pTextboxAttrList = NULL; } @@ -220,16 +218,11 @@ bool DocxSdrExport::getDMLTextFrameSyntax() return m_pImpl->m_bDMLTextFrameSyntax; } -sax_fastparser::FastAttributeList*& DocxSdrExport::getFlyAttrList() +std::unique_ptr<sax_fastparser::FastAttributeList>& DocxSdrExport::getFlyAttrList() { return m_pImpl->m_pFlyAttrList; } -void DocxSdrExport::setFlyAttrList(sax_fastparser::FastAttributeList* pAttrList) -{ - m_pImpl->m_pFlyAttrList = pAttrList; -} - sax_fastparser::FastAttributeList* DocxSdrExport::getTextboxAttrList() { return m_pImpl->m_pTextboxAttrList; @@ -1592,7 +1585,7 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly m_pImpl->m_pFlyFrameSize = &aSize; m_pImpl->m_bTextFrameSyntax = true; - m_pImpl->m_pFlyAttrList = pFS->createAttrList(); + m_pImpl->m_pFlyAttrList.reset(pFS->createAttrList()); m_pImpl->m_pTextboxAttrList = pFS->createAttrList(); m_pImpl->m_aTextFrameStyle = "position:absolute"; if (!bTextBoxOnly) @@ -1610,8 +1603,7 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly if (!sAnchorId.isEmpty()) m_pImpl->m_pFlyAttrList->addNS(XML_w14, XML_anchorId, OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8)); } - sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->m_pFlyAttrList); - m_pImpl->m_pFlyAttrList = NULL; + sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->m_pFlyAttrList.release()); m_pImpl->m_bFrameBtLr = checkFrameBtlr(m_pImpl->m_rExport.pDoc->GetNodes()[nStt], m_pImpl->m_pTextboxAttrList); sax_fastparser::XFastAttributeListRef xTextboxAttrList(m_pImpl->m_pTextboxAttrList); m_pImpl->m_pTextboxAttrList = NULL; diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx index 09101289003e..da2d97516a13 100644 --- a/sw/source/filter/ww8/docxsdrexport.hxx +++ b/sw/source/filter/ww8/docxsdrexport.hxx @@ -62,8 +62,7 @@ public: const Size* getFlyFrameSize(); bool getTextFrameSyntax(); bool getDMLTextFrameSyntax(); - sax_fastparser::FastAttributeList*& getFlyAttrList(); - void setFlyAttrList(sax_fastparser::FastAttributeList* pAttrList); + std::unique_ptr<sax_fastparser::FastAttributeList>& getFlyAttrList(); /// Attributes of the next v:textbox element. sax_fastparser::FastAttributeList* getTextboxAttrList(); OStringBuffer& getTextFrameStyle(); |