summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-09 15:32:10 +0200
committerNoel Grandin <noel@peralex.com>2013-01-28 08:22:53 +0200
commit49cf14a3ca8dceed39baead918b1ddaaab5f4ab3 (patch)
treeee1ea9363933db10c96e373b091ac7952ae9dfc0
parent4b37df18a18b61521e5fcbf358c6bc85639abdfc (diff)
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
-rw-r--r--basic/source/uno/dlgcont.cxx14
-rw-r--r--chart2/source/model/filter/XMLFilter.cxx9
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx6
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/document/GraphicObjectResolver.idl42
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx14
6 files changed, 59 insertions, 27 deletions
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index d5bcedc85a64..2c0054da5df0 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -28,9 +28,9 @@
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include "com/sun/star/resource/XStringResourceWithStorage.hpp"
-#include "com/sun/star/resource/XStringResourceWithLocation.hpp"
-#include "com/sun/star/document/XGraphicObjectResolver.hpp"
+#include <com/sun/star/resource/XStringResourceWithStorage.hpp>
+#include <com/sun/star/resource/XStringResourceWithLocation.hpp>
+#include <com/sun/star/document/GraphicObjectResolver.hpp>
#include "dlgcont.hxx"
#include "sbmodule.hxx"
#include <comphelper/componentcontext.hxx>
@@ -238,17 +238,15 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
Reference< io::XInputStream > xInput( xISP->createInputStream() );
Reference< XNameContainer > xDialogModel( mxMSF->createInstance
( OUString( "com.sun.star.awt.UnoControlDialogModel" ) ) , UNO_QUERY );
- Reference< XComponentContext > xContext(
- comphelper::getComponentContext( mxMSF ) );
+ Reference< XComponentContext > xContext( comphelper::getComponentContext( mxMSF ) );
::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
std::vector< OUString > vEmbeddedImageURLs;
GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
if ( !vEmbeddedImageURLs.empty() )
{
// Export the images to the storage
- Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= xStorage;
- Reference< document::XGraphicObjectResolver > xGraphicResolver( mxMSF->createInstanceWithArguments( OUString("com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs ), UNO_QUERY );
+ Reference< document::XGraphicObjectResolver > xGraphicResolver =
+ document::GraphicObjectResolver::createWithStorage( xContext, xStorage );
std::vector< OUString >::iterator it = vEmbeddedImageURLs.begin();
std::vector< OUString >::iterator it_end = vEmbeddedImageURLs.end();
if ( xGraphicResolver.is() )
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 603ea175bf6b..41cff8a6053f 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -50,7 +50,7 @@
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.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>
using namespace ::com::sun::star;
@@ -619,11 +619,8 @@ sal_Int32 XMLFilter::impl_Export(
}
}
- uno::Sequence< uno::Any > aGraphicResolverArgs(1);
- aGraphicResolverArgs[0] <<= xStorage;
- Reference< document::XGraphicObjectResolver > xGraphicObjectResolver(
- xServiceFactory->createInstanceWithArguments(
- C2U("com.sun.star.comp.Svx.GraphicExportHelper"), aGraphicResolverArgs ), uno::UNO_QUERY );
+ Reference< document::XGraphicObjectResolver > xGraphicObjectResolver = document::GraphicObjectResolver::createWithStorage(
+ m_xContext, xStorage );
// property map for export info set
comphelper::PropertyMapEntry aExportInfoMap[] =
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 09919f36c242..42b4cfbbe2b1 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XFilter.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/XEmbedPersist.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
@@ -435,10 +436,7 @@ void lcl_uglyHackToStoreDialogeEmbedImages( const Reference< XStorageBasedLibrar
if ( !vEmbedImgUrls.empty() )
{
// Export the images to the storage
- Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= xTmpPic;
- Reference< XGraphicObjectResolver > xGraphicResolver(
- aContext.createComponentWithArguments( "com.sun.star.comp.Svx.GraphicExportHelper", aArgs ), UNO_QUERY );
+ Reference< XGraphicObjectResolver > xGraphicResolver = GraphicObjectResolver::createWithStorage(aContext.getUNOContext(), xTmpPic);
std::vector< OUString >::iterator it = vEmbedImgUrls.begin();
std::vector< OUString >::iterator it_end = vEmbedImgUrls.end();
if ( xGraphicResolver.is() )
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 6be7bd8876ba..59fea6336a6b 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -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,\
DocumentProperties \
DocumentRevisionListPersistence \
+ GraphicObjectResolver \
OleEmbeddedServerRegistration \
OOXMLDocumentPropertiesImporter \
))
diff --git a/offapi/com/sun/star/document/GraphicObjectResolver.idl b/offapi/com/sun/star/document/GraphicObjectResolver.idl
new file mode 100644
index 000000000000..f10ea2951416
--- /dev/null
+++ b/offapi/com/sun/star/document/GraphicObjectResolver.idl
@@ -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: */
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index b0004ed8bcd3..3ac5fa163589 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -55,7 +55,7 @@
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.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/processfactory.hxx>
@@ -700,14 +700,10 @@ void ElementDescriptor::readImageURLAttr( OUString const & rPropName, OUString c
Reference< document::XStorageBasedDocument > xDocStorage( _xDocument, UNO_QUERY );
if ( xDocStorage.is() )
{
- uno::Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
- aContext.createComponentWithArguments( "com.sun.star.comp.Svx.GraphicExportHelper" , aArgs, xGraphicResolver );
- if ( xGraphicResolver.is() )
- sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
+ Reference<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver =
+ document::GraphicObjectResolver::createWithStorage( xContext, xDocStorage->getDocumentStorage() );
+ sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
}
}
if ( !sURL.isEmpty() )