Revert "remove css::embed::XLinkFactory"

This reverts commit 26305f046f.

it removes a published API without deprecating it first

Change-Id: I174320a675e9fe6f9a7de475491ca7984ac30d9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206709
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Xisco Fauli
2026-06-17 08:52:51 +02:00
parent 4c8f80433e
commit c855a3ff35
6 changed files with 148 additions and 0 deletions
@@ -306,6 +306,63 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta
return xResult;
}
uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceLinkUserInit(
const uno::Sequence< sal_Int8 >& aClassID,
const OUString& /*aClassName*/,
const uno::Reference< embed::XStorage >& xStorage,
const OUString& sEntName,
const uno::Sequence< beans::PropertyValue >& lArguments,
const uno::Sequence< beans::PropertyValue >& lObjArgs )
{
if ( officecfg::Office::Common::Security::Scripting::DisableActiveContent::get() )
throw lang::NoSupportException(u"Active embedded content is disabled!"_ustr);
uno::Reference< uno::XInterface > xResult;
// the initialization is completely controlled by user
if ( !xStorage.is() )
throw lang::IllegalArgumentException( u"No parent storage is provided!"_ustr,
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
1 );
if ( sEntName.isEmpty() )
throw lang::IllegalArgumentException( u"Empty element name is provided!"_ustr,
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
2 );
uno::Sequence< beans::PropertyValue > aTempMedDescr( lArguments );
OUString aURL;
for (beans::PropertyValue const& prop : aTempMedDescr)
if ( prop.Name == "URL" )
prop.Value >>= aURL;
if ( aURL.isEmpty() )
throw lang::IllegalArgumentException( u"No URL for the link is provided!"_ustr,
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
3 );
uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID );
if ( !aObject.hasElements() )
throw io::IOException(); // unexpected mimetype of the storage
OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, aObject );
if ( aFilterName.isEmpty() )
{
// the object must be OOo embedded object, if it is not an exception must be thrown
throw io::IOException(); // TODO:
}
xResult.set(static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
m_xContext,
aObject,
aTempMedDescr,
lObjArgs ) ),
uno::UNO_QUERY );
return xResult;
}
OUString SAL_CALL OOoEmbeddedObjectFactory::getImplementationName()
{
return u"com.sun.star.comp.embed.OOoEmbeddedObjectFactory"_ustr;
@@ -20,6 +20,7 @@
#pragma once
#include <com/sun/star/embed/XEmbeddedObjectCreator.hpp>
#include <com/sun/star/embed/XLinkFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <osl/diagnose.h>
#include <cppuhelper/implbase.hxx>
@@ -27,6 +28,7 @@
class OOoEmbeddedObjectFactory : public ::cppu::WeakImplHelper<
css::embed::XEmbeddedObjectCreator,
css::embed::XLinkFactory,
css::lang::XServiceInfo >
{
css::uno::Reference< css::uno::XComponentContext > m_xContext;
@@ -53,6 +55,9 @@ public:
// XLinkCreator
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceLink( const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr, const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
// XLinkFactory
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceLinkUserInit( const css::uno::Sequence< sal_Int8 >& aClassID, const OUString& aClassName, const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, const css::uno::Sequence< css::beans::PropertyValue >& lArguments, const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+1
View File
@@ -2405,6 +2405,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/embed,\
XInplaceObject \
XInsertObjectDialog \
XLinkCreator \
XLinkFactory \
XLinkageSupport \
XOLESimpleStorage \
XOptimizedStorage \
@@ -27,6 +27,7 @@ interface XEmbeddedObjectCreator
interface XEmbedObjectCreator;
interface XEmbedObjectFactory;
interface XLinkCreator;
[optional] interface XLinkFactory;
};
@@ -0,0 +1,80 @@
/* -*- 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 .
*/
module com { module sun { module star { module embed {
/** allows to create and initialize a new link of specified type.
*/
published interface XLinkFactory: com::sun::star::uno::XInterface
{
/** creates a new link and transport parameters for persistent
initialization.
<p>
This method can be used to have a full control over persistence
initialization of a link.
</p>
@param aClassID
the class id of the new object
@param ClassName
the class name of the new object
@param xStorage
a parent storage the entry should be created in
@param sEntryName
a name for the entry
@param aArgs
com::sun::star::document::MediaDescriptor
that contains source for the link
@param aObjectArgs
optional parameters for the object persistence initialization
see also
com::sun::star::embed::EmbeddedObjectDescriptor
@throws ::com::sun::star::lang::IllegalArgumentException
one of arguments is illegal
@throws com::sun::star::io::IOException
in case of io problems during opening or creation
@throws com::sun::star::uno::Exception
in case of other problems
*/
::com::sun::star::uno::XInterface createInstanceLinkUserInit(
[in] sequence< byte > aClassID,
[in] string ClassName,
[in] ::com::sun::star::embed::XStorage xStorage,
[in] string sEntryName,
[in] sequence< ::com::sun::star::beans::PropertyValue > aArgs,
[in] sequence< ::com::sun::star::beans::PropertyValue > aObjectArgs )
raises( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::io::IOException,
::com::sun::star::uno::Exception );
};
}; }; }; };
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+4
View File
@@ -6069,6 +6069,10 @@ module com {
interface ::com::sun::star::uno::XInterface;
::com::sun::star::uno::XInterface createInstanceLink([in] ::com::sun::star::embed::XStorage xStorage, [in] string sEntryName, [in] sequence< ::com::sun::star::beans::PropertyValue > aArgs, [in] sequence< ::com::sun::star::beans::PropertyValue > aObjectArgs) raises (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception);
};
published interface XLinkFactory {
interface ::com::sun::star::uno::XInterface;
::com::sun::star::uno::XInterface createInstanceLinkUserInit([in] sequence< byte > aClassID, [in] string ClassName, [in] ::com::sun::star::embed::XStorage xStorage, [in] string sEntryName, [in] sequence< ::com::sun::star::beans::PropertyValue > aArgs, [in] sequence< ::com::sun::star::beans::PropertyValue > aObjectArgs) raises (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception);
};
};
module frame {
published interface XDispatchProviderInterceptor;