[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source
Michael Stahl
mstahl at redhat.com
Fri Jun 6 08:57:02 PDT 2014
sw/inc/ndgrf.hxx | 8 +++---
sw/source/core/doc/doc.cxx | 2 -
sw/source/core/graphic/ndgrf.cxx | 51 +++++++++++++++++++++++++--------------
3 files changed, 37 insertions(+), 24 deletions(-)
New commits:
commit 26f76e859761b5fa39196edff454644d7fb36a02
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jun 6 17:37:04 2014 +0200
revert sw part of "don't swap in all images when loading files"
Half of commit 9b9eb2e4f619c63eabdc54b5d749ac55d8eaf333 is obsoleted
by orw's fix for i#124999; not sure about the other half.
Change-Id: I337a4bbf79912c02be7c7c56c5705253b3d7b125
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index ed025f5..329df90 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -345,9 +345,6 @@ SwGrfNode::~SwGrfNode()
/// allow reaction on change of content of GraphicObject
void SwGrfNode::onGraphicChanged()
{
- if (GetGrfObj().IsSwappedOut()) // don't force swap-in for this
- return;
-
// try to access SwFlyFrmFmt; since title/desc/name are set there, there is no
// use to continue if it is not yet set. If not yet set, call onGraphicChanged()
// when it is set.
commit b181a3cdf8fc0206c4c71fa7d29d3a04b0caa46b
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri Jun 6 12:14:07 2014 +0000
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
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 4d97b6a..d4cd0fb 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 01e9478..39a2849 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 00e383d..ed025f5 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 );
More information about the Libreoffice-commits
mailing list