summaryrefslogtreecommitdiff
path: root/xmloff/source/transform/MergeElemTContext.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-12-17 14:47:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-12-17 16:51:16 +0100
commit21e72c5f1d315068b0aa6afd3b9750c2ad878dcb (patch)
treef93a352182acf4890f0469425526894029323d62 /xmloff/source/transform/MergeElemTContext.cxx
parentb902432b431d01634c1f56e4758ec236a999650d (diff)
Hold XMLTransformerContext by rtl::Reference
Change-Id: I60b8d422d53d47537996756aa1b7fb3c26f8383a
Diffstat (limited to 'xmloff/source/transform/MergeElemTContext.cxx')
-rw-r--r--xmloff/source/transform/MergeElemTContext.cxx44
1 files changed, 18 insertions, 26 deletions
diff --git a/xmloff/source/transform/MergeElemTContext.cxx b/xmloff/source/transform/MergeElemTContext.cxx
index 3e1a79da7376..f35fde9c4dfe 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();