Bug 36210 - disable "Insert" command impossible through dispatch framework
Summary: disable "Insert" command impossible through dispatch framework
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.3.2 release
Hardware: Other All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevEval
Depends on:
Blocks: Macro-UNOAPI
  Show dependency treegraph
 
Reported: 2011-04-13 08:29 UTC by Laurent Godard
Modified: 2023-09-20 03:06 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
a file with a correct macro (10.82 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-11-21 17:22 UTC, Laurent Godard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Godard 2011-04-13 08:29:51 UTC
the whole suite menus/action use dispatch framework

this is useful when one want to disable some UI commands

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Disable_Commands

especially, it is said :
The dispatch framework works with the design pattern chain of responsibility 
...
The disable commands implementation is the first chain member and can therefore work as a wall for all disabled commands. They are not be sent to the next chain member, and disappear.

applying this to "Insert" command works for menu entries (insert > sheet or right click on a sheet tab) - see given macro code

but, the Insert is still available
- by clicking the green + button
- by clicking empty space near sheet tabs

--> these 2 functionality should respect the dispatch framework
Comment 1 Laurent Godard 2011-04-13 08:31:29 UTC
the macro to test this - answer yes/No wether you want to disable/enable the Insert sheet command

dim conf

sub testDisableInsert

conf = getConfigSetting("/org.openoffice.Office.Commands/Execute/Disabled" ,true)

	message = "do you want to DISABLE ""insert sheet"" command ?"
	response = msgBox(message, 32 + 4, "Question")
	value = (response = 6)

	setEnable(value,"Insert")

end sub


sub setEnable(state,url)

	if state then
		enable(url)
	else
		disable(url)
	endif
	conf.commitChanges()
end sub

sub disable(url)

	spliter = split(url,"?")
	nom = spliter(0)
	if not conf.hasByName(nom) then
		elem = conf.createInstanceWithArguments(array())
		elem.setPropertyValue("Command",url)
		conf.insertByName(nom,elem)
	endif

end sub 
sub enable(url)

	spliter = split(url,"?")
	nom = spliter(0)
	if conf.hasByName(nom) then
		conf.removeByName(nom)
	endif

end sub

function getConfigSetting(target as string, forUpdate as boolean)
' retourne le noeud de config demandé
' exemple: aSettings = getConfigSetting( "/org.openoffice.Office.Common/Path/Current", false)

	dim service as String ' nom du service d'acces à la configuration
	dim aSettings, aConfigProvider
	dim aParams(0) As new com.sun.star.beans.PropertyValue
	dim varEmpty

	if forUpdate then
		service = "com.sun.star.configuration.ConfigurationUpdateAccess"
	else
		service = "com.sun.star.configuration.ConfigurationAccess"
	endif
	
	aConfigProvider = createUnoService( "com.sun.star.configuration.ConfigurationProvider" )
	aParams(0).Name = "nodepath"
	aParams(0).Value = target
	
	aSettings = aConfigProvider.createInstanceWithArguments(service, aParams() )
	
	getConfigSetting = aSettings

end function
Comment 2 Björn Michaelsen 2011-12-23 12:05:31 UTC Comment hidden (obsolete)
Comment 3 Florian Reisinger 2012-08-14 14:03:28 UTC Comment hidden (obsolete)
Comment 4 Florian Reisinger 2012-08-14 14:04:23 UTC Comment hidden (obsolete)
Comment 5 Florian Reisinger 2012-08-14 14:08:55 UTC Comment hidden (obsolete)
Comment 6 Florian Reisinger 2012-08-14 14:10:56 UTC Comment hidden (obsolete)
Comment 7 sasha.libreoffice 2012-08-31 09:34:01 UTC
Nobody tested yet. Reopening
Comment 8 Joel Madero 2012-11-21 16:54:39 UTC
I can't get the macro to do anything for me. It asks if I want to disable the insert sheet command and I click yes, but I'm still able to insert sheet ANY method (insert - sheet, right click on sheet1 and do Insert Sheet..., Clicking Green +, or Empty Space)

Can you verify that your macro disables insert sheet in any way? I don't know the code so I can't verify that aspect but I want to confirm that we're on the same page before triaging the bug. Marking as NEEDINFO until you respond.

Thanks for your patience and apologies for the long delay.


Regards,
Joel
Comment 9 Laurent Godard 2012-11-21 17:16:05 UTC
i confirm the macro does do anythoing anymore
i'll have a look
i let you know
Comment 10 Laurent Godard 2012-11-21 17:22:11 UTC
Created attachment 70382 [details]
a file with a correct macro

Please find an ods document with the macro inside (enable macros in security)
click the button to DISABLE (answer Yes) or ENABLE (answer No)

when DISABLE
disapear in menu Insert
Right click on tab, the menu entry iss still there but inactive
the other described way are still available
Comment 11 Joel Madero 2012-11-21 17:34:45 UTC
Confirmed, quite strange :)

Marking as NEW and prioritizing:

Minor: Doesn't prevent high quality/professional work

Low: Very very few users would actually care about this - the number of users using macros is already low, one as specific as limiting the ability to make new sheets is probably less than 0.1% of users. 

Leaving PrposedEasyHack as I don't think it'd be that difficult to fix.

Thanks for your patience and the test document
Comment 12 Joel Madero 2014-02-27 22:55:13 UTC
In order to limit the confusion between ProposedEasyHack and EasyHack and to make queries much easier we are changing ProposedEasyHack to NeedsDevEval.

Thank you and apologies for the noise
Comment 13 Robinson Tryon (qubit) 2015-12-13 11:20:52 UTC Comment hidden (obsolete)
Comment 14 QA Administrators 2018-10-22 02:47:37 UTC Comment hidden (obsolete)
Comment 15 Buovjaga 2019-08-10 16:52:39 UTC
(In reply to Laurent Godard from comment #10)
> Created attachment 70382 [details]
> a file with a correct macro
> 
> Please find an ods document with the macro inside (enable macros in security)
> click the button to DISABLE (answer Yes) or ENABLE (answer No)
> 
> when DISABLE
> disapear in menu Insert
> Right click on tab, the menu entry iss still there but inactive
> the other described way are still available

Nothing is disabled, not even menu entries in Sheet menu.

Arch Linux 64-bit
Version: 6.4.0.0.alpha0+
Build ID: 37fc9f51a8de11d40632e8cda17ccf1fa4b1f503
CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 6 August 2019
Comment 16 QA Administrators 2021-09-19 03:44:06 UTC Comment hidden (obsolete)
Comment 17 QA Administrators 2023-09-20 03:06:10 UTC
Dear Laurent Godard,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug