diff options
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 8 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeEngine.cxx | 41 |
2 files changed, 27 insertions, 22 deletions
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index c0f022282699..70a5ae3ee8ed 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -2785,7 +2785,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportPPT(SvStream &rStream) ::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell(SfxObjectCreateMode::EMBEDDED, false, DocumentType::Impress); SdDrawDocument *pDoc = xDocShRef->GetDoc(); - bRet = ImportPPT(pDoc, *xDocStream, *xStorage, aSrcMed); + try + { + bRet = ImportPPT(pDoc, *xDocStream, *xStorage, aSrcMed); + } + catch (...) + { + } xDocShRef->DoClose(); } diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index de998eb422e5..6a8dd7d3986e 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -298,29 +298,27 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render() bool bFlipH = aCustomShape2d.IsFlipHorz(); bool bLineGeometryNeededOnly = bTextPathOn; - SdrObject* pRenderedShape = aCustomShape2d.CreateObject( bLineGeometryNeededOnly ); - if ( pRenderedShape ) + std::unique_ptr<SdrObject, SdrObjectFreeOp> xRenderedShape(aCustomShape2d.CreateObject(bLineGeometryNeededOnly)); + if (xRenderedShape) { if ( bTextPathOn ) { - SdrObject* pRenderedFontWork( + std::unique_ptr<SdrObject, SdrObjectFreeOp> xRenderedFontWork( EnhancedCustomShapeFontWork::CreateFontWork( - pRenderedShape, + xRenderedShape.get(), rSdrObjCustomShape)); - if ( pRenderedFontWork ) + if (xRenderedFontWork) { - SdrObject::Free( pRenderedShape ); - pRenderedShape = pRenderedFontWork; + xRenderedShape = std::move(xRenderedFontWork); } } - SdrObject* pRenderedShape3d = EnhancedCustomShape3d::Create3DObject(pRenderedShape, rSdrObjCustomShape); - if ( pRenderedShape3d ) + std::unique_ptr<SdrObject, SdrObjectFreeOp> xRenderedShape3d(EnhancedCustomShape3d::Create3DObject(xRenderedShape.get(), rSdrObjCustomShape)); + if (xRenderedShape3d) { bFlipV = bFlipH = false; nRotateAngle = 0; - SdrObject::Free( pRenderedShape ); - pRenderedShape = pRenderedShape3d; + xRenderedShape = std::move(xRenderedShape3d); } tools::Rectangle aRect(rSdrObjCustomShape.GetSnapRect()); @@ -336,43 +334,44 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render() nTan = -nTan; } - pRenderedShape->Shear(rSdrObjCustomShape.GetSnapRect().Center(), nShearAngle, nTan, false); + xRenderedShape->Shear(rSdrObjCustomShape.GetSnapRect().Center(), nShearAngle, nTan, false); } if(nRotateAngle ) { double a = nRotateAngle * F_PI18000; - pRenderedShape->NbcRotate(rSdrObjCustomShape.GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a )); + xRenderedShape->NbcRotate(rSdrObjCustomShape.GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a )); } if ( bFlipV ) { Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 ); Point aRight( aLeft.X() + 1000, aLeft.Y() ); - pRenderedShape->NbcMirror( aLeft, aRight ); + xRenderedShape->NbcMirror( aLeft, aRight ); } if ( bFlipH ) { Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() ); Point aBottom( aTop.X(), aTop.Y() + 1000 ); - pRenderedShape->NbcMirror( aTop, aBottom ); + xRenderedShape->NbcMirror( aTop, aBottom ); } - pRenderedShape->NbcSetStyleSheet(rSdrObjCustomShape.GetStyleSheet(), true); - pRenderedShape->RecalcSnapRect(); + xRenderedShape->NbcSetStyleSheet(rSdrObjCustomShape.GetStyleSheet(), true); + xRenderedShape->RecalcSnapRect(); } if ( mbForceGroupWithText ) { - pRenderedShape = ImplForceGroupWithText( + xRenderedShape.reset(ImplForceGroupWithText( rSdrObjCustomShape, - pRenderedShape); + xRenderedShape.release())); } Reference< drawing::XShape > xShape; - if ( pRenderedShape ) + if (xRenderedShape) { - aCustomShape2d.ApplyGluePoints( pRenderedShape ); + aCustomShape2d.ApplyGluePoints(xRenderedShape.get()); + SdrObject* pRenderedShape = xRenderedShape.release(); xShape = SvxDrawPage::CreateShapeByTypeAndInventor( pRenderedShape->GetObjIdentifier(), pRenderedShape->GetObjInventor(), pRenderedShape ); } |