summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-11-07 10:41:51 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-11-07 10:45:15 +0100
commit9e68beb85da94386443f53ff9f8bd4685f2c50ea (patch)
tree1e00e2b3c2ba38b02be2ed4cee736b1ef7b34c38
parent5e52aa124b444a34edbef823a91c63ccd58dc17c (diff)
More replacements of manual swapping with SwGrfNode::GetGrf()/GetGrfObj()
Change-Id: Ie56584c03af8a6d3ea8f8d4294f5492a841933b7
-rw-r--r--sw/inc/ndgrf.hxx4
-rw-r--r--sw/source/core/doc/notxtfrm.cxx18
-rw-r--r--sw/source/core/docnode/ndnotxt.cxx3
-rw-r--r--sw/source/core/edit/editsh.cxx33
-rw-r--r--sw/source/core/frmedt/fefly1.cxx3
-rw-r--r--sw/source/core/graphic/ndgrf.cxx10
-rw-r--r--sw/source/core/undo/unins.cxx3
7 files changed, 20 insertions, 54 deletions
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 2b50fce7ec24..5a2dcbd5a283 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -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;
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 563144a40c3e..612b785bc510 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -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 &&
diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx
index 7a325c93cc94..dfb38b1f7bfe 100644
--- a/sw/source/core/docnode/ndnotxt.cxx
+++ b/sw/source/core/docnode/ndnotxt.cxx
@@ -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
{
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index c59b59c697fd..f9df5120c545 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -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() )
{
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 0f77236214fa..8c104cb8c74f 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -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);
}
}
}
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 6a3e587fa522..3cd7ef95507d 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -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;
}
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 06694b3639a2..cd9c8560d4ea 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -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();