diff options
author | erack <er@openoffice.org> | 2011-09-10 22:49:30 +0000 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2011-11-23 23:34:58 +0100 |
commit | 363868f040caab7b410ed480553855ffe42aa162 (patch) | |
tree | 4e3acc8548cde24074495ff764c32634fe8c42c4 /filter | |
parent | 70b02c18b95ef19bd224788efa491671e762ae23 (diff) |
impress212: #i97241# fixed relative links
* found as LGPLv3-only fix at svn rev 1167641 (http://svn.apache.org/viewvc?view=revision&revision=1167641)
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 47077dbc3c6b..49b95891421b 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4174,7 +4174,7 @@ static void lcl_ApplyCropping( const DffPropSet& rPropSet, SfxItemSet* pSet, Gra SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, const DffObjData& rObjData ) { SdrObject* pRet = NULL; - String aFilename; + String aFileName; String aLinkFileName, aLinkFilterName; Rectangle aVisArea; @@ -4187,7 +4187,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons { Graphic aGraf; // be sure this graphic is deleted before swapping out if( SeekToContent( DFF_Prop_pibName, rSt ) ) - MSDFFReadZString( rSt, aFilename, GetPropertyValue( DFF_Prop_pibName ), sal_True ); + MSDFFReadZString( rSt, aFileName, GetPropertyValue( DFF_Prop_pibName ), sal_True ); // UND, ODER folgendes: if( !( eFlags & mso_blipflagDoNotSave ) ) // Grafik embedded @@ -4362,30 +4362,22 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons if( bLinkGrf && !bGrfRead ) // sj: #i55484# if the graphic was embedded ( bGrfRead == true ) then { // we do not need to set a link. TODO: not to lose the information where the graphic is linked from - UniString aName( ::URIHelper::SmartRel2Abs( INetURLObject(maBaseURL), aFilename, URIHelper::GetMaybeFileHdl(), true, false, - INetURLObject::WAS_ENCODED, - INetURLObject::DECODE_UNAMBIGUOUS ) ); - - String aFilterName; - INetURLObject aURLObj( aName ); - - if( aURLObj.GetProtocol() == INET_PROT_NOT_VALID ) + INetURLObject aAbsURL; + if ( !INetURLObject( maBaseURL ).GetNewAbsURL( ByteString( aFileName, RTL_TEXTENCODING_UTF8 ), &aAbsURL ) ) { String aValidURL; - - if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aValidURL ) ) - aURLObj = INetURLObject( aValidURL ); + if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aFileName, aValidURL ) ) + aAbsURL = INetURLObject( aValidURL ); } - - if( aURLObj.GetProtocol() != INET_PROT_NOT_VALID ) + if( aAbsURL.GetProtocol() != INET_PROT_NOT_VALID ) { GraphicFilter &rGrfFilter = GraphicFilter::GetGraphicFilter(); - aFilterName = rGrfFilter.GetImportFormatName( - rGrfFilter.GetImportFormatNumberForShortName( aURLObj.getExtension() ) ); + aLinkFilterName = rGrfFilter.GetImportFormatName( + rGrfFilter.GetImportFormatNumberForShortName( aAbsURL.getExtension() ) ); + aLinkFileName = aAbsURL.GetMainURL( INetURLObject::DECODE_TO_IURI ); } - - aLinkFileName = aName; - aLinkFilterName = aFilterName; + else + aLinkFileName = aFileName; } } @@ -4399,11 +4391,11 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons if ( ( eFlags & mso_blipflagType ) != mso_blipflagComment ) { INetURLObject aURL; - aURL.SetSmartURL( aFilename ); + aURL.SetSmartURL( aFileName ); pRet->SetName( aURL.getBase() ); } else - pRet->SetName( aFilename ); + pRet->SetName( aFileName ); } } pRet->SetModel( pSdrModel ); // fuer GraphicLink erforderlich |