summaryrefslogtreecommitdiff
path: root/sc/source/filter
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/filter')
-rw-r--r--sc/source/filter/xml/xmldpimp.cxx13
-rw-r--r--sc/source/filter/xml/xmldpimp.hxx2
2 files changed, 7 insertions, 8 deletions
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index c6d3581ca7a3..0c4b583ca598 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -909,17 +909,16 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotFieldCont
return pContext;
}
-void ScXMLDataPilotFieldContext::AddMember(ScDPSaveMember* pMember)
+void ScXMLDataPilotFieldContext::AddMember(std::unique_ptr<ScDPSaveMember> pMember)
{
if (xDim)
{
- xDim->AddMember(pMember);
- if (!pMember->GetIsVisible())
+ bool isVisible = pMember->GetIsVisible();
+ xDim->AddMember(std::move(pMember));
+ if (!isVisible)
// This member is hidden.
mbHasHiddenMember = true;
}
- else
- delete pMember;
}
void ScXMLDataPilotFieldContext::SetSubTotalName(const OUString& rName)
@@ -1389,12 +1388,12 @@ void SAL_CALL ScXMLDataPilotMemberContext::endFastElement( sal_Int32 /*nElement*
{
if (bHasName) // #i53407# don't check sName, empty name is allowed
{
- ScDPSaveMember* pMember = new ScDPSaveMember(sName);
+ std::unique_ptr<ScDPSaveMember> pMember(new ScDPSaveMember(sName));
if (!maDisplayName.isEmpty())
pMember->SetLayoutName(maDisplayName);
pMember->SetIsVisible(bDisplay);
pMember->SetShowDetails(bDisplayDetails);
- pDataPilotField->AddMember(pMember);
+ pDataPilotField->AddMember(std::move(pMember));
}
}
diff --git a/sc/source/filter/xml/xmldpimp.hxx b/sc/source/filter/xml/xmldpimp.hxx
index 9cc139e0f08f..df8b2f279ae9 100644
--- a/sc/source/filter/xml/xmldpimp.hxx
+++ b/sc/source/filter/xml/xmldpimp.hxx
@@ -277,7 +277,7 @@ public:
void SetShowEmpty(const bool bValue) { if (xDim) xDim->SetShowEmpty(bValue); }
void SetRepeatItemLabels(const bool bSet) { if (xDim) xDim->SetRepeatItemLabels(bSet); }
void SetSubTotals(std::vector<ScGeneralFunction> const & rFunctions) { if (xDim) xDim->SetSubTotals(rFunctions); }
- void AddMember(ScDPSaveMember* pMember);
+ void AddMember(std::unique_ptr<ScDPSaveMember> pMember);
void SetSubTotalName(const OUString& rName);
void SetFieldReference(const css::sheet::DataPilotFieldReference& aRef) { if (xDim) xDim->SetReferenceValue(&aRef); }
void SetAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo& aInfo) { if (xDim) xDim->SetAutoShowInfo(&aInfo); }