summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-10-26 16:38:36 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2017-10-31 00:21:13 +0100
commit5631652200a1261e4fee8e51cca238a35b465d14 (patch)
treec6cf5512ba9826b0ec89e79abd231094776cf78e
parent60a03d97bc35c02cb1eff0e4a02b6f37fd1a6a34 (diff)
Drop bDelayed from SwNodes::MakeGrfNode
There is no caller, which sets bDelayed. The comment "// create object delayed, only from a SW/G-reader" doesn't help me much either. But in case of a linked image, it seems appropriate to just drop the empty image and use the delayed SwGrfNode constructor. At least a linked PDF and PNG still work. Change-Id: Idff5599ac0ff04c3efcb141c731c0ee1cfa747de Reviewed-on: https://gerrit.libreoffice.org/43908 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--sw/inc/ndarr.hxx3
-rw-r--r--sw/source/core/graphic/ndgrf.cxx18
-rw-r--r--sw/source/core/unocore/unoframe.cxx6
3 files changed, 15 insertions, 12 deletions
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 80270f209f08..1c2bdf87a2bf 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -219,8 +219,7 @@ public:
const OUString& rFltName,
const Graphic* pGraphic,
SwGrfFormatColl *pColl,
- SwAttrSet const * pAutoAttr = nullptr,
- bool bDelayed = false ); ///< in ndgrf.cxx
+ SwAttrSet const * pAutoAttr = nullptr ); ///< in ndgrf.cxx
static SwGrfNode *MakeGrfNode( const SwNodeIndex & rWhere,
const GraphicObject& rGrfObj,
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index e6dd87bd0616..7ef061715ba8 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -60,7 +60,8 @@ using namespace com::sun::star;
SwGrfNode::SwGrfNode(
const SwNodeIndex & rWhere,
- const OUString& rGrfName, const OUString& rFltName,
+ const OUString& rGrfName,
+ const OUString& rFltName,
const Graphic* pGraphic,
SwGrfFormatColl *pGrfColl,
SwAttrSet const * pAutoAttr ) :
@@ -80,8 +81,9 @@ SwGrfNode::SwGrfNode(
}
SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
- const GraphicObject& rGrfObj,
- SwGrfFormatColl *pGrfColl, SwAttrSet const * pAutoAttr ) :
+ const GraphicObject& rGrfObj,
+ SwGrfFormatColl *pGrfColl,
+ SwAttrSet const * pAutoAttr ) :
SwNoTextNode( rWhere, SwNodeType::Grf, pGrfColl, pAutoAttr ),
maGrfObj(rGrfObj),
mpReplacementGraphic(nullptr),
@@ -102,7 +104,8 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
* @note Does not read/open the image itself!
*/
SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
- const OUString& rGrfName, const OUString& rFltName,
+ const OUString& rGrfName,
+ const OUString& rFltName,
SwGrfFormatColl *pGrfColl,
SwAttrSet const * pAutoAttr ) :
SwNoTextNode( rWhere, SwNodeType::Grf, pGrfColl, pAutoAttr ),
@@ -119,7 +122,7 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
bInSwapIn = bChgTwipSize =
bFrameInPaint = bScaleImageMap = false;
- bGraphicArrived = true;
+ bGraphicArrived = false;
InsertLink( rGrfName, rFltName );
if( IsLinkedFile() )
@@ -425,13 +428,12 @@ SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere,
const OUString& rFltName,
const Graphic* pGraphic,
SwGrfFormatColl* pGrfColl,
- SwAttrSet const * pAutoAttr,
- bool bDelayed )
+ SwAttrSet const * pAutoAttr )
{
OSL_ENSURE( pGrfColl, "MakeGrfNode: Formatpointer is 0." );
SwGrfNode *pNode;
// create object delayed, only from a SW/G-reader
- if( bDelayed )
+ if( !pGraphic )
pNode = new SwGrfNode( rWhere, rGrfName,
rFltName, pGrfColl, pAutoAttr );
else
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index a73201a56b1c..c715ee00f76a 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2836,7 +2836,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
}
Graphic aGraphic;
const ::uno::Any* pGraphic;
- if( pProps->GetProperty( FN_UNO_GRAPHIC, 0, pGraphic ))
+ const bool bHasGraphic = pProps->GetProperty( FN_UNO_GRAPHIC, 0, pGraphic );
+ if( bHasGraphic )
{
uno::Reference< graphic::XGraphic > xGraphic;
(*pGraphic) >>= xGraphic;
@@ -2854,7 +2855,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
? pDoc->getIDocumentContentOperations().InsertGraphicObject(
aPam, *pGrfObj, &aFrameSet, &aGrSet, pParentFrameFormat)
: pDoc->getIDocumentContentOperations().InsertGraphic(
- aPam, sGraphicURL, sFltName, &aGraphic,
+ aPam, sGraphicURL, sFltName,
+ (!bHasGraphic && !sGraphicURL.isEmpty()) ? nullptr : &aGraphic,
&aFrameSet, &aGrSet, pParentFrameFormat);
delete pGrfObj;
if(pFormat)