From 431604f9fa603a7acf67985c9e4851f37d9cd580 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 6 Dec 2011 04:36:22 +0100 Subject: refactor media embedding completely: Do the tempfile handling in SdrMediaObj, not in the window; this has the advantage that it works even in the presence of clipboard documents without SfxBaseModels and thus without storage (sc, sw). The SdrMediaObj instances share ownership of a temp file. --- sw/source/ui/shells/grfshex.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sw') diff --git a/sw/source/ui/shells/grfshex.cxx b/sw/source/ui/shells/grfshex.cxx index e3807cba4a78..2fc57e5e0ffb 100644 --- a/sw/source/ui/shells/grfshex.cxx +++ b/sw/source/ui/shells/grfshex.cxx @@ -136,8 +136,6 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq ) else aSize = Size( 2835, 2835 ); - uno::Reference const xModel( - rSh.GetDoc()->GetDocShell()->GetModel()); ::rtl::OUString realURL; if (bLink) { @@ -145,13 +143,16 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq ) } else { + uno::Reference const xModel( + rSh.GetDoc()->GetDocShell()->GetModel()); bRet = ::avmedia::EmbedMedia(xModel, aURL, realURL); if (!bRet) { return bRet; } } SdrMediaObj* pObj = new SdrMediaObj( Rectangle( aPos, aSize ) ); - pObj->setURL( realURL, (bLink) ? 0 : xModel ); + pObj->SetModel(rSh.GetDoc()->GetDrawModel()); // set before setURL + pObj->setURL( realURL ); rSh.EnterStdMode(); rSh.SwFEShell::InsertDrawObj( *pObj, aPos ); bRet = true; -- cgit