Kaydet (Commit) 9e68beb8 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

More replacements of manual swapping with SwGrfNode::GetGrf()/GetGrfObj()

Change-Id: Ie56584c03af8a6d3ea8f8d4294f5492a841933b7
üst 5e52aa12
...@@ -123,8 +123,8 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode ...@@ -123,8 +123,8 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
public: public:
virtual ~SwGrfNode(); virtual ~SwGrfNode();
const Graphic& GetGrf() const; const Graphic& GetGrf(bool bWait = false) const;
const GraphicObject& GetGrfObj() const; const GraphicObject& GetGrfObj(bool bWait = false) const;
const GraphicObject* GetReplacementGrfObj() const; const GraphicObject* GetReplacementGrfObj() const;
virtual SwCntntNode *SplitCntntNode( const SwPosition & ) SAL_OVERRIDE; virtual SwCntntNode *SplitCntntNode( const SwPosition & ) SAL_OVERRIDE;
......
...@@ -879,7 +879,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons ...@@ -879,7 +879,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
} }
bool bContinue = true; bool bContinue = true;
const GraphicObject& rGrfObj = pGrfNd->GetGrfObj(); const GraphicObject& rGrfObj = pGrfNd->GetGrfObj(bPrn);
GraphicAttr aGrfAttr; GraphicAttr aGrfAttr;
pGrfNd->GetGraphicAttr( aGrfAttr, this ); pGrfNd->GetGraphicAttr( aGrfAttr, this );
...@@ -917,8 +917,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons ...@@ -917,8 +917,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if( bContinue ) if( bContinue )
{ {
const bool bSwappedIn = pGrfNd->SwapIn( bPrn ); if( rGrfObj.GetGraphic().IsSupportedGraphic())
if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
{ {
const bool bAnimate = rGrfObj.IsAnimated() && const bool bAnimate = rGrfObj.IsAnimated() &&
!pShell->IsPreview() && !pShell->IsPreview() &&
...@@ -955,13 +954,12 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons ...@@ -955,13 +954,12 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
else else
{ {
sal_uInt16 nResId = 0; sal_uInt16 nResId = 0;
if( bSwappedIn )
{ if( GRAPHIC_NONE == rGrfObj.GetType() )
if( GRAPHIC_NONE == rGrfObj.GetType() ) nResId = STR_COMCORE_READERROR;
nResId = STR_COMCORE_READERROR; else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() ) nResId = STR_COMCORE_CANT_SHOW;
nResId = STR_COMCORE_CANT_SHOW;
}
((SwNoTxtFrm*)this)->nWeight = -1; ((SwNoTxtFrm*)this)->nWeight = -1;
OUString aText; OUString aText;
if ( !nResId && if ( !nResId &&
......
...@@ -251,8 +251,7 @@ Graphic SwNoTxtNode::GetGraphic() const ...@@ -251,8 +251,7 @@ Graphic SwNoTxtNode::GetGraphic() const
Graphic aRet; Graphic aRet;
if ( GetGrfNode() ) if ( GetGrfNode() )
{ {
((SwGrfNode*)this)->SwapIn( true ); aRet = ((SwGrfNode*)this)->GetGrf(true);
aRet = ((SwGrfNode*)this)->GetGrf();
} }
else else
{ {
......
...@@ -238,28 +238,7 @@ const Graphic* SwEditShell::GetGraphic( bool bWait ) const ...@@ -238,28 +238,7 @@ const Graphic* SwEditShell::GetGraphic( bool bWait ) const
const Graphic* pGrf( 0L ); const Graphic* pGrf( 0L );
if ( pGrfNode ) if ( pGrfNode )
{ {
pGrf = &(pGrfNode->GetGrf()); pGrf = &(pGrfNode->GetGrf(bWait && GRAPHIC_DEFAULT == pGrfNode->GetGrf().GetType()));
// --> #i73788#
// no load of linked graphic, if its not needed now (bWait = sal_False).
if ( bWait )
{
if( pGrf->IsSwapOut() ||
( pGrfNode->IsLinkedFile() && GRAPHIC_DEFAULT == pGrf->GetType() ) )
{
bool const bResult = pGrfNode->SwapIn(bWait);
OSL_ENSURE(bResult || !bWait, "Graphic could not be loaded" );
(void) bResult; // unused in non-debug
}
}
else
{
if ( pGrf->IsSwapOut() && !pGrfNode->IsLinkedFile() )
{
bool const bResult = pGrfNode->SwapIn(bWait);
OSL_ENSURE(bResult || !bWait, "Graphic could not be loaded" );
(void) bResult; // unused in non-debug
}
}
} }
return pGrf; return pGrf;
} }
...@@ -611,15 +590,7 @@ Graphic SwEditShell::GetIMapGraphic() const ...@@ -611,15 +590,7 @@ Graphic SwEditShell::GetIMapGraphic() const
if( rNd.IsGrfNode() ) if( rNd.IsGrfNode() )
{ {
SwGrfNode & rGrfNode(static_cast<SwGrfNode&>(rNd)); SwGrfNode & rGrfNode(static_cast<SwGrfNode&>(rNd));
const Graphic& rGrf = rGrfNode.GetGrf(); aRet = rGrfNode.GetGrf(GRAPHIC_DEFAULT == rGrfNode.GetGrf().GetType());
if( rGrf.IsSwapOut() || ( rGrfNode.IsLinkedFile() &&
GRAPHIC_DEFAULT == rGrf.GetType() ) )
{
bool const bResult = rGrfNode.SwapIn(true);
OSL_ENSURE(bResult, "Graphic could not be loaded" );
(void) bResult; // unused in non-debug
}
aRet = rGrf;
} }
else if ( rNd.IsOLENode() ) else if ( rNd.IsOLENode() )
{ {
......
...@@ -1557,8 +1557,7 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt, ...@@ -1557,8 +1557,7 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt,
pNd->GetFileFilterNms( &rName, 0 ); pNd->GetFileFilterNms( &rName, 0 );
if ( rName.isEmpty() ) if ( rName.isEmpty() )
rName = pFly->GetFmt()->GetName(); rName = pFly->GetFmt()->GetName();
pNd->SwapIn( true ); return &pNd->GetGrf(true);
return &pNd->GetGrf();
} }
} }
} }
......
...@@ -396,15 +396,15 @@ void SwGrfNode::SetGraphic(const Graphic& rGraphic, const OUString& rLink) ...@@ -396,15 +396,15 @@ void SwGrfNode::SetGraphic(const Graphic& rGraphic, const OUString& rLink)
onGraphicChanged(); onGraphicChanged();
} }
const Graphic& SwGrfNode::GetGrf() const const Graphic& SwGrfNode::GetGrf(bool bWait) const
{ {
const_cast<SwGrfNode*>(this)->SwapIn(); const_cast<SwGrfNode*>(this)->SwapIn(bWait);
return maGrfObj.GetGraphic(); return maGrfObj.GetGraphic();
} }
const GraphicObject& SwGrfNode::GetGrfObj() const const GraphicObject& SwGrfNode::GetGrfObj(bool bWait) const
{ {
const_cast<SwGrfNode*>(this)->SwapIn(); const_cast<SwGrfNode*>(this)->SwapIn(bWait);
return maGrfObj; return maGrfObj;
} }
...@@ -461,7 +461,7 @@ Size SwGrfNode::GetTwipSize() const ...@@ -461,7 +461,7 @@ Size SwGrfNode::GetTwipSize() const
{ {
if( !nGrfSize.Width() && !nGrfSize.Height() ) if( !nGrfSize.Width() && !nGrfSize.Height() )
{ {
const_cast<SwGrfNode*>(this)->SwapIn(true); const_cast<SwGrfNode*>(this)->SwapIn();
} }
return nGrfSize; return nGrfSize;
} }
......
...@@ -851,8 +851,7 @@ void SwUndoReRead::SaveGraphicData( const SwGrfNode& rGrfNd ) ...@@ -851,8 +851,7 @@ void SwUndoReRead::SaveGraphicData( const SwGrfNode& rGrfNd )
} }
else else
{ {
((SwGrfNode&)rGrfNd).SwapIn( true ); pGrf = new Graphic( rGrfNd.GetGrf(true) );
pGrf = new Graphic( rGrfNd.GetGrf() );
pNm = pFltr = 0; pNm = pFltr = 0;
} }
nMirr = rGrfNd.GetSwAttrSet().GetMirrorGrf().GetValue(); nMirr = rGrfNd.GetSwAttrSet().GetMirrorGrf().GetValue();
......
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