emfplus: create a wmf/emf/emf+ primitive based importer
First steps to organize an importer that can read/interpret wmf/emf/emf+ and deliver a primitive representation for the content by parsing it. Use the same mechanisms as already applied for Svg, so to reuse abilities to keep original binary data to allow save again and embedding in files and have an implemented replacement bitmap based representation. For this, unify the used helper classes to handle more than just Svg. For 1st try, add test code and static bool switches Change-Id: I6e0a82943541d811a8f8d65a84115569fcd8cee7
This commit is contained in:
parent
79f5cb6209
commit
83535a28c5
74 changed files with 1042 additions and 240 deletions
|
@ -406,6 +406,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
|
|||
storagefd \
|
||||
$(call gb_Helper_optional,SCRIPTING,stringresource) \
|
||||
svgio \
|
||||
emfio \
|
||||
svl \
|
||||
svt \
|
||||
svx \
|
||||
|
|
|
@ -77,6 +77,7 @@ $(eval $(call gb_Module_add_moduledirs,cross_toolset,\
|
|||
sfx2 \
|
||||
sot \
|
||||
svgio \
|
||||
emfio \
|
||||
svl \
|
||||
svtools \
|
||||
svx \
|
||||
|
|
|
@ -126,6 +126,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
|
|||
svl \
|
||||
svtools \
|
||||
svgio \
|
||||
emfio \
|
||||
svx \
|
||||
sw \
|
||||
swext \
|
||||
|
|
|
@ -144,7 +144,7 @@
|
|||
#include <vcl/seleng.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/unohelp2.hxx>
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/status.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
|
|
|
@ -102,6 +102,7 @@ DEFAULTS = \
|
|||
'sot.sot' : ( 5, EXCLUDE, EXCLUDE, INCLUDE), # 3.1
|
||||
'starmath.sm' : ( 5, EXCLUDE, EXCLUDE, INCLUDE), # 10.9
|
||||
'svgio.svgio' : ( 8, EXCLUDE, EXCLUDE, INCLUDE), # 4.3
|
||||
'emfio.emfio' : ( 8, EXCLUDE, EXCLUDE, INCLUDE), # 4.3
|
||||
'svl.svl' : ( 6, EXCLUDE, EXCLUDE, EXCLUDE), # 7.6
|
||||
'svtools.svt' : ( 4, EXCLUDE, INCLUDE, EXCLUDE), # 17.6
|
||||
'svx.svx' : ( 3, EXCLUDE, EXCLUDE, INCLUDE), # 20.7
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
#include <vcl/settings.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/tabctrl.hxx>
|
||||
#include <vcl/tabdlg.hxx>
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
#include <vcl/scheduler.hxx>
|
||||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclevent.hxx>
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
#include <vcl/settings.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
#include <vcl/salnativewidgets.hxx>
|
||||
#include <vcl/scheduler.hxx>
|
||||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclptr.hxx>
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
#include <vcl/scheduler.hxx>
|
||||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclevent.hxx>
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
#include <vcl/scheduler.hxx>
|
||||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace drawinglayer
|
|||
|
||||
const GraphicObject& rGraphicObject = getGraphicObject();
|
||||
Graphic aTransformedGraphic(rGraphicObject.GetGraphic());
|
||||
const bool isBitmap(GraphicType::Bitmap == aTransformedGraphic.GetType() && !aTransformedGraphic.getSvgData().get());
|
||||
const bool isBitmap(GraphicType::Bitmap == aTransformedGraphic.GetType() && !aTransformedGraphic.getVectorGraphicData().get());
|
||||
const bool isAdjusted(getGraphicAttr().IsAdjusted());
|
||||
const bool isDrawMode(GraphicDrawMode::Standard != getGraphicAttr().GetDrawMode());
|
||||
|
||||
|
|
|
@ -473,31 +473,31 @@ namespace drawinglayer
|
|||
rGraphic,
|
||||
rTransform);
|
||||
}
|
||||
else if(rGraphic.getSvgData().get())
|
||||
else if(rGraphic.getVectorGraphicData().get())
|
||||
{
|
||||
// embedded Svg fill, create embed transform
|
||||
const basegfx::B2DRange& rSvgRange(rGraphic.getSvgData()->getRange());
|
||||
// embedded Vector Graphic Data fill, create embed transform
|
||||
const basegfx::B2DRange& rSvgRange(rGraphic.getVectorGraphicData()->getRange());
|
||||
|
||||
if(basegfx::fTools::more(rSvgRange.getWidth(), 0.0) && basegfx::fTools::more(rSvgRange.getHeight(), 0.0))
|
||||
{
|
||||
// translate back to origin, scale to unit coordinates
|
||||
basegfx::B2DHomMatrix aEmbedSvg(
|
||||
basegfx::B2DHomMatrix aEmbedVectorGraphic(
|
||||
basegfx::tools::createTranslateB2DHomMatrix(
|
||||
-rSvgRange.getMinX(),
|
||||
-rSvgRange.getMinY()));
|
||||
|
||||
aEmbedSvg.scale(
|
||||
aEmbedVectorGraphic.scale(
|
||||
1.0 / rSvgRange.getWidth(),
|
||||
1.0 / rSvgRange.getHeight());
|
||||
|
||||
// apply created object transformation
|
||||
aEmbedSvg = rTransform * aEmbedSvg;
|
||||
aEmbedVectorGraphic = rTransform * aEmbedVectorGraphic;
|
||||
|
||||
// add Svg primitives embedded
|
||||
// add Vector Graphic Data primitives embedded
|
||||
aRetval.resize(1);
|
||||
aRetval[0] = new TransformPrimitive2D(
|
||||
aEmbedSvg,
|
||||
rGraphic.getSvgData()->getPrimitive2DSequence());
|
||||
aEmbedVectorGraphic,
|
||||
rGraphic.getVectorGraphicData()->getPrimitive2DSequence());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -397,13 +397,13 @@ namespace drawinglayer
|
|||
{
|
||||
// content is bitmap(ex)
|
||||
//
|
||||
// for SVG support, force decomposition when SVG is present. This will lead to use
|
||||
// the primitive representation of the svg directly.
|
||||
// for Vector Graphic Data (SVG, EMF+) support, force decomposition when present. This will lead to use
|
||||
// the primitive representation of the vector data directly.
|
||||
//
|
||||
// when graphic is animated, force decomposition to use the correct graphic, else
|
||||
// fill style will not be animated
|
||||
if(GraphicType::Bitmap == rFillGraphicAttribute.getGraphic().GetType()
|
||||
&& !rFillGraphicAttribute.getGraphic().getSvgData().get()
|
||||
&& !rFillGraphicAttribute.getGraphic().getVectorGraphicData().get()
|
||||
&& !rFillGraphicAttribute.getGraphic().IsAnimated())
|
||||
{
|
||||
// decompose matrix to check for shear, rotate and mirroring
|
||||
|
|
67
emfio/CppunitTest_emfio.mk
Normal file
67
emfio/CppunitTest_emfio.mk
Normal file
|
@ -0,0 +1,67 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
$(eval $(call gb_CppunitTest_CppunitTest,emfio))
|
||||
|
||||
$(eval $(call gb_CppunitTest_set_componentfile,emfio,emfio/emfio))
|
||||
|
||||
$(eval $(call gb_CppunitTest_set_include,emfio,\
|
||||
$$(INCLUDE) \
|
||||
-I$(SRCDIR)/emfio/inc \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_externals,emfio,\
|
||||
boost_headers \
|
||||
libxml2 \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_sdk_api,emfio))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_library_objects,emfio,\
|
||||
emfio \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,emfio,\
|
||||
basegfx \
|
||||
drawinglayer \
|
||||
cppu \
|
||||
cppuhelper \
|
||||
comphelper \
|
||||
sal \
|
||||
svt \
|
||||
test \
|
||||
unotest \
|
||||
tl \
|
||||
vcl \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,emfio,\
|
||||
emfio/qa/cppunit/EmfImportTest \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_ure,emfio))
|
||||
$(eval $(call gb_CppunitTest_use_vcl,emfio))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_components,emfio,\
|
||||
configmgr/source/configmgr \
|
||||
dtrans/util/mcnttype \
|
||||
framework/util/fwk \
|
||||
i18npool/util/i18npool \
|
||||
package/source/xstor/xstor \
|
||||
package/util/package2 \
|
||||
toolkit/util/tk \
|
||||
sfx2/util/sfx \
|
||||
ucb/source/core/ucb1 \
|
||||
ucb/source/ucp/file/ucpfile1 \
|
||||
unotools/util/utl \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_configuration,emfio))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
51
emfio/Library_emfio.mk
Normal file
51
emfio/Library_emfio.mk
Normal file
|
@ -0,0 +1,51 @@
|
|||
#
|
||||
# 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 .
|
||||
#
|
||||
|
||||
$(eval $(call gb_Library_Library,emfio))
|
||||
|
||||
$(eval $(call gb_Library_set_componentfile,emfio,emfio/emfio))
|
||||
|
||||
$(eval $(call gb_Library_set_include,emfio,\
|
||||
$$(INCLUDE) \
|
||||
-I$(SRCDIR)/emfio/inc \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_use_external,emfio,boost_headers))
|
||||
|
||||
$(eval $(call gb_Library_set_precompiled_header,emfio,$(SRCDIR)/emfio/inc/pch/precompiled_emfio))
|
||||
|
||||
$(eval $(call gb_Library_use_sdk_api,emfio))
|
||||
|
||||
$(eval $(call gb_Library_use_libraries,emfio,\
|
||||
basegfx \
|
||||
drawinglayer \
|
||||
cppu \
|
||||
cppuhelper \
|
||||
sal \
|
||||
tl \
|
||||
sax \
|
||||
vcl \
|
||||
svt \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_exception_objects,emfio,\
|
||||
emfio/source/emfuno/emfuno \
|
||||
emfio/source/emfuno/xemfparser \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
14
emfio/Makefile
Normal file
14
emfio/Makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
include $(module_directory)/../solenv/gbuild/partial_build.mk
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
29
emfio/Module_emfio.mk
Normal file
29
emfio/Module_emfio.mk
Normal file
|
@ -0,0 +1,29 @@
|
|||
#
|
||||
# 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 .
|
||||
#
|
||||
|
||||
$(eval $(call gb_Module_Module,emfio))
|
||||
|
||||
$(eval $(call gb_Module_add_targets,emfio,\
|
||||
Library_emfio \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Module_add_check_targets,emfio,\
|
||||
CppunitTest_emfio \
|
||||
))
|
||||
|
||||
# vim: set noet ts=4 sw=4:
|
1
emfio/README
Normal file
1
emfio/README
Normal file
|
@ -0,0 +1 @@
|
|||
It contains emfio/source/emfeader which is used for "Insert->Picture->From File".
|
25
emfio/emfio.component
Normal file
25
emfio/emfio.component
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* 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 .
|
||||
-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
||||
prefix="emfio" xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="emfio::emfreader::XEmfParser">
|
||||
<service name="com.sun.star.graphic.EmfTools"/>
|
||||
</implementation>
|
||||
</component>
|
12
emfio/inc/pch/precompiled_emfio.cxx
Normal file
12
emfio/inc/pch/precompiled_emfio.cxx
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* -*- 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 "precompiled_emfio.hxx"
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
29
emfio/inc/pch/precompiled_emfio.hxx
Normal file
29
emfio/inc/pch/precompiled_emfio.hxx
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* -*- 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 has been autogenerated by update_pch.sh. It is possible to edit it
|
||||
manually (such as when an include file has been moved/renamed/removed). All such
|
||||
manual changes will be rewritten by the next run of update_pch.sh (which presumably
|
||||
also fixes all possible problems, so it's usually better to use it).
|
||||
|
||||
Generated on 2017-06-09 17:33:30 using:
|
||||
bin/update_pch emfio emfio --cutoff=8 --exclude:system --exclude:module --include:local
|
||||
|
||||
If after updating build fails, use the following command to locate conflicting headers:
|
||||
./bin/update_pch_bisect ./emfio/inc/pch/precompiled_emfio.hxx "make emfio.build" --find-conflicts
|
||||
*/
|
||||
|
||||
#include <osl/diagnose.h>
|
||||
#include <rtl/instance.hxx>
|
||||
#include <rtl/unload.h>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <sal/types.h>
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
102
emfio/qa/cppunit/EmfImportTest.cxx
Normal file
102
emfio/qa/cppunit/EmfImportTest.cxx
Normal file
|
@ -0,0 +1,102 @@
|
|||
/* -*- 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 <sal/config.h>
|
||||
|
||||
#include <test/bootstrapfixture.hxx>
|
||||
#include <test/primitive2dxmldump.hxx>
|
||||
#include <test/xmltesttools.hxx>
|
||||
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/seqstream.hxx>
|
||||
#include <comphelper/sequence.hxx>
|
||||
|
||||
#include <com/sun/star/graphic/EmfTools.hpp>
|
||||
#include <com/sun/star/graphic/Primitive2DTools.hpp>
|
||||
#include <com/sun/star/graphic/XPrimitive2D.hpp>
|
||||
|
||||
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
using namespace css::uno;
|
||||
using namespace css::io;
|
||||
using namespace css::graphic;
|
||||
using drawinglayer::primitive2d::Primitive2DSequence;
|
||||
using drawinglayer::primitive2d::Primitive2DContainer;
|
||||
|
||||
class Test : public test::BootstrapFixture, public XmlTestTools
|
||||
{
|
||||
void checkRectPrimitive(Primitive2DSequence& rPrimitive);
|
||||
|
||||
void testWorking();
|
||||
|
||||
Primitive2DSequence parseEmf(const char* aSource);
|
||||
|
||||
public:
|
||||
CPPUNIT_TEST_SUITE(Test);
|
||||
CPPUNIT_TEST(testWorking);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
};
|
||||
|
||||
Primitive2DSequence Test::parseEmf(const char* aSource)
|
||||
{
|
||||
const Reference<XEmfParser> xEmfParser = EmfTools::create(m_xContext);
|
||||
|
||||
OUString aUrl = m_directories.getURLFromSrc(aSource);
|
||||
OUString aPath = m_directories.getPathFromSrc(aSource);
|
||||
|
||||
SvFileStream aFileStream(aUrl, StreamMode::READ);
|
||||
std::size_t nSize = aFileStream.remainingSize();
|
||||
std::unique_ptr<sal_Int8[]> pBuffer(new sal_Int8[nSize + 1]);
|
||||
aFileStream.ReadBytes(pBuffer.get(), nSize);
|
||||
pBuffer[nSize] = 0;
|
||||
|
||||
Sequence<sal_Int8> aData(pBuffer.get(), nSize + 1);
|
||||
Reference<XInputStream> aInputStream(new comphelper::SequenceInputStream(aData));
|
||||
|
||||
return xEmfParser->getDecomposition(aInputStream, aPath);
|
||||
}
|
||||
|
||||
void Test::checkRectPrimitive(Primitive2DSequence& rPrimitive)
|
||||
{
|
||||
Primitive2dXmlDump dumper;
|
||||
xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(rPrimitive));
|
||||
|
||||
CPPUNIT_ASSERT (pDocument);
|
||||
|
||||
// emfio: add examples
|
||||
// assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00cc00"); // rect background color
|
||||
// assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "height", "100"); // rect background height
|
||||
// assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "width", "100"); // rect background width
|
||||
// assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "minx", "10");
|
||||
// assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "miny", "10");
|
||||
// assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxx", "110");
|
||||
// assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxy", "110");
|
||||
// assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", "#ff0000"); // rect stroke color
|
||||
// assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "3"); // rect stroke width
|
||||
}
|
||||
|
||||
void Test::testWorking()
|
||||
{
|
||||
Primitive2DSequence aSequenceRect = parseEmf("/emfio/qa/cppunit/data/fdo79679-2.emf");
|
||||
CPPUNIT_ASSERT_EQUAL(1, (int) aSequenceRect.getLength());
|
||||
checkRectPrimitive(aSequenceRect);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
BIN
emfio/qa/cppunit/data/fdo79679-2.emf
Normal file
BIN
emfio/qa/cppunit/data/fdo79679-2.emf
Normal file
Binary file not shown.
46
emfio/source/emfuno/emfuno.cxx
Normal file
46
emfio/source/emfuno/emfuno.cxx
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* -*- 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 .
|
||||
*/
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <cppuhelper/factory.hxx>
|
||||
#include <cppuhelper/implementationentry.hxx>
|
||||
#include <sal/types.h>
|
||||
|
||||
#include "xemfparser.hxx"
|
||||
|
||||
namespace {
|
||||
|
||||
static cppu::ImplementationEntry const services[] = {
|
||||
{ &emfio::emfreader::XEmfParser_createInstance,
|
||||
&emfio::emfreader::XEmfParser_getImplementationName,
|
||||
&emfio::emfreader::XEmfParser_getSupportedServiceNames,
|
||||
&cppu::createSingleComponentFactory, nullptr, 0 },
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 } };
|
||||
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL emfio_component_getFactory(
|
||||
char const * pImplName, void * pServiceManager, void * pRegistryKey)
|
||||
{
|
||||
return cppu::component_getFactoryHelper(
|
||||
pImplName, pServiceManager, pRegistryKey, services);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
210
emfio/source/emfuno/xemfparser.cxx
Normal file
210
emfio/source/emfuno/xemfparser.cxx
Normal file
|
@ -0,0 +1,210 @@
|
|||
/* -*- 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 .
|
||||
*/
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <com/sun/star/graphic/XEmfParser.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/lang/XInitialization.hpp>
|
||||
#include <cppuhelper/implbase2.hxx>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
#include <comphelper/sequence.hxx>
|
||||
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
|
||||
#include <basegfx/color/bcolor.hxx>
|
||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||
#include <basegfx/polygon/b2dpolygontools.hxx>
|
||||
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
|
||||
|
||||
//#include <com/sun/star/xml/sax/XParser.hpp>
|
||||
//#include <com/sun/star/xml/sax/Parser.hpp>
|
||||
//#include <com/sun/star/xml/sax/InputSource.hpp>
|
||||
//#include <drawinglayer/geometry/viewinformation2d.hxx>
|
||||
//#include <svgdocumenthandler.hxx>
|
||||
|
||||
#include "xemfparser.hxx"
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
namespace emfio
|
||||
{
|
||||
namespace emfreader
|
||||
{
|
||||
class XEmfParser : public ::cppu::WeakAggImplHelper2< graphic::XEmfParser, lang::XServiceInfo >
|
||||
{
|
||||
private:
|
||||
uno::Reference< uno::XComponentContext > context_;
|
||||
|
||||
protected:
|
||||
public:
|
||||
explicit XEmfParser(
|
||||
uno::Reference< uno::XComponentContext > const & context);
|
||||
XEmfParser(const XEmfParser&) = delete;
|
||||
XEmfParser& operator=(const XEmfParser&) = delete;
|
||||
|
||||
// XEmfParser
|
||||
virtual uno::Sequence< uno::Reference< ::graphic::XPrimitive2D > > SAL_CALL getDecomposition(
|
||||
const uno::Reference< ::io::XInputStream >& xEmfStream,
|
||||
const OUString& aAbsolutePath) override;
|
||||
|
||||
// XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName() override;
|
||||
virtual sal_Bool SAL_CALL supportsService(const OUString&) override;
|
||||
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
|
||||
};
|
||||
} // end of namespace emfreader
|
||||
} // end of namespace emfio
|
||||
|
||||
// uno functions
|
||||
namespace emfio
|
||||
{
|
||||
namespace emfreader
|
||||
{
|
||||
uno::Sequence< OUString > XEmfParser_getSupportedServiceNames()
|
||||
{
|
||||
return uno::Sequence< OUString > { "com.sun.star.graphic.EmfTools" };
|
||||
}
|
||||
|
||||
OUString XEmfParser_getImplementationName()
|
||||
{
|
||||
return OUString( "emfio::emfreader::XEmfParser" );
|
||||
}
|
||||
|
||||
uno::Reference< uno::XInterface > SAL_CALL XEmfParser_createInstance(const uno::Reference< uno::XComponentContext >& context)
|
||||
{
|
||||
return static_cast< ::cppu::OWeakObject* >(new XEmfParser(context));
|
||||
}
|
||||
} // end of namespace emfreader
|
||||
} // end of namespace emfio
|
||||
|
||||
namespace emfio
|
||||
{
|
||||
namespace emfreader
|
||||
{
|
||||
XEmfParser::XEmfParser(
|
||||
uno::Reference< uno::XComponentContext > const & context):
|
||||
context_(context)
|
||||
{
|
||||
}
|
||||
|
||||
uno::Sequence< uno::Reference< ::graphic::XPrimitive2D > > XEmfParser::getDecomposition(
|
||||
const uno::Reference< ::io::XInputStream >& xEmfStream,
|
||||
const OUString& aAbsolutePath )
|
||||
{
|
||||
drawinglayer::primitive2d::Primitive2DContainer aRetval;
|
||||
|
||||
if (xEmfStream.is())
|
||||
{
|
||||
static bool bTestCode(true);
|
||||
|
||||
if (bTestCode)
|
||||
{
|
||||
// for test, just create some graphic data
|
||||
const basegfx::B2DRange aRange(1000, 1000, 5000, 5000);
|
||||
const basegfx::BColor aColor(1.0, 0.0, 0.0);
|
||||
const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
|
||||
|
||||
aRetval.push_back(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), aColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
// new parser here
|
||||
bool bBla = true;
|
||||
|
||||
|
||||
|
||||
|
||||
// // local document handler
|
||||
// SvgDocHdl* pSvgDocHdl = new SvgDocHdl(aAbsolutePath);
|
||||
// uno::Reference< xml::sax::XDocumentHandler > xSvgDocHdl(pSvgDocHdl);
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// // prepare ParserInputSrouce
|
||||
// xml::sax::InputSource myInputSource;
|
||||
// myInputSource.aInputStream = xEmfStream;
|
||||
//
|
||||
// // get parser
|
||||
// uno::Reference< xml::sax::XParser > xParser(
|
||||
// xml::sax::Parser::create(context_));
|
||||
// // fdo#60471 need to enable internal entities because
|
||||
// // certain ... popular proprietary products write SVG files
|
||||
// // that use entities to define XML namespaces.
|
||||
// uno::Reference<lang::XInitialization> const xInit(xParser,
|
||||
// uno::UNO_QUERY_THROW);
|
||||
// uno::Sequence<uno::Any> args(1);
|
||||
// args[0] <<= OUString("DoSmeplease");
|
||||
// xInit->initialize(args);
|
||||
//
|
||||
// // connect parser and filter
|
||||
// xParser->setDocumentHandler(xSvgDocHdl);
|
||||
//
|
||||
// // finally, parse the stream to a hierarchy of
|
||||
// // SVGGraphicPrimitive2D which will be embedded to the
|
||||
// // primitive sequence. Their decompositions will in the
|
||||
// // end create local low-level primitives, thus SVG will
|
||||
// // be processable from all our processors
|
||||
// xParser->parseStream(myInputSource);
|
||||
// }
|
||||
// catch(const uno::Exception& e)
|
||||
// {
|
||||
// SAL_WARN( "svg", "Parse error! : " << e.Message);
|
||||
// }
|
||||
//
|
||||
// // decompose to primitives
|
||||
// const SvgNodeVector& rResults = pSvgDocHdl->getSvgDocument().getSvgNodeVector();
|
||||
// const sal_uInt32 nCount(rResults.size());
|
||||
//
|
||||
// for(sal_uInt32 a(0); a < nCount; a++)
|
||||
// {
|
||||
// SvgNode* pCandidate = rResults[a];
|
||||
//
|
||||
// if(Display_none != pCandidate->getDisplay())
|
||||
// {
|
||||
// pCandidate->decomposeSvgNode(aRetval, false);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ENSURE(false, "Invalid stream (!)");
|
||||
}
|
||||
|
||||
return comphelper::containerToSequence(aRetval);
|
||||
}
|
||||
|
||||
OUString SAL_CALL XEmfParser::getImplementationName()
|
||||
{
|
||||
return(XEmfParser_getImplementationName());
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL XEmfParser::supportsService(const OUString& rServiceName)
|
||||
{
|
||||
return cppu::supportsService(this, rServiceName);
|
||||
}
|
||||
|
||||
uno::Sequence< OUString > SAL_CALL XEmfParser::getSupportedServiceNames()
|
||||
{
|
||||
return XEmfParser_getSupportedServiceNames();
|
||||
}
|
||||
|
||||
} // end of namespace emfreader
|
||||
} // end of namespace emfio
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
50
emfio/source/emfuno/xemfparser.hxx
Normal file
50
emfio/source/emfuno/xemfparser.hxx
Normal file
|
@ -0,0 +1,50 @@
|
|||
/* -*- 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 INCLUDED_EMFIO_SOURCE_EMFUNO_XEMFARSER_HXX
|
||||
#define INCLUDED_EMFIO_SOURCE_EMFUNO_XEMFARSER_HXX
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <sal/types.h>
|
||||
|
||||
namespace com { namespace sun { namespace star {
|
||||
namespace uno {
|
||||
class XComponentContext;
|
||||
class XInterface;
|
||||
}
|
||||
} } }
|
||||
|
||||
namespace emfio { namespace emfreader {
|
||||
|
||||
css::uno::Reference< css::uno::XInterface > SAL_CALL
|
||||
XEmfParser_createInstance( css::uno::Reference< css::uno::XComponentContext > const &);
|
||||
|
||||
OUString SAL_CALL XEmfParser_getImplementationName();
|
||||
|
||||
css::uno::Sequence< OUString > SAL_CALL
|
||||
XEmfParser_getSupportedServiceNames();
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -131,7 +131,7 @@
|
|||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclevent.hxx>
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
#include <vcl/region.hxx>
|
||||
#include <vcl/scheduler.hxx>
|
||||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclptr.hxx>
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
#include <vcl/settings.hxx>
|
||||
#include <vcl/status.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/toolbox.hxx>
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
|
|
|
@ -188,8 +188,8 @@ public:
|
|||
virtual void SetPage(SdrPage* pNewPage) override;
|
||||
virtual void SetModel(SdrModel* pNewModel) override;
|
||||
|
||||
bool isEmbeddedSvg() const;
|
||||
GDIMetaFile getMetafileFromEmbeddedSvg() const;
|
||||
bool isEmbeddedVectorGraphicData() const;
|
||||
GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const;
|
||||
|
||||
virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <vcl/gdimtf.hxx>
|
||||
#include <vcl/gfxlink.hxx>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <basegfx/vector/b2dsize.hxx>
|
||||
|
||||
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
Graphic( Graphic&& rGraphic );
|
||||
Graphic( const Bitmap& rBmp );
|
||||
Graphic( const BitmapEx& rBmpEx );
|
||||
Graphic( const SvgDataPtr& rSvgDataPtr );
|
||||
Graphic( const VectorGraphicDataPtr& rVectorGraphicDataPtr );
|
||||
Graphic( const Animation& rAnimation );
|
||||
Graphic( const GDIMetaFile& rMtf );
|
||||
Graphic( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic );
|
||||
|
@ -219,7 +219,7 @@ public:
|
|||
|
||||
public:
|
||||
|
||||
const SvgDataPtr& getSvgData() const;
|
||||
const VectorGraphicDataPtr& getVectorGraphicData() const;
|
||||
|
||||
void setPdfData(const css::uno::Sequence<sal_Int8>& rPdfData);
|
||||
const css::uno::Sequence<sal_Int8>& getPdfData() const;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_VCL_SVGDATA_HXX
|
||||
#define INCLUDED_VCL_SVGDATA_HXX
|
||||
#ifndef INCLUDED_VCL_VECTORGRAPHICDATA_HXX
|
||||
#define INCLUDED_VCL_VECTORGRAPHICDATA_HXX
|
||||
|
||||
#include <basegfx/range/b2drange.hxx>
|
||||
#include <com/sun/star/graphic/XPrimitive2D.hpp>
|
||||
|
@ -27,7 +27,7 @@
|
|||
#include <deque>
|
||||
|
||||
|
||||
typedef css::uno::Sequence<sal_Int8> SvgDataArray;
|
||||
typedef css::uno::Sequence<sal_Int8> VectorGraphicDataArray;
|
||||
|
||||
|
||||
// helper to convert any Primitive2DSequence to a good quality BitmapEx,
|
||||
|
@ -39,39 +39,53 @@ BitmapEx VCL_DLLPUBLIC convertPrimitive2DSequenceToBitmapEx(
|
|||
const sal_uInt32 nMaximumQuadraticPixels = 500000);
|
||||
|
||||
|
||||
class VCL_DLLPUBLIC SvgData
|
||||
enum class VectorGraphicDataType
|
||||
{
|
||||
Svg = 0,
|
||||
Emf = 1,
|
||||
Wmf = 2
|
||||
};
|
||||
|
||||
class VCL_DLLPUBLIC VectorGraphicData
|
||||
{
|
||||
private:
|
||||
// the file and length
|
||||
SvgDataArray maSvgDataArray;
|
||||
VectorGraphicDataArray maVectorGraphicDataArray;
|
||||
|
||||
// The absolute Path if available
|
||||
OUString maPath;
|
||||
OUString maPath;
|
||||
|
||||
// on demand created content
|
||||
basegfx::B2DRange maRange;
|
||||
basegfx::B2DRange maRange;
|
||||
std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >
|
||||
maSequence;
|
||||
BitmapEx maReplacement;
|
||||
size_t mNestedBitmapSize;
|
||||
maSequence;
|
||||
BitmapEx maReplacement;
|
||||
size_t mNestedBitmapSize;
|
||||
VectorGraphicDataType meVectorGraphicDataType;
|
||||
|
||||
// on demand creators
|
||||
void ensureReplacement();
|
||||
void ensureSequenceAndRange();
|
||||
|
||||
SvgData(const SvgData&) = delete;
|
||||
SvgData& operator=(const SvgData&) = delete;
|
||||
VectorGraphicData(const VectorGraphicData&) = delete;
|
||||
VectorGraphicData& operator=(const VectorGraphicData&) = delete;
|
||||
|
||||
public:
|
||||
SvgData(const SvgDataArray& rSvgDataArray, const OUString& rPath);
|
||||
SvgData(const OUString& rPath);
|
||||
VectorGraphicData(
|
||||
const VectorGraphicDataArray& rVectorGraphicDataArray,
|
||||
const OUString& rPath,
|
||||
VectorGraphicDataType eVectorDataType); // = VectorGraphicDataType::Svg);
|
||||
VectorGraphicData(
|
||||
const OUString& rPath,
|
||||
VectorGraphicDataType eVectorDataType);
|
||||
|
||||
/// data read
|
||||
const SvgDataArray& getSvgDataArray() const { return maSvgDataArray; }
|
||||
sal_uInt32 getSvgDataArrayLength() const { return maSvgDataArray.getLength(); }
|
||||
const VectorGraphicDataArray& getVectorGraphicDataArray() const { return maVectorGraphicDataArray; }
|
||||
sal_uInt32 getVectorGraphicDataArrayLength() const { return maVectorGraphicDataArray.getLength(); }
|
||||
enum class State { UNPARSED, PARSED };
|
||||
std::pair<State, size_t> getSizeBytes();
|
||||
const OUString& getPath() const { return maPath; }
|
||||
const VectorGraphicDataType& getVectorGraphicDataType() const { return meVectorGraphicDataType; }
|
||||
|
||||
/// data read and evtl. on demand creation
|
||||
const basegfx::B2DRange& getRange() const;
|
||||
|
@ -79,8 +93,8 @@ public:
|
|||
const BitmapEx& getReplacement() const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr< SvgData > SvgDataPtr;
|
||||
typedef std::shared_ptr< VectorGraphicData > VectorGraphicDataPtr;
|
||||
|
||||
#endif // INCLUDED_VCL_SVGDATA_HXX
|
||||
#endif // INCLUDED_VCL_VECTORGRAPHICDATA_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -210,6 +210,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/graphic,\
|
|||
GraphicProvider \
|
||||
Primitive2DTools \
|
||||
SvgTools \
|
||||
EmfTools \
|
||||
))
|
||||
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/inspection,\
|
||||
DefaultHelpProvider \
|
||||
|
@ -2705,6 +2706,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/graphic,\
|
|||
XPrimitive3D \
|
||||
XPrimitiveFactory2D \
|
||||
XSvgParser \
|
||||
XEmfParser \
|
||||
))
|
||||
$(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/i18n,\
|
||||
AmPmValue \
|
||||
|
|
39
offapi/com/sun/star/graphic/EmfTools.idl
Normal file
39
offapi/com/sun/star/graphic/EmfTools.idl
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* -*- 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_graphic_EmfTools_idl
|
||||
#define com_sun_star_graphic_EmfTools_idl
|
||||
|
||||
#include <com/sun/star/graphic/XEmfParser.idl>
|
||||
|
||||
module com { module sun { module star { module graphic
|
||||
{
|
||||
|
||||
/** Service that describes the necessary interfaces and properties
|
||||
to handle emf files.
|
||||
Parses an WMF/EMF/EMF+ file to a sequence of B2DPrimitives for internal usage
|
||||
*/
|
||||
|
||||
service EmfTools : XEmfParser;
|
||||
|
||||
} ; } ; } ; } ;
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
54
offapi/com/sun/star/graphic/XEmfParser.idl
Normal file
54
offapi/com/sun/star/graphic/XEmfParser.idl
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* -*- 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_graphic_XEmfParser_idl__
|
||||
#define __com_sun_star_graphic_XEmfParser_idl__
|
||||
|
||||
#include <com/sun/star/uno/XInterface.idl>
|
||||
#include <com/sun/star/io/XInputStream.idl>
|
||||
|
||||
module com { module sun { module star { module graphic {
|
||||
|
||||
interface XPrimitive2D;
|
||||
|
||||
/** XEmfParser interface
|
||||
|
||||
This interface allows to parse an WMF/EMF/EMF+ stream in form of a sequence of bytes
|
||||
to be parsed into a sequence of XPrimitive2Ds
|
||||
*/
|
||||
interface XEmfParser : ::com::sun::star::uno::XInterface
|
||||
{
|
||||
/** Retrieve decomposed list of simpler primitives
|
||||
|
||||
@param xEmfStream
|
||||
The file containing the WMF/EMF/EMF+ binary data
|
||||
|
||||
@param aAbsolutePath
|
||||
The path containing the WMF/EMF/EMF+ data
|
||||
*/
|
||||
sequence< XPrimitive2D > getDecomposition(
|
||||
[in] io::XInputStream xEmfStream,
|
||||
[in] string aAbsolutePath);
|
||||
};
|
||||
|
||||
}; }; }; };
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -85,7 +85,7 @@
|
|||
#include <vcl/gfxlink.hxx>
|
||||
#include <vcl/graph.hxx>
|
||||
#include <vcl/mapmod.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <basegfx/basegfxdllapi.h>
|
||||
#include <basegfx/color/bcolor.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
|
|
|
@ -81,6 +81,7 @@ $(eval $(call gb_Rdb_add_components,services,\
|
|||
svl/util/svl \
|
||||
svtools/util/svt \
|
||||
svgio/svgio \
|
||||
emfio/emfio \
|
||||
svx/util/svx \
|
||||
svx/util/svxcore \
|
||||
svx/util/textconversiondlgs \
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclevent.hxx>
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/status.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/tabctrl.hxx>
|
||||
#include <vcl/tabdlg.hxx>
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
#include <vcl/settings.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
#include <vcl/mapmod.hxx>
|
||||
#include <vcl/outdev.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/vclptr.hxx>
|
||||
#include <attrib.hxx>
|
||||
#include <basegfx/color/bcolor.hxx>
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
#include <vcl/settings.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/tabctrl.hxx>
|
||||
#include <vcl/tabdlg.hxx>
|
||||
|
|
|
@ -711,9 +711,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
|
|||
{
|
||||
const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0));
|
||||
|
||||
if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg())
|
||||
if(pSdrGrafObj && pSdrGrafObj->isEmbeddedVectorGraphicData())
|
||||
{
|
||||
aGraphic = Graphic(pSdrGrafObj->GetGraphic().getSvgData()->getReplacement());
|
||||
aGraphic = Graphic(pSdrGrafObj->GetGraphic().getVectorGraphicData()->getReplacement());
|
||||
bDone = true;
|
||||
}
|
||||
}
|
||||
|
@ -2362,9 +2362,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
|
|||
{
|
||||
nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionSize();
|
||||
}
|
||||
else if(pGraf->isEmbeddedSvg())
|
||||
else if(pGraf->isEmbeddedVectorGraphicData())
|
||||
{
|
||||
nCount += pGraf->getMetafileFromEmbeddedSvg().GetActionSize();
|
||||
nCount += pGraf->getMetafileFromEmbeddedVectorGraphicData().GetActionSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1387,7 +1387,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
|
|||
{
|
||||
case GraphicType::Bitmap :
|
||||
bFoundBitmap = true;
|
||||
if(pSdrGrafObj->isEmbeddedSvg())
|
||||
if(pSdrGrafObj->isEmbeddedVectorGraphicData())
|
||||
{
|
||||
bFoundMetafile = true;
|
||||
}
|
||||
|
|
|
@ -1015,7 +1015,7 @@ bool View::IsVectorizeAllowed() const
|
|||
|
||||
if(pObj)
|
||||
{
|
||||
if(GraphicType::Bitmap == pObj->GetGraphicType() && !pObj->isEmbeddedSvg())
|
||||
if(GraphicType::Bitmap == pObj->GetGraphicType() && !pObj->isEmbeddedVectorGraphicData())
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
|
|
|
@ -142,11 +142,11 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid
|
|||
OUString uri = "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER + aBaseName + ".svg";
|
||||
rtl::Bootstrap::expandMacros( uri );
|
||||
INetURLObject aObj( uri );
|
||||
SvgData aSvgData(aObj.PathToFileName());
|
||||
VectorGraphicData aVectorGraphicData(aObj.PathToFileName(), VectorGraphicDataType::Svg);
|
||||
|
||||
// transform into [0,0,width,width*aspect] std dimensions
|
||||
|
||||
basegfx::B2DRange aRange(aSvgData.getRange());
|
||||
basegfx::B2DRange aRange(aVectorGraphicData.getRange());
|
||||
const double fAspectRatio(
|
||||
aRange.getHeight() == 0.0 ? 1.0 : aRange.getWidth()/aRange.getHeight());
|
||||
basegfx::B2DHomMatrix aTransform(
|
||||
|
@ -160,7 +160,7 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid
|
|||
const drawinglayer::primitive2d::Primitive2DReference xTransformRef(
|
||||
new drawinglayer::primitive2d::TransformPrimitive2D(
|
||||
aTransform,
|
||||
aSvgData.getPrimitive2DSequence()));
|
||||
aVectorGraphicData.getPrimitive2DSequence()));
|
||||
|
||||
// UNO dance to render from drawinglayer
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
#include <vcl/scheduler.hxx>
|
||||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclevent.hxx>
|
||||
|
|
|
@ -288,6 +288,7 @@ calc_constructor_list = [
|
|||
draw_factory_list = [
|
||||
("libsdlo.a", "sd_component_getFactory"),
|
||||
("libsvgiolo.a", "svgio_component_getFactory"),
|
||||
("libemfiolo.a", "emfio_component_getFactory"),
|
||||
("libsvgfilterlo.a", "svgfilter_component_getFactory"),
|
||||
("libdeployment.a", "deployment_component_getFactory"),
|
||||
("libemboleobj.a", "emboleobj_component_getFactory"),
|
||||
|
|
|
@ -123,7 +123,7 @@ class CheckGbuildToJsonModules(unittest.TestCase):
|
|||
shutil.rmtree(self.tempwork)
|
||||
|
||||
def test_gbuildtojson(self):
|
||||
modules = ['accessibility', 'android', 'animations', 'apple_remote', 'avmedia', 'basctl', 'basegfx', 'basic', 'bean', 'canvas', 'chart2', 'codemaker', 'comphelper', 'cppcanvas', 'cui', 'dbaccess', 'desktop', 'drawinglayer', 'dtrans', 'editeng', 'embeddedobj', 'embedserv', 'eventattacher', 'extras', 'filter', 'forms', 'formula', 'fpicker', 'framework', 'hwpfilter', 'i18nlangtag', 'i18nutil', 'idl', 'idlc', 'instsetoo_native', 'io', 'ios', 'jvmaccess', 'jvmfwk', 'l10ntools', 'librelogo', 'libreofficekit', 'linguistic', 'lotuswordpro', 'mysqlc', 'nlpsolver', 'o3tl', 'offapi', 'officecfg', 'onlineupdate', 'oovbaapi', 'oox', 'opencl', 'package', 'postprocess', 'pyuno', 'registry', 'remotebridges', 'reportbuilder', 'reportdesign', 'ridljar', 'rsc', 'salhelper', 'sax', 'sc', 'sccomp', 'scp2', 'scripting', 'sd', 'sdext', 'setup_native', 'sfx2', 'slideshow', 'smoketest', 'soltools', 'sot', 'starmath', 'store', 'svgio', 'svl', 'svtools', 'svx', 'sw', 'swext', 'sysui', 'test', 'testtools', 'toolkit', 'ucb', 'ucbhelper', 'udkapi', 'uitest', 'UnoControls', 'unodevtools', 'unoidl', 'unoil', 'unotest', 'unotools', 'unoxml', 'ure', 'uui', 'vbahelper', 'vcl', 'winaccessibility', 'wizards', 'writerperfect', 'xmerge', 'xmlhelp', 'xmloff', 'xmlreader', 'xmlscript', 'xmlsecurity']
|
||||
modules = ['accessibility', 'android', 'animations', 'apple_remote', 'avmedia', 'basctl', 'basegfx', 'basic', 'bean', 'canvas', 'chart2', 'codemaker', 'comphelper', 'cppcanvas', 'cui', 'dbaccess', 'desktop', 'drawinglayer', 'dtrans', 'editeng', 'embeddedobj', 'embedserv', 'eventattacher', 'extras', 'filter', 'forms', 'formula', 'fpicker', 'framework', 'hwpfilter', 'i18nlangtag', 'i18nutil', 'idl', 'idlc', 'instsetoo_native', 'io', 'ios', 'jvmaccess', 'jvmfwk', 'l10ntools', 'librelogo', 'libreofficekit', 'linguistic', 'lotuswordpro', 'mysqlc', 'nlpsolver', 'o3tl', 'offapi', 'officecfg', 'onlineupdate', 'oovbaapi', 'oox', 'opencl', 'package', 'postprocess', 'pyuno', 'registry', 'remotebridges', 'reportbuilder', 'reportdesign', 'ridljar', 'rsc', 'salhelper', 'sax', 'sc', 'sccomp', 'scp2', 'scripting', 'sd', 'sdext', 'setup_native', 'sfx2', 'slideshow', 'smoketest', 'soltools', 'sot', 'starmath', 'store', 'svgio', 'emfio', 'svl', 'svtools', 'svx', 'sw', 'swext', 'sysui', 'test', 'testtools', 'toolkit', 'ucb', 'ucbhelper', 'udkapi', 'uitest', 'UnoControls', 'unodevtools', 'unoidl', 'unoil', 'unotest', 'unotools', 'unoxml', 'ure', 'uui', 'vbahelper', 'vcl', 'winaccessibility', 'wizards', 'writerperfect', 'xmerge', 'xmlhelp', 'xmloff', 'xmlreader', 'xmlscript', 'xmlsecurity']
|
||||
if os.environ['OS'] == 'WNT':
|
||||
# for now, use a limited subset for testing on windows as it is so annoyingly slow on this
|
||||
modules = ['chart2', 'cui', 'dbaccess', 'framework', 'oox', 'sfx2', 'svl', 'svtools', 'svx', 'toolkit', 'vcl', 'xmloff']
|
||||
|
|
|
@ -166,13 +166,13 @@ namespace svgio
|
|||
{
|
||||
if(GraphicType::Bitmap == rGraphic.GetType())
|
||||
{
|
||||
if(rGraphic.getSvgData().get())
|
||||
if(rGraphic.getVectorGraphicData().get())
|
||||
{
|
||||
// embedded Svg
|
||||
rEmbedded = rGraphic.getSvgData()->getPrimitive2DSequence();
|
||||
rEmbedded = rGraphic.getVectorGraphicData()->getPrimitive2DSequence();
|
||||
|
||||
// fill aViewBox
|
||||
rViewBox = rGraphic.getSvgData()->getRange();
|
||||
rViewBox = rGraphic.getVectorGraphicData()->getRange();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -70,15 +70,15 @@ GraphicID::GraphicID( const GraphicObject& rObj )
|
|||
{
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(rGraphic.getSvgData().get())
|
||||
if(rGraphic.getVectorGraphicData().get())
|
||||
{
|
||||
const SvgDataPtr& rSvgDataPtr = rGraphic.getSvgData();
|
||||
const basegfx::B2DRange& rRange = rSvgDataPtr->getRange();
|
||||
const VectorGraphicDataPtr& rVectorGraphicDataPtr = rGraphic.getVectorGraphicData();
|
||||
const basegfx::B2DRange& rRange = rVectorGraphicDataPtr->getRange();
|
||||
|
||||
mnID1 |= rSvgDataPtr->getSvgDataArrayLength();
|
||||
mnID1 |= rVectorGraphicDataPtr->getVectorGraphicDataArrayLength();
|
||||
mnID2 = basegfx::fround(rRange.getWidth());
|
||||
mnID3 = basegfx::fround(rRange.getHeight());
|
||||
mnID4 = vcl_get_checksum(0, rSvgDataPtr->getSvgDataArray().getConstArray(), rSvgDataPtr->getSvgDataArrayLength());
|
||||
mnID4 = vcl_get_checksum(0, rVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), rVectorGraphicDataPtr->getVectorGraphicDataArrayLength());
|
||||
}
|
||||
else if( rGraphic.IsAnimated() )
|
||||
{
|
||||
|
@ -145,15 +145,15 @@ private:
|
|||
|
||||
std::vector< GraphicObject* > maGraphicObjectList;
|
||||
|
||||
GraphicID maID;
|
||||
GfxLink maGfxLink;
|
||||
BitmapEx* mpBmpEx;
|
||||
GDIMetaFile* mpMtf;
|
||||
Animation* mpAnimation;
|
||||
bool mbSwappedAll;
|
||||
GraphicID maID;
|
||||
GfxLink maGfxLink;
|
||||
BitmapEx* mpBmpEx;
|
||||
GDIMetaFile* mpMtf;
|
||||
Animation* mpAnimation;
|
||||
bool mbSwappedAll;
|
||||
|
||||
// SvgData support
|
||||
SvgDataPtr maSvgData;
|
||||
// VectorGraphicData support
|
||||
VectorGraphicDataPtr maVectorGraphicData;
|
||||
uno::Sequence<sal_Int8> maPdfData;
|
||||
|
||||
bool ImplInit( const GraphicObject& rObj );
|
||||
|
@ -229,9 +229,9 @@ bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj )
|
|||
{
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(rGraphic.getSvgData().get())
|
||||
if(rGraphic.getVectorGraphicData().get())
|
||||
{
|
||||
maSvgData = rGraphic.getSvgData();
|
||||
maVectorGraphicData = rGraphic.getVectorGraphicData();
|
||||
}
|
||||
else if( rGraphic.IsAnimated() )
|
||||
{
|
||||
|
@ -280,9 +280,9 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute )
|
|||
if( rSubstitute.IsLink() && ( GfxLinkType::NONE == maGfxLink.GetType() ) )
|
||||
maGfxLink = rSubstitute.GetLink();
|
||||
|
||||
if(maSvgData.get())
|
||||
if(maVectorGraphicData.get())
|
||||
{
|
||||
rSubstitute = maSvgData;
|
||||
rSubstitute = maVectorGraphicData;
|
||||
}
|
||||
else if( mpBmpEx )
|
||||
{
|
||||
|
@ -381,8 +381,8 @@ void GraphicCacheEntry::GraphicObjectWasSwappedOut()
|
|||
delete mpAnimation;
|
||||
mpAnimation = nullptr;
|
||||
|
||||
// #119176# also reset SvgData
|
||||
maSvgData.reset();
|
||||
// #119176# also reset VectorGraphicData
|
||||
maVectorGraphicData.reset();
|
||||
maPdfData = uno::Sequence<sal_Int8>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -598,9 +598,9 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
|
|||
}
|
||||
if ( rGraphic.GetType() == GraphicType::Bitmap )
|
||||
{
|
||||
if(rGraphic.getSvgData().get())
|
||||
if(rGraphic.getVectorGraphicData().get())
|
||||
{
|
||||
// embedded Svg, no need to scale. Also no method to apply crop data currently
|
||||
// embedded Vector Graphic Data, no need to scale. Also no method to apply crop data currently
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
#include <vcl/settings.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
|
|
|
@ -604,7 +604,7 @@ void SdrEditView::CheckPossibilities()
|
|||
const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
|
||||
const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
|
||||
|
||||
if(pSdrGrafObj && ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) || pSdrGrafObj->isEmbeddedSvg()))
|
||||
if(pSdrGrafObj && ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) || pSdrGrafObj->isEmbeddedVectorGraphicData()))
|
||||
{
|
||||
bImportMtfPossible = true;
|
||||
}
|
||||
|
|
|
@ -2000,8 +2000,8 @@ namespace
|
|||
{
|
||||
if (pGraf->HasGDIMetaFile())
|
||||
return pGraf->GetTransformedGraphic(SdrGrafObjTransformsAttrs::COLOR|SdrGrafObjTransformsAttrs::MIRROR).GetGDIMetaFile();
|
||||
assert(pGraf->isEmbeddedSvg());
|
||||
return pGraf->getMetafileFromEmbeddedSvg();
|
||||
assert(pGraf->isEmbeddedVectorGraphicData());
|
||||
return pGraf->getMetafileFromEmbeddedVectorGraphicData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2039,7 +2039,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo)
|
|||
sal_uIntPtr nInsAnz=0;
|
||||
tools::Rectangle aLogicRect;
|
||||
|
||||
if (pGraf && (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedSvg()))
|
||||
if (pGraf && (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedVectorGraphicData()))
|
||||
{
|
||||
GDIMetaFile aMetaFile(GetMetaFile(pGraf));
|
||||
if(aMetaFile.GetActionSize())
|
||||
|
|
|
@ -285,12 +285,12 @@ void SdrGrafObj::onGraphicChanged()
|
|||
if (!pGraphic || pGraphic->IsSwappedOut()) // don't force swap-in for this
|
||||
return;
|
||||
|
||||
const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
|
||||
const VectorGraphicDataPtr& rVectorGraphicDataPtr = pGraphic->GetGraphic().getVectorGraphicData();
|
||||
|
||||
if (!rSvgDataPtr.get())
|
||||
if (!rVectorGraphicDataPtr.get())
|
||||
return;
|
||||
|
||||
const drawinglayer::primitive2d::Primitive2DContainer aSequence(rSvgDataPtr->getPrimitive2DSequence());
|
||||
const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVectorGraphicDataPtr->getPrimitive2DSequence());
|
||||
|
||||
if (aSequence.empty())
|
||||
return;
|
||||
|
@ -432,11 +432,11 @@ const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const
|
|||
{
|
||||
if(!mpReplacementGraphic && pGraphic)
|
||||
{
|
||||
const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
|
||||
const VectorGraphicDataPtr& rVectorGraphicDataPtr = pGraphic->GetGraphic().getVectorGraphicData();
|
||||
|
||||
if(rSvgDataPtr.get())
|
||||
if(rVectorGraphicDataPtr.get())
|
||||
{
|
||||
const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement());
|
||||
const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rVectorGraphicDataPtr->getReplacement());
|
||||
}
|
||||
else if (pGraphic->GetGraphic().getPdfData().hasElements())
|
||||
{
|
||||
|
@ -742,11 +742,11 @@ OUString SdrGrafObj::TakeObjNameSingul() const
|
|||
if (!pGraphic)
|
||||
return OUString();
|
||||
|
||||
const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
|
||||
const VectorGraphicDataPtr& rVectorGraphicDataPtr = pGraphic->GetGraphic().getVectorGraphicData();
|
||||
|
||||
OUStringBuffer sName;
|
||||
|
||||
if(rSvgDataPtr.get())
|
||||
if(rVectorGraphicDataPtr.get())
|
||||
{
|
||||
sName.append(ImpGetResStr(STR_ObjNameSingulGRAFSVG));
|
||||
}
|
||||
|
@ -795,11 +795,11 @@ OUString SdrGrafObj::TakeObjNamePlural() const
|
|||
if(!pGraphic)
|
||||
return OUString();
|
||||
|
||||
const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
|
||||
const VectorGraphicDataPtr& rVectorGraphicDataPtr = pGraphic->GetGraphic().getVectorGraphicData();
|
||||
|
||||
OUStringBuffer sName;
|
||||
|
||||
if(rSvgDataPtr.get())
|
||||
if(rVectorGraphicDataPtr.get())
|
||||
{
|
||||
sName.append(ImpGetResStr(STR_ObjNamePluralGRAFSVG));
|
||||
}
|
||||
|
@ -1030,16 +1030,16 @@ bool SdrGrafObj::HasGDIMetaFile() const
|
|||
return( pGraphic->GetType() == GraphicType::GdiMetafile );
|
||||
}
|
||||
|
||||
bool SdrGrafObj::isEmbeddedSvg() const
|
||||
bool SdrGrafObj::isEmbeddedVectorGraphicData() const
|
||||
{
|
||||
return GraphicType::Bitmap == GetGraphicType() && GetGraphic().getSvgData().get();
|
||||
return GraphicType::Bitmap == GetGraphicType() && GetGraphic().getVectorGraphicData().get();
|
||||
}
|
||||
|
||||
GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedSvg() const
|
||||
GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedVectorGraphicData() const
|
||||
{
|
||||
GDIMetaFile aRetval;
|
||||
|
||||
if(isEmbeddedSvg() && GetModel())
|
||||
if(isEmbeddedVectorGraphicData() && GetModel())
|
||||
{
|
||||
ScopedVclPtrInstance< VirtualDevice > pOut;
|
||||
const tools::Rectangle aBoundRect(GetCurrentBoundRect());
|
||||
|
@ -1061,15 +1061,15 @@ GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedSvg() const
|
|||
|
||||
GDIMetaFile SdrGrafObj::GetMetaFile(GraphicType &rGraphicType) const
|
||||
{
|
||||
if (isEmbeddedSvg())
|
||||
if (isEmbeddedVectorGraphicData())
|
||||
{
|
||||
// Embedded Svg
|
||||
// Embedded Vector Graphic Data
|
||||
// There is currently no helper to create SdrObjects from primitives (even if I'm thinking
|
||||
// about writing one for some time). To get the roundtrip to SdrObjects it is necessary to
|
||||
// use the old converter path over the MetaFile mechanism. Create Metafile from Svg
|
||||
// primitives here pretty directly
|
||||
rGraphicType = GraphicType::GdiMetafile;
|
||||
return getMetafileFromEmbeddedSvg();
|
||||
return getMetafileFromEmbeddedVectorGraphicData();
|
||||
}
|
||||
else if (GraphicType::GdiMetafile == rGraphicType)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include <vcl/virdev.hxx>
|
||||
#include <svl/style.hxx>
|
||||
#include <fmobj.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
|
||||
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
|
||||
#include <drawinglayer/geometry/viewinformation2d.hxx>
|
||||
|
@ -462,9 +462,9 @@ BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked) const
|
|||
{
|
||||
const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(GetMarkedObjectByIndex(0));
|
||||
|
||||
if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg())
|
||||
if(pSdrGrafObj && pSdrGrafObj->isEmbeddedVectorGraphicData())
|
||||
{
|
||||
aBmp = pSdrGrafObj->GetGraphic().getSvgData()->getReplacement();
|
||||
aBmp = pSdrGrafObj->GetGraphic().getVectorGraphicData()->getReplacement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -608,10 +608,10 @@ Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject*
|
|||
|
||||
if(pSdrGrafObj)
|
||||
{
|
||||
if(pSdrGrafObj->isEmbeddedSvg())
|
||||
if(pSdrGrafObj->isEmbeddedVectorGraphicData())
|
||||
{
|
||||
// get Metafile for Svg content
|
||||
aRet = pSdrGrafObj->getMetafileFromEmbeddedSvg();
|
||||
aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -147,11 +147,11 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
|
|||
aURL.setBase( aName );
|
||||
}
|
||||
|
||||
// #i121128# use shortcut to write SVG data in original form (if possible)
|
||||
const SvgDataPtr& aSvgDataPtr(rGraphic.getSvgData());
|
||||
// #i121128# use shortcut to write Vector Graphic Data data in original form (if possible)
|
||||
const VectorGraphicDataPtr& aVectorGraphicDataPtr(rGraphic.getVectorGraphicData());
|
||||
|
||||
if(aSvgDataPtr.get()
|
||||
&& aSvgDataPtr->getSvgDataArrayLength()
|
||||
if(aVectorGraphicDataPtr.get()
|
||||
&& aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()
|
||||
&& rFilterName.equalsIgnoreAsciiCase("svg"))
|
||||
{
|
||||
if(!(nFlags & XOutFlags::DontAddExtension))
|
||||
|
@ -165,7 +165,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
|
|||
|
||||
if(pOStm)
|
||||
{
|
||||
pOStm->WriteBytes(aSvgDataPtr->getSvgDataArray().getConstArray(), aSvgDataPtr->getSvgDataArrayLength());
|
||||
pOStm->WriteBytes(aVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), aVectorGraphicDataPtr->getVectorGraphicDataArrayLength());
|
||||
aMedium.Commit();
|
||||
|
||||
if(!aMedium.GetError())
|
||||
|
|
|
@ -162,7 +162,7 @@
|
|||
#include <vcl/settings.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclevent.hxx>
|
||||
|
|
|
@ -173,7 +173,7 @@
|
|||
#include <vcl/settings.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
#include <vcl/settings.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclevent.hxx>
|
||||
|
|
|
@ -332,11 +332,11 @@ void SwGrfNode::onGraphicChanged()
|
|||
OUString aName;
|
||||
OUString aTitle;
|
||||
OUString aDesc;
|
||||
const SvgDataPtr& rSvgDataPtr = GetGrf().getSvgData();
|
||||
const VectorGraphicDataPtr& rVectorGraphicDataPtr = GetGrf().getVectorGraphicData();
|
||||
|
||||
if(rSvgDataPtr.get())
|
||||
if(rVectorGraphicDataPtr.get())
|
||||
{
|
||||
const drawinglayer::primitive2d::Primitive2DContainer aSequence(rSvgDataPtr->getPrimitive2DSequence());
|
||||
const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVectorGraphicDataPtr->getPrimitive2DSequence());
|
||||
|
||||
if(!aSequence.empty())
|
||||
{
|
||||
|
@ -394,11 +394,11 @@ const GraphicObject* SwGrfNode::GetReplacementGrfObj() const
|
|||
{
|
||||
if(!mpReplacementGraphic)
|
||||
{
|
||||
const SvgDataPtr& rSvgDataPtr = GetGrfObj().GetGraphic().getSvgData();
|
||||
const VectorGraphicDataPtr& rVectorGraphicDataPtr = GetGrfObj().GetGraphic().getVectorGraphicData();
|
||||
|
||||
if(rSvgDataPtr.get())
|
||||
if(rVectorGraphicDataPtr.get())
|
||||
{
|
||||
const_cast< SwGrfNode* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement());
|
||||
const_cast< SwGrfNode* >(this)->mpReplacementGraphic = new GraphicObject(rVectorGraphicDataPtr->getReplacement());
|
||||
}
|
||||
else if (GetGrfObj().GetGraphic().getPdfData().hasElements())
|
||||
{
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/vclevent.hxx>
|
||||
|
|
|
@ -298,7 +298,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
|
|||
vcl/source/gdi/sallayout \
|
||||
vcl/source/gdi/salmisc \
|
||||
vcl/source/gdi/salnativewidgets-none \
|
||||
vcl/source/gdi/svgdata \
|
||||
vcl/source/gdi/vectorgraphicdata \
|
||||
vcl/source/gdi/textlayout \
|
||||
vcl/source/gdi/virdev \
|
||||
vcl/source/gdi/wall \
|
||||
|
|
|
@ -48,7 +48,7 @@ private:
|
|||
mutable sal_uLong mnSizeBytes;
|
||||
bool mbSwapOut;
|
||||
bool mbDummyContext;
|
||||
SvgDataPtr maSvgData;
|
||||
VectorGraphicDataPtr maVectorGraphicData;
|
||||
css::uno::Sequence<sal_Int8> maPdfData;
|
||||
|
||||
private:
|
||||
|
@ -58,7 +58,7 @@ private:
|
|||
ImpGraphic( ImpGraphic&& rImpGraphic );
|
||||
ImpGraphic( const Bitmap& rBmp );
|
||||
ImpGraphic( const BitmapEx& rBmpEx );
|
||||
ImpGraphic(const SvgDataPtr& rSvgDataPtr);
|
||||
ImpGraphic(const VectorGraphicDataPtr& rVectorGraphicDataPtr);
|
||||
ImpGraphic( const Animation& rAnimation );
|
||||
ImpGraphic( const GDIMetaFile& rMtf );
|
||||
public:
|
||||
|
@ -145,7 +145,7 @@ private:
|
|||
friend void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic);
|
||||
friend void ReadImpGraphic(SvStream& rIStm, ImpGraphic& rImpGraphic);
|
||||
|
||||
const SvgDataPtr& getSvgData() const { return maSvgData; }
|
||||
const VectorGraphicDataPtr& getVectorGraphicData() const { return maVectorGraphicData; }
|
||||
};
|
||||
|
||||
#endif // INCLUDED_VCL_INC_IMPGRAPH_HXX
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <tools/stream.hxx>
|
||||
#include <vcl/pngread.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
|
||||
namespace {
|
||||
bool loadPng( const OUString & rPath, BitmapEx &rBitmap)
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <vcl/salctype.hxx>
|
||||
#include <vcl/pngread.hxx>
|
||||
#include <vcl/pngwrite.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <osl/file.hxx>
|
||||
|
@ -1679,7 +1679,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
|
|||
|
||||
if (!rIStream.GetError() && nMemoryLength >= 0)
|
||||
{
|
||||
SvgDataArray aNewData(nMemoryLength);
|
||||
VectorGraphicDataArray aNewData(nMemoryLength);
|
||||
aMemStream.Seek(STREAM_SEEK_TO_BEGIN);
|
||||
aMemStream.ReadBytes(aNewData.begin(), nMemoryLength);
|
||||
|
||||
|
@ -1690,22 +1690,22 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
|
|||
|
||||
if(!aMemStream.GetError() )
|
||||
{
|
||||
SvgDataPtr aSvgDataPtr(new SvgData(aNewData, rPath));
|
||||
rGraphic = Graphic(aSvgDataPtr);
|
||||
VectorGraphicDataPtr aVectorGraphicDataPtr(new VectorGraphicData(aNewData, rPath, VectorGraphicDataType::Svg));
|
||||
rGraphic = Graphic(aVectorGraphicDataPtr);
|
||||
bOkay = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SvgDataArray aNewData(nStreamLength);
|
||||
VectorGraphicDataArray aNewData(nStreamLength);
|
||||
rIStream.Seek(nStreamPosition);
|
||||
rIStream.ReadBytes(aNewData.begin(), nStreamLength);
|
||||
|
||||
if(!rIStream.GetError())
|
||||
{
|
||||
SvgDataPtr aSvgDataPtr(new SvgData(aNewData, rPath));
|
||||
rGraphic = Graphic(aSvgDataPtr);
|
||||
VectorGraphicDataPtr aVectorGraphicDataPtr(new VectorGraphicData(aNewData, rPath, VectorGraphicDataType::Svg));
|
||||
rGraphic = Graphic(aVectorGraphicDataPtr);
|
||||
bOkay = true;
|
||||
}
|
||||
}
|
||||
|
@ -1766,13 +1766,46 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
|
|||
else if( aFilterName.equalsIgnoreAsciiCase( IMP_WMF ) ||
|
||||
aFilterName.equalsIgnoreAsciiCase( IMP_EMF ) )
|
||||
{
|
||||
GDIMetaFile aMtf;
|
||||
if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, nullptr, pExtHeader ) )
|
||||
nStatus = ERRCODE_GRFILTER_FORMATERROR;
|
||||
static bool bCheckEmf = false;
|
||||
if (bCheckEmf)
|
||||
{
|
||||
if (rGraphic.IsDummyContext())
|
||||
rGraphic.SetDummyContext(false);
|
||||
|
||||
const sal_uInt32 nStreamPosition(rIStream.Tell());
|
||||
const sal_uInt32 nStreamLength(rIStream.Seek(STREAM_SEEK_TO_END) - nStreamPosition);
|
||||
VectorGraphicDataArray aNewData(nStreamLength);
|
||||
bool bOkay(false);
|
||||
|
||||
rIStream.Seek(nStreamPosition);
|
||||
rIStream.ReadBytes(aNewData.begin(), nStreamLength);
|
||||
|
||||
if (!rIStream.GetError())
|
||||
{
|
||||
VectorGraphicDataPtr aVectorGraphicDataPtr(new VectorGraphicData(aNewData, rPath, VectorGraphicDataType::Emf));
|
||||
rGraphic = Graphic(aVectorGraphicDataPtr);
|
||||
bOkay = true;
|
||||
}
|
||||
|
||||
if (bOkay)
|
||||
{
|
||||
eLinkType = GfxLinkType::NativeSvg;
|
||||
}
|
||||
else
|
||||
{
|
||||
nStatus = ERRCODE_GRFILTER_FILTERERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rGraphic = aMtf;
|
||||
eLinkType = GfxLinkType::NativeWmf;
|
||||
GDIMetaFile aMtf;
|
||||
if (!ConvertWMFToGDIMetaFile(rIStream, aMtf, nullptr, pExtHeader))
|
||||
nStatus = ERRCODE_GRFILTER_FORMATERROR;
|
||||
else
|
||||
{
|
||||
rGraphic = aMtf;
|
||||
eLinkType = GfxLinkType::NativeWmf;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( aFilterName.equalsIgnoreAsciiCase( IMP_SVSGF )
|
||||
|
@ -2163,12 +2196,12 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
|
|||
{
|
||||
bool bDone(false);
|
||||
|
||||
// do we have a native SVG RenderGraphic, whose data can be written directly?
|
||||
const SvgDataPtr& aSvgDataPtr(rGraphic.getSvgData());
|
||||
// do we have a native Vector Graphic Data RenderGraphic, whose data can be written directly?
|
||||
const VectorGraphicDataPtr& aVectorGraphicDataPtr(rGraphic.getVectorGraphicData());
|
||||
|
||||
if (aSvgDataPtr.get() && aSvgDataPtr->getSvgDataArrayLength())
|
||||
if (aVectorGraphicDataPtr.get() && aVectorGraphicDataPtr->getVectorGraphicDataArrayLength())
|
||||
{
|
||||
rOStm.WriteBytes(aSvgDataPtr->getSvgDataArray().getConstArray(), aSvgDataPtr->getSvgDataArrayLength());
|
||||
rOStm.WriteBytes(aVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), aVectorGraphicDataPtr->getVectorGraphicDataArrayLength());
|
||||
|
||||
if( rOStm.GetError() )
|
||||
{
|
||||
|
|
|
@ -211,8 +211,8 @@ Graphic::Graphic(const BitmapEx& rBmpEx)
|
|||
{
|
||||
}
|
||||
|
||||
Graphic::Graphic(const SvgDataPtr& rSvgDataPtr)
|
||||
: mxImpGraphic(new ImpGraphic(rSvgDataPtr))
|
||||
Graphic::Graphic(const VectorGraphicDataPtr& rVectorGraphicDataPtr)
|
||||
: mxImpGraphic(new ImpGraphic(rVectorGraphicDataPtr))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -581,9 +581,9 @@ void WriteGraphic( SvStream& rOStream, const Graphic& rGraphic )
|
|||
WriteImpGraphic(rOStream, *rGraphic.mxImpGraphic);
|
||||
}
|
||||
|
||||
const SvgDataPtr& Graphic::getSvgData() const
|
||||
const VectorGraphicDataPtr& Graphic::getVectorGraphicData() const
|
||||
{
|
||||
return mxImpGraphic->getSvgData();
|
||||
return mxImpGraphic->getVectorGraphicData();
|
||||
}
|
||||
|
||||
void Graphic::setPdfData(const uno::Sequence<sal_Int8>& rPdfData)
|
||||
|
|
|
@ -114,7 +114,7 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic)
|
|||
, mnSizeBytes(rImpGraphic.mnSizeBytes)
|
||||
, mbSwapOut(rImpGraphic.mbSwapOut)
|
||||
, mbDummyContext(rImpGraphic.mbDummyContext)
|
||||
, maSvgData(rImpGraphic.maSvgData)
|
||||
, maVectorGraphicData(rImpGraphic.maVectorGraphicData)
|
||||
, maPdfData(rImpGraphic.maPdfData)
|
||||
{
|
||||
if( rImpGraphic.mpGfxLink )
|
||||
|
@ -139,7 +139,7 @@ ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic)
|
|||
, mnSizeBytes(rImpGraphic.mnSizeBytes)
|
||||
, mbSwapOut(rImpGraphic.mbSwapOut)
|
||||
, mbDummyContext(rImpGraphic.mbDummyContext)
|
||||
, maSvgData(std::move(rImpGraphic.maSvgData))
|
||||
, maVectorGraphicData(std::move(rImpGraphic.maVectorGraphicData))
|
||||
, maPdfData(std::move(rImpGraphic.maPdfData))
|
||||
{
|
||||
rImpGraphic.ImplClear();
|
||||
|
@ -164,12 +164,12 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
|
|||
{
|
||||
}
|
||||
|
||||
ImpGraphic::ImpGraphic(const SvgDataPtr& rSvgDataPtr)
|
||||
: meType( rSvgDataPtr.get() ? GraphicType::Bitmap : GraphicType::NONE ),
|
||||
ImpGraphic::ImpGraphic(const VectorGraphicDataPtr& rVectorGraphicDataPtr)
|
||||
: meType( rVectorGraphicDataPtr.get() ? GraphicType::Bitmap : GraphicType::NONE ),
|
||||
mnSizeBytes( 0UL ),
|
||||
mbSwapOut( false ),
|
||||
mbDummyContext ( false ),
|
||||
maSvgData(rSvgDataPtr)
|
||||
maVectorGraphicData(rVectorGraphicDataPtr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic )
|
|||
if( rImpGraphic.mpGfxLink )
|
||||
mpGfxLink = o3tl::make_unique<GfxLink>( *rImpGraphic.mpGfxLink );
|
||||
|
||||
maSvgData = rImpGraphic.maSvgData;
|
||||
maVectorGraphicData = rImpGraphic.maVectorGraphicData;
|
||||
maPdfData = rImpGraphic.maPdfData;
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ ImpGraphic& ImpGraphic::operator=(ImpGraphic&& rImpGraphic)
|
|||
mbSwapOut = rImpGraphic.mbSwapOut;
|
||||
mpSwapFile = std::move(rImpGraphic.mpSwapFile);
|
||||
mpGfxLink = std::move(rImpGraphic.mpGfxLink);
|
||||
maSvgData = std::move(rImpGraphic.maSvgData);
|
||||
maVectorGraphicData = std::move(rImpGraphic.maVectorGraphicData);
|
||||
maPdfData = std::move(rImpGraphic.maPdfData);
|
||||
|
||||
rImpGraphic.ImplClear();
|
||||
|
@ -280,20 +280,20 @@ bool ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const
|
|||
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(maSvgData.get())
|
||||
if(maVectorGraphicData.get())
|
||||
{
|
||||
if(maSvgData == rImpGraphic.maSvgData)
|
||||
if(maVectorGraphicData == rImpGraphic.maVectorGraphicData)
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
else if(rImpGraphic.maSvgData)
|
||||
else if(rImpGraphic.maVectorGraphicData)
|
||||
{
|
||||
if(maSvgData->getSvgDataArrayLength() == rImpGraphic.maSvgData->getSvgDataArrayLength())
|
||||
if(maVectorGraphicData->getVectorGraphicDataArrayLength() == rImpGraphic.maVectorGraphicData->getVectorGraphicDataArrayLength())
|
||||
{
|
||||
if(0 == memcmp(
|
||||
maSvgData->getSvgDataArray().getConstArray(),
|
||||
rImpGraphic.maSvgData->getSvgDataArray().getConstArray(),
|
||||
maSvgData->getSvgDataArrayLength()))
|
||||
maVectorGraphicData->getVectorGraphicDataArray().getConstArray(),
|
||||
rImpGraphic.maVectorGraphicData->getVectorGraphicDataArray().getConstArray(),
|
||||
maVectorGraphicData->getVectorGraphicDataArrayLength()))
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ void ImpGraphic::ImplClearGraphics()
|
|||
maMetaFile.Clear();
|
||||
mpAnimation.reset();
|
||||
mpGfxLink.reset();
|
||||
maSvgData.reset();
|
||||
maVectorGraphicData.reset();
|
||||
maPdfData = uno::Sequence<sal_Int8>();
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ bool ImpGraphic::ImplIsTransparent() const
|
|||
{
|
||||
bool bRet(true);
|
||||
|
||||
if( meType == GraphicType::Bitmap && !maSvgData.get())
|
||||
if( meType == GraphicType::Bitmap && !maVectorGraphicData.get())
|
||||
{
|
||||
bRet = ( mpAnimation ? mpAnimation->IsTransparent() : maEx.IsTransparent() );
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ bool ImpGraphic::ImplIsAlpha() const
|
|||
{
|
||||
bool bRet(false);
|
||||
|
||||
if(maSvgData.get())
|
||||
if(maVectorGraphicData.get())
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
|
@ -435,10 +435,10 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
|
|||
|
||||
if( meType == GraphicType::Bitmap )
|
||||
{
|
||||
if(maSvgData.get() && maEx.IsEmpty())
|
||||
if(maVectorGraphicData.get() && maEx.IsEmpty())
|
||||
{
|
||||
// use maEx as local buffer for rendered svg
|
||||
const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
|
||||
const_cast< ImpGraphic* >(this)->maEx = maVectorGraphicData->getReplacement();
|
||||
}
|
||||
|
||||
const BitmapEx& rRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
|
||||
|
@ -543,10 +543,10 @@ BitmapEx ImpGraphic::ImplGetBitmapEx(const GraphicConversionParameters& rParamet
|
|||
|
||||
if( meType == GraphicType::Bitmap )
|
||||
{
|
||||
if(maSvgData.get() && maEx.IsEmpty())
|
||||
if(maVectorGraphicData.get() && maEx.IsEmpty())
|
||||
{
|
||||
// use maEx as local buffer for rendered svg
|
||||
const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
|
||||
const_cast< ImpGraphic* >(this)->maEx = maVectorGraphicData->getReplacement();
|
||||
}
|
||||
|
||||
aRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
|
||||
|
@ -601,10 +601,10 @@ const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
|
|||
// survive copying (change this if not wanted)
|
||||
ImpGraphic* pThat = const_cast< ImpGraphic* >(this);
|
||||
|
||||
if(maSvgData.get() && !maEx)
|
||||
if(maVectorGraphicData.get() && !maEx)
|
||||
{
|
||||
// use maEx as local buffer for rendered svg
|
||||
pThat->maEx = maSvgData->getReplacement();
|
||||
pThat->maEx = maVectorGraphicData->getReplacement();
|
||||
}
|
||||
|
||||
// #123983# directly create a metafile with the same PrefSize and PrefMapMode
|
||||
|
@ -643,10 +643,10 @@ Size ImpGraphic::ImplGetPrefSize() const
|
|||
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(maSvgData.get() && maEx.IsEmpty())
|
||||
if(maVectorGraphicData.get() && maEx.IsEmpty())
|
||||
{
|
||||
// svg not yet buffered in maEx, return size derived from range
|
||||
const basegfx::B2DRange& rRange = maSvgData->getRange();
|
||||
const basegfx::B2DRange& rRange = maVectorGraphicData->getRange();
|
||||
|
||||
aSize = Size(basegfx::fround(rRange.getWidth()), basegfx::fround(rRange.getHeight()));
|
||||
}
|
||||
|
@ -686,10 +686,10 @@ void ImpGraphic::ImplSetPrefSize( const Size& rPrefSize )
|
|||
{
|
||||
// used when importing a writer FlyFrame with SVG as graphic, added conversion
|
||||
// to allow setting the PrefSize at the BitmapEx to hold it
|
||||
if(maSvgData.get() && maEx.IsEmpty())
|
||||
if(maVectorGraphicData.get() && maEx.IsEmpty())
|
||||
{
|
||||
// use maEx as local buffer for rendered svg
|
||||
maEx = maSvgData->getReplacement();
|
||||
maEx = maVectorGraphicData->getReplacement();
|
||||
}
|
||||
|
||||
// #108077# Push through pref size to animation object,
|
||||
|
@ -728,7 +728,7 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const
|
|||
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(maSvgData.get() && maEx.IsEmpty())
|
||||
if(maVectorGraphicData.get() && maEx.IsEmpty())
|
||||
{
|
||||
// svg not yet buffered in maEx, return default PrefMapMode
|
||||
aMapMode = MapMode(MapUnit::Map100thMM);
|
||||
|
@ -765,10 +765,10 @@ void ImpGraphic::ImplSetPrefMapMode( const MapMode& rPrefMapMode )
|
|||
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(maSvgData.get())
|
||||
if(maVectorGraphicData.get())
|
||||
{
|
||||
// ignore for Svg. If this is really used (except the grfcache)
|
||||
// it can be extended by using maEx as buffer for maSvgData->getReplacement()
|
||||
// ignore for Vector Graphic Data. If this is really used (except the grfcache)
|
||||
// it can be extended by using maEx as buffer for maVectorGraphicData->getReplacement()
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -799,12 +799,12 @@ sal_uLong ImpGraphic::ImplGetSizeBytes() const
|
|||
{
|
||||
if( meType == GraphicType::Bitmap )
|
||||
{
|
||||
if(maSvgData.get())
|
||||
if(maVectorGraphicData.get())
|
||||
{
|
||||
std::pair<SvgData::State, size_t> tmp(maSvgData->getSizeBytes());
|
||||
if (SvgData::State::UNPARSED == tmp.first)
|
||||
std::pair<VectorGraphicData::State, size_t> tmp(maVectorGraphicData->getSizeBytes());
|
||||
if (VectorGraphicData::State::UNPARSED == tmp.first)
|
||||
{
|
||||
return tmp.second; // don't cache it until SVG is parsed
|
||||
return tmp.second; // don't cache it until Vector Graphic Data is parsed
|
||||
}
|
||||
mnSizeBytes = tmp.second;
|
||||
}
|
||||
|
@ -833,10 +833,10 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
|
|||
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(maSvgData.get() && !maEx)
|
||||
if(maVectorGraphicData.get() && !maEx)
|
||||
{
|
||||
// use maEx as local buffer for rendered svg
|
||||
const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
|
||||
const_cast< ImpGraphic* >(this)->maEx = maVectorGraphicData->getReplacement();
|
||||
}
|
||||
|
||||
if ( mpAnimation )
|
||||
|
@ -869,10 +869,10 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
|
|||
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(maSvgData.get() && maEx.IsEmpty())
|
||||
if(maVectorGraphicData.get() && maEx.IsEmpty())
|
||||
{
|
||||
// use maEx as local buffer for rendered svg
|
||||
const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
|
||||
const_cast< ImpGraphic* >(this)->maEx = maVectorGraphicData->getReplacement();
|
||||
}
|
||||
|
||||
if( mpAnimation )
|
||||
|
@ -1004,10 +1004,10 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
|
|||
{
|
||||
if( meType == GraphicType::Bitmap )
|
||||
{
|
||||
if(maSvgData.get() && maEx.IsEmpty())
|
||||
if(maVectorGraphicData.get() && maEx.IsEmpty())
|
||||
{
|
||||
// use maEx as local buffer for rendered svg
|
||||
maEx = maSvgData->getReplacement();
|
||||
maEx = maVectorGraphicData->getReplacement();
|
||||
}
|
||||
|
||||
maEx.aBitmapSize = aSize;
|
||||
|
@ -1351,10 +1351,10 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
|
|||
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(maSvgData.get() && maEx.IsEmpty())
|
||||
if(maVectorGraphicData.get() && maEx.IsEmpty())
|
||||
{
|
||||
// use maEx as local buffer for rendered svg
|
||||
const_cast< ImpGraphic* >(this)->maEx = maSvgData->getReplacement();
|
||||
const_cast< ImpGraphic* >(this)->maEx = maVectorGraphicData->getReplacement();
|
||||
}
|
||||
|
||||
if( mpAnimation )
|
||||
|
@ -1520,20 +1520,20 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic )
|
|||
|
||||
if (nSvgMagic == nMagic)
|
||||
{
|
||||
sal_uInt32 nSvgDataArrayLength(0);
|
||||
rIStm.ReadUInt32(nSvgDataArrayLength);
|
||||
sal_uInt32 nVectorGraphicDataArrayLength(0);
|
||||
rIStm.ReadUInt32(nVectorGraphicDataArrayLength);
|
||||
|
||||
if (nSvgDataArrayLength)
|
||||
if (nVectorGraphicDataArrayLength)
|
||||
{
|
||||
SvgDataArray aNewData(nSvgDataArrayLength);
|
||||
VectorGraphicDataArray aNewData(nVectorGraphicDataArrayLength);
|
||||
|
||||
rIStm.ReadBytes(aNewData.getArray(), nSvgDataArrayLength);
|
||||
rIStm.ReadBytes(aNewData.getArray(), nVectorGraphicDataArrayLength);
|
||||
OUString aPath = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet());
|
||||
|
||||
if (!rIStm.GetError())
|
||||
{
|
||||
SvgDataPtr aSvgDataPtr(new SvgData(aNewData, aPath));
|
||||
rImpGraphic = aSvgDataPtr;
|
||||
VectorGraphicDataPtr aVectorGraphicDataPtr(new VectorGraphicData(aNewData, aPath, VectorGraphicDataType::Svg));
|
||||
rImpGraphic = aVectorGraphicDataPtr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1604,7 +1604,7 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
|
|||
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
if(rImpGraphic.getSvgData().get())
|
||||
if(rImpGraphic.getVectorGraphicData().get())
|
||||
{
|
||||
// stream out Svg defining data (length, byte array and evtl. path)
|
||||
// this is used e.g. in swapping out graphic data and in transporting it over UNO API
|
||||
|
@ -1613,10 +1613,10 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
|
|||
const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
|
||||
|
||||
rOStm.WriteUInt32( nSvgMagic );
|
||||
rOStm.WriteUInt32( rImpGraphic.getSvgData()->getSvgDataArrayLength() );
|
||||
rOStm.WriteBytes(rImpGraphic.getSvgData()->getSvgDataArray().getConstArray(),
|
||||
rImpGraphic.getSvgData()->getSvgDataArrayLength());
|
||||
rOStm.WriteUniOrByteString(rImpGraphic.getSvgData()->getPath(),
|
||||
rOStm.WriteUInt32( rImpGraphic.getVectorGraphicData()->getVectorGraphicDataArrayLength() );
|
||||
rOStm.WriteBytes(rImpGraphic.getVectorGraphicData()->getVectorGraphicDataArray().getConstArray(),
|
||||
rImpGraphic.getVectorGraphicData()->getVectorGraphicDataArrayLength());
|
||||
rOStm.WriteUniOrByteString(rImpGraphic.getVectorGraphicData()->getPath(),
|
||||
rOStm.GetStreamCharSet());
|
||||
}
|
||||
else if (rImpGraphic.maPdfData.hasElements())
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
*/
|
||||
|
||||
#include <tools/stream.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <com/sun/star/graphic/SvgTools.hpp>
|
||||
#include <com/sun/star/graphic/EmfTools.hpp>
|
||||
#include <com/sun/star/graphic/Primitive2DTools.hpp>
|
||||
#include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp>
|
||||
#include <com/sun/star/util/XAccounting.hpp>
|
||||
|
@ -105,7 +106,7 @@ size_t estimateSize(
|
|||
return nRet;
|
||||
}
|
||||
|
||||
void SvgData::ensureReplacement()
|
||||
void VectorGraphicData::ensureReplacement()
|
||||
{
|
||||
ensureSequenceAndRange();
|
||||
|
||||
|
@ -115,15 +116,15 @@ void SvgData::ensureReplacement()
|
|||
}
|
||||
}
|
||||
|
||||
void SvgData::ensureSequenceAndRange()
|
||||
void VectorGraphicData::ensureSequenceAndRange()
|
||||
{
|
||||
if(maSequence.empty() && maSvgDataArray.hasElements())
|
||||
if(maSequence.empty() && maVectorGraphicDataArray.hasElements())
|
||||
{
|
||||
// import SVG to maSequence, also set maRange
|
||||
maRange.reset();
|
||||
|
||||
// create stream
|
||||
const uno::Reference< io::XInputStream > myInputStream(new comphelper::SequenceInputStream(maSvgDataArray));
|
||||
const uno::Reference< io::XInputStream > myInputStream(new comphelper::SequenceInputStream(maVectorGraphicDataArray));
|
||||
|
||||
if(myInputStream.is())
|
||||
{
|
||||
|
@ -131,9 +132,19 @@ void SvgData::ensureSequenceAndRange()
|
|||
try
|
||||
{
|
||||
uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
|
||||
const uno::Reference< graphic::XSvgParser > xSvgParser = graphic::SvgTools::create(xContext);
|
||||
|
||||
maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xSvgParser->getDecomposition(myInputStream, maPath));
|
||||
if (VectorGraphicDataType::Emf == getVectorGraphicDataType())
|
||||
{
|
||||
const uno::Reference< graphic::XEmfParser > xEmfParser = graphic::EmfTools::create(xContext);
|
||||
|
||||
maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xEmfParser->getDecomposition(myInputStream, maPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
const uno::Reference< graphic::XSvgParser > xSvgParser = graphic::SvgTools::create(xContext);
|
||||
|
||||
maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xSvgParser->getDecomposition(myInputStream, maPath));
|
||||
}
|
||||
}
|
||||
catch(const uno::Exception&)
|
||||
{
|
||||
|
@ -169,35 +180,42 @@ void SvgData::ensureSequenceAndRange()
|
|||
}
|
||||
}
|
||||
|
||||
auto SvgData::getSizeBytes() -> std::pair<State, size_t>
|
||||
auto VectorGraphicData::getSizeBytes() -> std::pair<State, size_t>
|
||||
{
|
||||
if (maSequence.empty() && maSvgDataArray.hasElements())
|
||||
if (maSequence.empty() && maVectorGraphicDataArray.hasElements())
|
||||
{
|
||||
return std::make_pair(State::UNPARSED, maSvgDataArray.getLength());
|
||||
return std::make_pair(State::UNPARSED, maVectorGraphicDataArray.getLength());
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::make_pair(State::PARSED, maSvgDataArray.getLength() + mNestedBitmapSize);
|
||||
return std::make_pair(State::PARSED, maVectorGraphicDataArray.getLength() + mNestedBitmapSize);
|
||||
}
|
||||
}
|
||||
|
||||
SvgData::SvgData(const SvgDataArray& rSvgDataArray, const OUString& rPath)
|
||||
: maSvgDataArray(rSvgDataArray),
|
||||
VectorGraphicData::VectorGraphicData(
|
||||
const VectorGraphicDataArray& rVectorGraphicDataArray,
|
||||
const OUString& rPath,
|
||||
VectorGraphicDataType eVectorDataType)
|
||||
: maVectorGraphicDataArray(rVectorGraphicDataArray),
|
||||
maPath(rPath),
|
||||
maRange(),
|
||||
maSequence(),
|
||||
maReplacement()
|
||||
, mNestedBitmapSize(0)
|
||||
maReplacement(),
|
||||
mNestedBitmapSize(0),
|
||||
meVectorGraphicDataType(eVectorDataType)
|
||||
{
|
||||
}
|
||||
|
||||
SvgData::SvgData(const OUString& rPath):
|
||||
maSvgDataArray(),
|
||||
VectorGraphicData::VectorGraphicData(
|
||||
const OUString& rPath,
|
||||
VectorGraphicDataType eVectorDataType)
|
||||
: maVectorGraphicDataArray(),
|
||||
maPath(rPath),
|
||||
maRange(),
|
||||
maSequence(),
|
||||
maReplacement()
|
||||
, mNestedBitmapSize(0)
|
||||
maReplacement(),
|
||||
mNestedBitmapSize(0),
|
||||
meVectorGraphicDataType(eVectorDataType)
|
||||
{
|
||||
SvFileStream rIStm(rPath, StreamMode::STD_READ);
|
||||
if(rIStm.GetError())
|
||||
|
@ -205,33 +223,33 @@ SvgData::SvgData(const OUString& rPath):
|
|||
const sal_uInt32 nStmLen(rIStm.remainingSize());
|
||||
if (nStmLen)
|
||||
{
|
||||
maSvgDataArray.realloc(nStmLen);
|
||||
rIStm.ReadBytes(maSvgDataArray.begin(), nStmLen);
|
||||
maVectorGraphicDataArray.realloc(nStmLen);
|
||||
rIStm.ReadBytes(maVectorGraphicDataArray.begin(), nStmLen);
|
||||
|
||||
if (rIStm.GetError())
|
||||
{
|
||||
maSvgDataArray = SvgDataArray();
|
||||
maVectorGraphicDataArray = VectorGraphicDataArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const basegfx::B2DRange& SvgData::getRange() const
|
||||
const basegfx::B2DRange& VectorGraphicData::getRange() const
|
||||
{
|
||||
const_cast< SvgData* >(this)->ensureSequenceAndRange();
|
||||
const_cast< VectorGraphicData* >(this)->ensureSequenceAndRange();
|
||||
|
||||
return maRange;
|
||||
}
|
||||
|
||||
const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& SvgData::getPrimitive2DSequence() const
|
||||
const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& VectorGraphicData::getPrimitive2DSequence() const
|
||||
{
|
||||
const_cast< SvgData* >(this)->ensureSequenceAndRange();
|
||||
const_cast< VectorGraphicData* >(this)->ensureSequenceAndRange();
|
||||
|
||||
return maSequence;
|
||||
}
|
||||
|
||||
const BitmapEx& SvgData::getReplacement() const
|
||||
const BitmapEx& VectorGraphicData::getReplacement() const
|
||||
{
|
||||
const_cast< SvgData* >(this)->ensureReplacement();
|
||||
const_cast< VectorGraphicData* >(this)->ensureReplacement();
|
||||
|
||||
return maReplacement;
|
||||
}
|
|
@ -150,7 +150,7 @@
|
|||
#include <vcl/scopedbitmapaccess.hxx>
|
||||
#include <vcl/seleng.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svgdata.hxx>
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/syswin.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
|
|
Loading…
Reference in a new issue