diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2018-11-28 15:26:33 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-12-11 13:15:50 +0100 |
commit | a5977185efb5728382f5ead19c715a59d5691eb7 (patch) | |
tree | 936ec8914f37791c1fd34e500ea782f9f45cd189 /sdext | |
parent | 1b6a0624c5ed6a2ecab18d52c32f6a2bfa09d375 (diff) |
presentation minimizer: warn user about unsaved presentation
If minimizer is used on current presentation without making
a copy and it has local modification we should suggest user
to save it before, since not all minimization opearions could
be reverted later.
Change-Id: I12600c9a818698418f3ec957d43b13c6044609d2
Reviewed-on: https://gerrit.libreoffice.org/64261
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/Library_PresentationMinimizer.mk | 1 | ||||
-rw-r--r-- | sdext/source/minimizer/optimizerdialog.cxx | 28 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizertoken.cxx | 1 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizertoken.hxx | 2 |
4 files changed, 31 insertions, 1 deletions
diff --git a/sdext/Library_PresentationMinimizer.mk b/sdext/Library_PresentationMinimizer.mk index c1f2a00a49b5..933877b16738 100644 --- a/sdext/Library_PresentationMinimizer.mk +++ b/sdext/Library_PresentationMinimizer.mk @@ -30,6 +30,7 @@ $(eval $(call gb_Library_set_include,PresentationMinimizer,\ )) $(eval $(call gb_Library_use_libraries,PresentationMinimizer,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index 717f06a08340..a1056b3a2542 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -28,9 +28,12 @@ #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/util/XCloseBroadcaster.hpp> +#include <com/sun/star/util/XModifiable.hpp> #include <sal/macros.h> #include <osl/time.h> #include <vcl/errinf.hxx> +#include <vcl/weld.hxx> +#include <vcl/layout.hxx> #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> #include <tools/urlobj.hxx> @@ -498,6 +501,7 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) mrOptimizerDialog.getControlProperty( "RadioButton1Pg4", "State" ) >>= nInt16; if ( nInt16 ) { + // Duplicate presentation before applying changes OUString aSaveAsURL; FileOpenDialog aFileOpenDialog( mrOptimizerDialog.GetComponentContext() ); @@ -550,6 +554,30 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) mrOptimizerDialog.mxReschedule->reschedule(); } } + else + { + // Apply changes to current presentation + Reference<XModifiable> xModifiable(mrOptimizerDialog.mxController->getModel(), + UNO_QUERY_THROW ); + if ( xModifiable->isModified() ) + { + SolarMutexGuard aSolarGuard; + std::unique_ptr<weld::MessageDialog> popupDlg(Application::CreateMessageDialog( + nullptr, VclMessageType::Question, VclButtonsType::YesNo, + mrOptimizerDialog.getString(STR_WARN_UNSAVED_PRESENTATION))); + if (popupDlg->run() != RET_YES) + { + // Selected not "yes" ("no" or dialog was cancelled) so return to previous step + mrOptimizerDialog.setControlProperty("btnNavBack", "Enabled", + Any(true)); + mrOptimizerDialog.setControlProperty("btnNavNext", "Enabled", Any(false)); + mrOptimizerDialog.setControlProperty("btnNavFinish", "Enabled", Any(true)); + mrOptimizerDialog.setControlProperty("btnNavCancel", "Enabled", Any(true)); + mrOptimizerDialog.EnablePage(ITEM_ID_SUMMARY); + return; + } + } + } if ( bSuccessfullyExecuted ) { // now check if we have to store a session template nInt16 = 0; diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx index 5470811249d5..e51045ea5caa 100644 --- a/sdext/source/minimizer/pppoptimizertoken.cxx +++ b/sdext/source/minimizer/pppoptimizertoken.cxx @@ -153,6 +153,7 @@ static const TokenTable pTokenTableArray[] = { "STR_CREATING_OLE_REPLACEMENTS",STR_CREATING_OLE_REPLACEMENTS }, { "STR_FileSizeSeparator", STR_FILESIZESEPARATOR }, { "STR_FILENAME_SUFFIX", STR_FILENAME_SUFFIX }, + { "STR_WARN_UNSAVED_PRESENTATION", STR_WARN_UNSAVED_PRESENTATION }, { "NotFound", TK_NotFound } diff --git a/sdext/source/minimizer/pppoptimizertoken.hxx b/sdext/source/minimizer/pppoptimizertoken.hxx index a72afd3ef83d..8f83e8dd8f8e 100644 --- a/sdext/source/minimizer/pppoptimizertoken.hxx +++ b/sdext/source/minimizer/pppoptimizertoken.hxx @@ -136,7 +136,7 @@ enum PPPOptimizerTokenEnum STR_CREATING_OLE_REPLACEMENTS, STR_FILESIZESEPARATOR, STR_FILENAME_SUFFIX, - + STR_WARN_UNSAVED_PRESENTATION, TK_NotFound }; |