Kaydet (Commit) b46236f5 authored tarafından Noel Grandin's avatar Noel Grandin

convert svx/source/xml/*.cxx from String to OUString

Change-Id: Id300414c0b34af4cc8c8a5cd49d1a17ba56f9b57
üst 78c96d83
...@@ -381,7 +381,7 @@ sal_Bool SvXMLEmbeddedObjectHelper::ImplReadObject( ...@@ -381,7 +381,7 @@ sal_Bool SvXMLEmbeddedObjectHelper::ImplReadObject(
if( !xCntnrStor.is() && !pTemp ) if( !xCntnrStor.is() && !pTemp )
return sal_False; return sal_False;
String aSrcObjName( rObjName ); OUString aSrcObjName( rObjName );
comphelper::EmbeddedObjectContainer& rContainer = mpDocPersist->getEmbeddedObjectContainer(); comphelper::EmbeddedObjectContainer& rContainer = mpDocPersist->getEmbeddedObjectContainer();
// Is the object name unique? // Is the object name unique?
......
...@@ -120,14 +120,14 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId ) ...@@ -120,14 +120,14 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId )
if( aGraphic.GetType() == GRAPHIC_BITMAP ) if( aGraphic.GetType() == GRAPHIC_BITMAP )
{ {
GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
String aFormat; OUString aFormat;
if( aGraphic.IsAnimated() ) if( aGraphic.IsAnimated() )
aFormat = String( "gif" ); aFormat = "gif";
else else
aFormat = String( "png" ); aFormat = "png";
bRet = ( rFilter.ExportGraphic( aGraphic, String(), *pStm, rFilter.GetExportFormatNumberForShortName( aFormat ) ) == 0 ); bRet = ( rFilter.ExportGraphic( aGraphic, "", *pStm, rFilter.GetExportFormatNumberForShortName( aFormat ) ) == 0 );
} }
else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE ) else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE )
{ {
...@@ -283,7 +283,7 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject() ...@@ -283,7 +283,7 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
mpOStm->Seek( 0 ); mpOStm->Seek( 0 );
sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW; sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW;
sal_uInt16 pDeterminedFormat = GRFILTER_FORMAT_DONTKNOW; sal_uInt16 pDeterminedFormat = GRFILTER_FORMAT_DONTKNOW;
GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, String(), *mpOStm ,nFormat,&pDeterminedFormat ); GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, "", *mpOStm ,nFormat,&pDeterminedFormat );
if (pDeterminedFormat == GRFILTER_FORMAT_DONTKNOW) if (pDeterminedFormat == GRFILTER_FORMAT_DONTKNOW)
{ {
...@@ -326,7 +326,7 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject() ...@@ -326,7 +326,7 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
if (nStreamLen_) if (nStreamLen_)
{ {
pDest->Seek(0L); pDest->Seek(0L);
GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, String(), *pDest ,nFormat,&pDeterminedFormat ); GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, "", *pDest ,nFormat,&pDeterminedFormat );
} }
} }
delete pDest; delete pDest;
...@@ -370,18 +370,18 @@ sal_Bool SvXMLGraphicHelper::ImplGetStreamNames( const OUString& rURLStr, ...@@ -370,18 +370,18 @@ sal_Bool SvXMLGraphicHelper::ImplGetStreamNames( const OUString& rURLStr,
OUString& rPictureStorageName, OUString& rPictureStorageName,
OUString& rPictureStreamName ) OUString& rPictureStreamName )
{ {
String aURLStr( rURLStr ); OUString aURLStr( rURLStr );
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
if( aURLStr.Len() ) if( !aURLStr.isEmpty() )
{ {
aURLStr = aURLStr.GetToken( comphelper::string::getTokenCount(aURLStr, ':') - 1, ':' ); aURLStr = aURLStr.getToken( comphelper::string::getTokenCount(aURLStr, ':') - 1, ':' );
const sal_uInt32 nTokenCount = comphelper::string::getTokenCount(aURLStr, '/'); const sal_uInt32 nTokenCount = comphelper::string::getTokenCount(aURLStr, '/');
if( 1 == nTokenCount ) if( 1 == nTokenCount )
{ {
rPictureStorageName = String( XML_GRAPHICSTORAGE_NAME ); rPictureStorageName = XML_GRAPHICSTORAGE_NAME;
rPictureStreamName = aURLStr; rPictureStreamName = aURLStr;
} }
else else
...@@ -495,7 +495,7 @@ Graphic SvXMLGraphicHelper::ImplReadGraphic( const OUString& rPictureStorageName ...@@ -495,7 +495,7 @@ Graphic SvXMLGraphicHelper::ImplReadGraphic( const OUString& rPictureStorageName
if( aStream.xStream.is() ) if( aStream.xStream.is() )
{ {
SvStream* pStream = utl::UcbStreamHelper::CreateStream( aStream.xStream ); SvStream* pStream = utl::UcbStreamHelper::CreateStream( aStream.xStream );
GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, String(), *pStream ); GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, "", *pStream );
delete pStream; delete pStream;
} }
...@@ -540,14 +540,14 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageNa ...@@ -540,14 +540,14 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageNa
if( aGraphic.GetType() == GRAPHIC_BITMAP ) if( aGraphic.GetType() == GRAPHIC_BITMAP )
{ {
GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
String aFormat; OUString aFormat;
if( aGraphic.IsAnimated() ) if( aGraphic.IsAnimated() )
aFormat = String( "gif" ); aFormat = "gif";
else else
aFormat = String( "png" ); aFormat = "png";
bRet = ( rFilter.ExportGraphic( aGraphic, String(), *pStream, bRet = ( rFilter.ExportGraphic( aGraphic, "", *pStream,
rFilter.GetExportFormatNumberForShortName( aFormat ) ) == 0 ); rFilter.GetExportFormatNumberForShortName( aFormat ) ) == 0 );
} }
else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE ) else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE )
...@@ -621,33 +621,33 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt ...@@ -621,33 +621,33 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
RTL_TEXTENCODING_ASCII_US); RTL_TEXTENCODING_ASCII_US);
} }
else else
rURLPair.second = String(); rURLPair.second = "";
} }
else else
{ {
const String aGraphicObjectId( aPictureStreamName ); const OUString aGraphicObjectId( aPictureStreamName );
const OString aAsciiObjectID(OUStringToOString(aGraphicObjectId, RTL_TEXTENCODING_ASCII_US)); const OString aAsciiObjectID(OUStringToOString(aGraphicObjectId, RTL_TEXTENCODING_ASCII_US));
const GraphicObject aGrfObject( aAsciiObjectID ); const GraphicObject aGrfObject( aAsciiObjectID );
if( aGrfObject.GetType() != GRAPHIC_NONE ) if( aGrfObject.GetType() != GRAPHIC_NONE )
{ {
String aStreamName( aGraphicObjectId ); OUString aStreamName( aGraphicObjectId );
Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() ); Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
const GfxLink aGfxLink( aGraphic.GetLink() ); const GfxLink aGfxLink( aGraphic.GetLink() );
String aExtension; OUString aExtension;
bool bUseGfxLink( true ); bool bUseGfxLink( true );
if( aGfxLink.GetDataSize() ) if( aGfxLink.GetDataSize() )
{ {
switch( aGfxLink.GetType() ) switch( aGfxLink.GetType() )
{ {
case( GFX_LINK_TYPE_EPS_BUFFER ): aExtension = String( ".eps" ); break; case( GFX_LINK_TYPE_EPS_BUFFER ): aExtension = ".eps"; break;
case( GFX_LINK_TYPE_NATIVE_GIF ): aExtension = String( ".gif" ); break; case( GFX_LINK_TYPE_NATIVE_GIF ): aExtension = ".gif"; break;
case( GFX_LINK_TYPE_NATIVE_JPG ): aExtension = String( ".jpg" ); break; case( GFX_LINK_TYPE_NATIVE_JPG ): aExtension = ".jpg"; break;
case( GFX_LINK_TYPE_NATIVE_PNG ): aExtension = String( ".png" ); break; case( GFX_LINK_TYPE_NATIVE_PNG ): aExtension = ".png"; break;
case( GFX_LINK_TYPE_NATIVE_TIF ): aExtension = String( ".tif" ); break; case( GFX_LINK_TYPE_NATIVE_TIF ): aExtension = ".tif"; break;
case( GFX_LINK_TYPE_NATIVE_WMF ): aExtension = String( ".wmf" ); break; case( GFX_LINK_TYPE_NATIVE_WMF ): aExtension = ".wmf"; break;
case( GFX_LINK_TYPE_NATIVE_MET ): aExtension = String( ".met" ); break; case( GFX_LINK_TYPE_NATIVE_MET ): aExtension = ".met"; break;
case( GFX_LINK_TYPE_NATIVE_PCT ): aExtension = String( ".pct" ); break; case( GFX_LINK_TYPE_NATIVE_PCT ): aExtension = ".pct"; break;
case( GFX_LINK_TYPE_NATIVE_SVG ): case( GFX_LINK_TYPE_NATIVE_SVG ):
// backward-compat kludge: since no released OOo // backward-compat kludge: since no released OOo
// version to date can handle svg properly, wrap it up // version to date can handle svg properly, wrap it up
...@@ -657,14 +657,14 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt ...@@ -657,14 +657,14 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
if( SvtSaveOptions().GetODFDefaultVersion() <= SvtSaveOptions::ODFVER_012 ) if( SvtSaveOptions().GetODFDefaultVersion() <= SvtSaveOptions::ODFVER_012 )
{ {
bUseGfxLink = false; bUseGfxLink = false;
aExtension = String( ".svm" ); aExtension = ".svm";
} }
else else
aExtension = String( ".svg" ); aExtension = ".svg";
break; break;
default: default:
aExtension = String( ".grf" ); aExtension = ".grf";
break; break;
} }
} }
...@@ -673,23 +673,23 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt ...@@ -673,23 +673,23 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
if( aGrfObject.GetType() == GRAPHIC_BITMAP ) if( aGrfObject.GetType() == GRAPHIC_BITMAP )
{ {
if( aGrfObject.IsAnimated() ) if( aGrfObject.IsAnimated() )
aExtension = String( ".gif" ); aExtension = ".gif";
else else
aExtension = String( ".png" ); aExtension = ".png";
} }
else if( aGrfObject.GetType() == GRAPHIC_GDIMETAFILE ) else if( aGrfObject.GetType() == GRAPHIC_GDIMETAFILE )
{ {
// SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm // SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm
GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() ); GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() );
if ( ImplCheckForEPS( rMtf ) ) if ( ImplCheckForEPS( rMtf ) )
aExtension = String( ".eps" ); aExtension = ".eps";
else else
aExtension = String( ".svm" ); aExtension = ".svm";
} }
} }
OUString aURLEntry; OUString aURLEntry;
const String sPictures( "Pictures/" ); const OUString sPictures( "Pictures/" );
if ( !rRequestedFileName.isEmpty() ) if ( !rRequestedFileName.isEmpty() )
{ {
...@@ -709,7 +709,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt ...@@ -709,7 +709,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
aStreamName += aExtension; aStreamName += aExtension;
if( mbDirect && aStreamName.Len() ) if( mbDirect && !aStreamName.isEmpty() )
ImplWriteGraphic( aPictureStorageName, aStreamName, aGraphicObjectId, bUseGfxLink ); ImplWriteGraphic( aPictureStorageName, aStreamName, aGraphicObjectId, bUseGfxLink );
rURLPair.second = sPictures; rURLPair.second = sPictures;
......
...@@ -359,8 +359,7 @@ static void openStorageStream( xml::sax::InputSource *pParserInput, ...@@ -359,8 +359,7 @@ static void openStorageStream( xml::sax::InputSource *pParserInput,
uno::Reference < embed::XStorage > xStorage ) uno::Reference < embed::XStorage > xStorage )
{ {
uno::Reference < io::XStream > xIStm; uno::Reference < io::XStream > xIStm;
const String aContentStmName( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) ); xIStm.set( xStorage->openStreamElement( "Content.xml", embed::ElementModes::READ ), uno::UNO_QUERY_THROW );
xIStm.set( xStorage->openStreamElement( aContentStmName, embed::ElementModes::READ ), uno::UNO_QUERY_THROW );
if( !xIStm.is() ) if( !xIStm.is() )
{ {
OSL_FAIL( "could not open Content stream" ); OSL_FAIL( "could not open Content stream" );
......
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