diff options
Diffstat (limited to 'scripting/source/inc')
-rw-r--r-- | scripting/source/inc/util/MiscUtils.hxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/scripting/source/inc/util/MiscUtils.hxx b/scripting/source/inc/util/MiscUtils.hxx index 9ed5bfb00df3..436b9179dd54 100644 --- a/scripting/source/inc/util/MiscUtils.hxx +++ b/scripting/source/inc/util/MiscUtils.hxx @@ -2,9 +2,9 @@ * * $RCSfile: MiscUtils.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: obo $ $Date: 2005-03-18 09:47:24 $ + * last change: $Author: obo $ $Date: 2005-04-18 11:46:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,6 +64,10 @@ #include <rtl/ustring> +#ifndef _URLOBJ_HXX +#include <tools/urlobj.hxx> +#endif + #include <ucbhelper/content.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -273,12 +277,9 @@ static ::rtl::OUString parseLocationName( const ::rtl::OUString& location ) // strip out the last leaf of location name // e.g. file://dir1/dir2/Blah.sxw - > Blah.sxw ::rtl::OUString temp = location; - sal_Int32 lastSlashIndex = temp.lastIndexOf( ::rtl::OUString::createFromAscii( "/" ) ); - - if ( ( lastSlashIndex + 1 ) < temp.getLength() ) - { - temp = temp.copy( lastSlashIndex + 1 ); - } + INetURLObject aURLObj( temp ); + if ( !aURLObj.HasError() ) + temp = aURLObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); return temp; } |