summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-09-08 14:56:44 +0200
committerDavid Tardon <dtardon@redhat.com>2016-09-09 07:30:30 +0200
commit516992ec6e8d67552610928b91d7b0d9f7014600 (patch)
tree4a03e5f903854e5635d8372dcbd912e89836f15f /xmloff
parent73f32870cf3b88b65c40e362fae9bb63e51ec5ce (diff)
remove manual memory management
Change-Id: Ice48916fc9841a29b3a02997375347c7b605effe
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/XMLTextColumnsContext.hxx4
-rw-r--r--xmloff/source/text/XMLTextColumnsContext.cxx48
2 files changed, 19 insertions, 33 deletions
diff --git a/xmloff/inc/XMLTextColumnsContext.hxx b/xmloff/inc/XMLTextColumnsContext.hxx
index f74363281b68..b750adb90447 100644
--- a/xmloff/inc/XMLTextColumnsContext.hxx
+++ b/xmloff/inc/XMLTextColumnsContext.hxx
@@ -26,7 +26,7 @@ class XMLTextColumnContext_Impl;
class XMLTextColumnSepContext_Impl;
class SvXMLTokenMap;
-typedef std::vector<XMLTextColumnContext_Impl *> XMLTextColumnsArray_Impl;
+typedef std::vector<css::uno::Reference<XMLTextColumnContext_Impl>> XMLTextColumnsArray_Impl;
class XMLTextColumnsContext :public XMLElementPropertyContext
{
@@ -40,7 +40,7 @@ class XMLTextColumnsContext :public XMLElementPropertyContext
XMLTextColumnsArray_Impl *pColumns;
- XMLTextColumnSepContext_Impl *pColumnSep;
+ css::uno::Reference<XMLTextColumnSepContext_Impl> mxColumnSep;
SvXMLTokenMap *pColumnAttrTokenMap;
SvXMLTokenMap *pColumnSepAttrTokenMap;
sal_Int16 nCount;
diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx
index 08e8d05270c0..475f9c916ce7 100644
--- a/xmloff/source/text/XMLTextColumnsContext.cxx
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -276,7 +276,6 @@ XMLTextColumnsContext::XMLTextColumnsContext(
, sAutomaticDistance("AutomaticDistance")
, sSeparatorLineStyle("SeparatorLineStyle")
, pColumns( nullptr )
-, pColumnSep( nullptr )
, pColumnAttrTokenMap( new SvXMLTokenMap(aColAttrTokenMap) )
, pColumnSepAttrTokenMap( new SvXMLTokenMap(aColSepAttrTokenMap) )
, nCount( 0 )
@@ -311,17 +310,6 @@ XMLTextColumnsContext::XMLTextColumnsContext(
XMLTextColumnsContext::~XMLTextColumnsContext()
{
- if( pColumns )
- {
- for (XMLTextColumnsArray_Impl::iterator it = pColumns->begin();
- it != pColumns->end(); ++it)
- {
- (*it)->ReleaseRef();
- }
- }
- if( pColumnSep )
- pColumnSep->ReleaseRef();
-
delete pColumns;
delete pColumnAttrTokenMap;
delete pColumnSepAttrTokenMap;
@@ -337,28 +325,26 @@ SvXMLImportContext *XMLTextColumnsContext::CreateChildContext(
if( XML_NAMESPACE_STYLE == nPrefix &&
IsXMLToken( rLocalName, XML_COLUMN ) )
{
- XMLTextColumnContext_Impl *pColumn =
+ const uno::Reference<XMLTextColumnContext_Impl> xColumn{
new XMLTextColumnContext_Impl( GetImport(), nPrefix, rLocalName,
- xAttrList, *pColumnAttrTokenMap );
+ xAttrList, *pColumnAttrTokenMap )};
// add new tabstop to array of tabstops
if( !pColumns )
pColumns = new XMLTextColumnsArray_Impl;
- pColumns->push_back( pColumn );
- pColumn->AddFirstRef();
+ pColumns->push_back( xColumn );
- pContext = pColumn;
+ pContext = xColumn.get();
}
else if( XML_NAMESPACE_STYLE == nPrefix &&
IsXMLToken( rLocalName, XML_COLUMN_SEP ) )
{
- pColumnSep =
+ mxColumnSep.set(
new XMLTextColumnSepContext_Impl( GetImport(), nPrefix, rLocalName,
- xAttrList, *pColumnSepAttrTokenMap );
- pColumnSep->AddFirstRef();
+ xAttrList, *pColumnSepAttrTokenMap ));
- pContext = pColumnSep;
+ pContext = mxColumnSep.get();
}
else
{
@@ -442,29 +428,29 @@ void XMLTextColumnsContext::EndElement( )
Reference < XPropertySet > xPropSet( xColumns, UNO_QUERY );
if( xPropSet.is() )
{
- bool bOn = pColumnSep != nullptr;
+ bool bOn = mxColumnSep != nullptr;
xPropSet->setPropertyValue( sSeparatorLineIsOn, Any(bOn) );
- if( pColumnSep )
+ if( mxColumnSep.is() )
{
- if( pColumnSep->GetWidth() )
+ if( mxColumnSep->GetWidth() )
{
- xPropSet->setPropertyValue( sSeparatorLineWidth, Any(pColumnSep->GetWidth()) );
+ xPropSet->setPropertyValue( sSeparatorLineWidth, Any(mxColumnSep->GetWidth()) );
}
- if( pColumnSep->GetHeight() )
+ if( mxColumnSep->GetHeight() )
{
xPropSet->setPropertyValue( sSeparatorLineRelativeHeight,
- Any(pColumnSep->GetHeight()) );
+ Any(mxColumnSep->GetHeight()) );
}
- if ( pColumnSep->GetStyle() )
+ if ( mxColumnSep->GetStyle() )
{
- xPropSet->setPropertyValue( sSeparatorLineStyle, Any(pColumnSep->GetStyle()) );
+ xPropSet->setPropertyValue( sSeparatorLineStyle, Any(mxColumnSep->GetStyle()) );
}
- xPropSet->setPropertyValue( sSeparatorLineColor, Any(pColumnSep->GetColor()) );
+ xPropSet->setPropertyValue( sSeparatorLineColor, Any(mxColumnSep->GetColor()) );
- xPropSet->setPropertyValue( sSeparatorLineVerticalAlignment, Any(pColumnSep->GetVertAlign()) );
+ xPropSet->setPropertyValue( sSeparatorLineVerticalAlignment, Any(mxColumnSep->GetVertAlign()) );
}
// handle 'automatic columns': column distance