summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2011-11-30 16:08:24 +0100
committerMichael Stahl <mstahl@redhat.com>2011-12-03 00:48:14 +0100
commit18ab7abaa9426cd27092125637fdf5fb849b4a04 (patch)
treeccebd65335fc2470ce40360c7cbfaaa6fe4cffe3 /avmedia
parentc6fdc42e87d3474d89d33486a23885a2921160af (diff)
MediaWindow::executeMediaURLDialog: add link button
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/inc/avmedia/mediawindow.hxx5
-rw-r--r--avmedia/source/framework/mediacontrol.cxx3
-rw-r--r--avmedia/source/viewer/mediawindow.cxx38
3 files changed, 41 insertions, 5 deletions
diff --git a/avmedia/inc/avmedia/mediawindow.hxx b/avmedia/inc/avmedia/mediawindow.hxx
index 9de4ab6bbfb0..696eab6d6801 100644
--- a/avmedia/inc/avmedia/mediawindow.hxx
+++ b/avmedia/inc/avmedia/mediawindow.hxx
@@ -119,7 +119,10 @@ namespace avmedia
public:
static void getMediaFilters( FilterNameVector& rFilterNameVector );
- static bool executeMediaURLDialog( Window* pParent, ::rtl::OUString& rURL, bool bInsertDialog = true );
+ /// @param o_pbLink if not 0, this is an "insert" dialog: display link
+ /// checkbox and store its state in *o_pbLink
+ static bool executeMediaURLDialog( Window* pParent,
+ ::rtl::OUString& rURL, bool *const o_pbLink );
static void executeFormatErrorBox( Window* pParent );
static bool isMediaURL( const ::rtl::OUString& rURL, bool bDeep = false, Size* pPreferredSizePixel = NULL );
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index e56550505219..291906992911 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -499,7 +499,8 @@ IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p )
{
::rtl::OUString aURL;
- if( ::avmedia::MediaWindow::executeMediaURLDialog( GetParent(), aURL, false ) )
+ if (::avmedia::MediaWindow::executeMediaURLDialog(
+ GetParent(), aURL, 0))
{
if( !::avmedia::MediaWindow::isMediaURL( aURL, true ) )
::avmedia::MediaWindow::executeFormatErrorBox( this );
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index b910a0c2c608..f063526d53e5 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -39,7 +39,9 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/media/XManager.hpp>
+#include "com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp"
#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp"
#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME_MEDIATIME 3.0
@@ -251,15 +253,19 @@ void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector )
// -------------------------------------------------------------------------
-bool MediaWindow::executeMediaURLDialog( Window* /* pParent */, ::rtl::OUString& rURL, bool bInsertDialog )
+bool MediaWindow::executeMediaURLDialog(Window* /* pParent */,
+ ::rtl::OUString& rURL, bool *const o_pbLink)
{
- ::sfx2::FileDialogHelper aDlg( com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ ::sfx2::FileDialogHelper aDlg( (o_pbLink)
+ ? ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW
+ : ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
static const ::rtl::OUString aWildcard( RTL_CONSTASCII_USTRINGPARAM( "*." ) );
FilterNameVector aFilters;
const ::rtl::OUString aSeparator( RTL_CONSTASCII_USTRINGPARAM( ";" ) );
::rtl::OUString aAllTypes;
- aDlg.SetTitle( AVMEDIA_RESID( bInsertDialog ? AVMEDIA_STR_INSERTMEDIA_DLG : AVMEDIA_STR_OPENMEDIA_DLG ) );
+ aDlg.SetTitle( AVMEDIA_RESID( (o_pbLink)
+ ? AVMEDIA_STR_INSERTMEDIA_DLG : AVMEDIA_STR_OPENMEDIA_DLG ) );
getMediaFilters( aFilters );
@@ -297,10 +303,36 @@ bool MediaWindow::executeMediaURLDialog( Window* /* pParent */, ::rtl::OUString&
// add filter for all types
aDlg.AddFilter( AVMEDIA_RESID( AVMEDIA_STR_ALL_FILES ), String( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) ) );
+ uno::Reference<ui::dialogs::XFilePicker> const xFP(aDlg.GetFilePicker());
+ uno::Reference<ui::dialogs::XFilePickerControlAccess> const xCtrlAcc(xFP,
+ uno::UNO_QUERY_THROW);
+ if (o_pbLink)
+ {
+ // for video link should be the default
+ xCtrlAcc->setValue(
+ ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0,
+ uno::makeAny(sal_True) );
+ // disabled for now: TODO: preview?
+ xCtrlAcc->enableControl(
+ ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PREVIEW,
+ sal_False);
+ }
+
if( aDlg.Execute() == ERRCODE_NONE )
{
const INetURLObject aURL( aDlg.GetPath() );
rURL = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
+
+ if (o_pbLink)
+ {
+ uno::Any const any = xCtrlAcc->getValue(
+ ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
+ if (!(any >>= *o_pbLink))
+ {
+ SAL_WARN("avmedia", "invalid link property");
+ *o_pbLink = true;
+ }
+ }
}
else if( rURL.getLength() )
rURL = ::rtl::OUString();