summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2011-12-06 04:36:22 +0100
committerMichael Stahl <mstahl@redhat.com>2011-12-06 04:36:22 +0100
commit431604f9fa603a7acf67985c9e4851f37d9cd580 (patch)
tree2dbbe2e40af935229dbc8f2738dc446ab18a93b8 /sw
parentf3c19f8263f3352ce4efff0965f8000d8347f6a5 (diff)
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.
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/shells/grfshex.cxx7
1 files changed, 4 insertions, 3 deletions
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<frame::XModel> const xModel(
- rSh.GetDoc()->GetDocShell()->GetModel());
::rtl::OUString realURL;
if (bLink)
{
@@ -145,13 +143,16 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq )
}
else
{
+ uno::Reference<frame::XModel> 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;