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

loplugin:useuniqueptr in ScPreview

Change-Id: I081066d34ed6b134b5354f8df7f9801356ef181c
Reviewed-on: https://gerrit.libreoffice.org/56907
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 2720dbe9
...@@ -51,8 +51,8 @@ private: ...@@ -51,8 +51,8 @@ private:
long nTotalPages; long nTotalPages;
Size aPageSize; // for GetOptimalZoom Size aPageSize; // for GetOptimalZoom
ScPrintState aState; ScPrintState aState;
ScPreviewLocationData* pLocationData; // stores table layout for accessibility API std::unique_ptr<ScPreviewLocationData> pLocationData; // stores table layout for accessibility API
FmFormView* pDrawView; std::unique_ptr<FmFormView> pDrawView;
// internal: // internal:
ScDocShell* pDocShell; ScDocShell* pDocShell;
...@@ -156,7 +156,7 @@ public: ...@@ -156,7 +156,7 @@ public:
DECL_STATIC_LINK( ScPreview, InvalidateHdl, void*, void ); DECL_STATIC_LINK( ScPreview, InvalidateHdl, void*, void );
static void StaticInvalidate(); static void StaticInvalidate();
FmFormView* GetDrawView() { return pDrawView; } FmFormView* GetDrawView() { return pDrawView.get(); }
SC_DLLPUBLIC void SetSelectedTabs(const ScMarkData& rMark); SC_DLLPUBLIC void SetSelectedTabs(const ScMarkData& rMark);
const ScMarkData::MarkedTabsType& GetSelectedTabs() const { return maSelectedTabs; } const ScMarkData::MarkedTabsType& GetSelectedTabs() const { return maSelectedTabs; }
......
...@@ -144,8 +144,8 @@ ScPreview::~ScPreview() ...@@ -144,8 +144,8 @@ ScPreview::~ScPreview()
void ScPreview::dispose() void ScPreview::dispose()
{ {
delete pDrawView; pDrawView.reset();
delete pLocationData; pLocationData.reset();
vcl::Window::dispose(); vcl::Window::dispose();
} }
...@@ -160,15 +160,12 @@ void ScPreview::UpdateDrawView() // nTab must be right ...@@ -160,15 +160,12 @@ void ScPreview::UpdateDrawView() // nTab must be right
if ( pDrawView && ( !pDrawView->GetSdrPageView() || pDrawView->GetSdrPageView()->GetPage() != pPage ) ) if ( pDrawView && ( !pDrawView->GetSdrPageView() || pDrawView->GetSdrPageView()->GetPage() != pPage ) )
{ {
// convert the displayed Page of drawView (see below) does not work?!? // convert the displayed Page of drawView (see below) does not work?!?
delete pDrawView; pDrawView.reset();
pDrawView = nullptr;
} }
if ( !pDrawView ) // New Drawing? if ( !pDrawView ) // New Drawing?
{ {
pDrawView = new FmFormView( pDrawView.reset( new FmFormView( *pModel, this) );
*pModel,
this);
// The DrawView takes over the Design-Mode from the Model // The DrawView takes over the Design-Mode from the Model
// (Settings "In opening Draftmode"), therefore to restore here // (Settings "In opening Draftmode"), therefore to restore here
...@@ -179,8 +176,7 @@ void ScPreview::UpdateDrawView() // nTab must be right ...@@ -179,8 +176,7 @@ void ScPreview::UpdateDrawView() // nTab must be right
} }
else if ( pDrawView ) else if ( pDrawView )
{ {
delete pDrawView; // for this Chart is not needed pDrawView.reset(); // for this Chart is not needed
pDrawView = nullptr;
} }
} }
...@@ -404,7 +400,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) ...@@ -404,7 +400,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
pPrintFunc->SetClearFlag(true); pPrintFunc->SetClearFlag(true);
pPrintFunc->SetUseStyleColor( pScMod->GetAccessOptions().GetIsForPagePreviews() ); pPrintFunc->SetUseStyleColor( pScMod->GetAccessOptions().GetIsForPagePreviews() );
pPrintFunc->SetDrawView( pDrawView ); pPrintFunc->SetDrawView( pDrawView.get() );
// MultiSelection for the one Page must produce something inconvenient // MultiSelection for the one Page must produce something inconvenient
Range aPageRange( nPageNo+1, nPageNo+1 ); Range aPageRange( nPageNo+1, nPageNo+1 );
...@@ -685,13 +681,13 @@ const ScPreviewLocationData& ScPreview::GetLocationData() ...@@ -685,13 +681,13 @@ const ScPreviewLocationData& ScPreview::GetLocationData()
{ {
if ( !pLocationData ) if ( !pLocationData )
{ {
pLocationData = new ScPreviewLocationData( &pDocShell->GetDocument(), this ); pLocationData.reset( new ScPreviewLocationData( &pDocShell->GetDocument(), this ) );
bLocationValid = false; bLocationValid = false;
} }
if ( !bLocationValid ) if ( !bLocationValid )
{ {
pLocationData->Clear(); pLocationData->Clear();
DoPrint( pLocationData ); DoPrint( pLocationData.get() );
bLocationValid = true; bLocationValid = true;
} }
return *pLocationData; return *pLocationData;
......
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