summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-10-18 15:08:39 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-11-07 10:45:08 +0100
commit17475638138c92162be1c0f34cf1f9cc95c63579 (patch)
tree36ff59050a651514352c4a1b5fbc22ab23d31850
parentda612badf7897ab41aa99437e5df874934596fd9 (diff)
Make SetSwapState() an internal method
So we can be sure it is always called when user data changed. Change-Id: If107907afffb85a7a57817f5807847a5c028416c
-rw-r--r--include/svtools/grfmgr.hxx2
-rw-r--r--svtools/source/graphic/grfmgr.cxx6
-rw-r--r--svx/source/svdraw/svdograf.cxx8
-rw-r--r--sw/source/core/graphic/ndgrf.cxx7
-rw-r--r--sw/source/core/unocore/unoframe.cxx2
5 files changed, 6 insertions, 19 deletions
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index 30ac6345a489..d4522768b199 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -313,6 +313,7 @@ protected:
virtual void GraphicManagerDestroyed();
virtual SvStream* GetSwapStream() const;
+ void SetSwapState();
virtual void Load( SvStream& ) SAL_OVERRIDE;
virtual void Save( SvStream& ) SAL_OVERRIDE;
@@ -421,7 +422,6 @@ public:
bool IsInSwapOut() const { return mbIsInSwapOut; }
bool IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); }
bool IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); }
- void SetSwapState();
bool Draw(
OutputDevice* pOut,
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index f02b185b4bda..2c4746d7ed16 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -102,6 +102,8 @@ GraphicObject::GraphicObject( const GraphicObject& rGraphicObj, const GraphicMan
ImplConstruct();
ImplAssignGraphicData();
ImplSetGraphicManager( pMgr, NULL, &rGraphicObj );
+ if( rGraphicObj.HasUserData() && rGraphicObj.IsSwappedOut() )
+ SetSwapState();
}
GraphicObject::GraphicObject( const OString& rUniqueID, const GraphicManager* pMgr ) :
@@ -351,8 +353,9 @@ GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj )
ImplAssignGraphicData();
mbAutoSwapped = false;
mpMgr = rGraphicObj.mpMgr;
-
mpMgr->ImplRegisterObj( *this, maGraphic, NULL, &rGraphicObj );
+ if( rGraphicObj.HasUserData() && rGraphicObj.IsSwappedOut() )
+ SetSwapState();
}
return *this;
@@ -427,6 +430,7 @@ void GraphicObject::SetUserData()
void GraphicObject::SetUserData( const OUString& rUserData )
{
maUserData = rUserData;
+ SetSwapState();
}
void GraphicObject::SetSwapStreamHdl()
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index ca735430d445..ca34e7e98084 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -552,10 +552,6 @@ void SdrGrafObj::SetGrafStreamURL( const OUString& rGraphicStreamURL )
else if( pModel->IsSwapGraphics() )
{
pGraphic->SetUserData( rGraphicStreamURL );
-
- // set state of graphic object to 'swapped out'
- if( pGraphic->GetType() == GRAPHIC_NONE )
- pGraphic->SetSwapState();
}
}
@@ -574,7 +570,6 @@ void SdrGrafObj::ForceSwapIn() const
Graphic aEmpty;
pGraphic->SetGraphic( aEmpty );
pGraphic->SetUserData( aUserData );
- pGraphic->SetSwapState();
const_cast< SdrGrafObj* >( this )->mbIsPreview = false;
}
@@ -634,9 +629,6 @@ void SdrGrafObj::SetGraphicLink(const OUString& rFileName, const OUString& rRefe
aFilterName = rFilterName;
ImpLinkAnmeldung();
pGraphic->SetUserData();
-
- // A linked graphic is per definition swapped out (has to be loaded)
- pGraphic->SetSwapState();
}
void SdrGrafObj::ReleaseGraphicLink()
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 4b7152b422ad..910d2850df61 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -91,8 +91,6 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
mbIsStreamReadOnly( false )
{
maGrfObj.SetSwapStreamHdl( LINK(this, SwGrfNode, SwapGraphic) );
- if( rGrfObj.HasUserData() && rGrfObj.IsSwappedOut() )
- maGrfObj.SetSwapState();
bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel =
bFrameInPaint = bScaleImageMap = false;
bGraphicArrived = true;
@@ -194,8 +192,6 @@ bool SwGrfNode::ReRead(
else if( pGrfObj )
{
maGrfObj = *pGrfObj;
- if( pGrfObj->HasUserData() && pGrfObj->IsSwappedOut() )
- maGrfObj.SetSwapState();
maGrfObj.SetLink( rGrfName );
onGraphicChanged();
bReadGrf = true;
@@ -242,8 +238,6 @@ bool SwGrfNode::ReRead(
maGrfObj = *pGrfObj;
onGraphicChanged();
- if( pGrfObj->HasUserData() && pGrfObj->IsSwappedOut() )
- maGrfObj.SetSwapState();
bReadGrf = true;
}
// Was the graphic already loaded?
@@ -467,7 +461,6 @@ bool SwGrfNode::ImportGraphic( SvStream& rStrm )
mpReplacementGraphic = 0;
maGrfObj.SetGraphic( aGraphic );
- maGrfObj.SetUserData( aURL );
onGraphicChanged();
return true;
}
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 8e4d879b550a..c8067904eddb 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1558,7 +1558,6 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
{
pGrfObj = new GraphicObject;
pGrfObj->SetUserData( sTmp );
- pGrfObj->SetSwapState();
sGrfName = "";
}
else if( sTmp.startsWith(sGraphicObjectProtocol) )
@@ -2822,7 +2821,6 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
{
pGrfObj = new GraphicObject;
pGrfObj->SetUserData( sGraphicURL );
- pGrfObj->SetSwapState();
sGraphicURL = "";
}
else if( sGraphicURL.startsWith(sGraphicObjectProtocol) )