[Libreoffice-commits] core.git: 4 commits - include/xmloff starmath/source xmloff/source
Stephan Bergmann
sbergman at redhat.com
Thu Dec 17 07:51:46 PST 2015
include/xmloff/xmlictxt.hxx | 6 -
starmath/source/mathmlimport.cxx | 2
xmloff/source/core/xmlictxt.cxx | 1
xmloff/source/core/xmlimp.cxx | 4 -
xmloff/source/transform/ChartPlotAreaOASISTContext.cxx | 12 +--
xmloff/source/transform/ChartPlotAreaOASISTContext.hxx | 2
xmloff/source/transform/ChartPlotAreaOOoTContext.cxx | 17 ++---
xmloff/source/transform/ChartPlotAreaOOoTContext.hxx | 9 +-
xmloff/source/transform/ControlOOoTContext.cxx | 12 +--
xmloff/source/transform/ControlOOoTContext.hxx | 2
xmloff/source/transform/CreateElemTContext.cxx | 21 ++----
xmloff/source/transform/DeepTContext.cxx | 57 +++++++----------
xmloff/source/transform/DeepTContext.hxx | 7 --
xmloff/source/transform/EventOOoTContext.cxx | 2
xmloff/source/transform/EventOOoTContext.hxx | 2
xmloff/source/transform/FormPropOOoTContext.cxx | 16 ++--
xmloff/source/transform/FormPropOOoTContext.hxx | 2
xmloff/source/transform/FrameOASISTContext.cxx | 18 ++---
xmloff/source/transform/FrameOASISTContext.hxx | 2
xmloff/source/transform/FrameOOoTContext.cxx | 6 -
xmloff/source/transform/FrameOOoTContext.hxx | 2
xmloff/source/transform/IgnoreTContext.cxx | 12 +--
xmloff/source/transform/IgnoreTContext.hxx | 2
xmloff/source/transform/MergeElemTContext.cxx | 44 +++++--------
xmloff/source/transform/MergeElemTContext.hxx | 2
xmloff/source/transform/MetaTContext.cxx | 8 +-
xmloff/source/transform/MetaTContext.hxx | 2
xmloff/source/transform/NotesTContext.cxx | 14 ++--
xmloff/source/transform/NotesTContext.hxx | 2
xmloff/source/transform/Oasis2OOo.cxx | 4 -
xmloff/source/transform/PersAttrListTContext.cxx | 2
xmloff/source/transform/PersAttrListTContext.hxx | 2
xmloff/source/transform/PersMixedContentTContext.cxx | 6 -
xmloff/source/transform/StyleOASISTContext.cxx | 8 +-
xmloff/source/transform/StyleOASISTContext.hxx | 2
xmloff/source/transform/StyleOOoTContext.cxx | 24 +++----
xmloff/source/transform/StyleOOoTContext.hxx | 2
xmloff/source/transform/TContextVector.hxx | 35 ----------
xmloff/source/transform/TransformerBase.cxx | 38 ++++-------
xmloff/source/transform/TransformerBase.hxx | 8 +-
xmloff/source/transform/TransformerContext.cxx | 3
xmloff/source/transform/TransformerContext.hxx | 8 +-
42 files changed, 192 insertions(+), 238 deletions(-)
New commits:
commit d1385731031fc30cfc2c182279ba5d4feb497328
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Dec 17 16:50:47 2015 +0100
Avoid memory leaks
...when exceptions get thrown while a context owns an rewind map
Change-Id: I90d26caa57ef2ff508e6eae05ddbc62cdb3f01ea
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx
index 325457c..16bb92f 100644
--- a/include/xmloff/xmlictxt.hxx
+++ b/include/xmloff/xmlictxt.hxx
@@ -44,9 +44,9 @@ class XMLOFF_DLLPUBLIC SvXMLImportContext : public SvRefBase,
SvXMLNamespaceMap *mpRewindMap;
- SAL_DLLPRIVATE SvXMLNamespaceMap *GetRewindMap() const
- { return mpRewindMap; }
- SAL_DLLPRIVATE void SetRewindMap( SvXMLNamespaceMap *p ) { mpRewindMap = p; }
+ SAL_DLLPRIVATE SvXMLNamespaceMap *TakeRewindMap()
+ { auto p = mpRewindMap; mpRewindMap = nullptr; return p; }
+ SAL_DLLPRIVATE void PutRewindMap( SvXMLNamespaceMap *p ) { mpRewindMap = p; }
protected:
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index aa1aa2e..ff7e439 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -47,6 +47,7 @@ SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp ) :
SvXMLImportContext::~SvXMLImportContext()
{
+ delete mpRewindMap;
}
SvXMLImportContext *SvXMLImportContext::CreateChildContext( sal_uInt16 nPrefix,
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 92fd16a..8ade9dc9 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -731,7 +731,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
// Remember old namespace map.
if( pRewindMap )
- pContext->SetRewindMap( pRewindMap );
+ pContext->PutRewindMap( pRewindMap );
// Call a startElement at the new context.
pContext->StartElement( xAttrList );
@@ -768,7 +768,7 @@ rName
pContext->EndElement();
// Get a namespace map to rewind.
- SvXMLNamespaceMap *pRewindMap = pContext->GetRewindMap();
+ SvXMLNamespaceMap *pRewindMap = pContext->TakeRewindMap();
// Delete the current context.
pContext->ReleaseRef();
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
index 71a78dd..57120b0 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -303,7 +303,7 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName,
// Remember old namespace map.
if( pRewindMap )
- xContext->SetRewindMap( pRewindMap );
+ xContext->PutRewindMap( pRewindMap );
// Push context on stack.
m_pContexts.push_back( xContext );
@@ -336,7 +336,7 @@ rName
m_pContexts.pop_back();
// Get a namespace map to rewind.
- SvXMLNamespaceMap *pRewindMap = xContext->GetRewindMap();
+ SvXMLNamespaceMap *pRewindMap = xContext->TakeRewindMap();
// Delete the current context.
xContext = nullptr;
diff --git a/xmloff/source/transform/TransformerContext.cxx b/xmloff/source/transform/TransformerContext.cxx
index d245314..72adbe6 100644
--- a/xmloff/source/transform/TransformerContext.cxx
+++ b/xmloff/source/transform/TransformerContext.cxx
@@ -56,6 +56,7 @@ XMLTransformerContext::XMLTransformerContext( XMLTransformerBase& rImp,
XMLTransformerContext::~XMLTransformerContext()
{
+ delete m_pRewindMap;
}
rtl::Reference<XMLTransformerContext> XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix,
diff --git a/xmloff/source/transform/TransformerContext.hxx b/xmloff/source/transform/TransformerContext.hxx
index a42e982..e514433 100644
--- a/xmloff/source/transform/TransformerContext.hxx
+++ b/xmloff/source/transform/TransformerContext.hxx
@@ -39,8 +39,9 @@ class XMLTransformerContext : public ::salhelper::SimpleReferenceObject
SvXMLNamespaceMap *m_pRewindMap;
- SvXMLNamespaceMap *GetRewindMap() const { return m_pRewindMap; }
- void SetRewindMap( SvXMLNamespaceMap *p ) { m_pRewindMap = p; }
+ SvXMLNamespaceMap *TakeRewindMap()
+ { auto p = m_pRewindMap; m_pRewindMap = nullptr; return p; }
+ void PutRewindMap( SvXMLNamespaceMap *p ) { m_pRewindMap = p; }
protected:
commit c535f115efddc5195d162517ad67ed013229de57
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Dec 17 16:25:47 2015 +0100
This probably should be a reference
...ever since SmXMLContext_Helper was introduced in
a0c8015b88b16a4192000bd841eeff594dae9c65 "#81141# MathML->StarMath editable text
display"
Change-Id: Ida4a4022159138a49c7c94ccb0ed90a8a149b796
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 5ba3826..a03f1f4 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -579,7 +579,7 @@ struct SmXMLContext_Helper
OUString sFontFamily;
OUString sColor;
- SmXMLImportContext rContext;
+ SmXMLImportContext & rContext;
explicit SmXMLContext_Helper(SmXMLImportContext &rImport)
: nIsBold( -1 )
commit ba3a9184045f7862ee94de8b3210dcbe9558f61a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Dec 17 14:58:31 2015 +0100
Remove trivial class XMLTransformerContextVector
Change-Id: I140614895d5727ffd97681ddd06bf7439fe7a443
diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx
index 75a14f5..b18df34 100644
--- a/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx
+++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx
@@ -19,8 +19,11 @@
#ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOOOTCONTEXT_HXX
#define INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOOOTCONTEXT_HXX
+#include <sal/config.h>
+
+#include <vector>
+
#include "ProcAttrTContext.hxx"
-#include "TContextVector.hxx"
class XMLAxisOOoContext;
diff --git a/xmloff/source/transform/CreateElemTContext.cxx b/xmloff/source/transform/CreateElemTContext.cxx
index 2a39c9a..48fad33 100644
--- a/xmloff/source/transform/CreateElemTContext.cxx
+++ b/xmloff/source/transform/CreateElemTContext.cxx
@@ -17,11 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <vector>
+
#include "CreateElemTContext.hxx"
#include "MutableAttrList.hxx"
#include "TransformerBase.hxx"
#include "TransformerActions.hxx"
-#include "TContextVector.hxx"
#include "FlatTContext.hxx"
#include "AttrTransformerAction.hxx"
#include <xmloff/nmspmap.hxx>
@@ -49,7 +52,7 @@ void XMLCreateElemTransformerContext::StartElement(
{
Reference< XAttributeList > xAttrList( rAttrList );
- XMLTransformerContextVector aChildContexts;
+ std::vector<rtl::Reference<XMLTransformerContext>> aChildContexts;
XMLMutableAttributeList *pMutableAttrList = nullptr;
XMLTransformerActions *pActions =
@@ -106,11 +109,9 @@ void XMLCreateElemTransformerContext::StartElement(
}
XMLTransformerContext::StartElement( xAttrList );
- XMLTransformerContextVector::iterator aIter = aChildContexts.begin();
-
- for( ; aIter != aChildContexts.end(); ++aIter )
+ for (auto const & i: aChildContexts)
{
- (*aIter)->Export();
+ i->Export();
}
}
diff --git a/xmloff/source/transform/DeepTContext.cxx b/xmloff/source/transform/DeepTContext.cxx
index d078cff..8668011 100644
--- a/xmloff/source/transform/DeepTContext.cxx
+++ b/xmloff/source/transform/DeepTContext.cxx
@@ -152,11 +152,9 @@ rtl::Reference<XMLTransformerContext> XMLPersElemContentTContext::CreateChildCon
void XMLPersElemContentTContext::ExportContent()
{
- XMLTransformerContextVector::iterator aIter = m_aChildContexts.begin();
-
- for( ; aIter != m_aChildContexts.end(); ++aIter )
+ for (auto const & i: m_aChildContexts)
{
- (*aIter)->Export();
+ i->Export();
}
}
diff --git a/xmloff/source/transform/DeepTContext.hxx b/xmloff/source/transform/DeepTContext.hxx
index 8031b15..d1e9c06 100644
--- a/xmloff/source/transform/DeepTContext.hxx
+++ b/xmloff/source/transform/DeepTContext.hxx
@@ -24,11 +24,10 @@
#include <vector>
#include "PersAttrListTContext.hxx"
-#include "TContextVector.hxx"
class XMLPersElemContentTContext : public XMLPersAttrListTContext
{
- XMLTransformerContextVector m_aChildContexts;
+ std::vector<rtl::Reference<XMLTransformerContext>> m_aChildContexts;
public:
// element content persistence only
diff --git a/xmloff/source/transform/TContextVector.hxx b/xmloff/source/transform/TContextVector.hxx
deleted file mode 100644
index ed4e62a..0000000
--- a/xmloff/source/transform/TContextVector.hxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_TCONTEXTVECTOR_HXX
-#define INCLUDED_XMLOFF_SOURCE_TRANSFORM_TCONTEXTVECTOR_HXX
-
-#include <rtl/ref.hxx>
-
-#include <vector>
-#include "TransformerContext.hxx"
-
-class XMLTransformerContextVector :
- public ::std::vector< ::rtl::Reference< XMLTransformerContext > >
-{
-};
-
-#endif // INCLUDED_XMLOFF_SOURCE_TRANSFORM_TCONTEXTVECTOR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
index 4b4341f..71a78dd 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -40,7 +40,6 @@
#include "TransformerTokenMap.hxx"
#include "TransformerBase.hxx"
-#include "TContextVector.hxx"
using namespace ::osl;
using namespace ::xmloff::token;
@@ -187,7 +186,6 @@ XMLTransformerBase::XMLTransformerBase( XMLTransformerActionInit *pInit,
throw () :
m_pNamespaceMap( new SvXMLNamespaceMap ),
m_pReplaceNamespaceMap( new SvXMLNamespaceMap ),
- m_pContexts( new XMLTransformerContextVector ),
m_pElemActions( new XMLTransformerActions( pInit ) ),
m_pTokenMap( new XMLTransformerTokenMap( pTKMapInit ) )
{
@@ -204,7 +202,6 @@ XMLTransformerBase::~XMLTransformerBase() throw ()
{
delete m_pNamespaceMap;
delete m_pReplaceNamespaceMap;
- delete m_pContexts;
delete m_pElemActions;
delete m_pTokenMap;
}
@@ -288,9 +285,9 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName,
// If there are contexts already, call a CreateChildContext at the topmost
// context. Otherwise, create a default context.
::rtl::Reference < XMLTransformerContext > xContext;
- if( !m_pContexts->empty() )
+ if( !m_pContexts.empty() )
{
- xContext = m_pContexts->back()->CreateChildContext( nPrefix,
+ xContext = m_pContexts.back()->CreateChildContext( nPrefix,
aLocalName,
rName,
xAttrList );
@@ -309,7 +306,7 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName,
xContext->SetRewindMap( pRewindMap );
// Push context on stack.
- m_pContexts->push_back( xContext );
+ m_pContexts.push_back( xContext );
// Call a startElement at the new context.
xContext->StartElement( xAttrList );
@@ -322,10 +319,10 @@ rName
)
throw(SAXException, RuntimeException, std::exception)
{
- if( !m_pContexts->empty() )
+ if( !m_pContexts.empty() )
{
// Get topmost context
- ::rtl::Reference< XMLTransformerContext > xContext = m_pContexts->back();
+ ::rtl::Reference< XMLTransformerContext > xContext = m_pContexts.back();
#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( xContext->GetQName() == rName,
@@ -336,7 +333,7 @@ rName
xContext->EndElement();
// and remove it from the stack.
- m_pContexts->pop_back();
+ m_pContexts.pop_back();
// Get a namespace map to rewind.
SvXMLNamespaceMap *pRewindMap = xContext->GetRewindMap();
@@ -356,9 +353,9 @@ rName
void SAL_CALL XMLTransformerBase::characters( const OUString& rChars )
throw(SAXException, RuntimeException, std::exception)
{
- if( !m_pContexts->empty() )
+ if( !m_pContexts.empty() )
{
- m_pContexts->back()->Characters( rChars );
+ m_pContexts.back()->Characters( rChars );
}
}
@@ -852,7 +849,7 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList(
case XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY:
{
// determine, if it's the transparency of a document style
- XMLTransformerContext* pFirstContext = (*m_pContexts)[0].get();
+ XMLTransformerContext* pFirstContext = m_pContexts[0].get();
OUString aFirstContextLocalName;
/* sal_uInt16 nFirstContextPrefix = */
GetNamespaceMap().GetKeyByAttrName( pFirstContext->GetQName(),
@@ -1427,23 +1424,20 @@ XMLTokenEnum XMLTransformerBase::GetToken( const OUString& rStr ) const
const XMLTransformerContext *XMLTransformerBase::GetCurrentContext() const
{
- OSL_ENSURE( !m_pContexts->empty(), "empty stack" );
+ OSL_ENSURE( !m_pContexts.empty(), "empty stack" );
- return m_pContexts->empty() ? nullptr : m_pContexts->back().get();
+ return m_pContexts.empty() ? nullptr : m_pContexts.back().get();
}
const XMLTransformerContext *XMLTransformerBase::GetAncestorContext(
sal_uInt32 n ) const
{
- XMLTransformerContextVector::size_type nSize =
- m_pContexts->size();
- XMLTransformerContextVector::size_type nPos =
- static_cast<XMLTransformerContextVector::size_type>( n );
+ auto nSize = m_pContexts.size();
- OSL_ENSURE( nSize >nPos+2 , "invalid context" );
+ OSL_ENSURE( nSize > n + 2 , "invalid context" );
- return nSize > nPos+2 ? (*m_pContexts)[nSize-(nPos+2)].get() : nullptr;
+ return nSize > n + 2 ? m_pContexts[nSize - (n + 2)].get() : nullptr;
}
bool XMLTransformerBase::isWriter() const
diff --git a/xmloff/source/transform/TransformerBase.hxx b/xmloff/source/transform/TransformerBase.hxx
index 18ccf6b..4dbb03c 100644
--- a/xmloff/source/transform/TransformerBase.hxx
+++ b/xmloff/source/transform/TransformerBase.hxx
@@ -20,12 +20,17 @@
#ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERBASE_HXX
#define INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERBASE_HXX
+#include <sal/config.h>
+
+#include <vector>
+
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/xml/sax/XLocator.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XModel.hpp>
+#include <rtl/ref.hxx>
#include <xmloff/xmltoken.hxx>
#include "Transformer.hxx"
@@ -36,7 +41,6 @@ namespace com { namespace sun { namespace star {
class SvXMLNamespaceMap;
class XMLTransformerContext;
-class XMLTransformerContextVector;
class XMLTransformerActions;
struct XMLTransformerActionInit;
struct TransformerAction_Impl;
@@ -60,7 +64,7 @@ class XMLTransformerBase : public XMLTransformer
SvXMLNamespaceMap *m_pNamespaceMap;
SvXMLNamespaceMap *m_pReplaceNamespaceMap;
- XMLTransformerContextVector *m_pContexts;
+ std::vector<rtl::Reference<XMLTransformerContext>> m_pContexts;
XMLTransformerActions *m_pElemActions;
XMLTransformerTokenMap *m_pTokenMap;
commit 21e72c5f1d315068b0aa6afd3b9750c2ad878dcb
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Dec 17 14:47:56 2015 +0100
Hold XMLTransformerContext by rtl::Reference
Change-Id: I60b8d422d53d47537996756aa1b7fb3c26f8383a
diff --git a/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx
index 95dc076..c0b8c10 100644
--- a/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx
+++ b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx
@@ -40,7 +40,7 @@ public:
::rtl::Reference< XMLPersAttrListTContext > & rOutCategoriesContext );
virtual ~XMLAxisOASISContext();
- virtual XMLTransformerContext *CreateChildContext(
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
@@ -68,13 +68,13 @@ XMLAxisOASISContext::XMLAxisOASISContext(
XMLAxisOASISContext::~XMLAxisOASISContext()
{}
-XMLTransformerContext * XMLAxisOASISContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLAxisOASISContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< xml::sax::XAttributeList >& xAttrList )
{
- XMLTransformerContext * pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( XML_NAMESPACE_CHART == nPrefix &&
IsXMLToken( rLocalName, XML_CATEGORIES ) )
@@ -194,18 +194,18 @@ XMLChartPlotAreaOASISTContext::XMLChartPlotAreaOASISTContext(
XMLChartPlotAreaOASISTContext::~XMLChartPlotAreaOASISTContext()
{}
-XMLTransformerContext * XMLChartPlotAreaOASISTContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLChartPlotAreaOASISTContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( XML_NAMESPACE_CHART == nPrefix &&
IsXMLToken( rLocalName, XML_AXIS ) )
{
- pContext = new XMLAxisOASISContext( GetTransformer(), rQName, m_rCategoriesContext );
+ pContext.set(new XMLAxisOASISContext( GetTransformer(), rQName, m_rCategoriesContext ));
}
else
{
diff --git a/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx b/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx
index e42f10f..fc1bc7b 100644
--- a/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx
+++ b/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx
@@ -30,7 +30,7 @@ public:
XMLTransformerBase & rTransformer, const OUString & rQName );
virtual ~XMLChartPlotAreaOASISTContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx
index 5df9753..16aeecc 100644
--- a/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx
+++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx
@@ -126,25 +126,25 @@ XMLChartPlotAreaOOoTContext::XMLChartPlotAreaOOoTContext(
XMLChartPlotAreaOOoTContext::~XMLChartPlotAreaOOoTContext()
{}
-XMLTransformerContext * XMLChartPlotAreaOOoTContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLChartPlotAreaOOoTContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( XML_NAMESPACE_CHART == nPrefix &&
IsXMLToken( rLocalName, XML_AXIS ) )
{
- XMLAxisOOoContext * pAxisContext( new XMLAxisOOoContext( GetTransformer(), rQName ));
+ rtl::Reference<XMLAxisOOoContext> pAxisContext( new XMLAxisOOoContext( GetTransformer(), rQName ));
AddContent( pAxisContext );
- pContext = pAxisContext;
+ pContext.set(pAxisContext.get());
}
else if( XML_NAMESPACE_CHART == nPrefix &&
IsXMLToken( rLocalName, XML_CATEGORIES ) )
{
- pContext = new XMLPersAttrListTContext( GetTransformer(), rQName );
+ pContext.set(new XMLPersAttrListTContext( GetTransformer(), rQName ));
// put categories at correct axis
XMLAxisContextVector::iterator aIter = m_aChildContexts.begin();
@@ -197,12 +197,11 @@ void XMLChartPlotAreaOOoTContext::EndElement()
XMLProcAttrTransformerContext::EndElement();
}
-void XMLChartPlotAreaOOoTContext::AddContent( XMLAxisOOoContext *pContext )
+void XMLChartPlotAreaOOoTContext::AddContent(rtl::Reference<XMLAxisOOoContext> const & pContext)
{
- OSL_ENSURE( pContext && pContext->IsPersistent(),
+ OSL_ENSURE( pContext.is() && pContext->IsPersistent(),
"non-persistent context" );
- XMLAxisContextVector::value_type aVal( pContext );
- m_aChildContexts.push_back( aVal );
+ m_aChildContexts.push_back(pContext);
}
diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx
index e2ddd63..75a14f5 100644
--- a/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx
+++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx
@@ -36,7 +36,7 @@ public:
XMLTransformerBase & rTransformer, const OUString & rQName );
virtual ~XMLChartPlotAreaOOoTContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
@@ -44,7 +44,7 @@ public:
virtual void ExportContent() override;
protected:
- void AddContent( XMLAxisOOoContext *pContent );
+ void AddContent( rtl::Reference<XMLAxisOOoContext> const & pContent );
private:
XMLAxisContextVector m_aChildContexts;
diff --git a/xmloff/source/transform/ControlOOoTContext.cxx b/xmloff/source/transform/ControlOOoTContext.cxx
index bff9ace..1961da4 100644
--- a/xmloff/source/transform/ControlOOoTContext.cxx
+++ b/xmloff/source/transform/ControlOOoTContext.cxx
@@ -48,19 +48,19 @@ void XMLControlOOoTransformerContext::StartElement(
m_xAttrList = new XMLMutableAttributeList( rAttrList, true );
}
-XMLTransformerContext *XMLControlOOoTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLControlOOoTransformerContext::CreateChildContext(
sal_uInt16 /*nPrefix*/,
const OUString& /*rLocalName*/,
const OUString& rQName,
const Reference< XAttributeList >& rAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( m_aElemQName.isEmpty() )
{
- pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ pContext.set(new XMLIgnoreTransformerContext( GetTransformer(),
rQName,
- false, false );
+ false, false ));
m_aElemQName = rQName;
static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
->AppendAttributeList( rAttrList );
@@ -72,9 +72,9 @@ XMLTransformerContext *XMLControlOOoTransformerContext::CreateChildContext(
}
else
{
- pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ pContext.set(new XMLIgnoreTransformerContext( GetTransformer(),
rQName,
- true, true );
+ true, true ));
}
return pContext;
}
diff --git a/xmloff/source/transform/ControlOOoTContext.hxx b/xmloff/source/transform/ControlOOoTContext.hxx
index 350e294..7e345ea 100644
--- a/xmloff/source/transform/ControlOOoTContext.hxx
+++ b/xmloff/source/transform/ControlOOoTContext.hxx
@@ -34,7 +34,7 @@ public:
virtual ~XMLControlOOoTransformerContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/CreateElemTContext.cxx b/xmloff/source/transform/CreateElemTContext.cxx
index e398646..2a39c9a 100644
--- a/xmloff/source/transform/CreateElemTContext.cxx
+++ b/xmloff/source/transform/CreateElemTContext.cxx
@@ -87,13 +87,11 @@ void XMLCreateElemTransformerContext::StartElement(
(*aIter).second.GetQNamePrefixFromParam1(),
::xmloff::token::GetXMLToken(
(*aIter).second.GetQNameTokenFromParam1()) ) );
- XMLTransformerContext *pContext =
+ rtl::Reference<XMLTransformerContext> pContext(
new XMLPersTextContentTContext( GetTransformer(),
- aElemQName );
+ aElemQName ));
pContext->Characters( rAttrValue );
- XMLTransformerContextVector::value_type aVal(
- pContext );
- aChildContexts.push_back( aVal );
+ aChildContexts.push_back(pContext);
pMutableAttrList->RemoveAttributeByIndex( i );
--i;
--nAttrCount;
diff --git a/xmloff/source/transform/DeepTContext.cxx b/xmloff/source/transform/DeepTContext.cxx
index 50bf401..d078cff 100644
--- a/xmloff/source/transform/DeepTContext.cxx
+++ b/xmloff/source/transform/DeepTContext.cxx
@@ -29,12 +29,11 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
-void XMLPersElemContentTContext::AddContent( XMLTransformerContext *pContext )
+void XMLPersElemContentTContext::AddContent( rtl::Reference<XMLTransformerContext> const & pContext )
{
- OSL_ENSURE( pContext && pContext->IsPersistent(),
+ OSL_ENSURE( pContext.is() && pContext->IsPersistent(),
"non-persistent context" );
- XMLTransformerContextVector::value_type aVal( pContext );
- m_aChildContexts.push_back( aVal );
+ m_aChildContexts.push_back(pContext);
}
XMLPersElemContentTContext::XMLPersElemContentTContext(
@@ -75,13 +74,13 @@ XMLPersElemContentTContext::~XMLPersElemContentTContext()
{
}
-XMLTransformerContext *XMLPersElemContentTContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLPersElemContentTContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
XMLTransformerActions::const_iterator aIter =
@@ -92,63 +91,61 @@ XMLTransformerContext *XMLPersElemContentTContext::CreateChildContext(
switch( (*aIter).second.m_nActionType )
{
case XML_ETACTION_COPY:
- pContext = new XMLPersMixedContentTContext( GetTransformer(),
- rQName );
+ pContext.set(new XMLPersMixedContentTContext( GetTransformer(),
+ rQName ));
break;
case XML_ETACTION_COPY_TEXT:
- pContext = new XMLPersMixedContentTContext( GetTransformer(),
- rQName );
+ pContext.set(new XMLPersMixedContentTContext( GetTransformer(),
+ rQName ));
break;
case XML_ETACTION_RENAME_ELEM:
- pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
+ pContext.set(new XMLPersMixedContentTContext( GetTransformer(), rQName,
(*aIter).second.GetQNamePrefixFromParam1(),
- (*aIter).second.GetQNameTokenFromParam1() );
+ (*aIter).second.GetQNameTokenFromParam1() ));
break;
case XML_ETACTION_RENAME_ELEM_PROC_ATTRS:
- pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
+ pContext.set(new XMLPersMixedContentTContext( GetTransformer(), rQName,
(*aIter).second.GetQNamePrefixFromParam1(),
(*aIter).second.GetQNameTokenFromParam1(),
- static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) );
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) ));
break;
case XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR:
{
- XMLPersMixedContentTContext *pMC =
+ rtl::Reference<XMLPersMixedContentTContext> pMC(
new XMLPersMixedContentTContext( GetTransformer(), rQName,
(*aIter).second.GetQNamePrefixFromParam1(),
(*aIter).second.GetQNameTokenFromParam1(),
static_cast< sal_uInt16 >(
- (*aIter).second.m_nParam3 >> 16 ) );
+ (*aIter).second.m_nParam3 >> 16 ) ));
pMC->AddAttribute(
(*aIter).second.GetQNamePrefixFromParam2(),
(*aIter).second.GetQNameTokenFromParam2(),
static_cast< ::xmloff::token::XMLTokenEnum >(
(*aIter).second.m_nParam3 & 0xffff ) );
- pContext = pMC;
+ pContext.set(pMC.get());
}
break;
case XML_ETACTION_PROC_ATTRS:
- pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
- static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) );
+ pContext.set(new XMLPersMixedContentTContext( GetTransformer(), rQName,
+ static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) ));
break;
default:
pContext = GetTransformer().CreateUserDefinedContext(
(*aIter).second, rQName, true );
- OSL_ENSURE( pContext && pContext->IsPersistent(),
+ OSL_ENSURE( pContext.is() && pContext->IsPersistent(),
"unknown or not persistent action" );
- if( pContext && !pContext->IsPersistent() )
+ if( pContext.is() && !pContext->IsPersistent() )
{
- delete pContext;
- pContext = nullptr;
+ pContext.clear();
}
break;
}
}
// default is copying
- if( !pContext )
- pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName );
- XMLTransformerContextVector::value_type aVal( pContext );
- m_aChildContexts.push_back( aVal );
+ if( !pContext.is() )
+ pContext.set(new XMLPersMixedContentTContext( GetTransformer(), rQName ));
+ m_aChildContexts.push_back(pContext);
return pContext;
}
diff --git a/xmloff/source/transform/DeepTContext.hxx b/xmloff/source/transform/DeepTContext.hxx
index 3966038..8031b15 100644
--- a/xmloff/source/transform/DeepTContext.hxx
+++ b/xmloff/source/transform/DeepTContext.hxx
@@ -55,12 +55,12 @@ public:
virtual ~XMLPersElemContentTContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
- void AddContent( XMLTransformerContext *pContent );
+ void AddContent( rtl::Reference<XMLTransformerContext> const & pContent );
bool HasElementContent() const
{
diff --git a/xmloff/source/transform/EventOOoTContext.cxx b/xmloff/source/transform/EventOOoTContext.cxx
index d3b97b4..7abb997 100644
--- a/xmloff/source/transform/EventOOoTContext.cxx
+++ b/xmloff/source/transform/EventOOoTContext.cxx
@@ -226,7 +226,7 @@ void XMLEventOOoTransformerContext::EndElement()
GetTransformer().GetDocHandler()->endElement( GetExportQName() );
}
-XMLTransformerContext * XMLEventOOoTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLEventOOoTransformerContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
diff --git a/xmloff/source/transform/EventOOoTContext.hxx b/xmloff/source/transform/EventOOoTContext.hxx
index fa7a7e2..b3d879f 100644
--- a/xmloff/source/transform/EventOOoTContext.hxx
+++ b/xmloff/source/transform/EventOOoTContext.hxx
@@ -42,7 +42,7 @@ public:
virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
virtual void EndElement() override;
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/FormPropOOoTContext.cxx b/xmloff/source/transform/FormPropOOoTContext.cxx
index 0aea009..fe7653f 100644
--- a/xmloff/source/transform/FormPropOOoTContext.cxx
+++ b/xmloff/source/transform/FormPropOOoTContext.cxx
@@ -150,36 +150,36 @@ XMLFormPropOOoTransformerContext::~XMLFormPropOOoTransformerContext()
{
}
-XMLTransformerContext *XMLFormPropOOoTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLFormPropOOoTransformerContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( XML_NAMESPACE_FORM == nPrefix &&
IsXMLToken( rLocalName, XML_PROPERTY_VALUE ) )
{
if( m_bIsList )
{
- pContext = new XMLFormPropValueTContext_Impl( GetTransformer(),
+ pContext.set(new XMLFormPropValueTContext_Impl( GetTransformer(),
rQName,
XML_NAMESPACE_OFFICE,
- m_eValueToken );
+ m_eValueToken ));
}
else if( !m_xValueContext.is() )
{
m_xValueContext=
new XMLFormPropValueTContext_Impl( GetTransformer(), rQName );
- pContext = m_xValueContext.get();
+ pContext.set(m_xValueContext.get());
}
}
// default is ignore
- if( !pContext )
- pContext = new XMLIgnoreTransformerContext( GetTransformer(), rQName,
- true, true );
+ if( !pContext.is() )
+ pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), rQName,
+ true, true ));
return pContext;
}
diff --git a/xmloff/source/transform/FormPropOOoTContext.hxx b/xmloff/source/transform/FormPropOOoTContext.hxx
index 54111ef..6630cc5 100644
--- a/xmloff/source/transform/FormPropOOoTContext.hxx
+++ b/xmloff/source/transform/FormPropOOoTContext.hxx
@@ -46,7 +46,7 @@ public:
virtual ~XMLFormPropOOoTransformerContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/FrameOASISTContext.cxx b/xmloff/source/transform/FrameOASISTContext.cxx
index 061a60b..ca5b1e9 100644
--- a/xmloff/source/transform/FrameOASISTContext.cxx
+++ b/xmloff/source/transform/FrameOASISTContext.cxx
@@ -105,20 +105,20 @@ void XMLFrameOASISTransformerContext::StartElement(
}
}
-XMLTransformerContext *XMLFrameOASISTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLFrameOASISTransformerContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& rAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( m_bIgnoreElement )
{
// do not export the frame element and all of its children
- pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ pContext.set(new XMLIgnoreTransformerContext( GetTransformer(),
rQName,
- true, true );
+ true, true ));
}
else
{
@@ -136,9 +136,9 @@ XMLTransformerContext *XMLFrameOASISTransformerContext::CreateChildContext(
if( m_aElemQName.isEmpty() &&
!IsLinkedEmbeddedObject( rLocalName, rAttrList ) )
{
- pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ pContext.set(new XMLIgnoreTransformerContext( GetTransformer(),
rQName,
- false, false );
+ false, false ));
m_aElemQName = rQName;
static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
->AppendAttributeList( rAttrList );
@@ -150,9 +150,9 @@ XMLTransformerContext *XMLFrameOASISTransformerContext::CreateChildContext(
}
else
{
- pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ pContext.set(new XMLIgnoreTransformerContext( GetTransformer(),
rQName,
- true, true );
+ true, true ));
}
break;
default:
@@ -163,7 +163,7 @@ XMLTransformerContext *XMLFrameOASISTransformerContext::CreateChildContext(
}
// default is copying
- if( !pContext )
+ if( !pContext.is() )
pContext = XMLTransformerContext::CreateChildContext( nPrefix,
rLocalName,
rQName,
diff --git a/xmloff/source/transform/FrameOASISTContext.hxx b/xmloff/source/transform/FrameOASISTContext.hxx
index 26b641f..55f0d54 100644
--- a/xmloff/source/transform/FrameOASISTContext.hxx
+++ b/xmloff/source/transform/FrameOASISTContext.hxx
@@ -40,7 +40,7 @@ public:
virtual ~XMLFrameOASISTransformerContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/FrameOOoTContext.cxx b/xmloff/source/transform/FrameOOoTContext.cxx
index f181f05..74385d6 100644
--- a/xmloff/source/transform/FrameOOoTContext.cxx
+++ b/xmloff/source/transform/FrameOOoTContext.cxx
@@ -100,13 +100,13 @@ void XMLFrameOOoTransformerContext::StartElement(
XMLTransformerContext::StartElement( xAttrList );
}
-XMLTransformerContext *XMLFrameOOoTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLFrameOOoTransformerContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& rAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
XMLTransformerActions *pActions =
GetTransformer().GetUserDefinedActions( OOO_FRAME_ELEM_ACTIONS );
@@ -133,7 +133,7 @@ XMLTransformerContext *XMLFrameOOoTransformerContext::CreateChildContext(
}
// default is copying
- if( !pContext )
+ if( !pContext.is() )
pContext = XMLTransformerContext::CreateChildContext(
nPrefix, rLocalName, rQName, rAttrList );
diff --git a/xmloff/source/transform/FrameOOoTContext.hxx b/xmloff/source/transform/FrameOOoTContext.hxx
index 9c8f753..c49b42d 100644
--- a/xmloff/source/transform/FrameOOoTContext.hxx
+++ b/xmloff/source/transform/FrameOOoTContext.hxx
@@ -32,7 +32,7 @@ public:
virtual ~XMLFrameOOoTransformerContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/IgnoreTContext.cxx b/xmloff/source/transform/IgnoreTContext.cxx
index 5174399..1dde4f7 100644
--- a/xmloff/source/transform/IgnoreTContext.cxx
+++ b/xmloff/source/transform/IgnoreTContext.cxx
@@ -53,20 +53,20 @@ XMLIgnoreTransformerContext::~XMLIgnoreTransformerContext()
{
}
-XMLTransformerContext *XMLIgnoreTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLIgnoreTransformerContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& xAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( m_bIgnoreElements )
- pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ pContext.set(new XMLIgnoreTransformerContext( GetTransformer(),
rQName, true,
- true );
+ true ));
else if (m_bRecursiveUse)
- pContext = new XMLIgnoreTransformerContext( GetTransformer(),
- rQName, m_bAllowCharactersRecursive );
+ pContext.set(new XMLIgnoreTransformerContext( GetTransformer(),
+ rQName, m_bAllowCharactersRecursive ));
else
pContext = XMLTransformerContext::CreateChildContext(
nPrefix, rLocalName, rQName, xAttrList );
diff --git a/xmloff/source/transform/IgnoreTContext.hxx b/xmloff/source/transform/IgnoreTContext.hxx
index aae5bf2..0246927 100644
--- a/xmloff/source/transform/IgnoreTContext.hxx
+++ b/xmloff/source/transform/IgnoreTContext.hxx
@@ -55,7 +55,7 @@ public:
// Create a children element context. By default, the import's
// CreateContext method is called to create a new default context.
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/MergeElemTContext.cxx b/xmloff/source/transform/MergeElemTContext.cxx
index 3e1a79d..f35fde9 100644
--- a/xmloff/source/transform/MergeElemTContext.cxx
+++ b/xmloff/source/transform/MergeElemTContext.cxx
@@ -41,7 +41,7 @@ public:
// Create a children element context. By default, the import's
// CreateContext method is called to create a new default context.
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
@@ -72,18 +72,14 @@ XMLParagraphTransformerContext::~XMLParagraphTransformerContext()
{
}
-XMLTransformerContext *XMLParagraphTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLParagraphTransformerContext::CreateChildContext(
sal_uInt16 /*nPrefix*/,
const OUString& /*rLocalName*/,
const OUString& rQName,
const Reference< XAttributeList >& )
{
- XMLTransformerContext *pContext = nullptr;
-
- pContext = new XMLIgnoreTransformerContext( GetTransformer(),
+ return new XMLIgnoreTransformerContext( GetTransformer(),
rQName, true );
-
- return pContext;
}
void XMLParagraphTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList )
@@ -200,13 +196,13 @@ void XMLMergeElemTransformerContext::StartElement(
}
}
-XMLTransformerContext *XMLMergeElemTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLMergeElemTransformerContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& rAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( !m_bStartElementExported )
{
@@ -225,36 +221,33 @@ XMLTransformerContext *XMLMergeElemTransformerContext::CreateChildContext(
{
case XML_ETACTION_MOVE_TO_ATTR_RNG2ISO_DATETIME:
{
- XMLPersTextContentTContext *pTC =
+ rtl::Reference<XMLPersTextContentTContext> pTC(
new XMLPersTextContentRNGTransformTContext(
GetTransformer(), rQName,
(*aIter).second.GetQNamePrefixFromParam1(),
- (*aIter).second.GetQNameTokenFromParam1() );
- XMLPersTextContentTContextVector::value_type aVal(pTC);
- m_aChildContexts.push_back( aVal );
- pContext = pTC;
+ (*aIter).second.GetQNameTokenFromParam1() ));
+ m_aChildContexts.push_back(pTC);
+ pContext.set(pTC.get());
}
break;
case XML_ETACTION_MOVE_TO_ATTR:
{
- XMLPersTextContentTContext *pTC =
+ rtl::Reference<XMLPersTextContentTContext> pTC(
new XMLPersTextContentTContext(
GetTransformer(), rQName,
(*aIter).second.GetQNamePrefixFromParam1(),
- (*aIter).second.GetQNameTokenFromParam1() );
- XMLPersTextContentTContextVector::value_type aVal(pTC);
- m_aChildContexts.push_back( aVal );
- pContext = pTC;
+ (*aIter).second.GetQNameTokenFromParam1() ));
+ m_aChildContexts.push_back(pTC);
+ pContext.set(pTC.get());
}
break;
case XML_ETACTION_EXTRACT_CHARACTERS:
{
if( !m_bStartElementExported )
ExportStartElement();
- XMLParagraphTransformerContext* pPTC =
+ pContext.set(
new XMLParagraphTransformerContext( GetTransformer(),
- rQName);
- pContext = pPTC;
+ rQName));
}
break;
default:
@@ -283,10 +276,9 @@ XMLTransformerContext *XMLMergeElemTransformerContext::CreateChildContext(
{
if( !m_bStartElementExported )
ExportStartElement();
- XMLParagraphTransformerContext* pPTC =
+ pContext.set(
new XMLParagraphTransformerContext( GetTransformer(),
- rQName);
- pContext = pPTC;
+ rQName));
}
break;
default:
@@ -298,7 +290,7 @@ XMLTransformerContext *XMLMergeElemTransformerContext::CreateChildContext(
}
// default is copying
- if( !pContext )
+ if( !pContext.is() )
{
if( !m_bStartElementExported )
ExportStartElement();
diff --git a/xmloff/source/transform/MergeElemTContext.hxx b/xmloff/source/transform/MergeElemTContext.hxx
index 39cc3b1..07602f6 100644
--- a/xmloff/source/transform/MergeElemTContext.hxx
+++ b/xmloff/source/transform/MergeElemTContext.hxx
@@ -43,7 +43,7 @@ public:
virtual ~XMLMergeElemTransformerContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/MetaTContext.cxx b/xmloff/source/transform/MetaTContext.cxx
index f029cdf..8dea091 100644
--- a/xmloff/source/transform/MetaTContext.cxx
+++ b/xmloff/source/transform/MetaTContext.cxx
@@ -67,18 +67,18 @@ XMLMetaTransformerContext::~XMLMetaTransformerContext()
{
}
-XMLTransformerContext *XMLMetaTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLMetaTransformerContext::CreateChildContext(
sal_uInt16 /*nPrefix*/,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& )
{
- XMLPersTextContentTContext *pContext =
- new XMLPersTextContentTContext( GetTransformer(), rQName );
+ rtl::Reference<XMLPersTextContentTContext> pContext(
+ new XMLPersTextContentTContext( GetTransformer(), rQName ));
XMLMetaContexts_Impl::value_type aVal( rLocalName, pContext );
m_aContexts.insert( aVal );
- return pContext;
+ return pContext.get();
}
void XMLMetaTransformerContext::EndElement()
diff --git a/xmloff/source/transform/MetaTContext.hxx b/xmloff/source/transform/MetaTContext.hxx
index a8788fa..f6ed271 100644
--- a/xmloff/source/transform/MetaTContext.hxx
+++ b/xmloff/source/transform/MetaTContext.hxx
@@ -49,7 +49,7 @@ public:
// Create a children element context. By default, the import's
// CreateContext method is called to create a new default context.
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/NotesTContext.cxx b/xmloff/source/transform/NotesTContext.cxx
index 9fbdf1f..bef8abc 100644
--- a/xmloff/source/transform/NotesTContext.cxx
+++ b/xmloff/source/transform/NotesTContext.cxx
@@ -153,13 +153,13 @@ void XMLNotesTransformerContext::EndElement()
}
}
-XMLTransformerContext *XMLNotesTransformerContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLNotesTransformerContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& rAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( XML_NOTE == m_eTypeToken )
{
if( XML_NAMESPACE_TEXT == nPrefix )
@@ -180,25 +180,25 @@ XMLTransformerContext *XMLNotesTransformerContext::CreateChildContext(
{
if( m_bPersistent )
{
- pContext = new XMLPersTextContentTContext(
+ pContext.set(new XMLPersTextContentTContext(
GetTransformer(), rQName,
XML_NAMESPACE_TEXT,
- eToken );
+ eToken ));
AddContent( pContext );
}
else
{
- pContext = new XMLRenameElemTransformerContext(
+ pContext.set(new XMLRenameElemTransformerContext(
GetTransformer(), rQName,
XML_NAMESPACE_TEXT,
- eToken );
+ eToken ));
}
}
}
}
- if( !pContext )
+ if( !pContext.is() )
{
pContext = m_bPersistent
? XMLPersElemContentTContext::CreateChildContext(
diff --git a/xmloff/source/transform/NotesTContext.hxx b/xmloff/source/transform/NotesTContext.hxx
index 1a49c4a..b7f9a6e 100644
--- a/xmloff/source/transform/NotesTContext.hxx
+++ b/xmloff/source/transform/NotesTContext.hxx
@@ -36,7 +36,7 @@ public:
virtual ~XMLNotesTransformerContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx
index 9ab3609..e23b5e1 100644
--- a/xmloff/source/transform/Oasis2OOo.cxx
+++ b/xmloff/source/transform/Oasis2OOo.cxx
@@ -1252,7 +1252,7 @@ public:
virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
@@ -1276,7 +1276,7 @@ void XMLBodyOASISTransformerContext_Impl::StartElement(
{
}
-XMLTransformerContext* XMLBodyOASISTransformerContext_Impl::CreateChildContext( sal_uInt16 nPrefix,
+rtl::Reference<XMLTransformerContext> XMLBodyOASISTransformerContext_Impl::CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList )
diff --git a/xmloff/source/transform/PersAttrListTContext.cxx b/xmloff/source/transform/PersAttrListTContext.cxx
index 82985eb..3f708fd 100644
--- a/xmloff/source/transform/PersAttrListTContext.cxx
+++ b/xmloff/source/transform/PersAttrListTContext.cxx
@@ -110,7 +110,7 @@ XMLPersAttrListTContext::~XMLPersAttrListTContext()
{
}
-XMLTransformerContext *XMLPersAttrListTContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLPersAttrListTContext::CreateChildContext(
sal_uInt16 /*nPrefix*/,
const OUString& /*rLocalName*/,
const OUString& rQName,
diff --git a/xmloff/source/transform/PersAttrListTContext.hxx b/xmloff/source/transform/PersAttrListTContext.hxx
index 5f4942c..e47fb33 100644
--- a/xmloff/source/transform/PersAttrListTContext.hxx
+++ b/xmloff/source/transform/PersAttrListTContext.hxx
@@ -69,7 +69,7 @@ public:
// Create a children element context. By default, the import's
// CreateContext method is called to create a new default context.
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/PersMixedContentTContext.cxx b/xmloff/source/transform/PersMixedContentTContext.cxx
index 3a4696a..43f49af 100644
--- a/xmloff/source/transform/PersMixedContentTContext.cxx
+++ b/xmloff/source/transform/PersMixedContentTContext.cxx
@@ -34,7 +34,7 @@ public:
const OUString& rChars );
virtual ~XMLPersTextTContext_Impl();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
@@ -58,14 +58,14 @@ XMLPersTextTContext_Impl::~XMLPersTextTContext_Impl()
{
}
-XMLTransformerContext *XMLPersTextTContext_Impl::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLPersTextTContext_Impl::CreateChildContext(
sal_uInt16,
const OUString&,
const OUString&,
const Reference< XAttributeList >& )
{
OSL_ENSURE( false, "illegal call to CreateChildContext" );
- return nullptr;
+ return {};
}
void XMLPersTextTContext_Impl::StartElement(
diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx
index 6a4163c..0603367 100644
--- a/xmloff/source/transform/StyleOASISTContext.cxx
+++ b/xmloff/source/transform/StyleOASISTContext.cxx
@@ -759,13 +759,13 @@ XMLStyleOASISTContext::~XMLStyleOASISTContext()
{
}
-XMLTransformerContext *XMLStyleOASISTContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLStyleOASISTContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& rAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
{
@@ -779,10 +779,10 @@ XMLTransformerContext *XMLStyleOASISTContext::CreateChildContext(
GetTransformer(), rQName, ePropType, m_aStyleFamily, m_bControlStyle );
else
m_xPropContext->SetQNameAndPropType( rQName, ePropType );
- pContext = m_xPropContext.get();
+ pContext.set(m_xPropContext.get());
}
}
- if( !pContext )
+ if( !pContext.is() )
{
// if a properties context exist close it
if( m_xPropContext.is() && !m_bPersistent )
diff --git a/xmloff/source/transform/StyleOASISTContext.hxx b/xmloff/source/transform/StyleOASISTContext.hxx
index ae46ba6..8b1149c 100644
--- a/xmloff/source/transform/StyleOASISTContext.hxx
+++ b/xmloff/source/transform/StyleOASISTContext.hxx
@@ -46,7 +46,7 @@ public:
virtual ~XMLStyleOASISTContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/StyleOOoTContext.cxx b/xmloff/source/transform/StyleOOoTContext.cxx
index 24d0234..4f30727 100644
--- a/xmloff/source/transform/StyleOOoTContext.cxx
+++ b/xmloff/source/transform/StyleOOoTContext.cxx
@@ -237,7 +237,7 @@ public:
virtual ~XMLPropertiesOOoTContext_Impl();
- XMLTransformerContext *CreateChildContext(
+ rtl::Reference<XMLTransformerContext> CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
@@ -378,7 +378,7 @@ XMLPropertiesOOoTContext_Impl::~XMLPropertiesOOoTContext_Impl()
{
}
-XMLTransformerContext *XMLPropertiesOOoTContext_Impl::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLPropertiesOOoTContext_Impl::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
@@ -1067,13 +1067,13 @@ XMLStyleOOoTContext::~XMLStyleOOoTContext()
{
}
-XMLTransformerContext *XMLStyleOOoTContext::CreateChildContext(
+rtl::Reference<XMLTransformerContext> XMLStyleOOoTContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& rAttrList )
{
- XMLTransformerContext *pContext = nullptr;
+ rtl::Reference<XMLTransformerContext> pContext;
if( XML_NAMESPACE_STYLE == nPrefix &&
IsXMLToken( rLocalName, XML_PROPERTIES ) )
@@ -1093,29 +1093,29 @@ XMLTransformerContext *XMLStyleOOoTContext::CreateChildContext(
aAttrActionMaps[aPropTypes[m_eFamily][0]];
if( nActionMap < MAX_OOO_PROP_ACTIONS )
{
- pContext = new XMLPropertiesOOoTContext_Impl(
+ pContext.set(new XMLPropertiesOOoTContext_Impl(
GetTransformer(), rQName,
- aPropTypes[m_eFamily], m_bPersistent );
+ aPropTypes[m_eFamily], m_bPersistent ));
}
else
{
if( m_bPersistent )
- pContext = new XMLPersElemContentTContext(
+ pContext.set(new XMLPersElemContentTContext(
GetTransformer(), rQName,
XML_NAMESPACE_STYLE,
- aPropTokens[aPropTypes[m_eFamily][0]] );
+ aPropTokens[aPropTypes[m_eFamily][0]] ));
else
- pContext = new XMLRenameElemTransformerContext(
+ pContext.set(new XMLRenameElemTransformerContext(
GetTransformer(), rQName,
XML_NAMESPACE_STYLE,
- aPropTokens[aPropTypes[m_eFamily][0]] );
+ aPropTokens[aPropTypes[m_eFamily][0]] ));
}
}
else
{
- pContext = new XMLPropertiesOOoTContext_Impl(
+ pContext.set(new XMLPropertiesOOoTContext_Impl(
GetTransformer(), rQName,
- aPropTypes[m_eFamily], m_bPersistent);
+ aPropTypes[m_eFamily], m_bPersistent));
}
if( m_bPersistent )
diff --git a/xmloff/source/transform/StyleOOoTContext.hxx b/xmloff/source/transform/StyleOOoTContext.hxx
index 5a716a5..12cb419 100644
--- a/xmloff/source/transform/StyleOOoTContext.hxx
+++ b/xmloff/source/transform/StyleOOoTContext.hxx
@@ -47,7 +47,7 @@ public:
virtual ~XMLStyleOOoTContext();
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/source/transform/TransformerContext.cxx b/xmloff/source/transform/TransformerContext.cxx
index 61e3df9..d245314 100644
--- a/xmloff/source/transform/TransformerContext.cxx
+++ b/xmloff/source/transform/TransformerContext.cxx
@@ -58,7 +58,7 @@ XMLTransformerContext::~XMLTransformerContext()
{
}
-XMLTransformerContext *XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix,
+rtl::Reference<XMLTransformerContext> XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const Reference< XAttributeList >& )
diff --git a/xmloff/source/transform/TransformerContext.hxx b/xmloff/source/transform/TransformerContext.hxx
index 449c3e1..a42e982 100644
--- a/xmloff/source/transform/TransformerContext.hxx
+++ b/xmloff/source/transform/TransformerContext.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <salhelper/simplereferenceobject.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include <xmloff/xmltoken.hxx>
@@ -69,7 +70,7 @@ public:
// Create a children element context. By default, the import's
// CreateContext method is called to create a new default context.
- virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
+ virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const OUString& rQName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList );
More information about the Libreoffice-commits
mailing list