Kaydet (Commit) 06726aa3 authored tarafından Thorsten Behrens's avatar Thorsten Behrens Kaydeden (comit) Thorsten Behrens

[API CHANGE] Remove NPAPI-related UNO API

Follow-up to 4c18af27, 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/20780Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 6dd7798f
......@@ -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 \
......
......@@ -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<MessageDialog>::Create(this, aErr)->Execute();
}
}
return nRet;
}
SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( vcl::Window *pParent,
const css::uno::Reference < css::embed::XStorage >& xStorage )
......
......@@ -1553,8 +1553,6 @@ SfxAbstractInsertObjectDialog* AbstractDialogFactory_Impl::CreateInsertObjectDia
InsertObjectDialog_Impl* pDlg=nullptr;
if ( rCommand == ".uno:InsertObject" )
pDlg = VclPtr<SvInsertOleDlg>::Create( pParent, xStor, pList );
else if ( rCommand == ".uno:InsertPlugin" )
pDlg = VclPtr<SvInsertPlugInDialog>::Create( pParent, xStor );
else if ( rCommand == ".uno:InsertObjectFloatingFrame" )
pDlg = VclPtr<SfxInsertFloatingFrameDialog>::Create( pParent, xStor );
......
......@@ -19,7 +19,6 @@
#ifndef INCLUDED_SFX2_DOCFILT_HXX
#define INCLUDED_SFX2_DOCFILT_HXX
#include <com/sun/star/plugin/PluginDescription.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/beans/UnknownPropertyException.hpp>
#include <com/sun/star/lang/WrappedTargetException.hpp>
......
......@@ -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???
}
}
}
}
}
......
......@@ -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<MessageDialog>::Create(mpWindow, aStrErr)->Execute();
}
}
}
}
}
......
......@@ -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 \
......
......@@ -54,7 +54,6 @@
#include <com/sun/star/frame/FrameActionEvent.hpp>
#include <com/sun/star/frame/FrameAction.hpp>
#include <com/sun/star/loader/XImplementationLoader.hpp>
#include <com/sun/star/mozilla/XPluginInstance.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
......
This diff is collapsed.
......@@ -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 \
......
/* -*- 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 <sfx2/docfile.hxx>
#include <com/sun/star/plugin/PluginDescription.hpp>
#include <com/sun/star/plugin/PluginManager.hpp>
#include <com/sun/star/plugin/XPluginManager.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <comphelper/processfactory.hxx>
#include "svx/pfiledlg.hxx"
#include <svx/dialogs.hrc>
#include <svx/dialmgr.hxx>
#include <list>
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<plugin::PluginDescription > 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: */
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment