[Libreoffice-commits] core.git: Branch 'feature/image_rework' - 10 commits - filter/source include/svtools include/vcl oox/source sd/qa svtools/source svx/source sw/inc sw/source vcl/inc vcl/source
Zolnai Tamás
tamas.zolnai at collabora.com
Sun Oct 26 04:21:05 PDT 2014
filter/source/msfilter/msdffimp.cxx | 1
include/svtools/grfmgr.hxx | 2 -
include/vcl/graph.hxx | 1
oox/source/export/drawingml.cxx | 3 --
sd/qa/unit/data/xml/fdo64586_0.xml | 4 +--
sd/qa/unit/data/xml/n758621_0.xml | 4 +--
sd/qa/unit/data/xml/n758621_1.xml | 4 +--
sd/qa/unit/data/xml/n819614_0.xml | 2 -
svtools/source/graphic/grfmgr.cxx | 31 +++++++++++++++++----------
svx/source/svdraw/svdograf.cxx | 8 ------
sw/inc/editsh.hxx | 2 -
sw/source/core/edit/editsh.cxx | 6 ++---
sw/source/core/graphic/ndgrf.cxx | 9 -------
sw/source/core/unocore/unoframe.cxx | 2 -
sw/source/filter/ww8/docxattributeoutput.cxx | 6 -----
sw/source/filter/ww8/rtfattributeoutput.cxx | 6 -----
sw/source/filter/ww8/writerhelper.cxx | 3 --
sw/source/filter/ww8/wrtww8gr.cxx | 4 ---
sw/source/filter/xml/xmltexte.cxx | 4 ---
sw/source/ui/frmdlg/wrap.cxx | 2 -
sw/source/uibase/shells/basesh.cxx | 4 +--
vcl/inc/impgraph.hxx | 1
vcl/source/gdi/graph.cxx | 6 +++++
vcl/source/gdi/impgraph.cxx | 13 +++++++----
24 files changed, 55 insertions(+), 73 deletions(-)
New commits:
commit 0942c2c5e9e57d58abee119cd397d29a106fbf3f
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Mon Oct 20 16:17:46 2014 +0200
Adapt sd test broken by a recent change
Commit broke the test:
ae72de8d10acd088d0a5f46880b8c4a3c8fd2c24
Change-Id: Ia3635e0f6622d603499dd47443d2434d093da38e
diff --git a/sd/qa/unit/data/xml/fdo64586_0.xml b/sd/qa/unit/data/xml/fdo64586_0.xml
index a248783..7bbf719 100644
--- a/sd/qa/unit/data/xml/fdo64586_0.xml
+++ b/sd/qa/unit/data/xml/fdo64586_0.xml
@@ -4,7 +4,7 @@
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
- <FillBitmap/>
+ <FillBitmap width="0" height="0"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
@@ -18,7 +18,7 @@
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
- <FillBitmap/>
+ <FillBitmap width="0" height="0"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
diff --git a/sd/qa/unit/data/xml/n758621_0.xml b/sd/qa/unit/data/xml/n758621_0.xml
index 754be1d..288bf98 100644
--- a/sd/qa/unit/data/xml/n758621_0.xml
+++ b/sd/qa/unit/data/xml/n758621_0.xml
@@ -4,7 +4,7 @@
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
- <FillBitmap/>
+ <FillBitmap width="0" height="0"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
@@ -18,7 +18,7 @@
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
- <FillBitmap/>
+ <FillBitmap width="0" height="0"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
diff --git a/sd/qa/unit/data/xml/n758621_1.xml b/sd/qa/unit/data/xml/n758621_1.xml
index 0f71931..a124211 100644
--- a/sd/qa/unit/data/xml/n758621_1.xml
+++ b/sd/qa/unit/data/xml/n758621_1.xml
@@ -4,7 +4,7 @@
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
- <FillBitmap/>
+ <FillBitmap width="0" height="0"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
@@ -18,7 +18,7 @@
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
- <FillBitmap/>
+ <FillBitmap width="0" height="0"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
diff --git a/sd/qa/unit/data/xml/n819614_0.xml b/sd/qa/unit/data/xml/n819614_0.xml
index aff9c32..b7005be 100644
--- a/sd/qa/unit/data/xml/n819614_0.xml
+++ b/sd/qa/unit/data/xml/n819614_0.xml
@@ -4,7 +4,7 @@
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
- <FillBitmap/>
+ <FillBitmap width="0" height="0"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
commit c6441344647e811e9be42a51fe77a3a0f886423b
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sat Oct 18 14:51:38 2014 +0200
Don't call SetUserData() when it actually does not change
This call leads to infinite loop, because SetUserDat() set
graphic state to swapped out which triggers ImportGraphic..
Change-Id: Id49c38e60a0bb924ff5ec0465e4fb141df61abe5
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index d9f168d..910d285 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -461,7 +461,6 @@ bool SwGrfNode::ImportGraphic( SvStream& rStrm )
mpReplacementGraphic = 0;
maGrfObj.SetGraphic( aGraphic );
- maGrfObj.SetUserData( aURL );
onGraphicChanged();
return true;
}
commit c817ec466823cdf6a2112de4adaf9e5c8e915620
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sat Oct 18 15:08:39 2014 +0200
Make SetSwapState() an internal method
So we can be sure it is always called when user data changed.
Change-Id: If107907afffb85a7a57817f5807847a5c028416c
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index 30ac634..d452276 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 6a20524..eb482cf 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 bb2d6b9..9088f9e 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 4b7152b..d9f168d 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?
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index e617703..43c7659 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1561,7 +1561,6 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
{
pGrfObj = new GraphicObject;
pGrfObj->SetUserData( sTmp );
- pGrfObj->SetSwapState();
sGrfName = "";
}
else if( sTmp.startsWith(sGraphicObjectProtocol) )
@@ -2825,7 +2824,6 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
{
pGrfObj = new GraphicObject;
pGrfObj->SetUserData( sGraphicURL );
- pGrfObj->SetSwapState();
sGraphicURL = "";
}
else if( sGraphicURL.startsWith(sGraphicObjectProtocol) )
commit 26293573ab518936f76dab65c08540f672c1f0cb
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sun Oct 19 18:30:47 2014 +0200
DOC import: avoid manual swapout call.
No reason to swapout the image directly after the import
because it will be used for rendering just a second later.
Change-Id: I78c8ef9225c55f306182dc5efd7bcaf0e88521c0
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index b7bf147..7396abe 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3974,7 +3974,6 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
Graphic aGraf(static_cast<SdrGrafObj*>(pRet)->GetGraphic());
lcl_ApplyCropping( *this, &rSet, aGraf );
}
- static_cast<SdrGrafObj*>(pRet)->ForceSwapOut();
}
return pRet;
commit b569a150ff91220e890916948e32b92efbae704e
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sat Oct 18 15:07:42 2014 +0200
MS export: don't need to manually swapout images after swapin them
We have some good auto mechanisms for that.
Change-Id: I487dbf4a5fc69c7563dfbc5c21f9ebdb05ba6b9e
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index f1ff69b..3c38c4d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -891,9 +891,6 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia )
sMediaType = "image/x-emf";
pExtension = ".emf";
}
-
- if (bSwapped)
- const_cast<Graphic&>(rGraphic).SwapOut();
}
else
{
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index be93040..d1de991 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4128,8 +4128,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
// Not in cache, then need to write it.
m_rDrawingML.SetFS( m_pSerializer ); // to be sure that we write to the right stream
- bool bSwapped = pGraphic->IsSwapOut();
- if (bSwapped)
+ if (pGraphic->IsSwapOut())
{
if (pGrfNode)
{
@@ -4142,9 +4141,6 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
OUString aImageId = m_rDrawingML.WriteImage( *pGraphic );
- if (bSwapped)
- const_cast<Graphic*>(pGraphic)->SwapOut();
-
aRelId = OUStringToOString( aImageId, RTL_TEXTENCODING_UTF8 );
m_aRelIdCache[pGraphic] = aRelId;
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 2d3a882..19b32f0 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3657,8 +3657,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
if (rGraphic.GetType()==GRAPHIC_NONE)
return;
- bool bSwapped = rGraphic.IsSwapOut();
- if (bSwapped)
+ if (rGraphic.IsSwapOut())
{
// always swapin via the Node
const_cast<SwGrfNode*>(pGrfNode)->SwapIn();
@@ -3834,9 +3833,6 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
else
m_rExport.Strm().WriteCharPtr("}}}}"); // Close SV, SP, SHPINST and SHP.
- if (bSwapped)
- const_cast<Graphic&>(rGraphic).SwapOut();
-
m_rExport.Strm().WriteCharPtr(SAL_NEWLINE_STRING);
}
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 0fc558f..ad68371 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -700,11 +700,8 @@ namespace sw
SwGrfNode *pGrfNode = const_cast<SwGrfNode*>(rNd.GetGrfNode());
if (pGrfNode && (GRAPHIC_NONE != pGrfNode->GetGrf().GetType()))
{
- bool bWasSwappedOut = pGrfNode->GetGrfObj().IsSwappedOut();
pGrfNode->SwapIn();
aGrTwipSz = pGrfNode->GetTwipSize();
- if (bWasSwappedOut)
- pGrfNode->SwapOut();
}
}
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index fad72e8..27ed033 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -725,7 +725,6 @@ void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd,
else
{
Graphic& rGrf = const_cast<Graphic&>(rGrfNd.GetGrf());
- bool bSwapped = rGrf.IsSwapOut();
// always swapin via the Node
const_cast<SwGrfNode&>(rGrfNd).SwapIn();
@@ -753,9 +752,6 @@ void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd,
WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight,
rGrfNd.GetpSwAttrSet());
WriteWindowMetafileBits(rStrm, aMeta);
-
- if (bSwapped)
- rGrf.SwapOut();
}
}
}
commit 8b0571fcffbcb174017475f1c4e9e4249aaeba1f
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sat Oct 18 15:06:57 2014 +0200
Remove manual SwapOut() call in ODF export
We have a good auto swapout mechanism which will
prevent excessive memory use.
Change-Id: I362f51c724ac31704561abe8b961910f5d490f04
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index 9198d7a..c830e1d 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -207,10 +207,6 @@ void SwXMLTextParagraphExport::setTextEmbeddedGraphicURL(
{
pGrfNd->ApplyNewEmbeddedStreamName("vnd.sun.star.Package:" + rURL);
}
-
- // #i15411# save-as will swap all graphics in; we need to swap
- // them out again, to prevent excessive memory use
- pGrfNd->SwapOut();
}
}
commit 6beebe82c266aca702375fc7ae6971e6ec0cabf2
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sun Oct 19 18:25:23 2014 +0200
Avoid using null pointer as a special indicator
When ImpGraphic::ImplSwapOut() is called with null
pointer it was assumed that it is becase the graphic is
a link and so we don't need to swap out it actually (we can
load it anytime using the link), only clear the graphic's
internal data.
The problem with that it can happen that ImplSwapOut()
is called with null pointer accidentally on a non-link
graphic object which leads to that we loose the graphic.
Seems more robust to use an explicit indicator
(GRFMGR_AUTOSWAPSTREAM_LINK) for links swapout.
indicator
Change-Id: Icf31524a192c7866278ba6a13eb85648aa69f554
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index 24d9e42..b55e7901 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -177,6 +177,7 @@ public:
sal_uLong GetDocFilePos() const;
bool SwapOut();
+ void SwapOutAsLink();
bool SwapOut( SvStream* pOStm );
bool SwapIn();
bool SwapIn( SvStream* pIStm );
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 9310018..6a20524 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -1099,7 +1099,16 @@ bool GraphicObject::SwapOut()
bool GraphicObject::SwapOut( SvStream* pOStm )
{
- const bool bRet = !mbAutoSwapped && maGraphic.SwapOut( pOStm );
+ bool bRet = !mbAutoSwapped;
+ // swap out as a link
+ if( pOStm == GRFMGR_AUTOSWAPSTREAM_LINK )
+ {
+ maGraphic.SwapOutAsLink();
+ }
+ else
+ {
+ bRet = bRet && maGraphic.SwapOut( pOStm );
+ }
if( bRet && mpMgr )
mpMgr->ImplGraphicObjectWasSwappedOut( *this );
@@ -1158,7 +1167,7 @@ IMPL_LINK_NOARG(GraphicObject, ImplAutoSwapOutHdl)
if( GRFMGR_AUTOSWAPSTREAM_NONE != pStream )
{
if( GRFMGR_AUTOSWAPSTREAM_LINK == pStream )
- mbAutoSwapped = SwapOut( NULL );
+ mbAutoSwapped = SwapOut( GRFMGR_AUTOSWAPSTREAM_LINK );
else
{
if( GRFMGR_AUTOSWAPSTREAM_TEMP == pStream )
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 280c6d4..4b7152b 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -621,7 +621,7 @@ bool SwGrfNode::SwapOut()
return false;
}
// written graphics and links are removed here
- return maGrfObj.SwapOut( NULL );
+ return maGrfObj.SwapOut( GRFMGR_AUTOSWAPSTREAM_LINK );
}
return true;
}
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 2242b44..513074d 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -143,6 +143,7 @@ private:
bool ImplSwapIn( SvStream* pIStm );
bool ImplSwapOut();
+ void ImplSwapOutAsLink();
bool ImplSwapOut( SvStream* pOStm );
bool ImplIsSwapOut() const { return mbSwapOut;}
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 4fe916a..2e39e5e 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -522,6 +522,12 @@ bool Graphic::SwapOut()
return mpImpGraphic->ImplSwapOut();
}
+void Graphic::SwapOutAsLink()
+{
+ ImplTestRefCount();
+ mpImpGraphic->ImplSwapOutAsLink();
+}
+
bool Graphic::SwapOut( SvStream* pOStream )
{
ImplTestRefCount();
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 9dc4908..9a1b818 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1349,6 +1349,12 @@ bool ImpGraphic::ImplSwapOut()
return bRet;
}
+void ImpGraphic::ImplSwapOutAsLink()
+{
+ ImplClearGraphics( true );
+ mbSwapOut = true;
+}
+
bool ImpGraphic::ImplSwapOut( SvStream* pOStm )
{
bool bRet = false;
@@ -1370,8 +1376,7 @@ bool ImpGraphic::ImplSwapOut( SvStream* pOStm )
}
else
{
- ImplClearGraphics( true );
- bRet = mbSwapOut = true;
+ SAL_WARN("vcl.gdi", "Graphic SwapOut: No stream for swap out!");
}
return bRet;
commit 2d0f1b052cae81211c4c6ece729adc89da14d0c1
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sat Oct 18 15:05:12 2014 +0200
Always call ImplAfterDataChange() when data is changed
Call it inside ImplAssignGraphicData() which assign
GraphicObject members using Graphic's data. With that
ImplAfterDataChange() method also called in constructors.
It's important to call ImplAfterDataChange(), because this
will triger the auto swaping mechanism.
Change-Id: I45af91f8df2fb5b0143fcc5eb05e82e4d408d0bc
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index b83c74a5..9310018 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -160,6 +160,9 @@ void GraphicObject::ImplAssignGraphicData()
mbAnimated = maGraphic.IsAnimated();
mbEPS = maGraphic.IsEPS();
mnAnimationLoopCount = ( mbAnimated ? maGraphic.GetAnimationLoopCount() : 0 );
+
+ // Handle evtl. needed AfterDataChanges
+ ImplAfterDataChange();
}
void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const OString* pID, const GraphicObject* pCopyObj )
@@ -260,9 +263,6 @@ void GraphicObject::ImplAutoSwapIn()
if( !mbAutoSwapped && mpMgr )
mpMgr->ImplGraphicObjectWasSwappedIn( *this );
}
-
- // Handle evtl. needed AfterDataChanges
- ImplAfterDataChange();
}
}
@@ -800,8 +800,7 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pC
if( mpSwapOutTimer )
mpSwapOutTimer->Start();
- // Handle evtl. needed AfterDataChanges
- ImplAfterDataChange();
+
}
void GraphicObject::SetGraphic( const Graphic& rGraphic, const OUString& rLink )
@@ -1132,9 +1131,6 @@ bool GraphicObject::SwapIn()
if( bRet )
{
ImplAssignGraphicData();
-
- // Handle evtl. needed AfterDataChanges
- ImplAfterDataChange();
}
return bRet;
commit 27c75d5c1ac73bc9021abb4ef110addec69c262b
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Fri Oct 17 10:06:10 2014 +0200
Do not check a reference
Change-Id: I5baac12f97ea7fa36293844331ca548b7bc2cdfd
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index d484329..9dc4908 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -141,7 +141,7 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
mpContext ( NULL ),
mpSwapFile ( NULL ),
mpGfxLink ( NULL ),
- meType ( !rBitmap ? GRAPHIC_NONE : GRAPHIC_BITMAP ),
+ meType ( GRAPHIC_BITMAP ),
mnDocFilePos ( 0UL ),
mnSizeBytes ( 0UL ),
mnRefCount ( 1UL ),
@@ -156,7 +156,7 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
mpContext ( NULL ),
mpSwapFile ( NULL ),
mpGfxLink ( NULL ),
- meType ( !rBitmapEx ? GRAPHIC_NONE : GRAPHIC_BITMAP ),
+ meType ( GRAPHIC_BITMAP ),
mnDocFilePos ( 0UL ),
mnSizeBytes ( 0UL ),
mnRefCount ( 1UL ),
commit 5fc321174a6bcba239345112b66fe292960eacb6
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Fri Oct 10 17:04:29 2014 +0200
Don't swap in graphic when only the type is needed.
Change-Id: I0066e7ffff216e02c75561844650127c3d866c10
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index b869896..8117d4d 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -619,7 +619,7 @@ public:
// #i73788#
/// Remove default parameter, because method always called this default value.
- Graphic GetIMapGraphic() const; ///< @return a graphic for all Flys!
+ Graphic GetIMapGraphic(bool bSwapIn = true) const; ///< @return a graphic for all Flys!
const SwFlyFrmFmt* FindFlyByName( const OUString& rName, sal_uInt8 nNdTyp = 0 ) const;
/** @return a ClientObject, if CurCrsr->Point() points to a SwOLENode
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index c59b59c..2b804ea 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -599,7 +599,7 @@ void *SwEditShell::GetIMapInventor() const
}
// #i73788#
-Graphic SwEditShell::GetIMapGraphic() const
+Graphic SwEditShell::GetIMapGraphic(bool bSwapIn) const
{
// returns always a graphic if the cursor is in a Fly
SET_CURR_SHELL( (SwViewShell*)this );
@@ -612,8 +612,8 @@ Graphic SwEditShell::GetIMapGraphic() const
{
SwGrfNode & rGrfNode(static_cast<SwGrfNode&>(rNd));
const Graphic& rGrf = rGrfNode.GetGrf();
- if( rGrf.IsSwapOut() || ( rGrfNode.IsLinkedFile() &&
- GRAPHIC_DEFAULT == rGrf.GetType() ) )
+ if( bSwapIn && (rGrf.IsSwapOut() || ( rGrfNode.IsLinkedFile() &&
+ GRAPHIC_DEFAULT == rGrf.GetType() ) ) )
{
bool const bResult = rGrfNode.SwapIn(true);
OSL_ENSURE(bResult, "Graphic could not be loaded" );
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index 9d0b32a..ba6b6b1 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -159,7 +159,7 @@ void SwWrapTabPage::Reset(const SfxItemSet *rSet)
int nSelType = pWrtSh->GetSelectionType();
if( ( nSelType & nsSelectionType::SEL_GRF ) ||
( nSelType & nsSelectionType::SEL_OLE && GRAPHIC_NONE !=
- pWrtSh->GetIMapGraphic().GetType() ))
+ pWrtSh->GetIMapGraphic(false).GetType() ))
bShowCB = true;
}
if( bShowCB )
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 96f5218..366feec 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1509,7 +1509,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
if ( nSel & nsSelectionType::SEL_GRF )
bDisable = GRAPHIC_NONE == rSh.GetGraphicType();
else
- bDisable = GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
+ bDisable = GRAPHIC_NONE == rSh.GetIMapGraphic(false).GetType();
}
if( bDisable )
@@ -1695,7 +1695,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
// #i102253# applied patch from OD (see task)
bDisable =
nSel & nsSelectionType::SEL_FRM ||
- GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
+ GRAPHIC_NONE == rSh.GetIMapGraphic(false).GetType();
}
}
bSet = bDisable ? sal_False : rWrap.IsContour();
More information about the Libreoffice-commits
mailing list