Kaydet (Commit) a5977185 authored tarafından Vasily Melenchuk's avatar Vasily Melenchuk Kaydeden (comit) Thorsten Behrens

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: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 1b6a0624
......@@ -199,6 +199,9 @@ The current presentation contains no OLE objects.</value>
<prop oor:name="STR_FILENAME_SUFFIX">
<value xml:lang="en-US">(minimized)</value>
</prop>
<prop oor:name="STR_WARN_UNSAVED_PRESENTATION">
<value xml:lang="en-US">Do you want to minimize presentation without saving?</value>
</prop>
</node>
<node oor:name="LastUsedSettings">
<prop oor:name="Name">
......
......@@ -365,6 +365,10 @@ The current presentation contains no OLE objects.</value>
<info><desc>String STR_FILENAME_SUFFIX.</desc></info>
<value>(minimized)</value>
</prop>
<prop oor:name="STR_WARN_UNSAVED_PRESENTATION" oor:type="xs:string" oor:localized="true">
<info><desc>String STR_WARN_UNSAVED_PRESENTATION.</desc></info>
<value>Do you want to minimize presentation without saving?</value>
</prop>
</group>
<node-ref oor:name="LastUsedSettings" oor:node-type="OptimizerSettings">
<info>
......
......@@ -30,6 +30,7 @@ $(eval $(call gb_Library_set_include,PresentationMinimizer,\
))
$(eval $(call gb_Library_use_libraries,PresentationMinimizer,\
comphelper \
cppu \
cppuhelper \
sal \
......
......@@ -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;
......
......@@ -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 }
......
......@@ -136,7 +136,7 @@ enum PPPOptimizerTokenEnum
STR_CREATING_OLE_REPLACEMENTS,
STR_FILESIZESEPARATOR,
STR_FILENAME_SUFFIX,
STR_WARN_UNSAVED_PRESENTATION,
TK_NotFound
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment