diff options
author | Michael Stahl <mstahl@redhat.com> | 2011-12-02 23:54:33 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2011-12-03 00:48:15 +0100 |
commit | e8a54ef88dacccb9759dd394473d52b53ff1cbd7 (patch) | |
tree | 6b6a18d6d11b365a46de3359e49f8ea2b2fd562e /sd | |
parent | 51ea69880ca32220fa1c6b3e95c8916e3409184c (diff) |
add avmedia::EmbedMedia
This new function is used by sc,sd,sw to embed media in the document storage.
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/View.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/view/sdview4.cxx | 22 |
3 files changed, 21 insertions, 6 deletions
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 184248dc228a..0ca60db2bfa7 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -768,7 +768,7 @@ void FuInsertAVMedia::DoExecute( SfxRequest& rReq ) aPos.Y() -= aSize.Height() >> 1; } - mpView->InsertMediaURL( aURL, nAction, aPos, aSize ) ; + mpView->InsertMediaURL( aURL, nAction, aPos, aSize, bLink ) ; if( mpWindow ) mpWindow->LeaveWait(); diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index 1387f461cc36..6816ef6e0d4a 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -152,7 +152,8 @@ public: sal_Int8& rAction, const Point& rPos, SdrObject* pSelectedObj, ImageMap* pImageMap ); SdrMediaObj* InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAction, - const Point& rPos, const Size& rSize ); + const Point& rPos, const Size& rSize, + bool const bLink ); bool PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions ); diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 2e8663f90b74..f42ad34cbc24 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -284,8 +284,22 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, // ----------------------------------------------------------------------------- SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAction, - const Point& rPos, const Size& rSize ) + const Point& rPos, const Size& rSize, + bool const bLink ) { + ::rtl::OUString realURL; + if (bLink) + { + realURL = rMediaURL; + } + else + { + uno::Reference<frame::XModel> const xModel( + GetDoc()->GetObjectShell()->GetModel()); + bool const bRet = ::avmedia::EmbedMedia(xModel, rMediaURL, realURL); + if (!bRet) { return 0; } + } + SdrEndTextEdit(); mnAction = rAction; @@ -308,7 +322,7 @@ SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAc if( mnAction == DND_ACTION_LINK && pPickObj && pPV && pPickObj->ISA( SdrMediaObj ) ) { pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->Clone() ); - pNewMediaObj->setURL( rMediaURL ); + pNewMediaObj->setURL( realURL ); BegUndo(String(SdResId(STR_UNDO_DRAGDROP))); ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj); @@ -339,7 +353,7 @@ SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAc else InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER ); - pNewMediaObj->setURL( rMediaURL ); + pNewMediaObj->setURL( realURL ); if( pPickObj ) { @@ -461,7 +475,7 @@ IMPL_LINK( View, DropInsertFileHdl, Timer*, EMPTYARG ) else aPrefSize = Size( 5000, 5000 ); - InsertMediaURL( aCurrentDropFile, mnAction, maDropPos, aPrefSize ) ; + InsertMediaURL( aCurrentDropFile, mnAction, maDropPos, aPrefSize, true ) ; } else if( mnAction & DND_ACTION_LINK ) static_cast< DrawViewShell* >( mpViewSh )->InsertURLButton( aCurrentDropFile, aCurrentDropFile, String(), &maDropPos ); |