Kaydet (Commit) 68334b7c authored tarafından Philipp Riemer's avatar Philipp Riemer

work on comments and remove commented-out code in sw/source/core/graphic

Change-Id: I2b1b29d469277998dafed41fb7c0bb33e8064a16
üst e89804f1
...@@ -209,9 +209,7 @@ sal_Bool SwGrfNode::ReRead( ...@@ -209,9 +209,7 @@ sal_Bool SwGrfNode::ReRead(
SwMsgPoolItem aMsgHint( RES_GRF_REREAD_AND_INCACHE ); SwMsgPoolItem aMsgHint( RES_GRF_REREAD_AND_INCACHE );
ModifyNotification( &aMsgHint, &aMsgHint ); ModifyNotification( &aMsgHint, &aMsgHint );
} }
// #i59688# // #i59688# - do not load linked graphic, if it isn't a new linked graphic.
// do not load linked graphic, if it isn't a new linked graphic.
// else {
else if ( bNewGrf ) else if ( bNewGrf )
{ {
//TODO refLink->setInputStream(getInputStream()); //TODO refLink->setInputStream(getInputStream());
...@@ -224,7 +222,7 @@ sal_Bool SwGrfNode::ReRead( ...@@ -224,7 +222,7 @@ sal_Bool SwGrfNode::ReRead(
} }
else if( pGraphic && !rGrfName.Len() ) else if( pGraphic && !rGrfName.Len() )
{ {
// MIB 27.02.2001: Old stream must be deleted before the new one is set. // Old stream must be deleted before the new one is set.
if( HasStreamName() ) if( HasStreamName() )
DelStreamName(); DelStreamName();
...@@ -234,7 +232,7 @@ sal_Bool SwGrfNode::ReRead( ...@@ -234,7 +232,7 @@ sal_Bool SwGrfNode::ReRead(
} }
else if( pGrfObj && !rGrfName.Len() ) else if( pGrfObj && !rGrfName.Len() )
{ {
// MIB 27.02.2001: Old stream must be deleted before the new one is set. // Old stream must be deleted before the new one is set.
if( HasStreamName() ) if( HasStreamName() )
DelStreamName(); DelStreamName();
...@@ -322,17 +320,15 @@ SwGrfNode::~SwGrfNode() ...@@ -322,17 +320,15 @@ SwGrfNode::~SwGrfNode()
} }
else else
{ {
// #i40014# - A graphic node, which are in linked // #i40014# - A graphic node, which is in a linked
// section, whose link is another section is the document, doesn't // section, whose link is another section in the document, doesn't
// have to remove the stream from the storage. // have to remove the stream from the storage.
// Because it's hard to detect this case here and it would only fix // Because it's hard to detect this case here and it would only fix
// one problem with shared graphic files - there are also problems, // one problem with shared graphic files - there are also problems,
// a certain graphic file is referenced by two independent graphic nodes, // a certain graphic file is referenced by two independent graphic nodes,
// brush item or drawing objects, the stream isn't no longer removed here. // brush item or drawing objects, the stream isn't no longer removed here.
// To do this stuff correct, a reference counting on shared streams // To do this stuff correctly, a reference counting on shared streams
// inside one document have to be implemented. // inside one document has to be implemented.
// if( !pDoc->IsInDtor() && HasStreamName() )
// DelStreamName();
} }
//#39289# delete frames already here since the Frms' dtor needs the graphic for its StopAnimation //#39289# delete frames already here since the Frms' dtor needs the graphic for its StopAnimation
if( GetDepends() ) if( GetDepends() )
...@@ -376,13 +372,6 @@ void SwGrfNode::onGraphicChanged() ...@@ -376,13 +372,6 @@ void SwGrfNode::onGraphicChanged()
} }
} }
// do not use this currently; it seems that this name has to be unique in
// the writer model and is already set to some default
//if(aName.Len() && pFlyFmt)
//{
// pFlyFmt->SetName(aName);
//}
if(aTitle.Len()) if(aTitle.Len())
{ {
SetTitle(aTitle); SetTitle(aTitle);
...@@ -494,7 +483,6 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData ) ...@@ -494,7 +483,6 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData )
GRAPHIC_DEFAULT == maGrfObj.GetType() ) GRAPHIC_DEFAULT == maGrfObj.GetType() )
{ {
// link was not loaded yet // link was not loaded yet
//TODO pLink->setInputStream(getInputStream());
if( pLink->SwapIn( bWaitForData ) ) if( pLink->SwapIn( bWaitForData ) )
nRet = -1; nRet = -1;
else if( GRAPHIC_DEFAULT == maGrfObj.GetType() ) else if( GRAPHIC_DEFAULT == maGrfObj.GetType() )
...@@ -511,7 +499,6 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData ) ...@@ -511,7 +499,6 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData )
} }
else if( maGrfObj.IsSwappedOut() ) { else if( maGrfObj.IsSwappedOut() ) {
// link to download // link to download
//TODO pLink->setInputStream(getInputStream());
nRet = pLink->SwapIn( bWaitForData ) ? 1 : 0; nRet = pLink->SwapIn( bWaitForData ) ? 1 : 0;
} }
else else
...@@ -524,11 +511,8 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData ) ...@@ -524,11 +511,8 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData )
nRet = (short)maGrfObj.SwapIn(); nRet = (short)maGrfObj.SwapIn();
else else
{ {
// #i48434# - usage of new method <_GetStreamForEmbedGrf(..)>
try try
{ {
// #i53025# - needed correction of new method <_GetStreamForEmbedGrf(..)>
String aStrmName, aPicStgName; String aStrmName, aPicStgName;
_GetStreamStorageNames( aStrmName, aPicStgName ); _GetStreamStorageNames( aStrmName, aPicStgName );
uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName ); uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
...@@ -634,14 +618,12 @@ sal_Bool SwGrfNode::SavePersistentData() ...@@ -634,14 +618,12 @@ sal_Bool SwGrfNode::SavePersistentData()
// Do not delete graphic file in storage, because the graphic file could // Do not delete graphic file in storage, because the graphic file could
// be referenced by other graphic nodes. // be referenced by other graphic nodes.
// Because it's hard to detect this case here and it would only fix // Because it's hard to detect this case here and it would only fix
// one problem with shared graphic files - there are also problems, // one problem with shared graphic files - there are also problems, if
// a certain graphic file is referenced by two independent graphic nodes, // a certain graphic file is referenced by two independent graphic nodes,
// brush item or drawing objects, the stream isn't no longer removed here. // brush item or drawing objects, the stream isn't no longer removed here.
// To do this stuff correct, a reference counting on shared streams // To do this stuff correct, a reference counting on shared streams
// inside one document have to be implemented. // inside one document has to be implemented.
// Important note: see also fix for #i40014# // Important note: see also fix for #i40014#
// if( HasStreamName() )
// DelStreamName();
// swap out into temp file // swap out into temp file
return (sal_Bool) SwapOut(); return (sal_Bool) SwapOut();
...@@ -699,7 +681,6 @@ void SwGrfNode::ReleaseLink() ...@@ -699,7 +681,6 @@ void SwGrfNode::ReleaseLink()
{ {
bInSwapIn = sal_True; bInSwapIn = sal_True;
SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink; SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink;
//TODO pLink->setInputStream(getInputStream());
pLink->SwapIn( sal_True, sal_True ); pLink->SwapIn( sal_True, sal_True );
bInSwapIn = sal_False; bInSwapIn = sal_False;
} }
...@@ -843,8 +824,6 @@ uno::Reference< embed::XStorage > SwGrfNode::_GetDocSubstorageOrRoot( const Stri ...@@ -843,8 +824,6 @@ uno::Reference< embed::XStorage > SwGrfNode::_GetDocSubstorageOrRoot( const Stri
provided via parameter. Otherwise the returned stream will be closed provided via parameter. Otherwise the returned stream will be closed
after the method returns, because its parent stream is closed and deleted. after the method returns, because its parent stream is closed and deleted.
Proposed name of embedded graphic stream is also provided by parameter. Proposed name of embedded graphic stream is also provided by parameter.
@author OD
*/ */
SvStream* SwGrfNode::_GetStreamForEmbedGrf( SvStream* SwGrfNode::_GetStreamForEmbedGrf(
const uno::Reference< embed::XStorage >& _refPics, const uno::Reference< embed::XStorage >& _refPics,
...@@ -889,8 +868,6 @@ SvStream* SwGrfNode::_GetStreamForEmbedGrf( ...@@ -889,8 +868,6 @@ SvStream* SwGrfNode::_GetStreamForEmbedGrf(
return pStrm; return pStrm;
} }
// #i53025# - stream couldn't be in a 3.1 - 5.2 storage any more.
// Thus, removing corresponding code.
void SwGrfNode::_GetStreamStorageNames( String& rStrmName, void SwGrfNode::_GetStreamStorageNames( String& rStrmName,
String& rStorName ) const String& rStorName ) const
{ {
...@@ -940,10 +917,8 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const ...@@ -940,10 +917,8 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink; SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink;
if( !pLink && HasStreamName() ) if( !pLink && HasStreamName() )
{ {
// #i48434# - usage of new method <_GetStreamForEmbedGrf(..)>
try try
{ {
// #i53025# - needed correction of new method <_GetStreamForEmbedGrf(..)>
String aStrmName, aPicStgName; String aStrmName, aPicStgName;
_GetStreamStorageNames( aStrmName, aPicStgName ); _GetStreamStorageNames( aStrmName, aPicStgName );
uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName ); uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
...@@ -1022,10 +997,8 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj ) ...@@ -1022,10 +997,8 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj )
if( HasStreamName() ) if( HasStreamName() )
{ {
// #i48434# - usage of new method <_GetStreamForEmbedGrf(..)>
try try
{ {
// #i53025# - needed correction of new method <_GetStreamForEmbedGrf(..)>
String aStrmName, aPicStgName; String aStrmName, aPicStgName;
_GetStreamStorageNames( aStrmName, aPicStgName ); _GetStreamStorageNames( aStrmName, aPicStgName );
uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName ); uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
...@@ -1079,7 +1052,7 @@ void DelAllGrfCacheEntries( SwDoc* pDoc ) ...@@ -1079,7 +1052,7 @@ void DelAllGrfCacheEntries( SwDoc* pDoc )
} }
} }
// returns the with our graphic attributes filled Graphic-Attr-Structure /// returns the Graphic-Attr-Structure filled with our graphic attributes
GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA, GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
const SwFrm* pFrm ) const const SwFrm* pFrm ) const
{ {
...@@ -1214,10 +1187,8 @@ void SwGrfNode::ApplyInputStream( ...@@ -1214,10 +1187,8 @@ void SwGrfNode::ApplyInputStream(
void SwGrfNode::UpdateLinkWithInputStream() void SwGrfNode::UpdateLinkWithInputStream()
{ {
// --> OD #i85105#
// do not work on link, if a <SwapIn> has been triggered. // do not work on link, if a <SwapIn> has been triggered.
if ( !bInSwapIn && IsLinkedFile() ) if ( !bInSwapIn && IsLinkedFile() )
// <--
{ {
GetLink()->setStreamToLoadFrom( mxInputStream, mbIsStreamReadOnly ); GetLink()->setStreamToLoadFrom( mxInputStream, mbIsStreamReadOnly );
GetLink()->Update(); GetLink()->Update();
......
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