summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter/source/svg/svgexport.cxx4
-rw-r--r--filter/source/svg/svgwriter.cxx135
2 files changed, 49 insertions, 90 deletions
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 73a5e0437d66..f04f169c8cb5 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -333,7 +333,7 @@ SVGExport::SVGExport(
comphelper::SequenceAsHashMap aFilterDataHashMap = rFilterData;
// TinyProfile
- mbIsUseTinyProfile = aFilterDataHashMap.getUnpackedValueOrDefault(SVG_PROP_TINYPROFILE, true);
+ mbIsUseTinyProfile = aFilterDataHashMap.getUnpackedValueOrDefault(SVG_PROP_TINYPROFILE, false);
// Font Embedding
comphelper::SequenceAsHashMap::const_iterator iter = aFilterDataHashMap.find(SVG_PROP_EMBEDFONTS);
@@ -349,7 +349,7 @@ SVGExport::SVGExport(
}
// Native Decoration
- mbIsUseNativeTextDecoration = !mbIsUseTinyProfile && aFilterDataHashMap.getUnpackedValueOrDefault(SVG_PROP_NATIVEDECORATION, false);
+ mbIsUseNativeTextDecoration = !mbIsUseTinyProfile && aFilterDataHashMap.getUnpackedValueOrDefault(SVG_PROP_NATIVEDECORATION, true);
// Tiny Opacity (supported from SVG Tiny 1.2)
mbIsUseOpacity = aFilterDataHashMap.getUnpackedValueOrDefault(SVG_PROP_OPACITY, true);
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 426521af203f..9c6a3f511646 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -794,32 +794,44 @@ void SVGTextWriter::addFontAttributes( bool bIsTextContainer )
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontWeight, OUString::number( nFontWeight ) );
}
- if( bIsTextContainer )
- maParentFont = maCurrentFont;
- }
- if( mrExport.IsUseNativeTextDecoration() )
- {
- FontUnderline eCurFontUnderline = maCurrentFont.GetUnderline();
- FontStrikeout eCurFontStrikeout = maCurrentFont.GetStrikeout();
+ if( mrExport.IsUseNativeTextDecoration() )
+ {
+ FontUnderline eCurFontUnderline = maCurrentFont.GetUnderline();
+ FontStrikeout eCurFontStrikeout = maCurrentFont.GetStrikeout();
- FontUnderline eParFontUnderline = maParentFont.GetUnderline();
- FontStrikeout eParFontStrikeout = maParentFont.GetStrikeout();
+ FontUnderline eParFontUnderline = maParentFont.GetUnderline();
+ FontStrikeout eParFontStrikeout = maParentFont.GetStrikeout();
- OUString sTextDecoration;
+ OUString sTextDecoration;
+ bool bIsDecorationChanged = false;
+ if( eCurFontUnderline != eParFontUnderline )
+ {
+ if( eCurFontUnderline != UNDERLINE_NONE )
+ sTextDecoration = "underline ";
+ bIsDecorationChanged = true;
+ }
+ if( eCurFontStrikeout != eParFontStrikeout )
+ {
+ if( eCurFontStrikeout != STRIKEOUT_NONE )
+ sTextDecoration += "line-through ";
+ bIsDecorationChanged = true;
+ }
- if( eCurFontUnderline != eParFontUnderline )
- {
- if( eCurFontUnderline != UNDERLINE_NONE )
- sTextDecoration = "underline ";
- }
- if( eCurFontStrikeout != eParFontStrikeout )
- {
- if( eCurFontStrikeout != STRIKEOUT_NONE )
- sTextDecoration += "line-through ";
+ if( !sTextDecoration.isEmpty() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTextDecoration, sTextDecoration );
+ }
+ else if( bIsDecorationChanged )
+ {
+ sTextDecoration = "none";
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTextDecoration, sTextDecoration );
+ }
}
- if( !sTextDecoration.isEmpty() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTextDecoration, sTextDecoration );
+
+ if( bIsTextContainer )
+ maParentFont = maCurrentFont;
+
}
}
@@ -1228,9 +1240,10 @@ void SVGTextWriter::startTextParagraph()
maParentFont = vcl::Font();
addFontAttributes( /* isTexTContainer: */ true );
mpTextParagraphElem = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS );
+
if( !mbIsListLevelStyleImage )
{
- startTextPosition();
+ mbPositioningNeeded = true;
}
}
@@ -1455,6 +1468,13 @@ void SVGTextWriter::writeTextPortion( const Point& rPos,
if( rText.isEmpty() )
return;
+ bool bStandAloneTextPortion = false;
+ if( !this->isTextShapeStarted() )
+ {
+ bStandAloneTextPortion = true;
+ this->startTextShape();
+ }
+
mbLineBreak = false;
if( !mbIsNewListItem || mbIsListLevelStyleImage )
@@ -1519,6 +1539,10 @@ void SVGTextWriter::writeTextPortion( const Point& rPos,
implWriteTextPortion( rPos, rText, mpVDev->GetTextColor(), bApplyMapping );
#endif
+ if( bStandAloneTextPortion )
+ {
+ this->endTextShape();
+ }
}
void SVGTextWriter::implWriteTextPortion( const Point& rPos,
@@ -1541,7 +1565,7 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
else
aPos = rPos;
- if( mbPositioningNeeded || bApplyMapping )
+ if( mbPositioningNeeded )
{
mbPositioningNeeded = false;
maTextPos.setX( aPos.X() );
@@ -3436,28 +3460,12 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( mrExport.IsUsePositionedCharacters() )
{
vcl::Font aFont = ImplSetCorrectFontHeight();
- bool bTextShapeStarted=false;
- if( !maTextWriter.isTextShapeStarted() )
- {
- bTextShapeStarted=true;
- maTextWriter.startTextShape();
- }
mpContext->SetFontAttr( aFont );
ImplWriteText( pA->GetPoint(), aText, NULL, 0 );
- if( bTextShapeStarted )
- maTextWriter.endTextShape();
}
else
{
- bool bTextShapeStarted=false;
- if( !maTextWriter.isTextShapeStarted() )
- {
- bTextShapeStarted=true;
- maTextWriter.startTextShape();
- }
maTextWriter.writeTextPortion( pA->GetPoint(), aText );
- if( bTextShapeStarted )
- maTextWriter.endTextShape();
}
}
}
@@ -3475,27 +3483,10 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( mrExport.IsUsePositionedCharacters() )
{
vcl::Font aFont = ImplSetCorrectFontHeight();
- bool bTextShapeStarted=false;
- if( !maTextWriter.isTextShapeStarted() )
- {
- bTextShapeStarted=true;
- maTextWriter.startTextShape();
- }
mpContext->SetFontAttr( aFont );
ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0 );
- if( bTextShapeStarted )
- maTextWriter.endTextShape();
- }
-
- bool bTextShapeStarted=false;
- if( !maTextWriter.isTextShapeStarted() )
- {
- bTextShapeStarted=true;
- maTextWriter.startTextShape();
}
maTextWriter.writeTextPortion( pA->GetRect().TopLeft(), pA->GetText() );
- if( bTextShapeStarted )
- maTextWriter.endTextShape();
}
}
}
@@ -3514,28 +3505,12 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( mrExport.IsUsePositionedCharacters() )
{
vcl::Font aFont = ImplSetCorrectFontHeight();
- bool bTextShapeStarted=false;
- if( !maTextWriter.isTextShapeStarted() )
- {
- bTextShapeStarted=true;
- maTextWriter.startTextShape();
- }
mpContext->SetFontAttr( aFont );
ImplWriteText( pA->GetPoint(), aText, pA->GetDXArray(), 0 );
- if( bTextShapeStarted )
- maTextWriter.endTextShape();
}
else
{
- bool bTextShapeStarted=false;
- if( !maTextWriter.isTextShapeStarted() )
- {
- bTextShapeStarted=true;
- maTextWriter.startTextShape();
- }
maTextWriter.writeTextPortion( pA->GetPoint(), aText );
- if( bTextShapeStarted )
- maTextWriter.endTextShape();
}
}
}
@@ -3555,28 +3530,12 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( mrExport.IsUsePositionedCharacters() )
{
vcl::Font aFont = ImplSetCorrectFontHeight();
- bool bTextShapeStarted=false;
- if( !maTextWriter.isTextShapeStarted() )
- {
- bTextShapeStarted=true;
- maTextWriter.startTextShape();
- }
mpContext->SetFontAttr( aFont );
ImplWriteText( pA->GetPoint(), aText, NULL, pA->GetWidth() );
- if( bTextShapeStarted )
- maTextWriter.endTextShape();
}
else
{
- bool bTextShapeStarted=false;
- if( !maTextWriter.isTextShapeStarted() )
- {
- bTextShapeStarted=true;
- maTextWriter.startTextShape();
- }
maTextWriter.writeTextPortion( pA->GetPoint(), aText );
- if( bTextShapeStarted )
- maTextWriter.endTextShape();
}
}
}