diff options
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/Library_PresentationMinimizer.mk | 1 | ||||
-rw-r--r-- | sdext/source/minimizer/optimizerdialog.cxx | 27 |
2 files changed, 10 insertions, 18 deletions
diff --git a/sdext/Library_PresentationMinimizer.mk b/sdext/Library_PresentationMinimizer.mk index 2ae650a5f855..eb8995f00be0 100644 --- a/sdext/Library_PresentationMinimizer.mk +++ b/sdext/Library_PresentationMinimizer.mk @@ -28,6 +28,7 @@ $(eval $(call gb_Library_use_libraries,PresentationMinimizer,\ cppu \ cppuhelper \ sal \ + tl \ )) $(eval $(call gb_Library_add_exception_objects,PresentationMinimizer,\ diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index 78c044a752c5..014228540a40 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <sal/macros.h> #include <osl/time.h> +#include <tools/urlobj.hxx> using namespace ::com::sun::star::io; @@ -511,24 +512,14 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) Reference< XStorable > xStorable( mrOptimizerDialog.mxController->getModel(), UNO_QUERY ); if ( xStorable.is() && xStorable->hasLocation() ) { - OUString aLocation( xStorable->getLocation() ); - if ( !aLocation.isEmpty() ) - { - sal_Int32 nIndex = aLocation.lastIndexOf( '/', aLocation.getLength() - 1 ); - if ( nIndex >= 0 ) - { - if ( nIndex < aLocation.getLength() - 1 ) - aLocation = aLocation.copy( nIndex + 1 ); - - // remove extension - nIndex = aLocation.lastIndexOf( '.', aLocation.getLength() - 1 ); - if ( nIndex >= 0 ) - aLocation = aLocation.copy( 0, nIndex ); - - // adding .mini - aLocation = aLocation.concat( ".mini" ); - aFileOpenDialog.setDefaultName( aLocation ); - } + INetURLObject aURLObj( xStorable->getLocation() ); + if ( !aURLObj.hasFinalSlash() && + aURLObj.setExtension( "mini", INetURLObject::LAST_SEGMENT, false ) ) { + // tdf#105382 uri-decode file name + auto aName( aURLObj.getName( INetURLObject::LAST_SEGMENT, + false, + INetURLObject::DecodeMechanism::WithCharset ) ); + aFileOpenDialog.setDefaultName( aName ); } } bool bDialogExecuted = aFileOpenDialog.execute() == dialogs::ExecutableDialogResults::OK; |