[Libreoffice-commits] core.git: filter/source

Chr. Rossmanith ChrRossmanith at gmx.de
Sat Apr 11 04:30:10 PDT 2015


 filter/source/svg/svgwriter.cxx |   68 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 64 insertions(+), 4 deletions(-)

New commits:
commit f8976c41dc847cc47abf127bed4e0dc58aa7f1b5
Author: Chr. Rossmanith <ChrRossmanith at gmx.de>
Date:   Fri Apr 10 21:58:43 2015 +0200

    tdf#37650: further improvement of svg export
    
    continues work of 0a4e9138281bd0a4be59031357c1bf52134d007a
    when opening a <tspan> element check if <text> element has been
    opened already; if not open <text> element and close it immediately
    after writing the text
    
    Change-Id: I6e4cfdf9ba107ec9e65a99e7866f4a1075737d82

diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 01d218b..5774dfd 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3435,14 +3435,29 @@ 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();
                         }
-
                     }
                 }
             }
@@ -3459,12 +3474,27 @@ 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() )
                         {
-                            maTextWriter.writeTextPortion( pA->GetRect().TopLeft(), pA->GetText() );
+                            bTextShapeStarted=true;
+                            maTextWriter.startTextShape();
                         }
+                        maTextWriter.writeTextPortion( pA->GetRect().TopLeft(), pA->GetText() );
+                        if( bTextShapeStarted )
+                            maTextWriter.endTextShape();
                     }
                 }
             }
@@ -3483,12 +3513,28 @@ 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();
                         }
                     }
                 }
@@ -3508,14 +3554,28 @@ 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
                         {
-                            maTextWriter.startTextShape();
+                            bool bTextShapeStarted=false;
+                            if( !maTextWriter.isTextShapeStarted() )
+                            {
+                                bTextShapeStarted=true;
+                                maTextWriter.startTextShape();
+                            }
                             maTextWriter.writeTextPortion( pA->GetPoint(), aText );
-                            maTextWriter.endTextShape();
+                            if( bTextShapeStarted )
+                                maTextWriter.endTextShape();
                         }
                     }
                 }


More information about the Libreoffice-commits mailing list