[Libreoffice-commits] .: 5 commits - filter/source
Thorsten Behrens
thorsten at kemper.freedesktop.org
Mon Feb 14 02:00:40 PST 2011
filter/source/svg/gfxtypes.hxx | 4 +++-
filter/source/svg/parserfragments.cxx | 4 ++--
filter/source/svg/svgreader.cxx | 15 ++++++++++++---
filter/source/svg/test/parsertest.cxx | 8 +++-----
4 files changed, 20 insertions(+), 11 deletions(-)
New commits:
commit a306a27fd039b9929f0fbbc1d3533996b36e240b
Author: Thorsten Behrens <tbehrens at novell.com>
Date: Mon Feb 14 11:00:04 2011 +0100
Make svg import unit tests compile again.
diff --git a/filter/source/svg/test/parsertest.cxx b/filter/source/svg/test/parsertest.cxx
index 89728fe..07845ba 100644
--- a/filter/source/svg/test/parsertest.cxx
+++ b/filter/source/svg/test/parsertest.cxx
@@ -27,7 +27,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_filter.hxx"
-#include <cppunit/simpleheader.hxx>
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
#include "../gfxtypes.hxx"
#include "../parserfragments.hxx"
@@ -215,8 +217,4 @@ public:
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(TestParser, "test svg parser fragments");
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f54758d5c6962e49bc7cd9390409a6af4e1b6aaa
Author: Takeshi Kurosawa <taken.spc at gmail.com>
Date: Mon Feb 14 15:26:21 2011 +0900
Ensure writing styles for text
When a text element doesn't have presentation attributes or styles,
style information is not written. As a result the text has zero width.
diff --git a/filter/source/svg/gfxtypes.hxx b/filter/source/svg/gfxtypes.hxx
index 0a07094..24c4cbd 100644
--- a/filter/source/svg/gfxtypes.hxx
+++ b/filter/source/svg/gfxtypes.hxx
@@ -174,7 +174,7 @@ struct State
maViewport(),
maViewBox(),
maFontFamily(), // app-default
- mnFontSize(12.0),
+ mnFontSize(0),
maFontStyle(RTL_CONSTASCII_USTRINGPARAM("normal")),
maFontVariant(RTL_CONSTASCII_USTRINGPARAM("normal")),
mnFontWeight(400.0),
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index 44fa416..b909155 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -147,6 +147,7 @@ struct AnnotatingVisitor
StateMap& rStateMap,
const State& rInitialState,
const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler) :
+ mbSeenText(false),
mnCurrStateId(0),
maCurrState(),
maParentStates(),
@@ -266,6 +267,13 @@ struct AnnotatingVisitor
maCurrState.maTransform.identity();
maCurrState.maViewBox.reset();
+ // set default font size here to ensure writing styles for text
+ if( !mbSeenText && XML_TEXT == nTagId )
+ {
+ maCurrState.mnFontSize = 12.0;
+ mbSeenText = true;
+ }
+
// scan for style info
const sal_Int32 nNumAttrs( xAttributes->getLength() );
rtl::OUString sAttributeValue;
@@ -1161,6 +1169,7 @@ struct AnnotatingVisitor
}
}
+ bool mbSeenText;
sal_Int32 mnCurrStateId;
State maCurrState;
std::vector<State> maParentStates;
commit 81ffe030d75a7738a09688520fab9b7c3d2d472b
Author: Takeshi Kurosawa <taken.spc at gmail.com>
Date: Mon Feb 14 15:24:11 2011 +0900
Relax paint url parsing (fix fdo#34205)
Allow ' and " around parens.
diff --git a/filter/source/svg/parserfragments.cxx b/filter/source/svg/parserfragments.cxx
index c515e85..95811d4 100644
--- a/filter/source/svg/parserfragments.cxx
+++ b/filter/source/svg/parserfragments.cxx
@@ -560,9 +560,9 @@ bool parsePaintUri( std::pair<const char*,const char*>& o_rPaintUri,
const bool bRes = parse(sPaintUri,
// Begin grammar
(
- str_p("url(#") >>
+ str_p("url(") >> !( str_p("'") | str_p("\"") ) >> ("#") >>
(+alnum_p)[assign_a(o_rPaintUri)] >>
- str_p(")") >>
+ !( str_p("'") | str_p("\"") ) >> str_p(")") >>
*( str_p("none")[assign_a(io_rColor.second,false)] |
str_p("currentColor")[assign_a(io_rColor.second,true)] |
ColorGrammar(io_rColor.first)
commit a3f382e1145cda8d583db194ab03be2e33a91689
Author: Takeshi Kurosawa <taken.spc at gmail.com>
Date: Mon Feb 14 15:23:20 2011 +0900
Fix color serialization
The are hex values.
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index 9ccd3b7..44fa416 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -410,13 +410,13 @@ struct AnnotatingVisitor
const sal_uInt8 nGreen( toByteColor(rColor.g) );
const sal_uInt8 nBlue ( toByteColor(rColor.b) );
aBuf.append( sal_Unicode('#') );
- if( nRed < 10 )
+ if( nRed < 0x10 )
aBuf.append( sal_Unicode('0') );
aBuf.append( sal_Int32(nRed), 16 );
- if( nGreen < 10 )
+ if( nGreen < 0x10 )
aBuf.append( sal_Unicode('0') );
aBuf.append( sal_Int32(nGreen), 16 );
- if( nBlue < 10 )
+ if( nBlue < 0x10 )
aBuf.append( sal_Unicode('0') );
aBuf.append( sal_Int32(nBlue), 16 );
commit b66dad64f83f8545b44506274892203dd83c97c3
Author: Takeshi Kurosawa <taken.spc at gmail.com>
Date: Mon Feb 14 15:21:41 2011 +0900
Check opacity for == operator
Or opacity is ignored.
diff --git a/filter/source/svg/gfxtypes.hxx b/filter/source/svg/gfxtypes.hxx
index 60e6a6c..0a07094 100644
--- a/filter/source/svg/gfxtypes.hxx
+++ b/filter/source/svg/gfxtypes.hxx
@@ -275,6 +275,7 @@ inline bool operator==(const State& rLHS, const State& rRHS )
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 &&
@@ -319,6 +320,7 @@ struct StateHash
^ size_t(rState.mbVisibility)
^ size_t(rState.meFillType)
^ size_t(rState.mnFillOpacity)
+ ^ size_t(rState.mnOpacity)
^ size_t(rState.meStrokeType)
^ size_t(rState.mnStrokeOpacity)
^ size_t(rState.meViewportFillType)
More information about the Libreoffice-commits
mailing list