diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-10-05 15:14:07 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-10-05 19:44:39 +0200 |
commit | c0afcc0f0777ec76c1c04611f528741271b58227 (patch) | |
tree | 637374552b22c6385e12277f8030d2b7ba2f5cb0 /sw | |
parent | 4106979a1d37c98b6ea93d134521fde9bb788956 (diff) |
This does not need to be a member function
Change-Id: I4d008ac516c66243d436a3afe3322ba1b6c9ef22
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/ndgrf.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 85 |
2 files changed, 45 insertions, 44 deletions
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index 5d01aafe8b5e..6d34a19e5623 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -78,10 +78,6 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode /** adjust return type and rename method to 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(); DECL_LINK( SwapGraphic, GraphicObject* ); diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index e2df34b6ad31..8dc05fa2228f 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -463,6 +463,47 @@ sal_Bool SwGrfNode::ImportGraphic( SvStream& rStrm ) 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, * 1 if reading successful, @@ -514,7 +555,7 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData ) try { String aStrmName, aPicStgName; - _GetStreamStorageNames( aStrmName, aPicStgName ); + lcl_GetStreamStorageNames( maGrfObj.GetUserData(), aStrmName, aPicStgName ); uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName ); SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName ); if ( pStrm ) @@ -776,7 +817,7 @@ void SwGrfNode::DelStreamName() try { String aPicStgName, aStrmName; - _GetStreamStorageNames( aStrmName, aPicStgName ); + lcl_GetStreamStorageNames( maGrfObj.GetUserData(), aStrmName, aPicStgName ); uno::Reference < embed::XStorage > refPics = xDocStg; if ( aPicStgName.Len() ) refPics = xDocStg->openStorageElement( aPicStgName, embed::ElementModes::READWRITE ); @@ -870,42 +911,6 @@ SvStream* SwGrfNode::_GetStreamForEmbedGrf( 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 { // copy formats into the other document @@ -918,7 +923,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const try { String aStrmName, aPicStgName; - _GetStreamStorageNames( aStrmName, aPicStgName ); + lcl_GetStreamStorageNames( maGrfObj.GetUserData(), aStrmName, aPicStgName ); uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName ); SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName ); if ( pStrm ) @@ -998,7 +1003,7 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj ) try { String aStrmName, aPicStgName; - _GetStreamStorageNames( aStrmName, aPicStgName ); + lcl_GetStreamStorageNames( maGrfObj.GetUserData(), aStrmName, aPicStgName ); uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName ); SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName ); if ( pStrm ) |