summaryrefslogtreecommitdiff
path: root/filter/source
diff options
context:
space:
mode:
authorJeevan <suryamaddu@yahoo.in>2017-03-05 00:13:03 +0530
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-03-07 02:50:28 +0000
commita5a6694128728c48c1a8482450a21ad49025c40c (patch)
treea90d7758bd305bdb9034afa025a8a69434d1cb11 /filter/source
parent39ec34b867ee60a5da68fd1e5e08b476f0b0c0ca (diff)
tdf#95416 Removed ../ in filter/source/svg/test files
Change-Id: I9f281c48ddd78f2a897e26b9af57fef2e89604d3 Reviewed-on: https://gerrit.libreoffice.org/34890 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'filter/source')
-rw-r--r--filter/source/svg/gfxtypes.hxx338
-rw-r--r--filter/source/svg/parserfragments.hxx69
-rw-r--r--filter/source/svg/svgreader.hxx40
-rw-r--r--filter/source/svg/test/parsertest.cxx4
-rw-r--r--filter/source/svg/test/svg2odf.cxx2
5 files changed, 3 insertions, 450 deletions
diff --git a/filter/source/svg/gfxtypes.hxx b/filter/source/svg/gfxtypes.hxx
deleted file mode 100644
index 33b195a076e2..000000000000
--- a/filter/source/svg/gfxtypes.hxx
+++ /dev/null
@@ -1,338 +0,0 @@
-/* -*- 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_GFXTYPES_HXX
-#define INCLUDED_FILTER_SOURCE_SVG_GFXTYPES_HXX
-
-#include <basegfx/range/b2drange.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/polygon/b2dlinegeometry.hxx>
-#include <rtl/ustring.hxx>
-#include <functional>
-#include <unordered_set>
-#include <unordered_map>
-
-namespace svgi
-{
-
-struct ARGBColor
-{
- static double toDoubleColor( sal_uInt8 val ) { return val/255.0; }
-
- ARGBColor() : a(1.0), r(0.0), g(0.0), b(0.0)
- {}
- explicit ARGBColor(double fGrey) : a(1.0), r(fGrey), g(fGrey), b(fGrey)
- {}
- ARGBColor( int r_, int g_, int b_ ) :
- a(1.0),
- r(toDoubleColor(sal::static_int_cast<sal_uInt8>(r_))),
- g(toDoubleColor(sal::static_int_cast<sal_uInt8>(g_))),
- b(toDoubleColor(sal::static_int_cast<sal_uInt8>(b_)))
- {}
- double a;
- double r;
- double g;
- double b;
-};
-inline bool operator==( const ARGBColor& rLHS, const ARGBColor& rRHS )
-{ return rLHS.a==rRHS.a && rLHS.r==rRHS.r && rLHS.g==rRHS.g && rLHS.b==rRHS.b; }
-inline bool operator!=( const ARGBColor& rLHS, const ARGBColor& rRHS )
-{ return !(rLHS==rRHS); }
-
-struct GradientStop
-{
- GradientStop() : maStopColor(), mnStopPosition(0.0)
- {}
- ARGBColor maStopColor;
- double mnStopPosition;
-};
-
-struct Gradient
-{
- enum GradientType { LINEAR, RADIAL};
- std::vector<std::size_t> maStops;
- basegfx::B2DHomMatrix maTransform;
- GradientType meType;
- union
- {
- struct
- {
- double mfX1;
- double mfX2;
- double mfY1;
- double mfY2;
- } linear;
- struct
- {
- double mfCX;
- double mfCY;
- double mfFX;
- double mfFY;
- double mfR;
- } radial;
- } maCoords;
- sal_Int32 mnId;
- bool mbBoundingBoxUnits;
-
-// explicit Gradient(GradientType eType) : maStops(), maTransform(), meType(eType), maCoords.mfCX(0.0), maCoords.mfCY(0.0), maCoords.mfFX(0.0), maCoords.mfFY(0.0), maCoords.mfR(0.0), mnId(0), mbBoundingBoxUnits(false)
- explicit Gradient(GradientType eType) : maStops(), maTransform(), meType(eType), mnId(0), mbBoundingBoxUnits(false)
- {
- maCoords.radial.mfCX = 0.0;
- maCoords.radial.mfCY = 0.0;
- maCoords.radial.mfFX = 0.0;
- maCoords.radial.mfFY = 0.0;
- maCoords.radial.mfR = 0.0;
- }
-};
-
-inline bool operator==( const Gradient& rLHS, const Gradient& rRHS )
-{
- if( rLHS.meType != rRHS.meType )
- return false;
- if( rLHS.meType == Gradient::LINEAR )
- return rLHS.mbBoundingBoxUnits==rRHS.mbBoundingBoxUnits && rLHS.maStops==rRHS.maStops &&
- rLHS.maCoords.linear.mfX1 == rRHS.maCoords.linear.mfX1 && rLHS.maCoords.linear.mfX2 == rRHS.maCoords.linear.mfX2 &&
- rLHS.maCoords.linear.mfY1 == rRHS.maCoords.linear.mfY1 && rLHS.maCoords.linear.mfY2 == rRHS.maCoords.linear.mfY2;
- else
- return rLHS.mbBoundingBoxUnits==rRHS.mbBoundingBoxUnits && rLHS.maStops==rRHS.maStops &&
- rLHS.maCoords.radial.mfCX == rRHS.maCoords.radial.mfCX && rLHS.maCoords.radial.mfCY == rRHS.maCoords.radial.mfCY &&
- rLHS.maCoords.radial.mfFX == rRHS.maCoords.radial.mfFX && rLHS.maCoords.radial.mfFY == rRHS.maCoords.radial.mfFY &&
- rLHS.maCoords.radial.mfR == rRHS.maCoords.radial.mfR;
-}
-
-enum PaintType
-{
- NONE,
- SOLID,
- GRADIENT,
- DASH
-};
-
-enum FillRule
-{
- NON_ZERO,
- EVEN_ODD
-};
-
-enum TextAlign
-{
- BEFORE,
- CENTER,
- AFTER
-};
-
-enum CapStyle
-{
- BUTT,
- RECT,
- ROUND
-};
-
-struct State
-{
- State() :
- maCTM(),
- maTransform(),
- maViewport(),
- maViewBox(),
- mbIsText(false),
- maFontFamily(), // app-default
- mnFontSize(12),
- mnParentFontSize(12),
- maFontStyle("normal"),
- maFontVariant("normal"),
- mnFontWeight(400.0),
- meTextAnchor(BEFORE),
- meTextDisplayAlign(BEFORE),
- mnTextLineIncrement(0.0),
- maCurrentColor(0.0),
- mbVisibility(true),
- meFillType(SOLID),
- mnFillOpacity(1.0),
- mnOpacity(1.0),
- meStrokeType(NONE),
- mnStrokeOpacity(1.0),
- meViewportFillType(NONE),
- mnViewportFillOpacity(1.0),
- maFillColor(0.0),
- maFillGradient(Gradient::LINEAR),
- meFillRule(NON_ZERO),
- maStrokeColor(0.0),
- maStrokeGradient(Gradient::LINEAR),
- maDashArray(),
- mnDashOffset(0.0),
- meLineCap(BUTT),
- meLineJoin(basegfx::B2DLineJoin::Miter),
- mnMiterLimit(4.0),
- mnStrokeWidth(1.0),
- maViewportFillColor(1.0),
- maViewportFillGradient(Gradient::LINEAR),
- mnStyleId(0)
- {}
-
- basegfx::B2DHomMatrix maCTM;
- basegfx::B2DHomMatrix maTransform;
- basegfx::B2DRange maViewport;
- basegfx::B2DRange maViewBox;
-
- bool mbIsText;
- OUString maFontFamily;
-
- double mnFontSize;
- double mnParentFontSize;
- OUString maFontStyle;
- OUString maFontVariant;
- double mnFontWeight;
-
- TextAlign meTextAnchor; // text-anchor
- TextAlign meTextDisplayAlign; // display-align
- double mnTextLineIncrement; // 0.0 means auto
-
- ARGBColor maCurrentColor;
- bool mbVisibility;
-
- PaintType meFillType;
- double mnFillOpacity;
- double mnOpacity;
- PaintType meStrokeType;
- double mnStrokeOpacity;
- PaintType meViewportFillType;
- double mnViewportFillOpacity;
-
- ARGBColor maFillColor;
- Gradient maFillGradient;
- FillRule meFillRule;
-
- ARGBColor maStrokeColor;
- Gradient maStrokeGradient;
- std::vector<double> maDashArray;
- double mnDashOffset;
- CapStyle meLineCap;
- basegfx::B2DLineJoin meLineJoin;
- double mnMiterLimit;
- double mnStrokeWidth;
-
- ARGBColor maViewportFillColor;
- Gradient maViewportFillGradient;
-
- sal_Int32 mnStyleId;
-};
-
-inline bool operator==(const State& rLHS, const State& rRHS )
-{
- return rLHS.maCTM==rRHS.maCTM &&
- rLHS.maTransform==rRHS.maTransform &&
- rLHS.maViewport==rRHS.maViewport &&
- rLHS.maViewBox==rRHS.maViewBox &&
- rLHS.mbIsText==rRHS.mbIsText &&
- rLHS.maFontFamily==rRHS.maFontFamily &&
- rLHS.mnFontSize==rRHS.mnFontSize &&
- rLHS.mnParentFontSize==rRHS.mnParentFontSize &&
- rLHS.maFontStyle==rRHS.maFontStyle &&
- rLHS.maFontVariant==rRHS.maFontVariant &&
- rLHS.mnFontWeight==rRHS.mnFontWeight &&
- rLHS.meTextAnchor==rRHS.meTextAnchor &&
- rLHS.meTextDisplayAlign==rRHS.meTextDisplayAlign &&
- rLHS.mnTextLineIncrement==rRHS.mnTextLineIncrement &&
- rLHS.maCurrentColor==rRHS.maCurrentColor &&
- rLHS.mbVisibility==rRHS.mbVisibility &&
- rLHS.meFillType==rRHS.meFillType &&
- rLHS.mnFillOpacity==rRHS.mnFillOpacity &&
- rLHS.mnOpacity==rRHS.mnOpacity &&
- rLHS.meStrokeType==rRHS.meStrokeType &&
- rLHS.mnStrokeOpacity==rRHS.mnStrokeOpacity &&
- rLHS.meViewportFillType==rRHS.meViewportFillType &&
- rLHS.mnViewportFillOpacity==rRHS.mnViewportFillOpacity &&
- rLHS.maFillColor==rRHS.maFillColor &&
- rLHS.maFillGradient==rRHS.maFillGradient &&
- rLHS.meFillRule==rRHS.meFillRule &&
- rLHS.maStrokeColor==rRHS.maStrokeColor &&
- rLHS.maStrokeGradient==rRHS.maStrokeGradient &&
- rLHS.maDashArray==rRHS.maDashArray &&
- rLHS.mnDashOffset==rRHS.mnDashOffset &&
- rLHS.meLineCap==rRHS.meLineCap &&
- rLHS.meLineJoin==rRHS.meLineJoin &&
- rLHS.mnMiterLimit==rRHS.mnMiterLimit &&
- rLHS.mnStrokeWidth==rRHS.mnStrokeWidth &&
- rLHS.maViewportFillColor==rRHS.maViewportFillColor &&
- rLHS.maViewportFillGradient==rRHS.maViewportFillGradient;
-}
-
-} // namespace svgi
-
-namespace std
-{
- template<> struct hash<svgi::State>
- {
- using result_type = std::size_t;
- using argument_type = svgi::State;
- std::size_t operator()(const svgi::State& rState ) const
- {
- return std::hash<double>()(rState.maCTM.get( 0, 0 ))
- ^ std::hash<double>()(rState.maCTM.get( 1, 0 ))
- ^ std::hash<double>()(rState.maCTM.get( 0, 1 ))
- ^ std::hash<double>()(rState.maCTM.get( 1, 1 ))
- ^ std::hash<double>()(rState.maCTM.get( 0, 2 ))
- ^ std::hash<double>()(rState.maCTM.get( 1, 2 ))
- ^ std::hash<double>()(rState.maViewport.getWidth())
- ^ std::hash<double>()(rState.maViewport.getHeight())
- ^ std::hash<double>()(rState.maViewBox.getWidth())
- ^ std::hash<double>()(rState.maViewBox.getHeight())
- ^ size_t(rState.mbIsText)
- ^ size_t(rState.maFontFamily.hashCode())
- ^ std::hash<double>()(rState.mnFontSize)
- ^ std::hash<double>()(rState.mnParentFontSize)
- ^ size_t(rState.maFontStyle.hashCode())
- ^ size_t(rState.maFontVariant.hashCode())
- ^ std::hash<double>()(rState.mnFontWeight)
- ^ size_t(rState.meTextAnchor)
- ^ size_t(rState.meTextDisplayAlign)
- ^ std::hash<double>()(rState.mnTextLineIncrement)
- ^ size_t(rState.mbVisibility)
- ^ size_t(rState.meFillType)
- ^ std::hash<double>()(rState.mnFillOpacity)
- ^ std::hash<double>()(rState.mnOpacity)
- ^ size_t(rState.meStrokeType)
- ^ std::hash<double>()(rState.mnStrokeOpacity)
- ^ size_t(rState.meViewportFillType)
- ^ std::hash<double>()(rState.mnViewportFillOpacity)
- ^ size_t(rState.maFillColor.a)
- ^ size_t(rState.maFillColor.r)
- ^ size_t(rState.maFillColor.g)
- ^ size_t(rState.maFillColor.b)
- ^ size_t(rState.maFillGradient.maStops.size())
- ^ size_t(rState.meFillRule)
- ^ size_t(rState.maStrokeColor.a)
- ^ size_t(rState.maStrokeColor.r)
- ^ size_t(rState.maStrokeColor.g)
- ^ size_t(rState.maStrokeColor.b)
- ^ size_t(rState.maStrokeGradient.maStops.size())
- ^ size_t(rState.maDashArray.size())
- ^ std::hash<double>()(rState.mnDashOffset)
- ^ size_t(rState.meLineCap)
- ^ size_t(rState.meLineJoin)
- ^ std::hash<double>()(rState.mnMiterLimit)
- ^ std::hash<double>()(rState.mnStrokeWidth)
- ^ size_t(rState.maViewportFillColor.a)
- ^ size_t(rState.maViewportFillColor.r)
- ^ size_t(rState.maViewportFillColor.g)
- ^ size_t(rState.maViewportFillColor.b)
- ^ size_t(rState.maViewportFillGradient.maStops.size());
- }
- };
-}
-
-namespace svgi
-{
-typedef std::unordered_set<State> StatePool;
-typedef std::unordered_map<sal_Int32, State> StateMap;
-} // namespace svgi
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/parserfragments.hxx b/filter/source/svg/parserfragments.hxx
deleted file mode 100644
index a93a5fb98379..000000000000
--- a/filter/source/svg/parserfragments.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- 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_PARSERFRAGMENTS_HXX
-#define INCLUDED_FILTER_SOURCE_SVG_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: */
diff --git a/filter/source/svg/svgreader.hxx b/filter/source/svg/svgreader.hxx
deleted file mode 100644
index b200c1b9b3b8..000000000000
--- a/filter/source/svg/svgreader.hxx
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- 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_SVGREADER_HXX
-#define INCLUDED_FILTER_SOURCE_SVG_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>
-
-namespace svgi
-{
-
-class SVGReader
-{
- 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;
-
-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: */
diff --git a/filter/source/svg/test/parsertest.cxx b/filter/source/svg/test/parsertest.cxx
index cbee13b0fca7..8cb367ea9a6d 100644
--- a/filter/source/svg/test/parsertest.cxx
+++ b/filter/source/svg/test/parsertest.cxx
@@ -12,8 +12,8 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include "../gfxtypes.hxx"
-#include "../parserfragments.hxx"
+#include "gfxtypes.hxx"
+#include "parserfragments.hxx"
using namespace svgi;
diff --git a/filter/source/svg/test/svg2odf.cxx b/filter/source/svg/test/svg2odf.cxx
index ba933327fd6e..d088d2552384 100644
--- a/filter/source/svg/test/svg2odf.cxx
+++ b/filter/source/svg/test/svg2odf.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "../svgreader.hxx"
+#include "svgreader.hxx"
#include "odfserializer.hxx"
#include <sal/main.h>