Bug 132145 - "com.sun.star.sheet.GlobalSheetSettings" properties, "org.openoffice.Office.Math" and "org.openoffice.Office.Calc/Input/" entries are not synchronized
Summary: "com.sun.star.sheet.GlobalSheetSettings" properties, "org.openoffice.Office.M...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.4.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.0
Keywords:
Depends on:
Blocks: Macro-UNOAPI
  Show dependency treegraph
 
Reported: 2020-04-16 12:01 UTC by Mike Kaganski
Modified: 2022-07-22 06:57 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2020-04-16 12:01:45 UTC
Consider this code:

> Sub Test
>   GlobalScope.BasicLibraries.LoadLibrary("Tools")
> 
>   oSet=createUnoService("com.sun.star.sheet.GlobalSheetSettings")
>   oSet.ExpandReferences=False
> 
>   MsgBox "oSet.ExpandReferences=" & oSet.ExpandReferences & chr(13) & "org.openoffice.Office.Calc/Input/ExpandReference=" & GetRegistryKeyContent("org.openoffice.Office.Calc/Input").getByName("ExpandReference")
> 
>   oSet.ExpandReferences=True
> 
>   MsgBox "oSet.ExpandReferences=" & oSet.ExpandReferences & chr(13) & "org.openoffice.Office.Calc/Input/ExpandReference=" & GetRegistryKeyContent("org.openoffice.Office.Calc/Input").getByName("ExpandReference")
> 
>   o = GetRegistryKeyContent("org.openoffice.Office.Calc/Input", True)
>   o.setPropertyValue("ExpandReference", False)
>   o.commitChanges()
> 
>   MsgBox "oSet.ExpandReferences=" & oSet.ExpandReferences & chr(13) & "org.openoffice.Office.Calc/Input/ExpandReference=" & GetRegistryKeyContent("org.openoffice.Office.Calc/Input").getByName("ExpandReference")
> 
>   o.setPropertyValue("ExpandReference", True)
>   o.commitChanges()
> 
>   MsgBox "oSet.ExpandReferences=" & oSet.ExpandReferences & chr(13) & "org.openoffice.Office.Calc/Input/ExpandReference=" & GetRegistryKeyContent("org.openoffice.Office.Calc/Input").getByName("ExpandReference")
> End Sub

This code shows that manipulating the same ExpandReference setting [1] via registry and via com.sun.star.sheet.GlobalSheetSettings service is not synchronized, as if the latter does not listen for the relevant registry changes. The setting in com.sun.star.sheet.GlobalSheetSettings is actually used in the following spreadsheet manipulations, and is reflected in the Options/Calc/General; but the changes in it are not immediately reflected in registrymodifications.xcu - until the program exits (or until the settings are saved from the Options dialog). On the other hand, changes done using "com.sun.star.configuration.ConfigurationUpdateAccess" (through GetRegistryKeyContent) are written into registrymodifications.xcu immediately on commit, but are not reflected in Options dialog, and will not be used until soffice.bin restarts.

Although the state where there's more than one way to access the setting might be confusing and redundant, having them also *behave* differently is confusing even more. The two should be synchronized, and allow to be used interchangeably: I can't see a reason to have current distinction in behaviour.

Tested with Version: 6.4.3.2 (x64)
Build ID: 747b5d0ebf89f41c860ec2a39efd7cb15b54f2d8
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded

[1] https://help.libreoffice.org/6.4/en-US/text/shared/optionen/01060300.html#hd_id3148451
Comment 1 dante19031999 2021-03-31 12:54:55 UTC
At least org.openoffice.Office.Math.AutoCloseBrackets does not work.
Comment 2 Mike Kaganski 2021-04-30 17:24:12 UTC
Stephan: what is the proper way to listen to registry changes? To automatically synchronize the cached settings when the data is set using low-level mechanism.
Comment 3 Stephan Bergmann 2021-05-03 14:09:50 UTC
(In reply to Mike Kaganski from comment #0)
> This code shows that manipulating the same ExpandReference setting [1] via
> registry and via com.sun.star.sheet.GlobalSheetSettings service is not
> synchronized, as if the latter does not listen for the relevant registry
> changes. The setting in com.sun.star.sheet.GlobalSheetSettings is actually
> used in the following spreadsheet manipulations, and is reflected in the
> Options/Calc/General; but the changes in it are not immediately reflected in
> registrymodifications.xcu - until the program exits (or until the settings
> are saved from the Options dialog). On the other hand, changes done using
> "com.sun.star.configuration.ConfigurationUpdateAccess" (through
> GetRegistryKeyContent) are written into registrymodifications.xcu
> immediately on commit, but are not reflected in Options dialog, and will not
> be used until soffice.bin restarts.

The implementation of the css.sheet.GlobalSheetSettings service (ScSpreadsheetSettings, sc/source/ui/unoobj/appluno.cxx) apparently delegates to some global ScModule (SC_MOD, sc/inc/scmod.hxx), which in turn delegates to classes like ScInputCfg (sc/inc/inputopt.hxx) which are based on the utl::ConfigItem wrapper fiasco around configmgr (and which reads configmgr data just once upfront, doesn't listen on configmgr data changes, and doesn't write back updates to configmgr promptly, or something like that).
Comment 4 Vladimir Sokolinskiy 2021-05-03 15:07:36 UTC
Mike, as a first step: it seems to me that it would be logical if the commitChanges method would call the same mechanism that the Options dialog uses when committing a parameter change.
Comment 5 Mike Kaganski 2021-07-26 11:32:41 UTC
A series of commits by Noel Grandin might *possibly* affect this:

https://gerrit.libreoffice.org/q/owner:noel.grandin%2540collabora.co.uk+%2522use+officecfg%2522
Comment 6 Vladimir Sokolinskiy 2021-07-26 12:53:20 UTC
That would be a great way forward!
Comment 7 Commit Notification 2021-11-27 06:16:59 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2b95775b0dd20e90bb6ec6925a6745b27cf032e6

tdf#132145: Synchronize ScInputCfg with configuration

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Mike Kaganski 2021-11-27 08:14:15 UTC
(In reply to dante19031999 from comment #1)
> At least org.openoffice.Office.Math.AutoCloseBrackets does not work.

Please clarify in which sense does that setting not work. Is there some property set analogous to com.sun.star.sheet.GlobalSheetSettings, that exhibits a similar problem to shown in comment 0?
Comment 9 Commit Notification 2021-11-28 12:42:39 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6c09362c257b26ebf26fea0168f7db752212da70

tdf#132145: Synchronize ScPrintCfg with configuration

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2021-11-29 02:54:47 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8810812e58f1b014d3156235c1ab5a2d6c73c828

tdf#132145: Synchronize ScAppCfg with configuration

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2021-11-30 11:04:59 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a5808c6446f6de536c44cf5bfba6566ad398fb8c

tdf#132145: Synchronize SmMathConfig with configuration

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Mike Kaganski 2021-11-30 11:06:16 UTC
(In reply to dante19031999 from comment #1)

I believe I saw the problem you mentioned, and addressed in in the commit mentioned above. Please test :-)
Comment 13 Commit Notification 2021-12-03 23:02:00 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/33f3470474dd79a3a0eae1f6cb369e6400b58b6a

Related tdf#132145: fix Print/Size NoSuchElementException

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.