summaryrefslogtreecommitdiff
path: root/sc
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 /sc
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 'sc')
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 3d5ea7d01f74..10b6661b1680 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -186,8 +186,6 @@ void lcl_InsertMedia( const ::rtl::OUString& rMediaURL, bool bApi,
if( pData->GetDocument()->IsNegativePage( pData->GetTabNo() ) )
aInsertPos.X() -= aSize.Width();
- uno::Reference<frame::XModel> const xModel(
- pData->GetDocument()->GetDocumentShell()->GetModel());
::rtl::OUString realURL;
if (bLink)
{
@@ -195,13 +193,16 @@ void lcl_InsertMedia( const ::rtl::OUString& rMediaURL, bool bApi,
}
else
{
+ uno::Reference<frame::XModel> const xModel(
+ pData->GetDocument()->GetDocumentShell()->GetModel());
bool const bRet = ::avmedia::EmbedMedia(xModel, rMediaURL, realURL);
if (!bRet) { return; }
}
SdrMediaObj* pObj = new SdrMediaObj( Rectangle( aInsertPos, aSize ) );
- pObj->setURL( realURL, (bLink) ? 0 : xModel );
+ pObj->SetModel(pData->GetDocument()->GetDrawLayer()); // set before setURL
+ pObj->setURL( realURL );
pView->InsertObjectAtView( pObj, *pPV, bApi ? SDRINSERT_DONTMARK : 0 );
}