Kaydet (Commit) 3ca7be09 authored tarafından Armin Le Grand's avatar Armin Le Grand

Replace SVGFilter using SVGIO

Target of this change is to get rid of the SVGFilter
in current LO which is based on the standard-ODF importer
using it's functionality by passing in/handing over
temporary created XML-Stream-Data.

First step is to alternatively import the given SVG
file to a newly created Document and to strip the
existing Filter-Code.

Adding the first prototype of the changed import. It
is capable of importing the given SVG to the created
Draw/Impress document. It adds the SVG which gets imported
by SVGIO as GraphicObject. It adapts sizes and positions of
Page and GraphicObject to have a smooth import.

Adding stripping of SVGFilter and used ressources. Done
as deep as possible, hopefully all places found.

Adapted now to create an Impress document. Also added needed
adaptions to PageSize(s), including layout and PresObj stuff
to make all MasterPages/LayoutPages work correctly.

Added reaction on empty SVG. This is needed since the
PageSize is adapted to the Graphic. With empty Graphic
a Size(0,0) results and this goes wrong.

Change-Id: Ia364a5783bee7dadcbe91e700efbabc121cf98f9
Reviewed-on: https://gerrit.libreoffice.org/54096Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarArmin Le Grand <Armin.Le.Grand@cib.de>
üst c845135b
......@@ -53,7 +53,6 @@ $(eval $(call gb_Helper_register_executables,NONE, \
regsvrex \
saxparser \
sp2bv \
svg2odf \
svidl \
$(if $(ENABLE_ONLINE_UPDATE_MAR),\
test_updater_dialog \
......
......@@ -109,10 +109,6 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
if (aFileName == SRCDIR "/extensions/source/plugin/unx/npnapi.cxx") {
return true;
}
// template magic
if (aFileName == SRCDIR "/filter/source/svg/svgreader.cxx") {
return true;
}
// vcl/unx/gtk3 re-using vcl/unx/gtk:
if (aFileName.find("/../../gtk/") != std::string::npos) {
return true;
......
# -*- 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_Executable_Executable,svg2odf))
$(eval $(call gb_Executable_set_targettype_gui,svg2odf,YES))
$(eval $(call gb_Executable_use_external,svg2odf,boost_headers))
$(eval $(call gb_Executable_use_sdk_api,svg2odf))
$(eval $(call gb_Executable_set_include,svg2odf,\
$$(INCLUDE) \
-I$(SRCDIR)/filter/inc \
))
$(eval $(call gb_Executable_use_libraries,svg2odf,\
svgfilter \
svxcore \
editeng \
xo \
svt \
vcl \
svl \
utl \
tl \
sax \
comphelper \
basegfx \
cppuhelper \
cppu \
sal \
))
$(eval $(call gb_Executable_add_exception_objects,svg2odf,\
filter/source/svg/test/svg2odf \
filter/source/svg/test/odfserializer \
))
# vim: set ts=4 sw=4 et:
......@@ -68,13 +68,7 @@ $(eval $(call gb_Library_use_externals,svgfilter,\
))
$(eval $(call gb_Library_add_exception_objects,svgfilter,\
filter/source/svg/b2dellipse \
filter/source/svg/parserfragments \
filter/source/svg/svgfilter \
filter/source/svg/svgimport \
filter/source/svg/svgreader \
filter/source/svg/tokenmap \
filter/source/svg/units \
filter/source/svg/svgexport \
filter/source/svg/svgfontexport \
filter/source/svg/svgwriter \
......
......@@ -47,12 +47,6 @@ $(eval $(call gb_Module_add_l10n_targets,filter,\
AllLangMoTarget_flt \
))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Module_add_targets,filter,\
Executable_svg2odf \
))
endif
$(eval $(call gb_Module_add_check_targets,filter,\
CppunitTest_filter_xslt \
CppunitTest_filter_priority \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_FILTER_INC_PARSERFRAGMENTS_HXX
#define INCLUDED_FILTER_INC_PARSERFRAGMENTS_HXX
#include <sal/config.h>
#include <vector>
#include <utility>
#include <rtl/ustring.hxx>
namespace basegfx
{
class B2DHomMatrix;
class B2DRange;
}
namespace svgi
{
struct ARGBColor;
/// Parse given string for one of the SVG color grammars
bool parseColor( const char* sColor, ARGBColor& rColor );
bool parseOpacity( const char* sOpacity, ARGBColor& rColor );
/// Parse given string for one of the SVG transformation grammars
bool parseTransform( const char* sTransform, basegfx::B2DHomMatrix& rTransform );
/// Parse given string for the viewBox attribute
bool parseViewBox( const char* sViewbox, basegfx::B2DRange& rRect );
/// Parse given string for a list of double values, comma-delimited
bool parseDashArray( const char* sDashArray, std::vector<double>& rOutputVector );
/** Parse paint uri
@param o_rPaintUri
Start and end ptr for uri substring (within
[sPaintUri,sPaintUri+strlen(sPaintUri)]
@param io_rColor
The optional paint color to use. if o_rPaintUri is empty,
parser sets io_rColor.second to false for color="None", to
true and keeps current io_rColor.first entry for
"currentColor", and to true and sets io_rColor.first to parsed
color otherwise.
@param sPaintUri
String to parse. Permitted to contain the optional paint
stuff, like fallback color.
@return true, if a paint uri was successfully parsed.
*/
bool parsePaintUri( std::pair<const char*,const char*>& o_rPaintUri,
std::pair<ARGBColor,bool>& io_rColor,
const char* sPaintUri );
/// Parse given string for the xlink attribute
bool parseXlinkHref( const char* xlink, OUString& data );
} // namespace svgi
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_FILTER_INC_SVGREADER_HXX
#define INCLUDED_FILTER_INC_SVGREADER_HXX
#include <filter/dllapi.h>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <xmloff/xmlimp.hxx>
namespace svgi
{
class SVGReader
{
private:
const css::uno::Reference< css::uno::XComponentContext > m_xContext;
const css::uno::Reference< css::io::XInputStream > m_xInputStream;
const css::uno::Reference< css::xml::sax::XDocumentHandler > m_xDocumentHandler;
SVGReader( const css::uno::Reference<css::uno::XComponentContext>& xContext,
const css::uno::Reference< css::io::XInputStream >& xInputStream,
const css::uno::Reference< css::xml::sax::XDocumentHandler >& xDocumentHandler,
SvXMLImport *pFastHandler);
public:
FILTER_DLLPUBLIC SVGReader( const css::uno::Reference<css::uno::XComponentContext>& xContext,
const css::uno::Reference< css::io::XInputStream >& xInputStream,
const css::uno::Reference< css::xml::sax::XDocumentHandler >& xDocumentHandler );
FILTER_DLLPUBLIC bool parseAndConvert();
};
} // namespace svgi
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -26,5 +26,5 @@
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop>
<prop oor:name="TemplateName"/>
<prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
<prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
</node>
/* -*- 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 "b2dellipse.hxx"
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
namespace basegfx
{
B2DEllipse::B2DEllipse(const basegfx::B2DPoint& rCenter, const basegfx::B2DTuple& rRadius)
: maCenter(rCenter), maRadius(rRadius)
{
}
B2DEllipse::~B2DEllipse()
{
}
} // end of namespace basegfx
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_FILTER_SOURCE_SVG_B2DELLIPSE_HXX
#define INCLUDED_FILTER_SOURCE_SVG_B2DELLIPSE_HXX
#include <sal/types.h>
#include <o3tl/cow_wrapper.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/tuple/b2dtuple.hxx>
#include <basegfx/vector/b2enums.hxx>
namespace basegfx
{
class B2DPoint;
} // end of namespace basegfx
namespace basegfx
{
class B2DEllipse
{
private:
const basegfx::B2DPoint maCenter;
const basegfx::B2DTuple maRadius;
public:
B2DEllipse(const B2DEllipse& rEllipse);
B2DEllipse(const basegfx::B2DPoint& rCenter, const basegfx::B2DTuple& rRadius);
~B2DEllipse();
// assignment operator
B2DEllipse& operator=(const B2DEllipse& rEllipse);
// Coordinate interface
const basegfx::B2DPoint& getB2DEllipseCenter() const { return maCenter; }
const basegfx::B2DTuple& getB2DEllipseRadius() const { return maRadius; }
};
} // end of namespace basegfx
#endif // INCLUDED_FILTER_SOURCE_SVG_B2DELLIPSE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
......@@ -52,6 +52,12 @@
#include "svgfilter.hxx"
#include "svgwriter.hxx"
#include <svx/unopage.hxx>
#include <vcl/graphicfilter.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdograf.hxx>
#include <svl/itempool.hxx>
#include <memory>
using namespace ::com::sun::star;
......@@ -94,14 +100,185 @@ SVGFilter::~SVGFilter()
sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescriptor )
{
SolarMutexGuard aGuard;
vcl::Window* pFocusWindow = Application::GetFocusWindow();
bool bRet;
vcl::Window* pFocusWindow(Application::GetFocusWindow());
bool bRet(false);
if( pFocusWindow )
if(pFocusWindow)
{
pFocusWindow->EnterWait();
}
if(mxDstDoc.is())
{
// Import. Use an endless loop to have easy exits for error handling
while(true)
{
// use MediaDescriptor to get needed data out of Sequence< PropertyValue >
utl::MediaDescriptor aMediaDescriptor(rDescriptor);
uno::Reference<io::XInputStream> xInputStream;
uno::Reference<task::XStatusIndicator> xStatus;
xInputStream.set(aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()], UNO_QUERY);
xStatus.set(aMediaDescriptor[utl::MediaDescriptor::PROP_STATUSINDICATOR()], UNO_QUERY);
if(!xInputStream.is() || !xStatus.is())
{
// we need the InputStream and StatusIndicator
break;
}
// get the DrawPagesSupplier
uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSupplier( mxDstDoc, uno::UNO_QUERY );
if(!xDrawPagesSupplier.is())
{
// we need the DrawPagesSupplier
break;
}
// get the DrawPages
uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), uno::UNO_QUERY );
if(!xDrawPages.is())
{
// we need the DrawPages
break;
}
// check DrawPageCount (there should be one by default)
sal_Int32 nDrawPageCount(xDrawPages->getCount());
if(0 == nDrawPageCount)
{
// at least one DrawPage should be there - we need that
break;
}
// get that DrawPage
uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPages->getByIndex(0), uno::UNO_QUERY );
if(!xDrawPage.is())
{
// we need that DrawPage
break;
}
if( mxDstDoc.is() )
bRet = implImport( rDescriptor );
// get that DrawPage's UNO API implementation
SvxDrawPage* pSvxDrawPage(SvxDrawPage::getImplementation(xDrawPage));
if(nullptr == pSvxDrawPage || nullptr == pSvxDrawPage->GetSdrPage())
{
// we need a SvxDrawPage
break;
}
// get the SvStream to work with
std::unique_ptr< SvStream > aStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
if(!aStream.get())
{
// we need the SvStream
break;
}
// create a GraphicFilter and load the SVG (format already known, thus *could*
// be handed over to ImportGraphic - but detection is fast).
// As a bonus, zipped data is already detected and handled there
GraphicFilter aGraphicFilter;
Graphic aGraphic;
const ErrCode nGraphicFilterErrorCode(aGraphicFilter.ImportGraphic(aGraphic, OUString(), *aStream.get()));
if(ERRCODE_NONE != nGraphicFilterErrorCode)
{
// SVG import error, cannot continue
break;
}
// get the GraphicPrefSize early to check if we have any content
// (the SVG may contain nothing and/or just <g visibility="hidden"> stuff...)
const Size aGraphicPrefSize(aGraphic.GetPrefSize());
if(0 == aGraphicPrefSize.Width() || 0 == aGraphicPrefSize.Height())
{
// SVG has no displayable content, stop import.
// Also possible would be to get the sequence< Primitives >
// from aGraphic and check if it is empty.
// Possibility to set some error message here to tell
// the user what/why loading went wrong, but I do not
// know how this could be done here
break;
}
// create a SdrModel-GraphicObject to insert to page
SdrPage* pTargetSdrPage(pSvxDrawPage->GetSdrPage());
std::unique_ptr< SdrGrafObj, SdrObjectFreeOp > aNewSdrGrafObj(
new SdrGrafObj(
pTargetSdrPage->getSdrModelFromSdrPage(),
aGraphic));
if(!aNewSdrGrafObj.get())
{
// could not create GraphicObject
break;
}
// Evtl. adapt the GraphicPrefSize to target-MapMode of target-Model
// (should be 100thmm here, but just stay safe by doing the conversion)
const MapMode aGraphicPrefMapMode(aGraphic.GetPrefMapMode());
const MapUnit eDestUnit(pTargetSdrPage->getSdrModelFromSdrPage().GetItemPool().GetMetric(0));
const MapUnit eSrcUnit(aGraphicPrefMapMode.GetMapUnit());
Size aGraphicSize(aGraphicPrefSize);
if (eDestUnit != eSrcUnit)
{
aGraphicSize = Size(
OutputDevice::LogicToLogic(aGraphicSize.Width(), eSrcUnit, eDestUnit),
OutputDevice::LogicToLogic(aGraphicSize.Height(), eSrcUnit, eDestUnit));
}
// Based on GraphicSize, set size of Page. Do not forget to adapt PageBorders,
// but interpret them relative to PageSize so that they do not 'expolde/shrink'
// in comparison. Use a common scaling factor for hor/ver to not get
// asynchronous border distances, though. All in all this will adapt borders
// nicely and is based on office-defaults for standard-page-border-sizes.
const Size aPageSize(pTargetSdrPage->GetSize());
const double fBorderRelation((
static_cast< double >(pTargetSdrPage->GetLeftBorder()) / aPageSize.Width() +
static_cast< double >(pTargetSdrPage->GetRightBorder()) / aPageSize.Width() +
static_cast< double >(pTargetSdrPage->GetUpperBorder()) / aPageSize.Height() +
static_cast< double >(pTargetSdrPage->GetLowerBorder()) / aPageSize.Height()) / 4.0);
const long nAllBorder(basegfx::fround((aGraphicSize.Width() + aGraphicSize.Height()) * fBorderRelation * 0.5));
// Adapt PageSize and Border stuff. To get all MasterPages and PresObjs
// correctly adapted, do not just use
// pTargetSdrPage->SetBorder(...) and
// pTargetSdrPage->SetSize(...),
// but ::adaptSizeAndBorderForAllPages
pTargetSdrPage->getSdrModelFromSdrPage().adaptSizeAndBorderForAllPages(
Size(
aGraphicSize.Width() + nAllBorder + nAllBorder,
aGraphicSize.Height() + nAllBorder + nAllBorder),
nAllBorder,
nAllBorder,
nAllBorder,
nAllBorder);
// set pos/size at SdrGraphicObj - add offset to PageBorder
aNewSdrGrafObj->SetSnapRect(
tools::Rectangle(
Point(nAllBorder, nAllBorder),
aGraphicSize));
// insert to page (owner change of SdrGrafObj)
pTargetSdrPage->InsertObject(aNewSdrGrafObj.release());
// done - set positive result now
bRet = true;
// always leave helper endless loop
break;
};
}
else if( mxSrcDoc.is() )
{
// #i124608# detect selection
......
......@@ -222,9 +222,6 @@ private:
Link<EditFieldInfo*,void> maOldFieldHdl;
Link<EditFieldInfo*,void> maNewFieldHdl;
/// @throws css::uno::RuntimeException
bool implImport( const Sequence< PropertyValue >& rDescriptor );
/// @throws css::uno::RuntimeException
bool implExport( const Sequence< PropertyValue >& rDescriptor );
static Reference< XWriter > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
......
/* -*- 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 "svgfilter.hxx"
#include <svgreader.hxx>
#include <rtl/ref.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/XImportFilter.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <unotools/mediadescriptor.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <tools/zcodec.hxx>
#include <memory>
using namespace ::com::sun::star;
using namespace ::svgi;
bool SVGFilter::implImport(const Sequence< PropertyValue >& rDescriptor)
{
utl::MediaDescriptor aMediaDescriptor(rDescriptor);
uno::Reference<io::XInputStream> xInputStream;
uno::Reference<task::XStatusIndicator> xStatus;
xInputStream.set(aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()], UNO_QUERY);
xStatus.set(aMediaDescriptor[utl::MediaDescriptor::PROP_STATUSINDICATOR()], UNO_QUERY);
if (isStreamGZip(xInputStream))
{
uno::Reference<io::XSeekable> xSeek(xInputStream, uno::UNO_QUERY);
if (!xSeek.is())
return false;
xSeek->seek(0);
std::unique_ptr<SvStream> aStream(utl::UcbStreamHelper::CreateStream(xInputStream, true ));
if(!aStream.get())
return false;
SvStream* pMemoryStream = new SvMemoryStream;
ZCodec aCodec;
aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
aCodec.Decompress(*aStream.get(), *pMemoryStream);
aCodec.EndCompression();
pMemoryStream->Seek(STREAM_SEEK_TO_BEGIN);
uno::Reference<io::XInputStream> xDecompressedInput(new utl::OSeekableInputStreamWrapper(pMemoryStream, true));
if (!xDecompressedInput.is())
return false;
xInputStream = xDecompressedInput;
}
else
{
uno::Reference<io::XSeekable> xSeek(xInputStream, uno::UNO_QUERY);
if (xSeek.is())
xSeek->seek(0);
}
OSL_ASSERT(xInputStream.is());
if(!xInputStream.is())
return false;
Reference < XDocumentHandler > xInternalHandler(
mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.comp.Draw.XMLOasisImporter", mxContext ), UNO_QUERY );
// The XImporter sets up an empty target document for XDocumentHandler to write to..
uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
xImporter->setTargetDocument(mxDstDoc);
bool bRet = false;
SVGReader aReader(mxContext, xInputStream, xInternalHandler);
try
{
bRet = aReader.parseAndConvert();
}
catch (const RuntimeException&)
{
throw;
}
catch (const Exception& e)
{
throw css::lang::WrappedTargetRuntimeException("SVGFilter::implImport non-RuntimeException",
static_cast<uno::XWeak*>(this), uno::makeAny(e));
}
return bRet;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
/* -*- 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/types.h>
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "gfxtypes.hxx"
#include "parserfragments.hxx"
using namespace svgi;
class TestParser : public CppUnit::TestFixture
{
public:
void testParseColor()
{
ARGBColor aTmp;
const char* sIn="#102030 ";
ARGBColor aOut(16, 32, 48);
CPPUNIT_ASSERT_MESSAGE( "Consuming color #112233",
parseColor( sIn, aTmp ) );
CPPUNIT_ASSERT_MESSAGE( "Parsing color #112233",
aOut==aTmp );
sIn=" #321";
aOut=ARGBColor(51, 34, 17);
CPPUNIT_ASSERT_MESSAGE( "Consuming color #321",
parseColor( sIn, aTmp ) );
CPPUNIT_ASSERT_MESSAGE( "Parsing color #321",
aOut==aTmp );
sIn="rgb(100,200,\t 50)";
aOut=ARGBColor(100, 200, 50);
CPPUNIT_ASSERT_MESSAGE( "Consuming color rgb(100,200,50)",
parseColor( sIn, aTmp ) );
CPPUNIT_ASSERT_MESSAGE( "Parsing color rgb(100,200,50)",
aOut==aTmp );
sIn="rgb(0.1, \t0.2,0.9)";
aOut=ARGBColor(0.1, 0.2, 0.9);
CPPUNIT_ASSERT_MESSAGE( "Consuming color rgb(0.1,0.2,0.9)",
parseColor( sIn, aTmp ) );
CPPUNIT_ASSERT_MESSAGE( "Parsing color rgb(0.1,0.2,0.9)",
aOut==aTmp );
sIn=" burlywood ";
aOut=ARGBColor(222,184,135);
CPPUNIT_ASSERT_MESSAGE( "Consuming color burlywood",
parseColor( sIn, aTmp ) );
CPPUNIT_ASSERT_MESSAGE( "Parsing color burlywood",
aOut==aTmp );
}
void testParseOpacity()
{
ARGBColor aTmp;
const char* sIn=" 0.123 ";
ARGBColor aOut(0.123, 0.0, 0.0, 0.0);
CPPUNIT_ASSERT_MESSAGE( "Consuming opacity 0.123",
parseOpacity( sIn, aTmp ) );
CPPUNIT_ASSERT_MESSAGE( "Parsing opacity 0.123",
aOut==aTmp );
}
void testParseTransform()
{
basegfx::B2DHomMatrix aOut;
const char* sIn=" none ";
basegfx::B2DHomMatrix aTmp;
CPPUNIT_ASSERT_MESSAGE( "Consuming transformation none",