From 06726aa39eaeba71701742d28a1a81bd1574f883 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Thu, 17 Dec 2015 19:30:22 +0100 Subject: [API CHANGE] Remove NPAPI-related UNO API Follow-up to 4c18af27bf95b332ee2006cfc0bbf469fb1a84d4, related to tdf#96398, removing more client code. The following published interfaces are removed: com::sun::star::mozilla::XPluginInstance com::sun::star::mozilla::XPluginInstanceNotifySink com::sun::star::mozilla::XPluginInstancePeer com::sun::star::mozilla::XPluginInstanceSyncPeer com::sun::star::mozilla::XPluginWindowPeer com::sun::star::plugin::PluginDescription com::sun::star::plugin::PluginException com::sun::star::plugin::PluginManager com::sun::star::plugin::PluginMode com::sun::star::plugin::PluginVariable com::sun::star::plugin::XPlugin com::sun::star::plugin::XPluginContext com::sun::star::plugin::XPluginManager Change-Id: I3818a23e0f46fd01bfe9be11b57f6a551c013441 Reviewed-on: https://gerrit.libreoffice.org/20780 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens --- cui/Library_cui.mk | 1 - cui/source/dialogs/insdlg.cxx | 127 --------------- cui/source/factory/dlgfact.cxx | 2 - include/sfx2/docfilt.hxx | 1 - sc/source/ui/drawfunc/fuins2.cxx | 38 ----- sd/source/ui/func/fuinsert.cxx | 39 ----- sfx2/Library_sfx.mk | 1 - sfx2/source/appl/app.cxx | 1 - sfx2/source/doc/plugin.cxx | 317 ------------------------------------- svx/Library_svx.mk | 1 - svx/source/dialog/pfiledlg.cxx | 186 ---------------------- sw/source/uibase/shells/textsh.cxx | 40 ----- 12 files changed, 754 deletions(-) delete mode 100644 sfx2/source/doc/plugin.cxx delete mode 100644 svx/source/dialog/pfiledlg.cxx diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 85a9bf034549..86cc3796e1b9 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -112,7 +112,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/dialogs/newtabledlg \ cui/source/dialogs/passwdomdlg \ cui/source/dialogs/pastedlg \ - cui/source/dialogs/plfilter \ cui/source/dialogs/postdlg \ cui/source/dialogs/scriptdlg \ cui/source/dialogs/sdrcelldlg \ diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index f47208bef1c3..c85e392a11a3 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -359,133 +359,6 @@ uno::Reference< io::XInputStream > SvInsertOleDlg::GetIconIfIconified( OUString* return uno::Reference< io::XInputStream >(); } -IMPL_LINK_NOARG_TYPED(SvInsertPlugInDialog, BrowseHdl, Button*, void) -{ - Sequence< OUString > aFilterNames, aFilterTypes; - fillNetscapePluginFilters( aFilterNames, aFilterTypes ); - - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - Reference< XFilePicker3 > xFilePicker = ui::dialogs::FilePicker::createWithMode( xContext, ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE ); - - // add the filters - try - { - const OUString* pNames = aFilterNames.getConstArray(); - const OUString* pTypes = aFilterTypes.getConstArray(); - for( int i = 0; i < aFilterNames.getLength(); i++ ) - xFilePicker->appendFilter( pNames[i], pTypes[i] ); - } - catch( IllegalArgumentException& ) - { - DBG_ASSERT( false, "caught IllegalArgumentException when registering filter\n" ); - } - - if( xFilePicker->execute() == ExecutableDialogResults::OK ) - { - Sequence< OUString > aPathSeq( xFilePicker->getSelectedFiles() ); - INetURLObject aObj( aPathSeq[0] ); - m_pEdFileurl->SetText(aObj.PathToFileName()); - } -} - - - -SvInsertPlugInDialog::SvInsertPlugInDialog(vcl::Window* pParent, - const uno::Reference < embed::XStorage >& xStorage) - : InsertObjectDialog_Impl(pParent, "InsertPluginDialog", "cui/ui/insertplugin.ui", xStorage) - , m_pURL(nullptr) -{ - get(m_pEdFileurl, "urled"); - get(m_pBtnFileurl, "urlbtn"); - get(m_pEdPluginsOptions, "pluginoptions"); - m_pBtnFileurl->SetClickHdl(LINK(this, SvInsertPlugInDialog, BrowseHdl)); -} - -SvInsertPlugInDialog::~SvInsertPlugInDialog() -{ - disposeOnce(); -} - -void SvInsertPlugInDialog::dispose() -{ - delete m_pURL; - m_pURL = nullptr; - m_pEdFileurl.clear(); - m_pBtnFileurl.clear(); - m_pEdPluginsOptions.clear(); - InsertObjectDialog_Impl::dispose(); -} - -static void Plugin_ImplFillCommandSequence( const OUString& aCommands, uno::Sequence< beans::PropertyValue >& aCommandSequence ) -{ - sal_Int32 nEaten; - SvCommandList aLst; - aLst.AppendCommands( aCommands, &nEaten ); - - const size_t nCount = aLst.size(); - aCommandSequence.realloc( nCount ); - for( size_t nIndex = 0; nIndex < nCount; nIndex++ ) - { - aCommandSequence[nIndex].Name = aLst[ nIndex ].GetCommand(); - aCommandSequence[nIndex].Handle = -1; - aCommandSequence[nIndex].Value = makeAny( aLst[ nIndex ].GetArgument() ); - aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE; - } -} - -short SvInsertPlugInDialog::Execute() -{ - short nRet = RET_OK; - m_aCommands.clear(); - DBG_ASSERT( m_xStorage.is(), "No storage!"); - if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK ) - { - if ( !m_pURL ) - m_pURL = new INetURLObject(); - else - *m_pURL = INetURLObject(); - - m_aCommands = GetPlugInOptions(); - OUString aURL = GetPlugInFile(); - - // URL can be a valid and absolute URL or a system file name - m_pURL->SetSmartProtocol( INetProtocol::File ); - if ( aURL.isEmpty() || m_pURL->SetSmartURL( aURL ) ) - { - // create a plugin object - OUString aName; - SvGlobalName aClassId( SO3_PLUGIN_CLASSID ); - m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName ); - } - - if ( m_xObj.is() ) - { - // set properties from dialog - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - - uno::Reference < beans::XPropertySet > xSet( m_xObj->getComponent(), uno::UNO_QUERY ); - if ( xSet.is() ) - { - xSet->setPropertyValue( "PluginURL", - makeAny( OUString( m_pURL->GetMainURL( INetURLObject::NO_DECODE ) ) ) ); - uno::Sequence< beans::PropertyValue > aCommandSequence; - Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence ); - xSet->setPropertyValue( "PluginCommands", makeAny( aCommandSequence ) ); - } - } - else - { - // PlugIn couldn't be created - // global Resource from svtools (former so3 resource) - OUString aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_PLUGIN ) ); - aErr = aErr.replaceFirst( "%", aURL ); - ScopedVclPtrInstance::Create(this, aErr)->Execute(); - } - } - - return nRet; -} SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( vcl::Window *pParent, const css::uno::Reference < css::embed::XStorage >& xStorage ) diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index d32081248f73..b3a19ef054b2 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1553,8 +1553,6 @@ SfxAbstractInsertObjectDialog* AbstractDialogFactory_Impl::CreateInsertObjectDia InsertObjectDialog_Impl* pDlg=nullptr; if ( rCommand == ".uno:InsertObject" ) pDlg = VclPtr::Create( pParent, xStor, pList ); - else if ( rCommand == ".uno:InsertPlugin" ) - pDlg = VclPtr::Create( pParent, xStor ); else if ( rCommand == ".uno:InsertObjectFloatingFrame" ) pDlg = VclPtr::Create( pParent, xStor ); diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx index fbb8ee00efdb..4a6babb6b7bd 100644 --- a/include/sfx2/docfilt.hxx +++ b/include/sfx2/docfilt.hxx @@ -19,7 +19,6 @@ #ifndef INCLUDED_SFX2_DOCFILT_HXX #define INCLUDED_SFX2_DOCFILT_HXX -#include #include #include #include diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 05bbdd21479e..6c7899f980fa 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -262,44 +262,6 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawView* break; } - case SID_INSERT_SOUND : - case SID_INSERT_VIDEO : - { - // create special filedialog for plugins - SvxPluginFileDlg aPluginFileDialog(pWin, nSlot); - - // open filedlg - if ( ERRCODE_NONE == aPluginFileDialog.Execute() ) - { - // get URL - INetURLObject aURL; - aURL.SetSmartProtocol( INetProtocol::File ); - if ( aURL.SetURL( aPluginFileDialog.GetPath() ) ) - { - // create a plugin object - OUString aObjName; - SvGlobalName aClassId( SO3_PLUGIN_CLASSID ); - comphelper::EmbeddedObjectContainer aCnt( xStorage ); - xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aObjName ); - if ( xObj.is() && svt::EmbeddedObjectRef::TryRunningState( xObj ) ) - { - // set properties from dialog - uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY ); - if ( xSet.is() ) - { - xSet->setPropertyValue("PluginURL", - uno::makeAny( OUString( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) ); - } - } - } - else - { - OSL_FAIL("Invalid URL!"); - //! error message - //! can this happen??? - } - } - } } } diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index be90f49dd3cb..e93fa84597bc 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -501,45 +501,6 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) break; } - case SID_INSERT_SOUND : - case SID_INSERT_VIDEO : - { - // create special filedialog for plugins - SvxPluginFileDlg aPluginFileDialog (mpWindow, nSlotId); - if( ERRCODE_NONE == aPluginFileDialog.Execute () ) - { - // get URL - OUString aStrURL(aPluginFileDialog.GetPath()); - INetURLObject aURL( aStrURL, INetProtocol::File ); - if( aURL.GetProtocol() != INetProtocol::NotValid ) - { - // create a plugin object - xObj = mpViewShell->GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), aName ); - } - - if ( xObj.is() && svt::EmbeddedObjectRef::TryRunningState( xObj ) ) - { - // set properties from dialog - uno::Reference < embed::XComponentSupplier > xSup( xObj, uno::UNO_QUERY ); - if ( xSup.is() ) - { - uno::Reference < beans::XPropertySet > xSet( xSup->getComponent(), uno::UNO_QUERY ); - if ( xSet.is() ) - { - xSet->setPropertyValue("PluginURL", - uno::makeAny( OUString( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) ); - } - } - } - else - { - // unable to create PlugIn - OUString aStrErr( SdResId( STR_ERROR_OBJNOCREATE_PLUGIN ) ); - aStrErr = aStrErr.replaceFirst( "%", aStrURL ); - ScopedVclPtrInstance::Create(mpWindow, aStrErr)->Execute(); - } - } - } } } diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 75be117a025f..2440cdc06f68 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -226,7 +226,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/doc/objxtor \ sfx2/source/doc/oleprops \ sfx2/source/doc/ownsubfilterservice \ - sfx2/source/doc/plugin \ sfx2/source/doc/printhelper \ sfx2/source/doc/querytemplate \ sfx2/source/doc/docundomanager \ diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 555a62f61dac..f64a1e49f219 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -54,7 +54,6 @@ #include #include #include -#include #include #include #include diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx deleted file mode 100644 index e94c495d2b89..000000000000 --- a/sfx2/source/doc/plugin.cxx +++ /dev/null @@ -1,317 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; - -namespace { - -class PluginWindow_Impl : public vcl::Window -{ -public: - uno::Reference < awt::XWindow > xWindow; - explicit PluginWindow_Impl(vcl::Window* pParent) - : Window( pParent, WB_CLIPCHILDREN ) - {} - - virtual void Resize() override; -}; - -void PluginWindow_Impl::Resize() -{ - Size aSize( GetOutputSizePixel() ); - if ( xWindow.is() ) - xWindow->setPosSize( 0, 0, aSize.Width(), aSize.Height(), css::awt::PosSize::SIZE ); -} - -#define PROPERTY_UNBOUND 0 - -#define WID_COMMANDS 1 -#define WID_MIMETYPE 2 -#define WID_URL 3 -const SfxItemPropertyMapEntry* lcl_GetPluginPropertyMap_Impl() -{ - static const SfxItemPropertyMapEntry aPluginPropertyMap_Impl[] = - { - { OUString("PluginCommands"), WID_COMMANDS, cppu::UnoType>::get(), PROPERTY_UNBOUND, 0}, - { OUString("PluginMimeType"), WID_MIMETYPE, cppu::UnoType::get(), PROPERTY_UNBOUND, 0 }, - { OUString("PluginURL"), WID_URL , cppu::UnoType::get(), PROPERTY_UNBOUND, 0 }, - { OUString(), 0, css::uno::Type(), 0, 0 } - }; - return aPluginPropertyMap_Impl; -} - -class PluginObject : public ::cppu::WeakImplHelper < - css::util::XCloseable, - css::lang::XEventListener, - css::frame::XSynchronousFrameLoader, - css::beans::XPropertySet, - css::lang::XServiceInfo > -{ - css::uno::Reference< css::plugin::XPlugin > mxPlugin; - SfxItemPropertyMap maPropMap; - SvCommandList maCmdList; - OUString maURL; - OUString maMimeType; - -public: - PluginObject(); - virtual ~PluginObject(); - - virtual sal_Bool SAL_CALL load( const css::uno::Sequence < css::beans::PropertyValue >& lDescriptor, - const css::uno::Reference < css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL cancel() throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) throw( css::util::CloseVetoException, css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addCloseListener( const css::uno::Reference < css::util::XCloseListener >& xListener ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removeCloseListener( const css::uno::Reference < css::util::XCloseListener >& xListener ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw (css::uno::RuntimeException, std::exception) override ; - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > & aListener) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removePropertyChangeListener(const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > & aListener) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addVetoableChangeListener(const OUString& aPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removeVetoableChangeListener(const OUString& aPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override; - virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override; - - virtual OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException, std::exception) override - { - return OUString("com.sun.star.comp.sfx2.PluginObject"); - } - - virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) - throw (css::uno::RuntimeException, std::exception) override - { - return cppu::supportsService(this, ServiceName); - } - - virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() - throw (css::uno::RuntimeException, std::exception) override - { - css::uno::Sequence< OUString > aSeq { "com.sun.star.frame.SpecialEmbeddedObject" }; - return aSeq; - } -}; - -PluginObject::PluginObject() - : maPropMap( lcl_GetPluginPropertyMap_Impl() ) -{ -} - -PluginObject::~PluginObject() -{ -} - -sal_Bool SAL_CALL PluginObject::load( - const uno::Sequence < css::beans::PropertyValue >& /*lDescriptor*/, - const uno::Reference < frame::XFrame >& xFrame ) -throw( uno::RuntimeException, std::exception ) -{ - uno::Reference< plugin::XPluginManager > xPMgr( plugin::PluginManager::create(comphelper::getProcessComponentContext()) ); - - if ( SvtMiscOptions().IsPluginsEnabled() ) - { - vcl::Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - VclPtr pWin = VclPtr::Create( pParent ); - pWin->SetSizePixel( pParent->GetOutputSizePixel() ); - pWin->SetBackground(); - pWin->Show(); - - size_t nCount = maCmdList.size(); - uno::Sequence < OUString > aCmds( nCount ), aArgs( nCount ); - OUString *pCmds = aCmds.getArray(), *pArgs = aArgs.getArray(); - for( size_t i = 0; i < nCount; i++ ) - { - pCmds[i] = maCmdList[ i ].GetCommand(); - pArgs[i] = maCmdList[ i ].GetArgument(); - } - - mxPlugin = xPMgr->createPluginFromURL( - xPMgr->createPluginContext(), plugin::PluginMode::EMBED, aCmds, aArgs, uno::Reference< awt::XToolkit >(), - uno::Reference< awt::XWindowPeer >( pWin->GetComponentInterface() ), maURL ); - - if ( mxPlugin.is() ) - { - uno::Reference< awt::XWindow > xWindow( mxPlugin, uno::UNO_QUERY ); - if ( xWindow.is() ) - { - pWin->xWindow = xWindow; - pWin->Resize(); - xWindow->setVisible( sal_True ); - } - - try - { - uno::Reference< awt::XControl > xControl( mxPlugin, uno::UNO_QUERY ); - if( xControl.is() ) - { - uno::Reference< awt::XControlModel > xModel = xControl->getModel(); - uno::Reference< beans::XPropertySet > xProp( xModel, ::uno::UNO_QUERY ); - if( xProp.is() ) - { - uno::Any aValue = xProp->getPropertyValue("URL"); - aValue >>= maURL; - aValue = xProp->getPropertyValue("TYPE"); - aValue >>= maMimeType; - } - } - } - catch( const uno::Exception& ) - { - } - } - - uno::Reference < awt::XWindow > xWindow( pWin->GetComponentInterface(), uno::UNO_QUERY ); - - // we must destroy the plugin before the parent is destroyed - xWindow->addEventListener( this ); - xFrame->setComponent( xWindow, uno::Reference < frame::XController >() ); - return mxPlugin.is(); - } - - return sal_False; -} - -void SAL_CALL PluginObject::cancel() throw( css::uno::RuntimeException, std::exception ) -{ - uno::Reference< lang::XComponent > xComp( mxPlugin, uno::UNO_QUERY ); - if (xComp.is()) - xComp->dispose(); - mxPlugin = nullptr; -} - -void SAL_CALL PluginObject::close( sal_Bool /*bDeliverOwnership*/ ) throw( css::util::CloseVetoException, css::uno::RuntimeException, std::exception ) -{ -} - -void SAL_CALL PluginObject::addCloseListener( const css::uno::Reference < css::util::XCloseListener >& ) throw( css::uno::RuntimeException, std::exception ) -{ -} - -void SAL_CALL PluginObject::removeCloseListener( const css::uno::Reference < css::util::XCloseListener >& ) throw( css::uno::RuntimeException, std::exception ) -{ -} - -void SAL_CALL PluginObject::disposing( const css::lang::EventObject& ) throw (css::uno::RuntimeException, std::exception) -{ - cancel(); -} - -uno::Reference< beans::XPropertySetInfo > SAL_CALL PluginObject::getPropertySetInfo() throw( css::uno::RuntimeException, std::exception ) -{ - static uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo( maPropMap ); - return xInfo; -} - -void SAL_CALL PluginObject::setPropertyValue(const OUString& aPropertyName, const uno::Any& aAny) - throw ( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception) -{ - if ( aPropertyName == "PluginURL" ) - { - aAny >>= maURL; - } - else if ( aPropertyName == "PluginMimeType" ) - { - aAny >>= maMimeType; - } - else if ( aPropertyName == "PluginCommands" ) - { - maCmdList.clear(); - uno::Sequence < beans::PropertyValue > aCommandSequence; - if( aAny >>= aCommandSequence ) - maCmdList.FillFromSequence( aCommandSequence ); - } - else - throw beans::UnknownPropertyException(); -} - -uno::Any SAL_CALL PluginObject::getPropertyValue(const OUString& aPropertyName) - throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) -{ - uno::Any aAny; - if ( aPropertyName == "PluginURL" ) - { - aAny <<= maURL; - } - else if ( aPropertyName == "PluginMimeType" ) - { - aAny <<= maMimeType; - } - else if ( aPropertyName == "PluginCommands" ) - { - uno::Sequence< beans::PropertyValue > aCommandSequence; - maCmdList.FillSequence( aCommandSequence ); - aAny <<= aCommandSequence; - } - else - throw beans::UnknownPropertyException(); - return aAny; -} - -void SAL_CALL PluginObject::addPropertyChangeListener(const OUString&, const css::uno::Reference< css::beans::XPropertyChangeListener > & ) throw( css::uno::RuntimeException, std::exception ) -{ -} - -void SAL_CALL PluginObject::removePropertyChangeListener(const OUString&, const css::uno::Reference< css::beans::XPropertyChangeListener > & ) throw( css::uno::RuntimeException, std::exception ) -{ -} - -void SAL_CALL PluginObject::addVetoableChangeListener(const OUString&, const css::uno::Reference< css::beans::XVetoableChangeListener > & ) throw( css::uno::RuntimeException, std::exception ) -{ -} - -void SAL_CALL PluginObject::removeVetoableChangeListener(const OUString&, const css::uno::Reference< css::beans::XVetoableChangeListener > & ) throw( css::uno::RuntimeException, std::exception ) -{ -} - -} - -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL -com_sun_star_comp_sfx2_PluginObject_get_implementation( - css::uno::XComponentContext *, - css::uno::Sequence const &) -{ - return cppu::acquire(new PluginObject()); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 90cfe49ca532..6f70a783be7b 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -133,7 +133,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/dialog/pagectrl \ svx/source/dialog/paraprev \ svx/source/dialog/passwd \ - svx/source/dialog/pfiledlg \ svx/source/dialog/prtqry \ svx/source/dialog/relfld \ svx/source/dialog/rlrcitem \ diff --git a/svx/source/dialog/pfiledlg.cxx b/svx/source/dialog/pfiledlg.cxx deleted file mode 100644 index 6a0d6364e844..000000000000 --- a/svx/source/dialog/pfiledlg.cxx +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include -#include -#include -#include - -#include - -#include "svx/pfiledlg.hxx" -#include - -#include -#include - -using namespace ::com::sun::star; - -sal_Char const sAudio[] = "audio"; -sal_Char const sVideo[] = "video"; - -// Filedialog to insert Plugin-Fileformats - -ErrCode SvxPluginFileDlg::Execute() -{ - return maFileDlg.Execute(); -} - -OUString SvxPluginFileDlg::GetPath() const -{ - return maFileDlg.GetPath(); -} - -SvxPluginFileDlg::SvxPluginFileDlg (vcl::Window *, sal_uInt16 nKind ) - : maFileDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, SFXWB_INSERT) -{ - // set title of the dialogwindow - switch (nKind) - { - case SID_INSERT_SOUND : - { - maFileDlg.SetTitle(SVX_RESSTR(STR_INSERT_SOUND_TITLE)); - } - break; - case SID_INSERT_VIDEO : - { - maFileDlg.SetTitle(SVX_RESSTR(STR_INSERT_VIDEO_TITLE)); - } - break; - } - - // fill the filterlist of the filedialog with data of installed plugins - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - uno::Reference< plugin::XPluginManager > rPluginManager( plugin::PluginManager::create(xContext) ); - - const uno::Sequence aSeq( rPluginManager->getPluginDescriptions() ); - const plugin::PluginDescription* pDescription = aSeq.getConstArray(); - sal_Int32 nAnzahlPlugins = rPluginManager->getPluginDescriptions().getLength(); - - std::list< OUString > aPlugNames; - std::list< OUString > aPlugExtensions; - std::list< OUString >::iterator j; - std::list< OUString >::iterator k; - std::list< OUString >::const_iterator end; - - for ( int i = 0; i < nAnzahlPlugins; i++ ) - { - OUString aStrPlugMIMEType( pDescription[i].Mimetype ); - OUString aStrPlugName( pDescription[i].Description ); - OUString aStrPlugExtension( pDescription[i].Extension ); - - aStrPlugMIMEType = aStrPlugMIMEType.toAsciiLowerCase(); - aStrPlugExtension = aStrPlugExtension.toAsciiLowerCase(); - - if ( ( nKind == SID_INSERT_SOUND && aStrPlugMIMEType.startsWith( sAudio ) ) || - ( nKind == SID_INSERT_VIDEO && aStrPlugMIMEType.startsWith( sVideo ) ) ) - { - // extension already in the filterlist of the filedlg ? - bool bAlreadyExist = false; - for ( j = aPlugExtensions.begin(), end = aPlugExtensions.end(); j != end && !bAlreadyExist; ++j ) - { - bAlreadyExist = (j->indexOf( aStrPlugExtension ) != -1 ); - } - - if ( !bAlreadyExist ) - { - // filterdescription already there? - // (then append the new extension to the existing filter) - int nfound = -1; - for ( j = aPlugNames.begin(), - k = aPlugExtensions.begin(), - end = aPlugNames.end(); - j != end && nfound != 0; ) - { - if ( ( nfound = j->indexOf( aStrPlugName ) ) == 0 ) - { - if ( !aStrPlugExtension.isEmpty() ) - aStrPlugExtension += ";"; - aStrPlugExtension += *k; - - // remove old entry, increment (iterators are invalid thereafter, thus the postincrement) - aPlugNames.erase(j++); - aPlugExtensions.erase(k++); - - // update end iterator (which may be invalid, too!) - end = aPlugNames.end(); - } - else - { - // next element - ++j; ++k; - } - } - - // build filterdescription - aStrPlugName += " ("; - aStrPlugName += aStrPlugExtension; - aStrPlugName += ")"; - - // use a own description for the video-formate avi, mov and mpeg - // the descriptions of these MIME-types are not very meaningful - const sal_Char sAVI[] = "*.avi"; - const sal_Char sMOV[] = "*.mov"; - const sal_Char sMPG[] = "*.mpg"; - const sal_Char sMPE[] = "*.mpe"; - const sal_Char sMPEG[] = "*.mpeg"; - - if ( aStrPlugExtension.equalsIgnoreAsciiCase( sAVI ) ) - aStrPlugName = SVX_RESSTR( STR_INSERT_VIDEO_EXTFILTER_AVI ); - else if ( aStrPlugExtension.equalsIgnoreAsciiCase( sMOV ) ) - aStrPlugName = SVX_RESSTR( STR_INSERT_VIDEO_EXTFILTER_MOV ); - else if ( aStrPlugExtension.indexOf( sMPG ) != -1 || - aStrPlugExtension.indexOf( sMPE ) != -1 || - aStrPlugExtension.indexOf( sMPEG ) != -1 ) - aStrPlugName = SVX_RESSTR(STR_INSERT_VIDEO_EXTFILTER_MPEG); - - aPlugNames.push_back( aStrPlugName ); - aPlugExtensions.push_back( aStrPlugExtension ); - } - } - } - - // add filter to dialog - for ( j = aPlugNames.begin(), - k = aPlugExtensions.begin(), - end = aPlugNames.end(); - j != end; ++j, ++k ) - { - maFileDlg.AddFilter( *j, *k ); - } - - // add the All-Filter - OUString aAllFilter( ResId( STR_EXTFILTER_ALL, DIALOG_MGR() ).toString() ); - maFileDlg.AddFilter(aAllFilter, "*.*"); - - // and activate him - maFileDlg.SetCurrentFilter( aAllFilter ); -} - -SvxPluginFileDlg::~SvxPluginFileDlg() -{ -} - -void SvxPluginFileDlg::SetContext( sfx2::FileDialogHelper::Context _eNewContext ) -{ - maFileDlg.SetContext( _eNewContext ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 4834685bc6f1..d30838e98b2e 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -236,46 +236,6 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) case SID_INSERT_AVMEDIA: rReq.SetReturnValue(SfxBoolItem(nSlot, InsertMediaDlg( rReq ))); break; - - case SID_INSERT_SOUND: - case SID_INSERT_VIDEO: - { - SvxPluginFileDlg aDlg( &GetView().GetViewFrame()->GetWindow(), nSlot ); - aDlg.SetContext( nSlot == SID_INSERT_SOUND? sfx2::FileDialogHelper::SW_INSERT_SOUND : sfx2::FileDialogHelper::SW_INSERT_VIDEO ); - - if ( ERRCODE_NONE == aDlg.Execute() ) - { - // Determine URL - OUString aStrURL( aDlg.GetPath() ); - aStrURL = URIHelper::SmartRel2Abs( - INetURLObject(), aStrURL, URIHelper::GetMaybeFileHdl() ); - - INetURLObject url; - url.SetSmartProtocol( INetProtocol::File ); - - if ( url.SetURL( aStrURL ) ) - { - OUString aName; - comphelper::EmbeddedObjectContainer aCnt; - svt::EmbeddedObjectRef xObj( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT ); - if ( xObj.is() ) - { - svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() ); - - // set properties from dialog - uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY ); - if ( xSet.is() ) - { - xSet->setPropertyValue("PluginURL", - uno::makeAny( OUString( url.GetMainURL( INetURLObject::NO_DECODE ) ) ) ); - } - } - - rSh.InsertObject( xObj, nullptr, true, nSlot); - } - } - } - break; #endif case SID_INSERT_OBJECT: -- cgit v1.2.3