sc/source/ui/app/drwtrans.cxx | 2 +- sc/source/ui/app/transobj.cxx | 5 ++--- sc/source/ui/docshell/docsh4.cxx | 4 ++-- sc/source/ui/inc/viewdata.hxx | 10 ++++++---- sc/source/ui/unoobj/docuno.cxx | 3 +-- sc/source/ui/view/tabview.cxx | 2 +- sc/source/ui/view/viewdata.cxx | 11 +++++++++++ 7 files changed, 24 insertions(+), 13 deletions(-)
New commits: commit 957adc83e67276805c6dcd7be1ea23c142c49306 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Sep 14 16:36:48 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Sep 15 20:07:35 2020 +0200 establish ScViewData always ctored from ScDocShell& or ScDocument& Change-Id: Ie4d9520fe2ce69bbfc5fa755cce165f01947a535 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102752 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index dcb90a5e06ed..2c3c11ca6b9b 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -730,7 +730,7 @@ void ScDrawTransferObj::InitDocShell() aViewOpt.SetOption( VOPT_GRID, false ); rDestDoc.SetViewOptions( aViewOpt ); - ScViewData aViewData( pDocSh, nullptr ); + ScViewData aViewData( *pDocSh, nullptr ); aViewData.SetTabNo( 0 ); aViewData.SetScreen( aDestArea ); aViewData.SetCurX( 0 ); diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 3b2d355fb0b7..d296422ae84d 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -99,8 +99,7 @@ void ScTransferObj::PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPr tools::Rectangle aBound( Point(), pDev->GetOutputSize() ); //! use size from clip area? - ScViewData aViewData(nullptr,nullptr); - aViewData.InitData( *pDoc ); + ScViewData aViewData(*pDoc); aViewData.SetTabNo( rBlock.aEnd.Tab() ); aViewData.SetScreen( rBlock.aStart.Col(), rBlock.aStart.Row(), @@ -757,7 +756,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) pDestPool->CopyStyleFrom( pStylePool, aStyleName, SfxStyleFamily::Page ); } - ScViewData aViewData( pDocSh, nullptr ); + ScViewData aViewData( *pDocSh, nullptr ); aViewData.SetScreen( nStartX,nStartY, nEndX,nEndY ); aViewData.SetCurX( nStartX ); aViewData.SetCurY( nStartY ); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 6f25468f716b..d4b8bf689208 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2132,7 +2132,7 @@ void ScDocShell::Draw( OutputDevice* pDev, const JobSetup & /* rSetup */, sal_uI if ( nAspect == ASPECT_THUMBNAIL ) { tools::Rectangle aBoundRect = GetVisArea( ASPECT_THUMBNAIL ); - ScViewData aTmpData( this, nullptr ); + ScViewData aTmpData( *this, nullptr ); aTmpData.SetTabNo(nVisTab); SnapVisArea( aBoundRect ); aTmpData.SetScreen( aBoundRect ); @@ -2142,7 +2142,7 @@ void ScDocShell::Draw( OutputDevice* pDev, const JobSetup & /* rSetup */, sal_uI { tools::Rectangle aOldArea = SfxObjectShell::GetVisArea(); tools::Rectangle aNewArea = aOldArea; - ScViewData aTmpData( this, nullptr ); + ScViewData aTmpData( *this, nullptr ); aTmpData.SetTabNo(nVisTab); SnapVisArea( aNewArea ); if ( aNewArea != aOldArea && (m_aDocument.GetPosLeft() > 0 || m_aDocument.GetPosTop() > 0) ) diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index d79d2e0b84ae..faebd6ee5aa6 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -345,12 +345,14 @@ private: SAL_DLLPRIVATE void EnsureTabDataSize(size_t nSize); SAL_DLLPRIVATE void UpdateCurrentTab(); -public: - ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ); - ~ScViewData() COVERITY_NOEXCEPT_FALSE; - + ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ); void InitData(ScDocument& rDocument); +public: + ScViewData( ScDocShell& rDocSh, ScTabViewShell* pViewSh ); + ScViewData( ScDocument& rDoc ); + ~ScViewData() COVERITY_NOEXCEPT_FALSE; + ScDocShell* GetDocShell() const { return pDocShell; } ScDocFunc& GetDocFunc() const; ScDBFunc* GetView() const { return pView; } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 3ff67bb64af6..b99ed1692f13 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2080,8 +2080,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec tools::Rectangle aBound( Point(), pDev->GetOutputSize()); - ScViewData aViewData(nullptr,nullptr); - aViewData.InitData( rDoc ); + ScViewData aViewData(rDoc); aViewData.SetTabNo( aRange.aStart.Tab() ); aViewData.SetScreen( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() ); diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index c177248846e6..e8b9e037bb1d 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -171,7 +171,7 @@ bool lcl_HasRowOutline( const ScViewData& rViewData ) ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) : pFrameWin( pParent ), - aViewData( &rDocSh, pViewShell ), + aViewData( rDocSh, pViewShell ), aFunctionSet( &aViewData ), aHdrFunc( &aViewData ), aVScrollTop( VclPtr<ScrollBar>::Create( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ) ), diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 6af89998cd99..ada3884b5af4 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -743,6 +743,17 @@ ScSplitPos ScViewDataTable::SanitizeWhichActive() const const ScSheetLimits gaNoShellSheetLimits(MAXCOL, MAXROW); +ScViewData::ScViewData(ScDocShell& rDocSh, ScTabViewShell* pViewSh) + : ScViewData(&rDocSh, pViewSh) +{ +} + +ScViewData::ScViewData(ScDocument& rDoc) + : ScViewData(nullptr, nullptr) +{ + InitData(rDoc); +} + ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) : nPPTX(0.0), nPPTY(0.0), _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits