officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu   |    
3 
 officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs |    
4 -
 sdext/Library_PresentationMinimizer.mk                                    |    
5 +
 sdext/source/minimizer/optimizerdialog.cxx                                |   
32 +++++++---
 sdext/source/minimizer/pppoptimizertoken.cxx                              |    
1 
 sdext/source/minimizer/pppoptimizertoken.hxx                              |    
1 
 6 files changed, 29 insertions(+), 17 deletions(-)

New commits:
commit 674ac4d169d387faddf7c840d8e3088915c437bf
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Fri Nov 2 11:20:14 2018 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Tue Nov 6 13:03:12 2018 +0100

    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.behr...@cib.de>
    Reviewed-on: https://gerrit.libreoffice.org/62940
    Tested-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git 
a/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu 
b/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
index 3308ad80ab58..fab5d1945cc7 100644
--- a/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
@@ -196,9 +196,6 @@ The current presentation contains no OLE objects.</value>
         <prop oor:name="STR_FILESIZESEPARATOR">
             <value xml:lang="en-US">.</value>
         </prop>
-        <prop oor:name="STR_ERROR_IO">
-            <value xml:lang="en-US">Writing output file failed!</value>
-        </prop>
     </node>
     <node oor:name="LastUsedSettings">
         <prop oor:name="Name">
diff --git 
a/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs 
b/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
index 7f8259af891d..179637d7d677 100644
--- a/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
@@ -361,10 +361,6 @@ The current presentation contains no OLE objects.</value>
                <info><desc>String STR_FILESIZESEPARATOR.</desc></info>
                                <value>.</value>
                        </prop>
-                       <prop oor:name="STR_ERROR_IO" oor:type="xs:string" 
oor:localized="true">
-               <info><desc>String STR_ERROR_IO.</desc></info>
-                               <value>Writing output file failed!</value>
-                       </prop>
                </group>
                <node-ref oor:name="LastUsedSettings" 
oor:node-type="OptimizerSettings">
                        <info>
diff --git a/sdext/Library_PresentationMinimizer.mk 
b/sdext/Library_PresentationMinimizer.mk
index 0da54ed887b6..1ec1f466aa4e 100644
--- a/sdext/Library_PresentationMinimizer.mk
+++ b/sdext/Library_PresentationMinimizer.mk
@@ -28,6 +28,10 @@ $(eval $(call 
gb_Library_use_libraries,PresentationMinimizer,\
     cppu \
     cppuhelper \
     sal \
+    sfx \
+    svt \
+    vcl \
+    tl \
 ))
 
 $(eval $(call gb_Library_add_exception_objects,PresentationMinimizer,\
@@ -45,7 +49,6 @@ $(eval $(call 
gb_Library_add_exception_objects,PresentationMinimizer,\
     sdext/source/minimizer/pppoptimizertoken \
     sdext/source/minimizer/pppoptimizeruno \
     sdext/source/minimizer/unodialog \
-    sdext/source/minimizer/errordialog \
 ))
 
 # vim:set noet sw=4 ts=4:
diff --git a/sdext/source/minimizer/optimizerdialog.cxx 
b/sdext/source/minimizer/optimizerdialog.cxx
index fc3fe776a0b1..ff8c6cb10b49 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/ui/dialogs/ExecutableDialogResults.hpp>
 #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
@@ -31,7 +30,9 @@
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <sal/macros.h>
 #include <osl/time.h>
-
+#include <svtools/sfxecode.hxx>
+#include <svtools/ehdl.hxx>
+#include <tools/urlobj.hxx>
 
 using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::ui;
@@ -585,6 +586,8 @@ void ActionListener::actionPerformed( const ActionEvent& 
rEvent )
                 lArguments[ 2 ].Name = "InformationDialog";
                 lArguments[ 2 ].Value <<= mrOptimizerDialog.GetFrame();
 
+
+                ErrCode errorCode = ERRCODE_NONE;
                 try
                 {
                     ImpOptimizer aOptimizer(
@@ -594,15 +597,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;
                 }
 
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx 
b/sdext/source/minimizer/pppoptimizertoken.cxx
index 24866ba625c3..d99c49bfb15b 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -152,7 +152,6 @@ static const TokenTable pTokenTableArray[] =
     { "STR_OPTIMIZING_GRAPHICS",    STR_OPTIMIZING_GRAPHICS },
     { "STR_CREATING_OLE_REPLACEMENTS",STR_CREATING_OLE_REPLACEMENTS },
     { "STR_FileSizeSeparator",      STR_FILESIZESEPARATOR },
-    { "STR_ERROR_IO",               STR_ERROR_IO },
 
     { "NotFound",           TK_NotFound }
 };
diff --git a/sdext/source/minimizer/pppoptimizertoken.hxx 
b/sdext/source/minimizer/pppoptimizertoken.hxx
index 3562e8b0ca89..e458da0d3181 100644
--- a/sdext/source/minimizer/pppoptimizertoken.hxx
+++ b/sdext/source/minimizer/pppoptimizertoken.hxx
@@ -135,7 +135,6 @@ enum PPPOptimizerTokenEnum
     STR_OPTIMIZING_GRAPHICS,
     STR_CREATING_OLE_REPLACEMENTS,
     STR_FILESIZESEPARATOR,
-    STR_ERROR_IO,
 
     TK_NotFound
 };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to