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
public:
virtual ~SwGrfNode();
const Graphic& GetGrf() const;
const GraphicObject& GetGrfObj() const;
const Graphic& GetGrf(bool bWait = false) const;
const GraphicObject& GetGrfObj(bool bWait = false) const;
const GraphicObject* GetReplacementGrfObj() const;
virtual SwCntntNode *SplitCntntNode( const SwPosition & ) SAL_OVERRIDE;
......
......@@ -879,7 +879,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
}
bool bContinue = true;
const GraphicObject& rGrfObj = pGrfNd->GetGrfObj();
const GraphicObject& rGrfObj = pGrfNd->GetGrfObj(bPrn);
GraphicAttr aGrfAttr;
pGrfNd->GetGraphicAttr( aGrfAttr, this );
......@@ -917,8 +917,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if( bContinue )
{
const bool bSwappedIn = pGrfNd->SwapIn( bPrn );
if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
if( rGrfObj.GetGraphic().IsSupportedGraphic())
{
const bool bAnimate = rGrfObj.IsAnimated() &&
!pShell->IsPreview() &&
......@@ -955,13 +954,12 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
else
{
sal_uInt16 nResId = 0;
if( bSwappedIn )
{
if( GRAPHIC_NONE == rGrfObj.GetType() )
nResId = STR_COMCORE_READERROR;
else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
nResId = STR_COMCORE_CANT_SHOW;
}
if( GRAPHIC_NONE == rGrfObj.GetType() )
nResId = STR_COMCORE_READERROR;
else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
nResId = STR_COMCORE_CANT_SHOW;
((SwNoTxtFrm*)this)->nWeight = -1;
OUString aText;
if ( !nResId &&
......
......@@ -251,8 +251,7 @@ Graphic SwNoTxtNode::GetGraphic() const
Graphic aRet;
if ( GetGrfNode() )
{
((SwGrfNode*)this)->SwapIn( true );
aRet = ((SwGrfNode*)this)->GetGrf();
aRet = ((SwGrfNode*)this)->GetGrf(true);
}
else
{
......
......@@ -238,28 +238,7 @@ const Graphic* SwEditShell::GetGraphic( bool bWait ) const
const Graphic* pGrf( 0L );
if ( pGrfNode )
{
pGrf = &(pGrfNode->GetGrf());
// --> #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
}
}
pGrf = &(pGrfNode->GetGrf(bWait && GRAPHIC_DEFAULT == pGrfNode->GetGrf().GetType()));
}
return pGrf;
}
......@@ -611,15 +590,7 @@ Graphic SwEditShell::GetIMapGraphic() const
if( rNd.IsGrfNode() )
{
SwGrfNode & rGrfNode(static_cast<SwGrfNode&>(rNd));
const Graphic& rGrf = rGrfNode.GetGrf();
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;
aRet = rGrfNode.GetGrf(GRAPHIC_DEFAULT == rGrfNode.GetGrf().GetType());
}
else if ( rNd.IsOLENode() )
{
......
......@@ -1557,8 +1557,7 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt,
pNd->GetFileFilterNms( &rName, 0 );
if ( rName.isEmpty() )
rName = pFly->GetFmt()->GetName();
pNd->SwapIn( true );
return &pNd->GetGrf();
return &pNd->GetGrf(true);
}
}
}
......
......@@ -396,15 +396,15 @@ void SwGrfNode::SetGraphic(const Graphic& rGraphic, const OUString& rLink)
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();
}
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;
}
......@@ -461,7 +461,7 @@ Size SwGrfNode::GetTwipSize() const
{
if( !nGrfSize.Width() && !nGrfSize.Height() )
{
const_cast<SwGrfNode*>(this)->SwapIn(true);
const_cast<SwGrfNode*>(this)->SwapIn();
}
return nGrfSize;
}
......
......@@ -851,8 +851,7 @@ void SwUndoReRead::SaveGraphicData( const SwGrfNode& rGrfNd )
}
else
{
((SwGrfNode&)rGrfNd).SwapIn( true );
pGrf = new Graphic( rGrfNd.GetGrf() );
pGrf = new Graphic( rGrfNd.GetGrf(true) );
pNm = pFltr = 0;
}
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