Page 1 of 1

[Solved] Show "Save changes before closing?" - Impress

Posted: Thu Aug 05, 2021 6:56 am
by HCL
I modified the texts on a slide.

But it is not shown the message "Save changes before closing?" when close the file.

Is there any way to showing this message?

This message was shown on Writer and Calc, but Impress not.
 Edit: Moved from Extensions forum; that forum is for 'Discussions about using 3rd party extension with OpenOffice.org'. You seem to want a macro solution. 

Re: Show "Save changes before closing?" message - Impress

Posted: Thu Aug 05, 2021 10:09 am
by Hagar Delest
Quite weird. I guess that you use the same method to close your Impress file as with the other components.
You can try to reset your OpenOffice user profile.

Note: I move the topic to the Impress forum, I don't see how it is linked to macros.

Re: Show "Save changes before closing?" message - Impress

Posted: Thu Aug 05, 2021 4:31 pm
by HCL
Please back this question to the extension forum.

I asked about developing a addon for Impress.

Re: Show "Save changes before closing?" message - Impress

Posted: Thu Aug 05, 2021 5:55 pm
by Hagar Delest
Then same reply as your other topic: please detail what you've developed so far and/or post the code.

Our divination skills are sometimes pretty limited.

Re: Show "Save changes before closing?" message - Impress

Posted: Thu Aug 05, 2021 6:20 pm
by Villeroy
There is util.XModifiable with method setModified(bool) to mark a document as modified or not: https://api.libreoffice.org/docs/idl/re ... iable.html
And another interface util.XModifiable2 with methods for testing and setting modifiability: https://api.libreoffice.org/docs/idl/re ... able2.html

Re: Show "Save changes before closing?" message - Impress

Posted: Fri Aug 06, 2021 1:58 am
by HCL
Thank you for your reply, Villeroy.

I could display the message.

Code: Select all

		XComponentContext context;
		XMultiComponentFactory manager = context.getServiceManager();
		Object desktop_obj = manager.createInstanceWithContext(
				"com.sun.star.frame.Desktop", context);
		XDesktop desktop = UnoRuntime.queryInterface(XDesktop.class, desktop_obj);
		XModifiable mod = UnoRuntime.queryInterface(XModifiable.class, desktop.getCurrentComponent());
		mod.setModified(true);