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

fdo#86573: Impress does not show pictures anymore

Regression from:
286e2f5c

Sometimes SdrGrafObj import the image file just as a
preview (with low resolution) and late when the real
picture is needed it just throws this preview and tries
to load the image again.
This preview works only with package URL so in this
case we should not forget that URL.

Plus two other related potential image loss situation:
- SetUserData() is called with empty image URL
- Image preview is thrown when we actually have no
package URL from we can import the image again.

Change-Id: Ib21f400eb6d28133e8598e6b201209e5dd1a976f
üst af90d610
...@@ -430,7 +430,8 @@ void GraphicObject::SetUserData() ...@@ -430,7 +430,8 @@ void GraphicObject::SetUserData()
void GraphicObject::SetUserData( const OUString& rUserData ) void GraphicObject::SetUserData( const OUString& rUserData )
{ {
maUserData = rUserData; maUserData = rUserData;
SetSwapState(); if( !rUserData.isEmpty() )
SetSwapState();
} }
void GraphicObject::SetSwapStreamHdl() void GraphicObject::SetSwapStreamHdl()
......
...@@ -562,7 +562,7 @@ OUString SdrGrafObj::GetGrafStreamURL() const ...@@ -562,7 +562,7 @@ OUString SdrGrafObj::GetGrafStreamURL() const
void SdrGrafObj::ForceSwapIn() const void SdrGrafObj::ForceSwapIn() const
{ {
if( mbIsPreview ) if( mbIsPreview && pGraphic->HasUserData() )
{ {
// removing preview graphic // removing preview graphic
const OUString aUserData( pGraphic->GetUserData() ); const OUString aUserData( pGraphic->GetUserData() );
...@@ -1347,8 +1347,16 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) ...@@ -1347,8 +1347,16 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
aGraphic, aUserData, *pStream, aGraphic, aUserData, *pStream,
GRFILTER_FORMAT_DONTKNOW, NULL, 0, pFilterData.get())) GRFILTER_FORMAT_DONTKNOW, NULL, 0, pFilterData.get()))
{ {
const OUString aNewUserData( pGraphic->GetUserData() );
pGraphic->SetGraphic( aGraphic ); pGraphic->SetGraphic( aGraphic );
pGraphic->SetUserData(); if( mbIsPreview )
{
pGraphic->SetUserData(aNewUserData);
}
else
{
pGraphic->SetUserData();
}
// Graphic successfully swapped in. // Graphic successfully swapped in.
pRet = GRFMGR_AUTOSWAPSTREAM_LOADED; pRet = GRFMGR_AUTOSWAPSTREAM_LOADED;
......
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