diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2014-06-06 12:14:07 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-06-06 17:51:08 +0200 |
commit | b181a3cdf8fc0206c4c71fa7d29d3a04b0caa46b (patch) | |
tree | 82c0fbcf3d49fccd2d9ac0c00c4cbb4d2e1f55cc | |
parent | adb1bb21f804c62004f31ad5473d4cf447436b9b (diff) |
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 4dbdc0ce931d7686583a49e68f8df09827357beb)
Change-Id: I3e6aa68d9507095925dec37075abcdf9da58c804
-rw-r--r-- | sw/inc/ndgrf.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 48 |
3 files changed, 37 insertions, 21 deletions
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index 4d97b6a9feae..d4cd0fb653c6 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -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 ); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 01e94789a047..39a28495618a 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -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; } diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 00e383d5f6b0..ed025f51dc61 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -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 ); |