summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-13 16:17:00 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-08-03 06:37:16 +0000
commit2660d24a07866e083c5135ea263030f3e3a2e729 (patch)
tree0089d6018d4fc33a7fde955e585e77191cdd258b /sw
parentbaba1d14766282bd2c592bffd79ed69f9078cfe1 (diff)
new loplugin: refcounting
This was a feature requested by mmeeks, as a result of tdf#92611. It validates that things that extend XInterface are not directly heap/stack-allocated, but have their lifecycle managed via css::uno::Reference or rtl::Reference. Change-Id: I28e3b8b236f6a4a56d0a6d6f26ad54e44b36e692 Reviewed-on: https://gerrit.libreoffice.org/16924 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks1.cxx8
-rw-r--r--sw/source/core/unocore/unorefmk.cxx38
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx188
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx36
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx38
-rw-r--r--sw/source/filter/ww8/docxsdrexport.hxx8
-rw-r--r--sw/source/ui/vba/vbawindow.cxx12
-rw-r--r--sw/source/uibase/config/StoredChapterNumbering.cxx4
-rw-r--r--sw/source/uibase/dbui/dbtree.cxx6
9 files changed, 192 insertions, 146 deletions
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index cd52f44b1707..f6fc59973d26 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -376,9 +376,9 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, const OUString&
uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter,
uno::UNO_QUERY);
- SwXMLTextBlockExport aExp( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler);
+ uno::Reference<SwXMLTextBlockExport> xExp( new SwXMLTextBlockExport( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler) );
- aExp.exportDoc( rText );
+ xExp->exportDoc( rText );
uno::Reference < embed::XTransactedObject > xTrans( xRoot, uno::UNO_QUERY );
if ( xTrans.is() )
@@ -497,9 +497,9 @@ void SwXMLTextBlocks::WriteInfo()
uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY);
- SwXMLBlockListExport aExp( xContext, *this, OUString(XMLN_BLOCKLIST), xHandler);
+ uno::Reference<SwXMLBlockListExport> xExp(new SwXMLBlockListExport( xContext, *this, OUString(XMLN_BLOCKLIST), xHandler) );
- aExp.exportDoc( XML_BLOCK_LIST );
+ xExp->exportDoc( XML_BLOCK_LIST );
uno::Reference < embed::XTransactedObject > xTrans( xBlkRoot, uno::UNO_QUERY );
if ( xTrans.is() )
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 4b8ba9656142..62f83e5a8caa 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -516,9 +516,9 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
#include <txtatr.hxx>
#include <fmtmeta.hxx>
#include <docsh.hxx>
+#include <cppuhelper/weak.hxx>
-class SwXMetaText
- : public SwXText
+class SwXMetaText : public cppu::OWeakObject, public SwXText
{
private:
SwXMeta & m_rMeta;
@@ -541,10 +541,8 @@ public:
void Invalidate() { SwXText::Invalidate(); };
// XInterface
- virtual void SAL_CALL acquire() throw() SAL_OVERRIDE
- { assert(false); }
- virtual void SAL_CALL release() throw() SAL_OVERRIDE
- { assert(false); }
+ virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { cppu::OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw() SAL_OVERRIDE { cppu::OWeakObject::release(); }
// XTypeProvider
virtual uno::Sequence< sal_Int8 > SAL_CALL
@@ -649,7 +647,7 @@ public:
bool m_bIsDisposed;
bool m_bIsDescriptor;
uno::Reference<text::XText> m_xParentText;
- SwXMetaText m_Text;
+ uno::Reference<SwXMetaText> m_xText;
Impl( SwXMeta & rThis, SwDoc & rDoc,
::sw::Meta * const pMeta,
@@ -661,7 +659,7 @@ public:
, m_bIsDisposed( false )
, m_bIsDescriptor(0 == pMeta)
, m_xParentText(xParentText)
- , m_Text(rDoc, rThis)
+ , m_xText(new SwXMetaText(rDoc, rThis))
{
}
@@ -692,7 +690,7 @@ void SwXMeta::Impl::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
}
m_bIsDisposed = true;
- m_Text.Invalidate();
+ m_xText->Invalidate();
uno::Reference<uno::XInterface> const xThis(m_wThis);
if (!xThis.is())
{ // fdo#72695: if UNO object is already dead, don't revive it with event
@@ -954,7 +952,7 @@ SwXMeta::dispose() throw (uno::RuntimeException, std::exception)
lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
m_pImpl->m_EventListeners.disposeAndClear(ev);
m_pImpl->m_bIsDisposed = true;
- m_pImpl->m_Text.Invalidate();
+ m_pImpl->m_xText->Invalidate();
}
else if (!m_pImpl->m_bIsDisposed)
{
@@ -1116,28 +1114,28 @@ uno::Reference< text::XTextRange > SAL_CALL
SwXMeta::getStart() throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.getStart();
+ return m_pImpl->m_xText->getStart();
}
uno::Reference< text::XTextRange > SAL_CALL
SwXMeta::getEnd() throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.getEnd();
+ return m_pImpl->m_xText->getEnd();
}
OUString SAL_CALL
SwXMeta::getString() throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.getString();
+ return m_pImpl->m_xText->getString();
}
void SAL_CALL
SwXMeta::setString(const OUString& rString) throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.setString(rString);
+ return m_pImpl->m_xText->setString(rString);
}
// XSimpleText
@@ -1145,7 +1143,7 @@ uno::Reference< text::XTextCursor > SAL_CALL
SwXMeta::createTextCursor() throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.createTextCursor();
+ return m_pImpl->m_xText->createTextCursor();
}
uno::Reference< text::XTextCursor > SAL_CALL
@@ -1154,7 +1152,7 @@ SwXMeta::createTextCursorByRange(
throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.createTextCursorByRange(xTextPosition);
+ return m_pImpl->m_xText->createTextCursorByRange(xTextPosition);
}
void SAL_CALL
@@ -1163,7 +1161,7 @@ SwXMeta::insertString(const uno::Reference<text::XTextRange> & xRange,
throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.insertString(xRange, rString, bAbsorb);
+ return m_pImpl->m_xText->insertString(xRange, rString, bAbsorb);
}
void SAL_CALL
@@ -1172,7 +1170,7 @@ SwXMeta::insertControlCharacter(const uno::Reference<text::XTextRange> & xRange,
throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.insertControlCharacter(xRange, nControlCharacter,
+ return m_pImpl->m_xText->insertControlCharacter(xRange, nControlCharacter,
bAbsorb);
}
@@ -1183,7 +1181,7 @@ SwXMeta::insertTextContent( const uno::Reference<text::XTextRange> & xRange,
throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.insertTextContent(xRange, xContent, bAbsorb);
+ return m_pImpl->m_xText->insertTextContent(xRange, xContent, bAbsorb);
}
void SAL_CALL
@@ -1192,7 +1190,7 @@ SwXMeta::removeTextContent(
throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
{
SolarMutexGuard g;
- return m_pImpl->m_Text.removeTextContent(xContent);
+ return m_pImpl->m_xText->removeTextContent(xContent);
}
// XChild
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e838e44e58df..e480f481af1f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -336,12 +336,12 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
m_bIsFirstParagraph = false;
}
-static void lcl_deleteAndResetTheLists( std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren, std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias)
+static void lcl_deleteAndResetTheLists( uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren, uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias)
{
- if( pSdtPrTokenChildren )
- pSdtPrTokenChildren.reset(0);
- if( pSdtPrDataBindingAttrs )
- pSdtPrDataBindingAttrs.reset(0);
+ if( pSdtPrTokenChildren.is() )
+ pSdtPrTokenChildren.clear();
+ if( pSdtPrDataBindingAttrs.is() )
+ pSdtPrDataBindingAttrs.clear();
if (!rSdtPrAlias.isEmpty())
rSdtPrAlias.clear();
}
@@ -605,13 +605,13 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
}
void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
- std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
- std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
- std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
+ uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
+ uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
+ uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
OUString& rSdtPrAlias,
bool bPara )
{
- if( nSdtPrToken > 0 || pSdtPrDataBindingAttrs )
+ if( nSdtPrToken > 0 || pSdtPrDataBindingAttrs.is() )
{
// sdt start mark
m_pSerializer->mark(Tag_WriteSdtBlock);
@@ -621,13 +621,14 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
// output sdt properties
m_pSerializer->startElementNS( XML_w, XML_sdtPr, FSEND );
- if( nSdtPrToken > 0 && pSdtPrTokenChildren )
+ if( nSdtPrToken > 0 && pSdtPrTokenChildren.is() )
{
- if (!pSdtPrTokenAttributes)
+ if (!pSdtPrTokenAttributes.is())
m_pSerializer->startElement( nSdtPrToken, FSEND );
else
{
- XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.release());
+ XFastAttributeListRef xAttrList(pSdtPrTokenAttributes);
+ pSdtPrTokenAttributes.clear();
m_pSerializer->startElement(nSdtPrToken, xAttrList);
}
@@ -644,11 +645,12 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
}
else if( (nSdtPrToken > 0) && nSdtPrToken != FSNS( XML_w, XML_id ) && !(m_bRunTextIsOn && m_rExport.SdrExporter().IsParagraphHasDrawing()))
{
- if (!pSdtPrTokenAttributes)
+ if (!pSdtPrTokenAttributes.is())
m_pSerializer->singleElement( nSdtPrToken, FSEND );
else
{
- XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.release());
+ XFastAttributeListRef xAttrList(pSdtPrTokenAttributes);
+ pSdtPrTokenAttributes.clear();
m_pSerializer->singleElement(nSdtPrToken, xAttrList);
}
}
@@ -659,9 +661,10 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
OString::number(comphelper::rng::uniform_int_distribution(0, std::numeric_limits<int>::max())),
FSEND);
- if(( pSdtPrDataBindingAttrs ) && !m_rExport.SdrExporter().IsParagraphHasDrawing())
+ if( pSdtPrDataBindingAttrs.is() && !m_rExport.SdrExporter().IsParagraphHasDrawing())
{
- XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs.release() );
+ XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs );
+ pSdtPrDataBindingAttrs.clear();
m_pSerializer->singleElementNS( XML_w, XML_dataBinding, xAttrList );
}
@@ -693,9 +696,8 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
// clear sdt status
nSdtPrToken = 0;
- pSdtPrTokenChildren.reset(0);
- if( pSdtPrDataBindingAttrs )
- pSdtPrDataBindingAttrs.reset(0);
+ pSdtPrTokenChildren.clear();
+ pSdtPrDataBindingAttrs.clear();
rSdtPrAlias.clear();
}
}
@@ -831,7 +833,7 @@ void DocxAttributeOutput::StartParagraphProperties()
void DocxAttributeOutput::InitCollectedParagraphProperties()
{
- m_pParagraphSpacingAttrList.reset(0);
+ m_pParagraphSpacingAttrList.clear();
// Write the elements in the spec order
static const sal_Int32 aOrder[] =
@@ -886,23 +888,26 @@ void DocxAttributeOutput::InitCollectedParagraphProperties()
void DocxAttributeOutput::WriteCollectedParagraphProperties()
{
- if ( m_rExport.SdrExporter().getFlyAttrList() )
+ if ( m_rExport.SdrExporter().getFlyAttrList().is() )
{
- XFastAttributeListRef xAttrList( m_rExport.SdrExporter().getFlyAttrList().release() );
+ XFastAttributeListRef xAttrList( m_rExport.SdrExporter().getFlyAttrList() );
+ m_rExport.SdrExporter().getFlyAttrList().clear();
m_pSerializer->singleElementNS( XML_w, XML_framePr, xAttrList );
}
- if ( m_pParagraphSpacingAttrList )
+ if ( m_pParagraphSpacingAttrList.is() )
{
- XFastAttributeListRef xAttrList( m_pParagraphSpacingAttrList.release() );
+ XFastAttributeListRef xAttrList( m_pParagraphSpacingAttrList );
+ m_pParagraphSpacingAttrList.clear();
m_pSerializer->singleElementNS( XML_w, XML_spacing, xAttrList );
}
- if ( m_pBackgroundAttrList )
+ if ( m_pBackgroundAttrList.is() )
{
- XFastAttributeListRef xAttrList( m_pBackgroundAttrList.release() );
+ XFastAttributeListRef xAttrList( m_pBackgroundAttrList );
+ m_pBackgroundAttrList.clear();
m_pSerializer->singleElementNS( XML_w, XML_shd, xAttrList );
}
@@ -970,9 +975,12 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
// to the DOCX when the function 'WriteCollectedRunProperties' 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.
- std::unique_ptr<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList.release());
- std::unique_ptr<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList.release());
- std::unique_ptr<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList.release());
+ uno::Reference<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList);
+ m_pFontsAttrList.clear();
+ uno::Reference<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList);
+ m_pEastAsianLayoutAttrList.clear();
+ uno::Reference<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList);
+ m_pCharLangAttrList.clear();
lcl_writeParagraphMarkerProperties(*this, rParagraphMarkerProperties);
@@ -980,9 +988,9 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
WriteCollectedRunProperties();
// Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList'
- m_pFontsAttrList.reset(pFontsAttrList_Original.release());
- m_pEastAsianLayoutAttrList.reset(pEastAsianLayoutAttrList_Original.release());
- m_pCharLangAttrList.reset(pCharLangAttrList_Original.release());
+ m_pFontsAttrList = pFontsAttrList_Original;
+ m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original;
+ m_pCharLangAttrList = pCharLangAttrList_Original;
if ( pRedlineParagraphMarkerDeleted )
{
@@ -1069,7 +1077,7 @@ void DocxAttributeOutput::EndRun()
{
int nFieldsInPrevHyperlink = m_nFieldsInHyperlink;
// Reset m_nFieldsInHyperlink if a new hyperlink is about to start
- if ( m_pHyperlinkAttrList )
+ if ( m_pHyperlinkAttrList.is() )
{
m_nFieldsInHyperlink = 0;
}
@@ -1093,7 +1101,7 @@ void DocxAttributeOutput::EndRun()
if (m_startedHyperlink)
++m_nFieldsInHyperlink;
- if ( m_pHyperlinkAttrList )
+ if ( m_pHyperlinkAttrList.is() )
{
m_nFieldsInHyperlink++;
}
@@ -1163,9 +1171,10 @@ void DocxAttributeOutput::EndRun()
}
// Start the hyperlink after the fields separators or we would generate invalid file
- if ( m_pHyperlinkAttrList )
+ if ( m_pHyperlinkAttrList.is() )
{
- XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList.release() );
+ XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList );
+ m_pHyperlinkAttrList.clear();
m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList );
m_startedHyperlink = true;
@@ -1214,7 +1223,7 @@ void DocxAttributeOutput::EndRun()
}
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
- if(GetExport().m_bTabInTOC && m_pHyperlinkAttrList)
+ if(GetExport().m_bTabInTOC && m_pHyperlinkAttrList.is())
{
RunText(OUString("\t")) ;
}
@@ -1232,7 +1241,7 @@ void DocxAttributeOutput::EndRun()
// (so on export sdt blocks are never nested ATM)
if ( !m_bAnchorLinkedToNode && !m_bStartedCharSdt )
{
- std::unique_ptr<sax_fastparser::FastAttributeList> pRunSdtPrTokenAttributes;
+ uno::Reference<sax_fastparser::FastAttributeList> pRunSdtPrTokenAttributes;
WriteSdtBlock( m_nRunSdtPrToken, m_pRunSdtPrTokenChildren, pRunSdtPrTokenAttributes, m_pRunSdtPrDataBindingAttrs, m_aRunSdtPrAlias, /*bPara=*/false );
}
else
@@ -1661,7 +1670,7 @@ void DocxAttributeOutput::StartRunProperties()
m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
- if(GetExport().m_bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList )
+ if(GetExport().m_bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList.is() )
{
m_pSerializer->singleElementNS( XML_w, XML_webHidden, FSEND );
}
@@ -1922,28 +1931,32 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence<c
void DocxAttributeOutput::WriteCollectedRunProperties()
{
// Write all differed properties
- if ( m_pFontsAttrList )
+ if ( m_pFontsAttrList.is() )
{
- XFastAttributeListRef xAttrList( m_pFontsAttrList.release() );
+ XFastAttributeListRef xAttrList( m_pFontsAttrList );
+ m_pFontsAttrList.clear();
m_pSerializer->singleElementNS( XML_w, XML_rFonts, xAttrList );
}
- if ( m_pColorAttrList )
+ if ( m_pColorAttrList.is() )
{
- XFastAttributeListRef xAttrList( m_pColorAttrList.release() );
+ XFastAttributeListRef xAttrList( m_pColorAttrList );
+ m_pColorAttrList.clear();
m_pSerializer->singleElementNS( XML_w, XML_color, xAttrList );
}
- if ( m_pEastAsianLayoutAttrList )
+ if ( m_pEastAsianLayoutAttrList.is() )
{
- XFastAttributeListRef xAttrList( m_pEastAsianLayoutAttrList.release() );
+ XFastAttributeListRef xAttrList( m_pEastAsianLayoutAttrList );
+ m_pEastAsianLayoutAttrList.clear();
m_pSerializer->singleElementNS( XML_w, XML_eastAsianLayout, xAttrList );
}
- if ( m_pCharLangAttrList )
+ if ( m_pCharLangAttrList.is() )
{
- XFastAttributeListRef xAttrList( m_pCharLangAttrList.release() );
+ XFastAttributeListRef xAttrList( m_pCharLangAttrList );
+ m_pCharLangAttrList.clear();
m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList );
}
@@ -2268,7 +2281,7 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarge
else
{
// Output a hyperlink XML element
- m_pHyperlinkAttrList.reset(FastSerializerHelper::createAttrList());
+ m_pHyperlinkAttrList = FastSerializerHelper::createAttrList();
if ( !bBookmarkOnly )
{
@@ -2382,9 +2395,12 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
// to the DOCX when the function 'WriteCollectedRunProperties' 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.
- std::unique_ptr<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList.release());
- std::unique_ptr<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList.release());
- std::unique_ptr<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList.release());
+ uno::Reference<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList);
+ m_pFontsAttrList.clear();
+ uno::Reference<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList);
+ m_pEastAsianLayoutAttrList.clear();
+ uno::Reference<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList);
+ m_pCharLangAttrList.clear();
// Output the redline item set
m_rExport.OutputItemSet( *pChangesSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF );
@@ -2393,9 +2409,9 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
WriteCollectedRunProperties();
// Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList'
- m_pFontsAttrList.reset(pFontsAttrList_Original.release());
- m_pEastAsianLayoutAttrList.reset(pEastAsianLayoutAttrList_Original.release());
- m_pCharLangAttrList.reset(pCharLangAttrList_Original.release());
+ m_pFontsAttrList = pFontsAttrList_Original;
+ m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original;
+ m_pCharLangAttrList = pCharLangAttrList_Original;
m_pSerializer->endElementNS( XML_w, XML_rPr );
@@ -2435,8 +2451,10 @@ 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.
- std::unique_ptr<sax_fastparser::FastAttributeList> pFlyAttrList_Original(m_rExport.SdrExporter().getFlyAttrList().release());
- std::unique_ptr<sax_fastparser::FastAttributeList> pParagraphSpacingAttrList_Original(m_pParagraphSpacingAttrList.release());
+ uno::Reference<sax_fastparser::FastAttributeList> pFlyAttrList_Original(m_rExport.SdrExporter().getFlyAttrList());
+ m_rExport.SdrExporter().getFlyAttrList().clear();
+ uno::Reference<sax_fastparser::FastAttributeList> pParagraphSpacingAttrList_Original(m_pParagraphSpacingAttrList);
+ m_pParagraphSpacingAttrList.clear();
// Output the redline item set
m_rExport.OutputItemSet( *pChangesSet, true, false, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF );
@@ -2445,8 +2463,8 @@ 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().getFlyAttrList().reset(pFlyAttrList_Original.release());
- m_pParagraphSpacingAttrList.reset(pParagraphSpacingAttrList_Original.release());
+ m_rExport.SdrExporter().getFlyAttrList() = pFlyAttrList_Original;
+ m_pParagraphSpacingAttrList = pParagraphSpacingAttrList_Original;
m_pSerializer->endElementNS( XML_w, XML_pPr );
@@ -3452,7 +3470,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
}
else
{
- std::unique_ptr<sax_fastparser::FastAttributeList> pAttrList;
+ css::uno::Reference<sax_fastparser::FastAttributeList> pAttrList;
for( aGrabBagElement = aGrabBag.begin(); aGrabBagElement != aGrabBag.end(); ++aGrabBagElement )
{
@@ -3479,7 +3497,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
else if( aGrabBagElement->first == "val")
AddToAttrList( pAttrList, FSNS( XML_w, XML_val ), sValue.getStr() );
}
- m_pSerializer->singleElementNS( XML_w, XML_shd, XFastAttributeListRef( pAttrList.release() ) );
+ m_pSerializer->singleElementNS( XML_w, XML_shd, pAttrList );
}
}
@@ -5487,9 +5505,10 @@ void DocxAttributeOutput::StartSection()
void DocxAttributeOutput::EndSection()
{
// Write the section properties
- if ( m_pSectionSpacingAttrList )
+ if ( m_pSectionSpacingAttrList.is() )
{
- XFastAttributeListRef xAttrList( m_pSectionSpacingAttrList.release() );
+ XFastAttributeListRef xAttrList( m_pSectionSpacingAttrList );
+ m_pSectionSpacingAttrList.clear();
m_pSerializer->singleElementNS( XML_w, XML_pgMar, xAttrList );
}
@@ -6126,7 +6145,7 @@ void DocxAttributeOutput::CharColor( const SvxColorItem& rColor )
aColorString = msfilter::util::ConvertColor( aColor );
const char* pExistingValue(NULL);
- if (m_pColorAttrList && m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pExistingValue))
+ if (m_pColorAttrList.is() && m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pExistingValue))
{
assert(aColorString.equalsL(pExistingValue, rtl_str_getLength(pExistingValue)));
return;
@@ -7630,16 +7649,16 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
OString sOriginalFill = OUStringToOString(
m_sOriginalBackgroundColor, RTL_TEXTENCODING_UTF8 );
- if( !m_pBackgroundAttrList )
+ if( !m_pBackgroundAttrList.is() )
{
- m_pBackgroundAttrList.reset(FastSerializerHelper::createAttrList());
+ m_pBackgroundAttrList = FastSerializerHelper::createAttrList();
m_pBackgroundAttrList->add( FSNS( XML_w, XML_fill ), sColor.getStr() );
m_pBackgroundAttrList->add( FSNS( XML_w, XML_val ), "clear" );
}
else if ( sOriginalFill != sColor )
{
// fill was modified during edition, theme fill attribute must be dropped
- m_pBackgroundAttrList.reset(FastSerializerHelper::createAttrList());
+ m_pBackgroundAttrList = FastSerializerHelper::createAttrList();
m_pBackgroundAttrList->add( FSNS( XML_w, XML_fill ), sColor.getStr() );
m_pBackgroundAttrList->add( FSNS( XML_w, XML_val ), "clear" );
}
@@ -8100,7 +8119,7 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem)
m_nParagraphSdtPrToken = FSNS( XML_w, XML_group );
else if (aPropertyValue.Name == "ooxml:CT_SdtPr_text")
m_nParagraphSdtPrToken = FSNS(XML_w, XML_text);
- else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && !m_pParagraphSdtPrDataBindingAttrs)
+ else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && !m_pParagraphSdtPrDataBindingAttrs.is())
{
uno::Sequence<beans::PropertyValue> aGrabBag;
aPropertyValue.Value >>= aGrabBag;
@@ -8203,25 +8222,25 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
OUString sOriginalValue;
for ( std::map< OUString, com::sun::star::uno::Any >::const_iterator i = rMap.begin(); i != rMap.end(); ++i )
{
- if ( m_pFontsAttrList && i->first == "CharThemeFontNameCs" )
+ if ( m_pFontsAttrList.is() && i->first == "CharThemeFontNameCs" )
{
if ( i->second >>= sOriginalValue )
bWriteCSTheme =
( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_cs ) ) == sOriginalValue );
}
- else if ( m_pFontsAttrList && i->first == "CharThemeFontNameAscii" )
+ else if ( m_pFontsAttrList.is() && i->first == "CharThemeFontNameAscii" )
{
if ( i->second >>= sOriginalValue )
bWriteAsciiTheme =
( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_ascii ) ) == sOriginalValue );
}
- else if ( m_pFontsAttrList && i->first == "CharThemeFontNameEastAsia" )
+ else if ( m_pFontsAttrList.is() && i->first == "CharThemeFontNameEastAsia" )
{
if ( i->second >>= sOriginalValue )
bWriteEastAsiaTheme =
( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_eastAsia ) ) == sOriginalValue );
}
- else if ( m_pColorAttrList && i->first == "CharThemeOriginalColor" )
+ else if ( m_pColorAttrList.is() && i->first == "CharThemeOriginalColor" )
{
if ( i->second >>= sOriginalValue )
bWriteThemeFontColor =
@@ -8335,7 +8354,7 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ).getStr() );
}
}
- else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && !m_pRunSdtPrDataBindingAttrs)
+ else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && !m_pRunSdtPrDataBindingAttrs.is())
{
uno::Sequence<beans::PropertyValue> aGrabBag;
aPropertyValue.Value >>= aGrabBag;
@@ -8362,7 +8381,7 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
SAL_WARN("sw.ww8", "DocxAttributeOutput::CharGrabBag: unexpected sdt alias value");
}
//do not overwrite the parent node.
- else if (aPropertyValue.Name == "ooxml:CT_SdtPr_text" && !m_pRunSdtPrTokenChildren)
+ else if (aPropertyValue.Name == "ooxml:CT_SdtPr_text" && !m_pRunSdtPrTokenChildren.is())
m_nRunSdtPrToken = FSNS( XML_w, XML_text );
else if (aPropertyValue.Name == "ooxml:CT_SdtPr_id" && m_nRunSdtPrToken == 0)
// only write id token as a marker if no other exist
@@ -8512,6 +8531,29 @@ void DocxAttributeOutput::AddToAttrList( std::unique_ptr<sax_fastparser::FastAtt
}
va_end( args );
}
+
+void DocxAttributeOutput::AddToAttrList( uno::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue )
+{
+ AddToAttrList( pAttrList, 1, nAttrName, sAttrValue );
+}
+
+void DocxAttributeOutput::AddToAttrList( uno::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrs, ... )
+{
+ if( !pAttrList.is() )
+ pAttrList = FastSerializerHelper::createAttrList();
+
+ va_list args;
+ va_start( args, nAttrs );
+ for( sal_Int32 i = 0; i<nAttrs; i++)
+ {
+ sal_Int32 nName = va_arg( args, sal_Int32 );
+ const char* pValue = va_arg( args, const char* );
+ if( pValue )
+ pAttrList->add( nName, pValue );
+ }
+ va_end( args );
+}
+
void DocxAttributeOutput::SetStartedParaSdt(bool bStartedParaSdt)
{
m_bStartedParaSdt = bStartedParaSdt;
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index b730c9fe375b..da5a263cae12 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -702,9 +702,9 @@ private:
void WritePostponedCustomShape();
void WriteSdtBlock(sal_Int32& nSdtPrToken,
- std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
- std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
- std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
+ css::uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
+ css::uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
+ css::uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
OUString& rSdtPrAlias,
bool bPara);
/// Closes a currently open SDT block.
@@ -717,13 +717,15 @@ private:
static void AddToAttrList( std::unique_ptr<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue );
static void AddToAttrList( std::unique_ptr<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nArgs, ... );
-
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pFontsAttrList;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pEastAsianLayoutAttrList;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pCharLangAttrList;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pSectionSpacingAttrList;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSpacingAttrList;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pHyperlinkAttrList;
+ static void AddToAttrList( css::uno::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue );
+ static void AddToAttrList( css::uno::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nArgs, ... );
+
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pFontsAttrList;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pEastAsianLayoutAttrList;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pCharLangAttrList;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pSectionSpacingAttrList;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pParagraphSpacingAttrList;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pHyperlinkAttrList;
/// If the current SDT around runs should be ended before the current run.
bool m_bEndCharSdt;
/// If an SDT around runs is currently open.
@@ -731,9 +733,9 @@ private:
/// If an SDT around paragraphs is currently open.
bool m_bStartedParaSdt;
/// Attributes of the run color
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pColorAttrList;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pColorAttrList;
/// Attributes of the paragraph background
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pBackgroundAttrList;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pBackgroundAttrList;
OUString m_sOriginalBackgroundColor;
OUString m_hyperLinkAnchor;
bool m_endPageRef;
@@ -908,15 +910,15 @@ private:
/// members to control the existence of grabbagged SDT properties in the paragraph
sal_Int32 m_nParagraphSdtPrToken;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSdtPrTokenChildren;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSdtPrTokenAttributes;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSdtPrDataBindingAttrs;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pParagraphSdtPrTokenChildren;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pParagraphSdtPrTokenAttributes;
+ css::uno::Reference<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;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pRunSdtPrDataBindingAttrs;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pRunSdtPrTokenChildren;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pRunSdtPrDataBindingAttrs;
/// Value of the <w:alias> paragraph SDT element.
OUString m_aParagraphSdtPrAlias;
/// Same as m_aParagraphSdtPrAlias, but its content is available till the SDT is closed.
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 824417174b22..3d89f7c9bde4 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -131,18 +131,18 @@ struct DocxSdrExport::Impl
const Size* m_pFlyFrameSize;
bool m_bTextFrameSyntax;
bool m_bDMLTextFrameSyntax;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pFlyAttrList;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pTextboxAttrList;
+ uno::Reference<sax_fastparser::FastAttributeList> m_pFlyAttrList;
+ uno::Reference<sax_fastparser::FastAttributeList> m_pTextboxAttrList;
OStringBuffer m_aTextFrameStyle;
bool m_bFrameBtLr;
bool m_bDrawingOpen;
bool m_bParagraphSdtOpen;
bool m_bParagraphHasDrawing; ///Flag for checking drawing in a paragraph.
bool m_bFlyFrameGraphic;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pFlyFillAttrList;
+ css::uno::Reference<sax_fastparser::FastAttributeList> m_pFlyFillAttrList;
sax_fastparser::FastAttributeList* m_pFlyWrapAttrList;
sax_fastparser::FastAttributeList* m_pBodyPrAttrList;
- std::unique_ptr<sax_fastparser::FastAttributeList> m_pDashLineStyleAttr;
+ css::uno::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.
std::set<const SwFrameFormat*> m_aTextBoxes;
@@ -211,12 +211,12 @@ bool DocxSdrExport::getDMLTextFrameSyntax()
return m_pImpl->m_bDMLTextFrameSyntax;
}
-std::unique_ptr<sax_fastparser::FastAttributeList>& DocxSdrExport::getFlyAttrList()
+uno::Reference<sax_fastparser::FastAttributeList>& DocxSdrExport::getFlyAttrList()
{
return m_pImpl->m_pFlyAttrList;
}
-std::unique_ptr<sax_fastparser::FastAttributeList>& DocxSdrExport::getTextboxAttrList()
+uno::Reference<sax_fastparser::FastAttributeList>& DocxSdrExport::getTextboxAttrList()
{
return m_pImpl->m_pTextboxAttrList;
}
@@ -256,7 +256,7 @@ void DocxSdrExport::setParagraphHasDrawing(bool bParagraphHasDrawing)
m_pImpl->m_bParagraphHasDrawing = bParagraphHasDrawing;
}
-std::unique_ptr<sax_fastparser::FastAttributeList>& DocxSdrExport::getFlyFillAttrList()
+uno::Reference<sax_fastparser::FastAttributeList>& DocxSdrExport::getFlyFillAttrList()
{
return m_pImpl->m_pFlyFillAttrList;
}
@@ -271,7 +271,7 @@ sax_fastparser::FastAttributeList* DocxSdrExport::getBodyPrAttrList()
return m_pImpl->m_pBodyPrAttrList;
}
-std::unique_ptr<sax_fastparser::FastAttributeList>& DocxSdrExport::getDashLineStyle()
+uno::Reference<sax_fastparser::FastAttributeList>& DocxSdrExport::getDashLineStyle()
{
return m_pImpl->m_pDashLineStyleAttr;
}
@@ -1640,8 +1640,8 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly
m_pImpl->m_pFlyFrameSize = &aSize;
m_pImpl->m_bTextFrameSyntax = true;
- m_pImpl->m_pFlyAttrList.reset(sax_fastparser::FastSerializerHelper::createAttrList());
- m_pImpl->m_pTextboxAttrList.reset(sax_fastparser::FastSerializerHelper::createAttrList());
+ m_pImpl->m_pFlyAttrList = sax_fastparser::FastSerializerHelper::createAttrList();
+ m_pImpl->m_pTextboxAttrList = sax_fastparser::FastSerializerHelper::createAttrList();
m_pImpl->m_aTextFrameStyle = "position:absolute";
if (!bTextBoxOnly)
{
@@ -1658,9 +1658,11 @@ 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.release());
+ sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->m_pFlyAttrList.get());
+ m_pImpl->m_pFlyAttrList.clear();
m_pImpl->m_bFrameBtLr = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/false);
- sax_fastparser::XFastAttributeListRef xTextboxAttrList(m_pImpl->m_pTextboxAttrList.release());
+ sax_fastparser::XFastAttributeListRef xTextboxAttrList(m_pImpl->m_pTextboxAttrList.get());
+ m_pImpl->m_pTextboxAttrList.clear();
m_pImpl->m_bTextFrameSyntax = false;
m_pImpl->m_pFlyFrameSize = 0;
m_pImpl->m_rExport.m_pParentFrame = NULL;
@@ -1670,14 +1672,16 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly
pFS->startElementNS(XML_w, XML_pict, FSEND);
pFS->startElementNS(XML_v, XML_rect, xFlyAttrList);
m_pImpl->textFrameShadow(rFrameFormat);
- if (m_pImpl->m_pFlyFillAttrList)
+ if (m_pImpl->m_pFlyFillAttrList.is())
{
- sax_fastparser::XFastAttributeListRef xFlyFillAttrList(m_pImpl->m_pFlyFillAttrList.release());
+ sax_fastparser::XFastAttributeListRef xFlyFillAttrList(m_pImpl->m_pFlyFillAttrList.get());
+ m_pImpl->m_pFlyFillAttrList.clear();
pFS->singleElementNS(XML_v, XML_fill, xFlyFillAttrList);
}
- if (m_pImpl->m_pDashLineStyleAttr)
+ if (m_pImpl->m_pDashLineStyleAttr.is())
{
- sax_fastparser::XFastAttributeListRef xDashLineStyleAttr(m_pImpl->m_pDashLineStyleAttr.release());
+ sax_fastparser::XFastAttributeListRef xDashLineStyleAttr(m_pImpl->m_pDashLineStyleAttr.get());
+ m_pImpl->m_pDashLineStyleAttr.clear();
pFS->singleElementNS(XML_v, XML_stroke, xDashLineStyleAttr);
}
pFS->startElementNS(XML_v, XML_textbox, xTextboxAttrList);
@@ -1717,7 +1721,7 @@ bool DocxSdrExport::Impl::checkFrameBtlr(SwNode* pStartNode, bool bDML)
if (bDML)
assert(m_pBodyPrAttrList);
else
- assert(m_pTextboxAttrList);
+ assert(m_pTextboxAttrList.is());
if (!pStartNode->IsTextNode())
return false;
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx
index 0a32f20fb555..a16c3d3c18c2 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -63,9 +63,9 @@ public:
const Size* getFlyFrameSize();
bool getTextFrameSyntax();
bool getDMLTextFrameSyntax();
- std::unique_ptr<sax_fastparser::FastAttributeList>& getFlyAttrList();
+ css::uno::Reference<sax_fastparser::FastAttributeList>& getFlyAttrList();
/// Attributes of the next v:textbox element.
- std::unique_ptr<sax_fastparser::FastAttributeList>& getTextboxAttrList();
+ css::uno::Reference<sax_fastparser::FastAttributeList>& getTextboxAttrList();
OStringBuffer& getTextFrameStyle();
/// Same, as DocxAttributeOutput::m_bBtLr, but for textframe rotation.
bool getFrameBtLr();
@@ -77,12 +77,12 @@ public:
bool IsDMLAndVMLDrawingOpen();
bool IsParagraphHasDrawing();
void setParagraphHasDrawing(bool bParagraphHasDrawing);
- std::unique_ptr<sax_fastparser::FastAttributeList>& getFlyFillAttrList();
+ css::uno::Reference<sax_fastparser::FastAttributeList>& getFlyFillAttrList();
sax_fastparser::FastAttributeList* getFlyWrapAttrList();
void setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrList);
/// Attributes of <wps:bodyPr>, used during DML export of text frames.
sax_fastparser::FastAttributeList* getBodyPrAttrList();
- std::unique_ptr<sax_fastparser::FastAttributeList>& getDashLineStyle();
+ css::uno::Reference<sax_fastparser::FastAttributeList>& getDashLineStyle();
void startDMLAnchorInline(const SwFrameFormat* pFrameFormat, const Size& rSize);
void endDMLAnchorInline(const SwFrameFormat* pFrameFormat);
diff --git a/sw/source/ui/vba/vbawindow.cxx b/sw/source/ui/vba/vbawindow.cxx
index 54fd8f27eed7..8f2f3ab72680 100644
--- a/sw/source/ui/vba/vbawindow.cxx
+++ b/sw/source/ui/vba/vbawindow.cxx
@@ -44,18 +44,18 @@ SwVbaWindow::SwVbaWindow(
void
SwVbaWindow::Activate() throw (css::uno::RuntimeException, std::exception)
{
- SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
+ uno::Reference<SwVbaDocument> document( new SwVbaDocument(uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel) );
- document.Activate();
+ document->Activate();
}
void
SwVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& RouteDocument ) throw (uno::RuntimeException, std::exception)
{
// FIXME: it is incorrect when there are more than 1 windows
- SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
+ uno::Reference<SwVbaDocument> document( new SwVbaDocument(uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel) );
uno::Any FileName;
- document.Close(SaveChanges, FileName, RouteDocument );
+ document->Close(SaveChanges, FileName, RouteDocument );
}
uno::Any SAL_CALL
@@ -69,8 +69,8 @@ void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeE
sal_Int32 nType = 0;
if( _view >>= nType )
{
- SwVbaView view( this, mxContext, m_xModel );
- view.setType( nType );
+ uno::Reference<SwVbaView> view( new SwVbaView(this, mxContext, m_xModel) );
+ view->setType( nType );
}
}
diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx
index 4fb902dd6503..1995bf3c0d66 100644
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
@@ -426,7 +426,7 @@ void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules,
uno::Reference<xml::sax::XDocumentHandler> const xHandler(
xWriter, uno::UNO_QUERY);
- StoredChapterNumberingExport exp(xContext, rFileName, xWriter);
+ uno::Reference<StoredChapterNumberingExport> exp(new StoredChapterNumberingExport(xContext, rFileName, xWriter));
// if style name contains a space then name != display-name
// ... and the import needs to map from name to display-name then!
@@ -452,7 +452,7 @@ void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules,
try
{
- exp.ExportRules(charStyles, numRules);
+ exp->ExportRules(charStyles, numRules);
}
catch (uno::Exception const& e)
{
diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index 829a7afde7c4..9aaf094b3846 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -494,14 +494,14 @@ void SwDBTreeList::StartDrag( sal_Int8 /*nAction*/, const Point& /*rPosPixel*/ )
if( !sColumnName.isEmpty() )
{
// drag database field
- svx::OColumnTransferable aColTransfer(
+ uno::Reference< svx::OColumnTransferable > xColTransfer( new svx::OColumnTransferable(
sDBName,
OUString(),
sdb::CommandType::TABLE,
sTableName,
sColumnName,
- (ColumnTransferFormatFlags::FIELD_DESCRIPTOR|ColumnTransferFormatFlags::COLUMN_DESCRIPTOR) );
- aColTransfer.addDataToContainer( pContainer );
+ (ColumnTransferFormatFlags::FIELD_DESCRIPTOR|ColumnTransferFormatFlags::COLUMN_DESCRIPTOR) ) );
+ xColTransfer->addDataToContainer( pContainer );
}
sDBName += "." + sTableName;