summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-22 07:39:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-23 11:37:04 +0000
commite07f5b0fb48b6a719258dfe69419330ca2a5dfec (patch)
treefac1a6757a5971eeb490633eb1ae9b5fd8aee529 /oox
parentfba010a77757d0724a0da4a902e78f17cdf15b65 (diff)
make oox ByteString free
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index cfe4bf02b13e..0d4c3fae4ff9 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -64,6 +64,7 @@
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/text/XTextRange.hpp>
+#include <comphelper/string.hxx>
#include <tools/stream.hxx>
#include <tools/string.hxx>
#include <vcl/cvtgrf.hxx>
@@ -447,15 +448,16 @@ void DrawingML::WriteOutline( Reference< XPropertySet > rXPropSet )
OUString DrawingML::WriteImage( const OUString& rURL )
{
- ByteString aURLBS(rtl::OUStringToOString(rURL, RTL_TEXTENCODING_UTF8));
+ rtl::OString aURLBS(rtl::OUStringToOString(rURL, RTL_TEXTENCODING_UTF8));
const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
- int index = aURLBS.Search( aURLBegin );
+ using comphelper::string::indexOfL;
+ sal_Int32 index = indexOfL(aURLBS, RTL_CONSTASCII_STRINGPARAM(aURLBegin));
- if ( index != STRING_NOTFOUND ) {
- DBG(printf ("begin: %ld %s\n", long( sizeof( aURLBegin ) ), USS( rURL ) + sizeof( aURLBegin ) - 1 ));
- aURLBS.Erase( 0, sizeof( aURLBegin ) - 1 );
- Graphic aGraphic = GraphicObject( aURLBS ).GetTransformedGraphic ();
+ if ( index != -1 )
+ {
+ DBG(printf ("begin: %ld %s\n", long( sizeof( aURLBegin ) ), USS( rURL ) + RTL_CONSTASCII_LENGTH( aURLBegin ) ));
+ Graphic aGraphic = GraphicObject( aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin)) ).GetTransformedGraphic ();
return WriteImage( aGraphic );
} else {