Kaydet (Commit) a61747c2 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

add XGraphicStorageHandler interface

This is a XGraphicObjectResolver (future) replacement as it will
not be needed anymore. All resolving from URL to URL will be
replaced by loading, saving and serialization of XGraphic objects
(when appropriate), which is covered by this interface and
implementation by XmlGraphicHelper - the same that implements the
XGraphicObjectResolver.

Change-Id: I227634e443ce336218c2a2effaf34f9ef3576382
Reviewed-on: https://gerrit.libreoffice.org/49073Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
Tested-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 3195fce9
......@@ -27,9 +27,11 @@
#include <set>
#include <utility>
#include <com/sun/star/document/XGraphicObjectResolver.hpp>
#include <com/sun/star/document/XGraphicStorageHandler.hpp>
#include <com/sun/star/document/XBinaryStreamResolver.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <svx/svxdllapi.h>
#include <unordered_map>
enum class SvXMLGraphicHelperMode
{
......@@ -42,8 +44,9 @@ struct SvxGraphicHelperStream_Impl
css::uno::Reference < css::io::XStream > xStream;
};
class SVX_DLLPUBLIC SvXMLGraphicHelper final : public cppu::WeakComponentImplHelper< css::document::XGraphicObjectResolver,
css::document::XBinaryStreamResolver >
class SVX_DLLPUBLIC SvXMLGraphicHelper final : public cppu::WeakComponentImplHelper<css::document::XGraphicObjectResolver,
css::document::XGraphicStorageHandler,
css::document::XBinaryStreamResolver>
{
typedef ::std::pair< OUString, OUString > URLPair;
typedef ::std::vector< URLPair > URLPairVector;
......@@ -57,6 +60,10 @@ class SVX_DLLPUBLIC SvXMLGraphicHelper final : public cppu::WeakComponentImplHel
GraphicObjectVector maGrfObjs;
GraphicOutputStreamVector maGrfStms;
::std::set< OUString > maURLSet;
std::unordered_map<OUString, css::uno::Reference<css::graphic::XGraphic>> maGraphicObjects;
std::unordered_map<Graphic, OUString> maExportGraphics;
SvXMLGraphicHelperMode meCreateMode;
OUString maOutputMimeType;
bool mbDirect;
......@@ -102,6 +109,16 @@ public:
// XGraphicObjectResolver
virtual OUString SAL_CALL resolveGraphicObjectURL( const OUString& aURL ) override;
// XGraphicStorageHandler
virtual css::uno::Reference<css::graphic::XGraphic> SAL_CALL
loadGraphic(const OUString& aURL) override;
virtual OUString SAL_CALL
saveGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic) override;
virtual css::uno::Reference<css::io::XInputStream> SAL_CALL
createInputStream(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic) override;
// XBinaryStreamResolver
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream( const OUString& rURL ) override;
virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL createOutputStream( ) override;
......
......@@ -2232,6 +2232,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/document,\
XFilter \
XFilterAdapter \
XGraphicObjectResolver \
XGraphicStorageHandler \
XImporter \
XInteractionFilterOptions \
XInteractionFilterSelect \
......
/* -*- 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/.
*
*/
#ifndef __com_sun_star_document_XGraphicStorageHandler_idl__
#define __com_sun_star_document_XGraphicStorageHandler_idl__
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/graphic/XGraphic.idl>
module com { module sun { module star { module document {
/** used to load, save and serialize XGraphic objects
*/
interface XGraphicStorageHandler : com::sun::star::uno::XInterface
{
com::sun::star::graphic::XGraphic loadGraphic([in] string aURL);
string saveGraphic([in] com::sun::star::graphic::XGraphic xGraphic);
com::sun::star::io::XInputStream createInputStream([in] com::sun::star::graphic::XGraphic xGraphic);
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
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