Kaydet (Commit) a9c78d78 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SwAccessibleParagraph

Change-Id: I2648add548c214f7d448941db39622ca660f6fab
Reviewed-on: https://gerrit.libreoffice.org/51665Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e1315724
...@@ -557,9 +557,9 @@ SwAccessibleParagraph::~SwAccessibleParagraph() ...@@ -557,9 +557,9 @@ SwAccessibleParagraph::~SwAccessibleParagraph()
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
delete m_pPortionData; m_pPortionData.reset();
delete m_pHyperTextData; m_pHyperTextData.reset();
delete mpParaChangeTrackInfo; // #i108125# mpParaChangeTrackInfo.reset(); // #i108125#
EndListeningAll(); EndListeningAll();
} }
...@@ -577,9 +577,8 @@ void SwAccessibleParagraph::UpdatePortionData() ...@@ -577,9 +577,8 @@ void SwAccessibleParagraph::UpdatePortionData()
const SwTextFrame* pFrame = static_cast<const SwTextFrame*>( GetFrame() ); const SwTextFrame* pFrame = static_cast<const SwTextFrame*>( GetFrame() );
// build new portion data // build new portion data
delete m_pPortionData; m_pPortionData.reset( new SwAccessiblePortionData(
m_pPortionData = new SwAccessiblePortionData( pFrame->GetTextNode(), GetMap()->GetShell()->GetViewOptions() ) );
pFrame->GetTextNode(), GetMap()->GetShell()->GetViewOptions() );
pFrame->VisitPortions( *m_pPortionData ); pFrame->VisitPortions( *m_pPortionData );
OSL_ENSURE( m_pPortionData != nullptr, "UpdatePortionData() failed" ); OSL_ENSURE( m_pPortionData != nullptr, "UpdatePortionData() failed" );
...@@ -587,11 +586,8 @@ void SwAccessibleParagraph::UpdatePortionData() ...@@ -587,11 +586,8 @@ void SwAccessibleParagraph::UpdatePortionData()
void SwAccessibleParagraph::ClearPortionData() void SwAccessibleParagraph::ClearPortionData()
{ {
delete m_pPortionData; m_pPortionData.reset();
m_pPortionData = nullptr; m_pHyperTextData.reset();
delete m_pHyperTextData;
m_pHyperTextData = nullptr;
} }
void SwAccessibleParagraph::ExecuteAtViewShell( sal_uInt16 nSlot ) void SwAccessibleParagraph::ExecuteAtViewShell( sal_uInt16 nSlot )
...@@ -3057,7 +3053,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL ...@@ -3057,7 +3053,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
if( pHt ) if( pHt )
{ {
if( !m_pHyperTextData ) if( !m_pHyperTextData )
m_pHyperTextData = new SwAccessibleHyperTextData; m_pHyperTextData.reset( new SwAccessibleHyperTextData );
SwAccessibleHyperTextData::iterator aIter = SwAccessibleHyperTextData::iterator aIter =
m_pHyperTextData ->find( pHt ); m_pHyperTextData ->find( pHt );
if( aIter != m_pHyperTextData->end() ) if( aIter != m_pHyperTextData->end() )
......
...@@ -73,8 +73,8 @@ class SwAccessibleParagraph : ...@@ -73,8 +73,8 @@ class SwAccessibleParagraph :
// string. // string.
// pPortionData may be NULL; it should only be accessed through the // pPortionData may be NULL; it should only be accessed through the
// Get/Clear/Has/UpdatePortionData() methods // Get/Clear/Has/UpdatePortionData() methods
SwAccessiblePortionData* m_pPortionData; std::unique_ptr<SwAccessiblePortionData> m_pPortionData;
SwAccessibleHyperTextData *m_pHyperTextData; std::unique_ptr<SwAccessibleHyperTextData> m_pHyperTextData;
sal_Int32 m_nOldCaretPos; // The 'old' caret pos. It's only valid as long sal_Int32 m_nOldCaretPos; // The 'old' caret pos. It's only valid as long
// as the cursor is inside this object (protected by // as the cursor is inside this object (protected by
...@@ -86,7 +86,7 @@ class SwAccessibleParagraph : ...@@ -86,7 +86,7 @@ class SwAccessibleParagraph :
// implementation for XAccessibleSelection // implementation for XAccessibleSelection
SwAccessibleSelectionHelper m_aSelectionHelper; SwAccessibleSelectionHelper m_aSelectionHelper;
SwParaChangeTrackingInfo* mpParaChangeTrackInfo; // #i108125# std::unique_ptr<SwParaChangeTrackingInfo> mpParaChangeTrackInfo; // #i108125#
/// get the SwTextNode (requires frame; check before) /// get the SwTextNode (requires frame; check before)
const SwTextNode* GetTextNode() const; const SwTextNode* GetTextNode() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment