Kaydet (Commit) c0afcc0f authored tarafından Matteo Casalin's avatar Matteo Casalin

This does not need to be a member function

Change-Id: I4d008ac516c66243d436a3afe3322ba1b6c9ef22
üst 4106979a
...@@ -78,10 +78,6 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode ...@@ -78,10 +78,6 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
/** adjust return type and rename method to /** adjust return type and rename method to
indicate that its an private one. */ indicate that its an private one. */
/** embedded graphic stream couldn't be inside a 3.1 - 5.2 storage any more.
Thus, return value isn't needed any more. */
void _GetStreamStorageNames( String& rStrmName, String& rStgName ) const;
void DelStreamName(); void DelStreamName();
DECL_LINK( SwapGraphic, GraphicObject* ); DECL_LINK( SwapGraphic, GraphicObject* );
......
...@@ -463,6 +463,47 @@ sal_Bool SwGrfNode::ImportGraphic( SvStream& rStrm ) ...@@ -463,6 +463,47 @@ sal_Bool SwGrfNode::ImportGraphic( SvStream& rStrm )
return sal_False; return sal_False;
} }
namespace
{
void lcl_GetStreamStorageNames( String aUserData,
String& rStrmName,
String& rStorName )
{
rStorName.Erase();
rStrmName.Erase();
if( !aUserData.Len() )
return;
String aProt( "vnd.sun.star.Package:" );
if( 0 == aUserData.CompareTo( aProt, aProt.Len() ) )
{
// 6.0 (XML) Package
xub_StrLen nPos = aUserData.Search( '/' );
if( STRING_NOTFOUND == nPos )
{
rStrmName = aUserData.Copy( aProt.Len() );
}
else
{
xub_StrLen nPathStart = aProt.Len();
if( 0 == aUserData.CompareToAscii( "./", 2 ) )
nPathStart += 2;
rStorName = aUserData.Copy( nPathStart, nPos-nPathStart );
rStrmName = aUserData.Copy( nPos+1 );
}
}
else
{
OSL_FAIL( "<lcl_GetStreamStorageNames(..)> - unknown graphic URL type. Code for handling 3.1 - 5.2 storages has been deleted by issue i53025." );
}
OSL_ENSURE( STRING_NOTFOUND == rStrmName.Search( '/' ),
"invalid graphic stream name" );
}
}
/** /**
* @return -1 if ReRead successful, * @return -1 if ReRead successful,
* 1 if reading successful, * 1 if reading successful,
...@@ -514,7 +555,7 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData ) ...@@ -514,7 +555,7 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData )
try try
{ {
String aStrmName, aPicStgName; String aStrmName, aPicStgName;
_GetStreamStorageNames( aStrmName, aPicStgName ); lcl_GetStreamStorageNames( maGrfObj.GetUserData(), aStrmName, aPicStgName );
uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName ); uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName ); SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName );
if ( pStrm ) if ( pStrm )
...@@ -776,7 +817,7 @@ void SwGrfNode::DelStreamName() ...@@ -776,7 +817,7 @@ void SwGrfNode::DelStreamName()
try try
{ {
String aPicStgName, aStrmName; String aPicStgName, aStrmName;
_GetStreamStorageNames( aStrmName, aPicStgName ); lcl_GetStreamStorageNames( maGrfObj.GetUserData(), aStrmName, aPicStgName );
uno::Reference < embed::XStorage > refPics = xDocStg; uno::Reference < embed::XStorage > refPics = xDocStg;
if ( aPicStgName.Len() ) if ( aPicStgName.Len() )
refPics = xDocStg->openStorageElement( aPicStgName, embed::ElementModes::READWRITE ); refPics = xDocStg->openStorageElement( aPicStgName, embed::ElementModes::READWRITE );
...@@ -870,42 +911,6 @@ SvStream* SwGrfNode::_GetStreamForEmbedGrf( ...@@ -870,42 +911,6 @@ SvStream* SwGrfNode::_GetStreamForEmbedGrf(
return pStrm; return pStrm;
} }
void SwGrfNode::_GetStreamStorageNames( String& rStrmName,
String& rStorName ) const
{
rStorName.Erase();
rStrmName.Erase();
String aUserData( maGrfObj.GetUserData() );
if( !aUserData.Len() )
return;
String aProt( "vnd.sun.star.Package:" );
if( 0 == aUserData.CompareTo( aProt, aProt.Len() ) )
{
// 6.0 (XML) Package
xub_StrLen nPos = aUserData.Search( '/' );
if( STRING_NOTFOUND == nPos )
{
rStrmName = aUserData.Copy( aProt.Len() );
}
else
{
xub_StrLen nPathStart = aProt.Len();
if( 0 == aUserData.CompareToAscii( "./", 2 ) )
nPathStart += 2;
rStorName = aUserData.Copy( nPathStart, nPos-nPathStart );
rStrmName = aUserData.Copy( nPos+1 );
}
}
else
{
OSL_FAIL( "<SwGrfNode::_GetStreamStorageNames(..)> - unknown graphic URL type. Code for handling 3.1 - 5.2 storages has been deleted by issue i53025." );
}
OSL_ENSURE( STRING_NOTFOUND == rStrmName.Search( '/' ),
"invalid graphic stream name" );
}
SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
{ {
// copy formats into the other document // copy formats into the other document
...@@ -918,7 +923,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const ...@@ -918,7 +923,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
try try
{ {
String aStrmName, aPicStgName; String aStrmName, aPicStgName;
_GetStreamStorageNames( aStrmName, aPicStgName ); lcl_GetStreamStorageNames( maGrfObj.GetUserData(), aStrmName, aPicStgName );
uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName ); uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName ); SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName );
if ( pStrm ) if ( pStrm )
...@@ -998,7 +1003,7 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj ) ...@@ -998,7 +1003,7 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj )
try try
{ {
String aStrmName, aPicStgName; String aStrmName, aPicStgName;
_GetStreamStorageNames( aStrmName, aPicStgName ); lcl_GetStreamStorageNames( maGrfObj.GetUserData(), aStrmName, aPicStgName );
uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName ); uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName ); SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName );
if ( pStrm ) if ( pStrm )
......
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