summaryrefslogtreecommitdiff
path: root/filter/source/msfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-09-21 09:05:19 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-09-21 14:35:32 +0200
commitc20afb30e724361b76257fec0f3f7b9b90f8d58c (patch)
tree2bfa5fa438c0999ac75de07074311e88a7c16bfc /filter/source/msfilter
parentda730a3df0dd8a8b1ac0eca09ccc9bba04830802 (diff)
new won't return null, so drop conditional now
Change-Id: I08e0bac8215f5aff92dc4c79caea4d3275b9c08e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140309 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter/source/msfilter')
-rw-r--r--filter/source/msfilter/svdfppt.cxx177
1 files changed, 87 insertions, 90 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index f0aed23a3363..7ccf84d1941b 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -1858,122 +1858,119 @@ rtl::Reference<SdrObject> SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
{
pDest->Seek(0);
Storage* pObjStor = new Storage(*pDest, true);
- if (pObjStor)
+ tools::SvRef<SotStorage> xObjStor( new SotStorage( pObjStor ) );
+ if ( xObjStor.is() && !xObjStor->GetError() )
{
- tools::SvRef<SotStorage> xObjStor( new SotStorage( pObjStor ) );
- if ( xObjStor.is() && !xObjStor->GetError() )
+ if ( xObjStor->GetClassName() == SvGlobalName() )
{
- if ( xObjStor->GetClassName() == SvGlobalName() )
- {
- xObjStor->SetClass( SvGlobalName( pObjStor->GetClassId() ), pObjStor->GetFormat(), pObjStor->GetUserName() );
+ xObjStor->SetClass( SvGlobalName( pObjStor->GetClassId() ), pObjStor->GetFormat(), pObjStor->GetUserName() );
+ }
+ tools::SvRef<SotStorageStream> xSrcTst = xObjStor->OpenSotStream( "\1Ole" );
+ if ( xSrcTst.is() )
+ {
+ sal_uInt8 aTestA[ 10 ];
+ bool bGetItAsOle = (sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
+ if ( !bGetItAsOle )
+ { // maybe there is a contents stream in here
+ xSrcTst = xObjStor->OpenSotStream( "Contents", StreamMode::READWRITE | StreamMode::NOCREATE );
+ bGetItAsOle = (xSrcTst.is() &&
+ sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
}
- tools::SvRef<SotStorageStream> xSrcTst = xObjStor->OpenSotStream( "\1Ole" );
- if ( xSrcTst.is() )
+ if ( bGetItAsOle )
{
- sal_uInt8 aTestA[ 10 ];
- bool bGetItAsOle = (sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
- if ( !bGetItAsOle )
- { // maybe there is a contents stream in here
- xSrcTst = xObjStor->OpenSotStream( "Contents", StreamMode::READWRITE | StreamMode::NOCREATE );
- bGetItAsOle = (xSrcTst.is() &&
- sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
- }
- if ( bGetItAsOle )
+ OUString aNm;
+ // if ( nSvxMSDffOLEConvFlags )
{
- OUString aNm;
- // if ( nSvxMSDffOLEConvFlags )
+ uno::Reference < embed::XStorage > xDestStorage( rOe.pShell->GetStorage() );
+ uno::Reference < embed::XEmbeddedObject > xObj =
+ CheckForConvertToSOObj(nSvxMSDffOLEConvFlags, *xObjStor, xDestStorage, rGraf, rVisArea, maBaseURL);
+ if( xObj.is() )
{
- uno::Reference < embed::XStorage > xDestStorage( rOe.pShell->GetStorage() );
- uno::Reference < embed::XEmbeddedObject > xObj =
- CheckForConvertToSOObj(nSvxMSDffOLEConvFlags, *xObjStor, xDestStorage, rGraf, rVisArea, maBaseURL);
- if( xObj.is() )
- {
- rOe.pShell->getEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aNm );
+ rOe.pShell->getEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aNm );
- svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
+ svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
- // TODO/LATER: need MediaType for Graphic
- aObj.SetGraphic( rGraf, OUString() );
- pRet = new SdrOle2Obj(
- *pSdrModel,
- aObj,
- aNm,
- rBoundRect);
- }
+ // TODO/LATER: need MediaType for Graphic
+ aObj.SetGraphic( rGraf, OUString() );
+ pRet = new SdrOle2Obj(
+ *pSdrModel,
+ aObj,
+ aNm,
+ rBoundRect);
}
- if ( !pRet && ( rOe.nType == PPT_PST_ExControl ) )
- {
- uno::Reference< frame::XModel > xModel( rOe.pShell->GetModel() );
- PPTConvertOCXControls aPPTConvertOCXControls( this, xModel, m_eCurrentPageKind );
- css::uno::Reference< css::drawing::XShape > xShape;
- if ( aPPTConvertOCXControls.ReadOCXStream( xObjStor, &xShape ) )
- pRet = SdrObject::getSdrObjectFromXShape(xShape);
+ }
+ if ( !pRet && ( rOe.nType == PPT_PST_ExControl ) )
+ {
+ uno::Reference< frame::XModel > xModel( rOe.pShell->GetModel() );
+ PPTConvertOCXControls aPPTConvertOCXControls( this, xModel, m_eCurrentPageKind );
+ css::uno::Reference< css::drawing::XShape > xShape;
+ if ( aPPTConvertOCXControls.ReadOCXStream( xObjStor, &xShape ) )
+ pRet = SdrObject::getSdrObjectFromXShape(xShape);
- }
- if ( !pRet )
- {
- aNm = rOe.pShell->getEmbeddedObjectContainer().CreateUniqueObjectName();
+ }
+ if ( !pRet )
+ {
+ aNm = rOe.pShell->getEmbeddedObjectContainer().CreateUniqueObjectName();
- // object is not an own object
- const css::uno::Reference < css::embed::XStorage >& rStorage = rOe.pShell->GetStorage();
- if (rStorage.is())
+ // object is not an own object
+ const css::uno::Reference < css::embed::XStorage >& rStorage = rOe.pShell->GetStorage();
+ if (rStorage.is())
+ {
+ tools::SvRef<SotStorage> xTarget = SotStorage::OpenOLEStorage(rStorage, aNm, StreamMode::READWRITE);
+ if (xObjStor.is() && xTarget.is())
{
- tools::SvRef<SotStorage> xTarget = SotStorage::OpenOLEStorage(rStorage, aNm, StreamMode::READWRITE);
- if (xObjStor.is() && xTarget.is())
- {
- xObjStor->CopyTo(xTarget.get());
- if (!xTarget->GetError())
- xTarget->Commit();
- }
- xTarget.clear();
+ xObjStor->CopyTo(xTarget.get());
+ if (!xTarget->GetError())
+ xTarget->Commit();
}
+ xTarget.clear();
+ }
- uno::Reference < embed::XEmbeddedObject > xObj =
- rOe.pShell->getEmbeddedObjectContainer().GetEmbeddedObject( aNm );
- if ( xObj.is() )
+ uno::Reference < embed::XEmbeddedObject > xObj =
+ rOe.pShell->getEmbeddedObjectContainer().GetEmbeddedObject( aNm );
+ if ( xObj.is() )
+ {
+ if ( rOe.nAspect != embed::Aspects::MSOLE_ICON )
{
- if ( rOe.nAspect != embed::Aspects::MSOLE_ICON )
+ //TODO/LATER: keep on hacking?!
+ // we don't want to be modified
+ //xInplaceObj->EnableSetModified( sal_False );
+ if ( rVisArea.IsEmpty() )
{
- //TODO/LATER: keep on hacking?!
- // we don't want to be modified
- //xInplaceObj->EnableSetModified( sal_False );
- if ( rVisArea.IsEmpty() )
- {
- MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( rOe.nAspect ) );
- Size aSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
- aGraphic.GetPrefMapMode(), MapMode( aMapUnit ) ) );
-
- awt::Size aSz;
- aSz.Width = aSize.Width();
- aSz.Height = aSize.Height();
- xObj->setVisualAreaSize( rOe.nAspect, aSz );
- }
- else
- {
- awt::Size aSize( rVisArea.GetSize().Width(), rVisArea.GetSize().Height() );
- xObj->setVisualAreaSize( rOe.nAspect, aSize );
- }
- //xInplaceObj->EnableSetModified( sal_True );
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( rOe.nAspect ) );
+ Size aSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
+ aGraphic.GetPrefMapMode(), MapMode( aMapUnit ) ) );
+
+ awt::Size aSz;
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( rOe.nAspect, aSz );
+ }
+ else
+ {
+ awt::Size aSize( rVisArea.GetSize().Width(), rVisArea.GetSize().Height() );
+ xObj->setVisualAreaSize( rOe.nAspect, aSize );
}
+ //xInplaceObj->EnableSetModified( sal_True );
+ }
- svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
+ svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
- // TODO/LATER: need MediaType for Graphic
- aObj.SetGraphic( aGraphic, OUString() );
+ // TODO/LATER: need MediaType for Graphic
+ aObj.SetGraphic( aGraphic, OUString() );
- pRet = new SdrOle2Obj(
- *pSdrModel,
- aObj,
- aNm,
- rBoundRect);
- }
+ pRet = new SdrOle2Obj(
+ *pSdrModel,
+ aObj,
+ aNm,
+ rBoundRect);
}
}
}
}
}
- aTmpFile.CloseStream();
}
+ aTmpFile.CloseStream();
}
}
rStCtrl.Seek( nOldPos );