diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2018-11-02 11:20:14 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-11-05 22:27:18 +0100 |
commit | 810b8a14f6d555eb9be0da8c69d67c9a390dcca6 (patch) | |
tree | b0ea1bd3ad9edcf4ba90b1b7e740aea3d01f3097 /sdext/source/minimizer/optimizerdialog.cxx | |
parent | d3b505c388537cc9a923da74b85aeeab79f3803a (diff) |
presentation minimizer: use standard error reporting
Insead of custom error dialogs try to use standard LO error
reporting & localization
Change-Id: I199c7770dd884a6c5d9b22075d22ab9a9f2037a8
Reviewed-on: https://gerrit.libreoffice.org/62779
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sdext/source/minimizer/optimizerdialog.cxx')
-rw-r--r-- | sdext/source/minimizer/optimizerdialog.cxx | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index 62b364345674..17eb90630715 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -21,7 +21,6 @@ #include "optimizerdialog.hxx" #include "impoptimizer.hxx" #include "fileopendialog.hxx" -#include "errordialog.hxx" #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ucb/XSimpleFileAccess.hpp> @@ -30,6 +29,9 @@ #include <com/sun/star/util/XCloseBroadcaster.hpp> #include <sal/macros.h> #include <osl/time.h> +#include <vcl/errinf.hxx> +#include <svtools/sfxecode.hxx> +#include <svtools/ehdl.hxx> #include <tools/urlobj.hxx> #include <bitmaps.hlst> @@ -568,6 +570,8 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) lArguments[ 2 ].Name = "InformationDialog"; lArguments[ 2 ].Value <<= mrOptimizerDialog.GetFrame(); + + ErrCode errorCode; try { ImpOptimizer aOptimizer( @@ -577,15 +581,30 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) } catch (css::io::IOException&) { - mrOptimizerDialog.maStats.SetStatusValue(TK_Progress, Any(static_cast<sal_Int32>(0))); + // We always receive just ERRCODE_IO_CANTWRITE in case of problems, so no need to bother + // about extracting error code from exception text + errorCode = ERRCODE_IO_CANTWRITE; + } + catch (css::uno::Exception&) + { + // Other general exception + errorCode = ERRCODE_IO_GENERAL; + } + + if (errorCode != ERRCODE_NONE) + { + // Restore wizard controls + mrOptimizerDialog.maStats.SetStatusValue(TK_Progress, + Any(static_cast<sal_Int32>(0))); mrOptimizerDialog.setControlProperty("btnNavBack", "Enabled", Any(true)); mrOptimizerDialog.setControlProperty("btnNavNext", "Enabled", Any(false)); mrOptimizerDialog.setControlProperty("btnNavFinish", "Enabled", Any(true)); mrOptimizerDialog.setControlProperty("btnNavCancel", "Enabled", Any(true)); - ErrorDialog aInformationDialog( - mrOptimizerDialog.UnoDialog::mxContext, mrOptimizerDialog.GetFrame(), - mrOptimizerDialog.getString(STR_ERROR_IO)); - aInformationDialog.execute(); + + OUString aFileName; + mrOptimizerDialog.GetConfigProperty(TK_SaveAsURL) >>= aFileName; + SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC, aFileName); + ErrorHandler::HandleError(errorCode); break; } |