[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - officecfg/registry sdext/Library_PresentationMinimizer.mk sdext/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Dec 12 23:42:29 UTC 2018
officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu | 3 +
officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs | 4 +
sdext/Library_PresentationMinimizer.mk | 1
sdext/source/minimizer/optimizerdialog.cxx | 27 ++++++++++
sdext/source/minimizer/pppoptimizertoken.cxx | 1
sdext/source/minimizer/pppoptimizertoken.hxx | 2
6 files changed, 37 insertions(+), 1 deletion(-)
New commits:
commit 00bc85ba489f5131b7c90e2290b407c6761ca9f3
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Wed Nov 28 15:26:33 2018 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 13 00:42:05 2018 +0100
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 at CIB.de>
Reviewed-on: https://gerrit.libreoffice.org/65029
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu b/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
index c13aeac41955..8b0f713c0d85 100644
--- a/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
@@ -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">
diff --git a/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs b/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
index 446b0159a4b1..5f45bbbeafa5 100644
--- a/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
@@ -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>
diff --git a/sdext/Library_PresentationMinimizer.mk b/sdext/Library_PresentationMinimizer.mk
index 1ec1f466aa4e..89a426b2ff72 100644
--- a/sdext/Library_PresentationMinimizer.mk
+++ b/sdext/Library_PresentationMinimizer.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_Library_use_api,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 bf17f9c4643c..3ed741194087 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -30,8 +30,11 @@
#include <com/sun/star/util/XCloseBroadcaster.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
#include <sal/macros.h>
#include <osl/time.h>
+#include <vcl/layout.hxx>
+#include <vcl/svapp.hxx>
#include <svtools/sfxecode.hxx>
#include <svtools/ehdl.hxx>
#include <tools/urlobj.hxx>
@@ -508,6 +511,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() );
@@ -560,6 +564,29 @@ 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;
+ if ( RET_YES != ScopedVclPtrInstance<MessageDialog>(nullptr,
+ mrOptimizerDialog.getString(STR_WARN_UNSAVED_PRESENTATION),
+ VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute() )
+ {
+ // 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 e48bb05dfdba..00ef7cf8778d 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
};
More information about the Libreoffice-commits
mailing list