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

Chr. Rossmanith ChrRossmanith at gmx.de
Sat Apr 11 04:21:18 PDT 2015


 filter/source/svg/svgfontexport.cxx |    9 ++++++---
 filter/source/svg/svgwriter.cxx     |    9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 9c3d44197613f1570026c0f351268bda293c08ea
Author: Chr. Rossmanith <ChrRossmanith at gmx.de>
Date:   Fri Apr 10 21:39:06 2015 +0200

    tdf#56467: copy text of meta actions with valid text length
    
    avoids !!br0ken!! in svg output
    
    Change-Id: I7f99a26f3a995cbaeb1e520a411a8e1c31a8a61f
    Reviewed-on: https://gerrit.libreoffice.org/15144
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx
index 2de4b73..b65370a 100644
--- a/filter/source/svg/svgfontexport.cxx
+++ b/filter/source/svg/svgfontexport.cxx
@@ -102,7 +102,8 @@ void SVGFontExport::implCollectGlyphs()
                     case( META_TEXT_ACTION ):
                     {
                         const MetaTextAction* pA = static_cast<const MetaTextAction*>(pAction);
-                        aText = pA->GetText().copy( pA->GetIndex(), pA->GetLen() );
+                        sal_Int32             aLength=std::min( pA->GetText().getLength(), pA->GetLen() );
+                        aText = pA->GetText().copy( pA->GetIndex(), aLength );
                     }
                     break;
 
@@ -116,14 +117,16 @@ void SVGFontExport::implCollectGlyphs()
                     case( META_TEXTARRAY_ACTION ):
                     {
                         const MetaTextArrayAction*  pA = static_cast<const MetaTextArrayAction*>(pAction);
-                        aText = pA->GetText().copy( pA->GetIndex(), pA->GetLen() );
+                        sal_Int32                   aLength=std::min( pA->GetText().getLength(), pA->GetLen() );
+                        aText = pA->GetText().copy( pA->GetIndex(), aLength );
                     }
                     break;
 
                     case( META_STRETCHTEXT_ACTION ):
                     {
                         const MetaStretchTextAction* pA = static_cast<const MetaStretchTextAction*>(pAction);
-                        aText = pA->GetText().copy( pA->GetIndex(), pA->GetLen() );
+                        sal_Int32                    aLength=std::min( pA->GetText().getLength(), pA->GetLen() );
+                        aText = pA->GetText().copy( pA->GetIndex(), aLength );
                     }
                     break;
 
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 44fe125..01d218b 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3427,7 +3427,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
                 if( nWriteFlags & SVGWRITER_WRITE_TEXT )
                 {
                     const MetaTextAction*   pA = static_cast<const MetaTextAction*>(pAction);
-                    const OUString          aText = pA->GetText().copy( pA->GetIndex(), pA->GetLen() );
+                    sal_Int32               aLength = std::min( pA->GetText().getLength(), pA->GetLen() );
+                    const OUString          aText = pA->GetText().copy( pA->GetIndex(), aLength );
 
                     if( !aText.isEmpty() )
                     {
@@ -3474,7 +3475,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
                 if( nWriteFlags & SVGWRITER_WRITE_TEXT )
                 {
                     const MetaTextArrayAction*  pA = static_cast<const MetaTextArrayAction*>(pAction);
-                    const OUString              aText = pA->GetText().copy( pA->GetIndex(), pA->GetLen() );
+                    sal_Int32                   aLength = std::min( pA->GetText().getLength(), pA->GetLen() );
+                    const OUString              aText = pA->GetText().copy( pA->GetIndex(), aLength );
 
                     if( !aText.isEmpty() )
                     {
@@ -3498,7 +3500,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
                 if( nWriteFlags & SVGWRITER_WRITE_TEXT )
                 {
                     const MetaStretchTextAction*    pA = static_cast<const MetaStretchTextAction*>(pAction);
-                    const OUString                  aText = pA->GetText().copy( pA->GetIndex(), pA->GetLen() );
+                    sal_Int32                       aLength = std::min( pA->GetText().getLength(), pA->GetLen() );
+                    const OUString                  aText = pA->GetText().copy( pA->GetIndex(), aLength );
 
                     if( !aText.isEmpty() )
                     {


More information about the Libreoffice-commits mailing list