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

add GraphicLoader and funct. to load graphic from URL

Change-Id: Ib722ee5bc20908d50642b1371b20c878158204cf
Reviewed-on: https://gerrit.libreoffice.org/50538Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
Tested-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 8fbacacc
/* -*- 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 INCLUDED_VCL_GRAPHIC_LOADER_HXX
#define INCLUDED_VCL_GRAPHIC_LOADER_HXX
#include <vcl/graph.hxx>
namespace vcl
{
namespace graphic
{
Graphic VCL_DLLPUBLIC loadFromURL(OUString const& rURL);
}
} // end vcl::graphic
#endif // INCLUDED_VCL_GRAPHIC_TOOLS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -300,7 +300,8 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/gdi/wall \
vcl/source/gdi/scrptrun \
vcl/source/gdi/CommonSalLayout \
vcl/source/bitmap/bitmap \
vcl/source/graphic/GraphicLoader \
vcl/source/bitmap/bitmap \
vcl/source/bitmap/bitmapfilter \
vcl/source/bitmap/bitmappaint \
vcl/source/bitmap/bitmapscalesuper \
......
/* -*- 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/.
*
*/
#include <vcl/GraphicLoader.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/graphic/GraphicProvider.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
//#include <com/sun/star/lang/XUnoTunnel.hpp>
//#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
//#include <cppuhelper/typeprovider.hxx>
using namespace css;
namespace vcl
{
namespace graphic
{
Graphic loadFromURL(OUString const& rURL)
{
uno::Reference<css::graphic::XGraphic> xGraphic;
uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
uno::Reference<css::graphic::XGraphicProvider> xProv(
css::graphic::GraphicProvider::create(xContext));
uno::Sequence<beans::PropertyValue> aLoadProps(1);
aLoadProps[0].Name = "URL";
aLoadProps[0].Value <<= rURL;
xGraphic = xProv->queryGraphic(aLoadProps);
Graphic aGraphic(xGraphic);
aGraphic.setOriginURL(rURL);
return aGraphic;
}
}
} // end vcl::graphic
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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