summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-08-28 15:54:41 +0200
committerEike Rathke <erack@redhat.com>2017-08-29 12:42:52 +0200
commit408b260c4f2873439473d8520352c1b3acaa157a (patch)
treed2397791e19766df81250fe0c61a958f22f16776
parentd3f1fa3cf190b83d585ec3d1b1a8e5b0896c8ea1 (diff)
Add keeper for FmFormView* pDrawView
So later we can bail out at any point without having to manually keep track of it. Change-Id: I4414456b870d4a82b4baf8209bdabcc5a8b63c35
-rw-r--r--sc/source/ui/unoobj/docuno.cxx26
1 files changed, 17 insertions, 9 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index c532ed6b3fda..67659f7076e4 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1789,15 +1789,27 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
SCTAB nTab = pPrintFuncCache->GetTabForPage( nRenderer );
ScDocument& rDoc = pDocShell->GetDocument();
- FmFormView* pDrawView = nullptr;
+ struct DrawViewKeeper
+ {
+ FmFormView* mpDrawView;
+ DrawViewKeeper() : mpDrawView(nullptr) {}
+ ~DrawViewKeeper()
+ {
+ if (mpDrawView)
+ {
+ mpDrawView->HideSdrPage();
+ delete mpDrawView;
+ }
+ }
+ } aDrawViewKeeper;
ScDrawLayer* pModel = rDoc.GetDrawLayer();
if( pModel )
{
- pDrawView = new FmFormView( pModel, pDev );
- pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
- pDrawView->SetPrintPreview();
+ aDrawViewKeeper.mpDrawView = new FmFormView( pModel, pDev );
+ aDrawViewKeeper.mpDrawView->ShowSdrPage(aDrawViewKeeper.mpDrawView->GetModel()->GetPage(nTab));
+ aDrawViewKeeper.mpDrawView->SetPrintPreview();
}
ScRange aRange;
@@ -1812,7 +1824,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
// pages of the same sheet
ScPrintFunc aFunc( pDev, pDocShell, nTab, pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange, &aStatus.GetOptions() );
- aFunc.SetDrawView( pDrawView );
+ aFunc.SetDrawView( aDrawViewKeeper.mpDrawView );
aFunc.SetRenderFlag( true );
if( aStatus.GetMode() == SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS )
aFunc.SetExclusivelyDrawOleAndDrawObjects();
@@ -1945,10 +1957,6 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
}
rBookmarks.clear();
}
-
- if ( pDrawView )
- pDrawView->HideSdrPage();
- delete pDrawView;
}
// XLinkTargetSupplier