Kaydet (Commit) db686e8a authored tarafından Zolnai Tamás's avatar Zolnai Tamás

Logically dead code related to embedded stream name in SwGrfNode\SdrGrafObj

See also:
286e2f5c

Since embedded URL exists until the first swap in these lines
are not needed anymore.

Change-Id: Ie6bf8efe7808cf42f20f7b4b3f8cb927555c0ea8
üst b0c97aec
...@@ -991,7 +991,6 @@ void SdrGrafObj::SetModel( SdrModel* pNewModel ) ...@@ -991,7 +991,6 @@ void SdrGrafObj::SetModel( SdrModel* pNewModel )
if( pGraphic->HasUserData() ) if( pGraphic->HasUserData() )
{ {
ForceSwapIn(); ForceSwapIn();
pGraphic->SetUserData();
} }
if( pGraphicLink != NULL ) if( pGraphicLink != NULL )
...@@ -1282,7 +1281,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) ...@@ -1282,7 +1281,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
{ {
const sal_uIntPtr nSwapMode = pModel->GetSwapGraphicsMode(); const sal_uIntPtr nSwapMode = pModel->GetSwapGraphicsMode();
if( ( pGraphic->HasUserData() || pGraphicLink ) && if( ( pGraphicLink ) &&
( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) ) ( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) )
{ {
pRet = GRFMGR_AUTOSWAPSTREAM_LINK; pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
...@@ -1392,22 +1391,7 @@ Reference< XInputStream > SdrGrafObj::getInputStream() ...@@ -1392,22 +1391,7 @@ Reference< XInputStream > SdrGrafObj::getInputStream()
if( pModel ) if( pModel )
{ {
// can be loaded from the original document stream later if( pGraphic && GetGraphic().IsLink() )
if( pGraphic && pGraphic->HasUserData() )
{
::comphelper::LifecycleProxy proxy;
xStream.set(
pModel->GetDocumentStream(pGraphic->GetUserData(), proxy));
// fdo#46340: this may look completely insane, and it is,
// but it also prevents a crash: the LifecycleProxy will go out
// of scope, but the xStream must be returned; the UcbStreamHelper
// will actually copy the xStream to a temp file (because it is
// not seekable), which makes it not crash...
SvStream *const pStream =
utl::UcbStreamHelper::CreateStream(xStream);
xStream.set(new utl::OInputStreamWrapper(pStream, true));
}
else if( pGraphic && GetGraphic().IsLink() )
{ {
Graphic aGraphic( GetGraphic() ); Graphic aGraphic( GetGraphic() );
GfxLink aLink( aGraphic.GetLink() ); GfxLink aLink( aGraphic.GetLink() );
......
...@@ -608,7 +608,7 @@ bool SwGrfNode::SwapOut() ...@@ -608,7 +608,7 @@ bool SwGrfNode::SwapOut()
maGrfObj.GetType() != GRAPHIC_NONE && maGrfObj.GetType() != GRAPHIC_NONE &&
!maGrfObj.IsSwappedOut() && !bInSwapIn ) !maGrfObj.IsSwappedOut() && !bInSwapIn )
{ {
if( refLink.Is() || HasEmbeddedStreamName() ) if( refLink.Is() )
{ {
// written graphics and links are removed here // written graphics and links are removed here
return maGrfObj.SwapOut( GRFMGR_AUTOSWAPSTREAM_LINK ); return maGrfObj.SwapOut( GRFMGR_AUTOSWAPSTREAM_LINK );
...@@ -931,32 +931,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const ...@@ -931,32 +931,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
// copy formats into the other document // copy formats into the other document
SwGrfFmtColl* pColl = pDoc->CopyGrfColl( *GetGrfColl() ); SwGrfFmtColl* pColl = pDoc->CopyGrfColl( *GetGrfColl() );
Graphic aTmpGrf; Graphic aTmpGrf = GetGrf();
SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink;
if( !pLink && HasEmbeddedStreamName() )
{
try
{
const StreamAndStorageNames aNames = lcl_GetStreamStorageNames( maGrfObj.GetUserData() );
uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aNames.sStorage );
SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aNames.sStream );
if ( pStrm )
{
const OUString aURL(maGrfObj.GetUserData());
GraphicFilter::GetGraphicFilter().ImportGraphic(aTmpGrf, aURL, *pStrm);
delete pStrm;
}
}
catch (const uno::Exception& e)
{
// #i48434#
SAL_WARN("sw.core", "<SwGrfNode::MakeCopy(..)> - unhandled exception!" << e.Message);
}
}
else
{
aTmpGrf = GetGrf();
}
const sfx2::LinkManager& rMgr = getIDocumentLinksAdministration()->GetLinkManager(); const sfx2::LinkManager& rMgr = getIDocumentLinksAdministration()->GetLinkManager();
OUString sFile, sFilter; OUString sFile, sFilter;
...@@ -1009,34 +984,6 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj ) ...@@ -1009,34 +984,6 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj )
else else
{ {
pRet = GRFMGR_AUTOSWAPSTREAM_TEMP; pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
if( HasEmbeddedStreamName() )
{
try
{
const StreamAndStorageNames aNames = lcl_GetStreamStorageNames( maGrfObj.GetUserData() );
uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aNames.sStorage );
SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aNames.sStream );
if ( pStrm )
{
if( pGrfObj->IsInSwapOut() )
{
pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
}
else
{
ImportGraphic( *pStrm );
pRet = GRFMGR_AUTOSWAPSTREAM_LOADED;
}
delete pStrm;
}
}
catch (const uno::Exception&)
{
// #i48434#
OSL_FAIL( "<SwapGraphic> - unhandled exception!" );
}
}
} }
return (sal_IntPtr)pRet; return (sal_IntPtr)pRet;
......
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