incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1167641 - /incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
Date Sat, 10 Sep 2011 22:49:30 GMT
Author: erack
Date: Sat Sep 10 22:49:30 2011
New Revision: 1167641

URL: http://svn.apache.org/viewvc?rev=1167641&view=rev
Log:
impress212: #i97241# fixed relative links

# User sj <sj@openoffice.org>

Modified:
    incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx

Modified: incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx?rev=1167641&r1=1167640&r2=1167641&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx Sat Sep 10 22:49:30 2011
@@ -3821,7 +3821,7 @@ static void lcl_ApplyCropping( const Dff
 SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, const
DffObjData& rObjData ) const
 {
 	SdrObject*  pRet = NULL;
-	String      aFilename;
+	String      aFileName;
 	String      aLinkFileName, aLinkFilterName;
 	Rectangle	aVisArea;
 
@@ -3834,7 +3834,7 @@ SdrObject* SvxMSDffManager::ImportGraphi
 	{
 		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
@@ -4010,30 +4010,22 @@ SdrObject* SvxMSDffManager::ImportGraphi
 
 			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* pGrfFilter = GraphicFilter::GetGraphicFilter();
-					aFilterName = pGrfFilter->GetImportFormatName(
-					                pGrfFilter->GetImportFormatNumberForShortName( aURLObj.getExtension()
) );
+					aLinkFilterName = pGrfFilter->GetImportFormatName(
+					                pGrfFilter->GetImportFormatNumberForShortName( aAbsURL.getExtension()
) );
+					aLinkFileName = aAbsURL.GetMainURL( INetURLObject::DECODE_TO_IURI );
 				}
-
-				aLinkFileName = aName;
-				aLinkFilterName = aFilterName;
+				else
+					aLinkFileName = aFileName;
 			}
 		}
 
@@ -4047,11 +4039,11 @@ SdrObject* SvxMSDffManager::ImportGraphi
 			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



Mime
View raw message