Kaydet (Commit) b181a3cd authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann Kaydeden (comit) Michael Stahl

i#124999: - call <SwGrfNode::onGraphicChanged()> only when <Graphic>

instance has been set, too

- <SwGrfNode::onGraphicChanged()> - assure that graphic is swapped
  out in case its swap in has been triggered by this method.

(cherry-picked from commit 4dbdc0ce)

Change-Id: I3e6aa68d9507095925dec37075abcdf9da58c804
üst adb1bb21
......@@ -117,6 +117,10 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > _GetDocSubstorageOrRoot(
const OUString& aStgName ) const;
/// allow reaction on change of content of GraphicObject, so always call
/// when GraphicObject content changes
void onGraphicChanged();
public:
virtual ~SwGrfNode();
const Graphic& GetGrf() const { return maGrfObj.GetGraphic(); }
......@@ -132,10 +136,6 @@ public:
void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData = 0, const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD, OutputDevice* pFirstFrameOutDev = NULL) { maGrfObj.StartAnimation(pOut, rPt, rSz, nExtraData, pAttr, nFlags, pFirstFrameOutDev); }
void StopGraphicAnimation(OutputDevice* pOut = NULL, long nExtraData = 0) { maGrfObj.StopAnimation(pOut, nExtraData); }
/// allow reaction on change of content of GraphicObject, so always call
/// when GraphicObject content changes
void onGraphicChanged();
virtual Size GetTwipSize() const SAL_OVERRIDE;
void SetTwipSize( const Size& rSz );
......
......@@ -578,7 +578,6 @@ SwFlyFrmFmt* SwDoc::Insert( const SwPaM &rRg,
mpDfltGrfFmtColl );
SwFlyFrmFmt* pSwFlyFrmFmt = _InsNoTxtNode( *rRg.GetPoint(), pSwGrfNode,
pFlyAttrSet, pGrfAttrSet, pFrmFmt );
pSwGrfNode->onGraphicChanged();
return pSwFlyFrmFmt;
}
......@@ -594,7 +593,6 @@ SwFlyFrmFmt* SwDoc::Insert( const SwPaM &rRg, const GraphicObject& rGrfObj,
rGrfObj, mpDfltGrfFmtColl );
SwFlyFrmFmt* pSwFlyFrmFmt = _InsNoTxtNode( *rRg.GetPoint(), pSwGrfNode,
pFlyAttrSet, pGrfAttrSet, pFrmFmt );
pSwGrfNode->onGraphicChanged();
return pSwFlyFrmFmt;
}
......
......@@ -219,7 +219,6 @@ bool SwGrfNode::ReRead(
SwMsgPoolItem aMsgHint( RES_GRF_REREAD_AND_INCACHE );
ModifyNotification( &aMsgHint, &aMsgHint );
}
// #i59688# - do not load linked graphic, if it isn't a new linked graphic.
else if ( bNewGrf )
{
//TODO refLink->setInputStream(getInputStream());
......@@ -284,12 +283,10 @@ bool SwGrfNode::ReRead(
}
else
{
// reset data of the old graphic so that the correct placeholder is
// shown in case the new link could not be loaded
Graphic aGrf; aGrf.SetDefaultType();
Graphic aGrf;
aGrf.SetDefaultType();
maGrfObj.SetGraphic( aGrf, rGrfName );
onGraphicChanged();
// #i59688# - do not load linked graphic, if it isn't a new linked graphic.
if ( bNewGrf )
{
((SwBaseLink*)&refLink)->SwapIn();
......@@ -358,6 +355,7 @@ void SwGrfNode::onGraphicChanged()
if(pFlyFmt)
{
const bool bWasSwappedOut = GetGrfObj().IsSwappedOut();
OUString aName;
OUString aTitle;
OUString aDesc;
......@@ -389,11 +387,20 @@ void SwGrfNode::onGraphicChanged()
{
SetTitle(aTitle);
}
else if (!aName.isEmpty())
{
SetTitle(aName);
}
if(!aDesc.isEmpty())
{
SetDescription(aDesc);
}
if (bWasSwappedOut)
{
SwapOut();
}
}
}
......@@ -736,7 +743,6 @@ void SwGrfNode::ReleaseLink()
{
if( refLink.Is() )
{
// #i15508# remember some stuff from the linked graphic
const OUString aFileName(maGrfObj.GetLink());
const Graphic aLocalGraphic(maGrfObj.GetGraphic());
const bool bHasOriginalData(aLocalGraphic.IsLink());
......@@ -1118,20 +1124,32 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
{
switch( rMirror.GetValue() )
{
case RES_MIRROR_GRAPH_DONT: nMirror = BMP_MIRROR_HORZ; break;
case RES_MIRROR_GRAPH_VERT: nMirror = BMP_MIRROR_NONE; break;
case RES_MIRROR_GRAPH_HOR: nMirror = BMP_MIRROR_HORZ|BMP_MIRROR_VERT;
break;
default: nMirror = BMP_MIRROR_VERT; break;
case RES_MIRROR_GRAPH_DONT:
nMirror = BMP_MIRROR_HORZ;
break;
case RES_MIRROR_GRAPH_VERT:
nMirror = BMP_MIRROR_NONE;
break;
case RES_MIRROR_GRAPH_HOR:
nMirror = BMP_MIRROR_HORZ|BMP_MIRROR_VERT;
break;
default:
nMirror = BMP_MIRROR_VERT;
break;
}
}
else
switch( rMirror.GetValue() )
{
case RES_MIRROR_GRAPH_BOTH: nMirror = BMP_MIRROR_HORZ|BMP_MIRROR_VERT;
break;
case RES_MIRROR_GRAPH_VERT: nMirror = BMP_MIRROR_HORZ; break;
case RES_MIRROR_GRAPH_HOR: nMirror = BMP_MIRROR_VERT; break;
case RES_MIRROR_GRAPH_BOTH:
nMirror = BMP_MIRROR_HORZ|BMP_MIRROR_VERT;
break;
case RES_MIRROR_GRAPH_VERT:
nMirror = BMP_MIRROR_HORZ;
break;
case RES_MIRROR_GRAPH_HOR:
nMirror = BMP_MIRROR_VERT;
break;
}
rGA.SetMirrorFlags( nMirror );
......
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