fdo#46808, Adapt document::GraphicObjectResolver UNO service to new style
The services already existed, it just did not have an IDL file Change-Id: I245f78c165dbfde11a981efd7033c5c282f4e8ad
This commit is contained in:
@@ -28,9 +28,9 @@
|
|||||||
#include <com/sun/star/io/XActiveDataSource.hpp>
|
#include <com/sun/star/io/XActiveDataSource.hpp>
|
||||||
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
||||||
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
|
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
|
||||||
#include "com/sun/star/resource/XStringResourceWithStorage.hpp"
|
#include <com/sun/star/resource/XStringResourceWithStorage.hpp>
|
||||||
#include "com/sun/star/resource/XStringResourceWithLocation.hpp"
|
#include <com/sun/star/resource/XStringResourceWithLocation.hpp>
|
||||||
#include "com/sun/star/document/XGraphicObjectResolver.hpp"
|
#include <com/sun/star/document/GraphicObjectResolver.hpp>
|
||||||
#include "dlgcont.hxx"
|
#include "dlgcont.hxx"
|
||||||
#include "sbmodule.hxx"
|
#include "sbmodule.hxx"
|
||||||
#include <comphelper/componentcontext.hxx>
|
#include <comphelper/componentcontext.hxx>
|
||||||
@@ -238,17 +238,15 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
|
|||||||
Reference< io::XInputStream > xInput( xISP->createInputStream() );
|
Reference< io::XInputStream > xInput( xISP->createInputStream() );
|
||||||
Reference< XNameContainer > xDialogModel( mxMSF->createInstance
|
Reference< XNameContainer > xDialogModel( mxMSF->createInstance
|
||||||
( OUString( "com.sun.star.awt.UnoControlDialogModel" ) ) , UNO_QUERY );
|
( OUString( "com.sun.star.awt.UnoControlDialogModel" ) ) , UNO_QUERY );
|
||||||
Reference< XComponentContext > xContext(
|
Reference< XComponentContext > xContext( comphelper::getComponentContext( mxMSF ) );
|
||||||
comphelper::getComponentContext( mxMSF ) );
|
|
||||||
::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
|
::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
|
||||||
std::vector< OUString > vEmbeddedImageURLs;
|
std::vector< OUString > vEmbeddedImageURLs;
|
||||||
GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
|
GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
|
||||||
if ( !vEmbeddedImageURLs.empty() )
|
if ( !vEmbeddedImageURLs.empty() )
|
||||||
{
|
{
|
||||||
// Export the images to the storage
|
// Export the images to the storage
|
||||||
Sequence< Any > aArgs( 1 );
|
Reference< document::XGraphicObjectResolver > xGraphicResolver =
|
||||||
aArgs[ 0 ] <<= xStorage;
|
document::GraphicObjectResolver::createWithStorage( xContext, xStorage );
|
||||||
Reference< document::XGraphicObjectResolver > xGraphicResolver( mxMSF->createInstanceWithArguments( OUString("com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs ), UNO_QUERY );
|
|
||||||
std::vector< OUString >::iterator it = vEmbeddedImageURLs.begin();
|
std::vector< OUString >::iterator it = vEmbeddedImageURLs.begin();
|
||||||
std::vector< OUString >::iterator it_end = vEmbeddedImageURLs.end();
|
std::vector< OUString >::iterator it_end = vEmbeddedImageURLs.end();
|
||||||
if ( xGraphicResolver.is() )
|
if ( xGraphicResolver.is() )
|
||||||
|
@@ -50,7 +50,7 @@
|
|||||||
#include <com/sun/star/xml/sax/Parser.hpp>
|
#include <com/sun/star/xml/sax/Parser.hpp>
|
||||||
#include <com/sun/star/xml/sax/SAXParseException.hpp>
|
#include <com/sun/star/xml/sax/SAXParseException.hpp>
|
||||||
#include <com/sun/star/packages/zip/ZipIOException.hpp>
|
#include <com/sun/star/packages/zip/ZipIOException.hpp>
|
||||||
#include <com/sun/star/document/XGraphicObjectResolver.hpp>
|
#include <com/sun/star/document/GraphicObjectResolver.hpp>
|
||||||
#include <com/sun/star/container/XNameAccess.hpp>
|
#include <com/sun/star/container/XNameAccess.hpp>
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
@@ -619,11 +619,8 @@ sal_Int32 XMLFilter::impl_Export(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Sequence< uno::Any > aGraphicResolverArgs(1);
|
Reference< document::XGraphicObjectResolver > xGraphicObjectResolver = document::GraphicObjectResolver::createWithStorage(
|
||||||
aGraphicResolverArgs[0] <<= xStorage;
|
m_xContext, xStorage );
|
||||||
Reference< document::XGraphicObjectResolver > xGraphicObjectResolver(
|
|
||||||
xServiceFactory->createInstanceWithArguments(
|
|
||||||
C2U("com.sun.star.comp.Svx.GraphicExportHelper"), aGraphicResolverArgs ), uno::UNO_QUERY );
|
|
||||||
|
|
||||||
// property map for export info set
|
// property map for export info set
|
||||||
comphelper::PropertyMapEntry aExportInfoMap[] =
|
comphelper::PropertyMapEntry aExportInfoMap[] =
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <com/sun/star/document/XExporter.hpp>
|
#include <com/sun/star/document/XExporter.hpp>
|
||||||
#include <com/sun/star/document/XFilter.hpp>
|
#include <com/sun/star/document/XFilter.hpp>
|
||||||
#include <com/sun/star/document/XImporter.hpp>
|
#include <com/sun/star/document/XImporter.hpp>
|
||||||
|
#include <com/sun/star/document/GraphicObjectResolver.hpp>
|
||||||
#include <com/sun/star/embed/EntryInitModes.hpp>
|
#include <com/sun/star/embed/EntryInitModes.hpp>
|
||||||
#include <com/sun/star/embed/XEmbedPersist.hpp>
|
#include <com/sun/star/embed/XEmbedPersist.hpp>
|
||||||
#include <com/sun/star/embed/XTransactedObject.hpp>
|
#include <com/sun/star/embed/XTransactedObject.hpp>
|
||||||
@@ -435,10 +436,7 @@ void lcl_uglyHackToStoreDialogeEmbedImages( const Reference< XStorageBasedLibrar
|
|||||||
if ( !vEmbedImgUrls.empty() )
|
if ( !vEmbedImgUrls.empty() )
|
||||||
{
|
{
|
||||||
// Export the images to the storage
|
// Export the images to the storage
|
||||||
Sequence< Any > aArgs( 1 );
|
Reference< XGraphicObjectResolver > xGraphicResolver = GraphicObjectResolver::createWithStorage(aContext.getUNOContext(), xTmpPic);
|
||||||
aArgs[ 0 ] <<= xTmpPic;
|
|
||||||
Reference< XGraphicObjectResolver > xGraphicResolver(
|
|
||||||
aContext.createComponentWithArguments( "com.sun.star.comp.Svx.GraphicExportHelper", aArgs ), UNO_QUERY );
|
|
||||||
std::vector< OUString >::iterator it = vEmbedImgUrls.begin();
|
std::vector< OUString >::iterator it = vEmbedImgUrls.begin();
|
||||||
std::vector< OUString >::iterator it_end = vEmbedImgUrls.end();
|
std::vector< OUString >::iterator it_end = vEmbedImgUrls.end();
|
||||||
if ( xGraphicResolver.is() )
|
if ( xGraphicResolver.is() )
|
||||||
|
@@ -95,6 +95,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/deployment
|
|||||||
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\
|
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\
|
||||||
DocumentProperties \
|
DocumentProperties \
|
||||||
DocumentRevisionListPersistence \
|
DocumentRevisionListPersistence \
|
||||||
|
GraphicObjectResolver \
|
||||||
OleEmbeddedServerRegistration \
|
OleEmbeddedServerRegistration \
|
||||||
OOXMLDocumentPropertiesImporter \
|
OOXMLDocumentPropertiesImporter \
|
||||||
))
|
))
|
||||||
|
42
offapi/com/sun/star/document/GraphicObjectResolver.idl
Normal file
42
offapi/com/sun/star/document/GraphicObjectResolver.idl
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/* -*- 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 .
|
||||||
|
*/
|
||||||
|
#ifndef __com_sun_star_document_GraphicObjectResolver_idl__
|
||||||
|
#define __com_sun_star_document_GraphicObjectResolver_idl__
|
||||||
|
|
||||||
|
#include <com/sun/star/document/XGraphicObjectResolver.idl>
|
||||||
|
#include <com/sun/star/embed/XStorage.idl>
|
||||||
|
|
||||||
|
|
||||||
|
module com { module sun { module star { module document {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@since LibreOffice 4.1
|
||||||
|
*/
|
||||||
|
service GraphicObjectResolver : XGraphicObjectResolver
|
||||||
|
{
|
||||||
|
createWithStorage([in] com::sun::star::embed::XStorage Storage);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}; }; }; };
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -55,7 +55,7 @@
|
|||||||
#include <com/sun/star/table/CellAddress.hpp>
|
#include <com/sun/star/table/CellAddress.hpp>
|
||||||
#include <com/sun/star/table/CellRangeAddress.hpp>
|
#include <com/sun/star/table/CellRangeAddress.hpp>
|
||||||
#include <com/sun/star/document/XStorageBasedDocument.hpp>
|
#include <com/sun/star/document/XStorageBasedDocument.hpp>
|
||||||
#include <com/sun/star/document/XGraphicObjectResolver.hpp>
|
#include <com/sun/star/document/GraphicObjectResolver.hpp>
|
||||||
|
|
||||||
#include <comphelper/componentcontext.hxx>
|
#include <comphelper/componentcontext.hxx>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
@@ -700,14 +700,10 @@ void ElementDescriptor::readImageURLAttr( OUString const & rPropName, OUString c
|
|||||||
Reference< document::XStorageBasedDocument > xDocStorage( _xDocument, UNO_QUERY );
|
Reference< document::XStorageBasedDocument > xDocStorage( _xDocument, UNO_QUERY );
|
||||||
if ( xDocStorage.is() )
|
if ( xDocStorage.is() )
|
||||||
{
|
{
|
||||||
uno::Sequence< Any > aArgs( 1 );
|
Reference<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
|
||||||
aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
|
uno::Reference< document::XGraphicObjectResolver > xGraphicResolver =
|
||||||
|
document::GraphicObjectResolver::createWithStorage( xContext, xDocStorage->getDocumentStorage() );
|
||||||
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
|
sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
|
||||||
uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
|
|
||||||
aContext.createComponentWithArguments( "com.sun.star.comp.Svx.GraphicExportHelper" , aArgs, xGraphicResolver );
|
|
||||||
if ( xGraphicResolver.is() )
|
|
||||||
sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !sURL.isEmpty() )
|
if ( !sURL.isEmpty() )
|
||||||
|
Reference in New Issue
Block a user