Issue 124409

Summary: Sidebar: picture measures displayed in inch not in centimeters
Product: Writer Reporter: tbordfeldt <bordfeldt>
Component: uiAssignee: Armin Le Grand <Armin.Le.Grand>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: Armin.Le.Grand, issues, j.nitschke
Version: 4.0.0   
Target Milestone: 4.2.0   
Hardware: PC   
OS: All   
Issue Type: DEFECT Latest Confirmation in: 4.1.0-beta
Developer Difficulty: ---

Description tbordfeldt 2014-03-12 07:20:21 UTC
OO 4.0.1 on Xubuntu 12.04 64bit

In the sidebar measures are displayed in inch, though in options 'centimeters' are chosen as standard unit.
Comment 1 j.nitschke 2014-03-12 08:05:54 UTC
can't verify with AOO 4.1 beta, AOO410m14(Build:9760)  -  Rev. 1573601 on Windows

need more information:
with measure in sidebar you mean the indents and spaces settings in paragraph?

what is the setting of "user interface" and "locale" in Tools - Options - language settings - languages?

there are several places to change the measure settings, where did you change it?
[ ] - OpenOffice Writer - General - measurement unit
[ ] - OpenOffice Writer - View - horizontal ruler
[ ] - OpenOffice Writer - View - vertical ruler
[ ] - OpenOffice Writer/Web - View- measurement unit
[ ] - OpenOffice Writer/Web - View - horizontal ruler
[ ] - OpenOffice Writer/Web - View - vertical ruler
Comment 2 tbordfeldt 2014-03-12 13:51:27 UTC
With measure in sidebar you mean the indents and spaces settings in paragraph?

After opening a document at first all measures are displayed correctly in centimeters.
Then I want to change the width and heigth of a graphic over the correspondent input fields in the sidebar. At first the measures are in cm, but after the first change they change to inch. If I then change to the paragraph settings in the sidebar, they are displayed in inch too.
The measures in the standard menu dialogues are correctly displayed in cm.

What is the setting of "user interface" and "locale" in Tools - Options - language settings - languages?

both german

there are several places to change the measure settings, where did you change it?
[ ] - OpenOffice Writer - General - measurement unit : centimeter
[ ] - OpenOffice Writer - View - horizontal ruler : centimeter
[ ] - OpenOffice Writer - View - vertical ruler : centimeter
[ ] - OpenOffice Writer/Web - View- measurement unit : centimeter
[ ] - OpenOffice Writer/Web - View - horizontal ruler : centimeter
[ ] - OpenOffice Writer/Web - View - vertical ruler : centimeter

I made no changes in these sections. All values were set to centimeters.
Comment 3 j.nitschke 2014-03-12 15:12:08 UTC
Thank you for the detailed description.

I could reproduce this bug. However the measure switched once then I couldn't reproduce the behavior, with a new document it switched again ...

We need reproducible steps to trigger this issue.

Here is how I produced the bug
settings:
user interface, locale and default language for documents = german
all measures set to cm
steps:
* open new document
* Alt + print to create screenshot, ctrl + v to insert screenshot
* Select a green size marking and drag it to change size of the screenshot
or
* edit width or height in the sidebar
! in the sidebar: position and size the measures for height and width change from cm to "
  if you hanged only the width then only width measure changed, same applies to height
* click beside the graphic and select it again the measures are back to cm
--
! also happens when you edit the width or height in the sidebar


an other maybe related observation:
* mark a graphic object (frame, image, line, ...)
* click beside the object and watch the sidebar
! the measurements in the paragraph settings change from " to cm
Comment 4 Oliver-Rainer Wittmann 2014-03-12 16:35:57 UTC
I could reproduce the described unit switching in AOO 4.0.0, AOO 4.0.1 and AOO 4.1.0 Beta.

I performed the following steps:
- start OpenOffice
- new text document
- insert graphic via Menu Insert - Picture - From File
- select inserted graphic via Mouse
- change width or height or both in Sidebar Properties Position and Size panel or via the Mouse using the handles at the selected graphic
--> unit switches from cm to ''
- click into the text and select again the graphic
--> unit back to cm in Sidebar Properties Position and Size panel
- change width or height
--> unit switches from cm to ''

I was not able to reproduce the unit switch with a drawing object - e.g. rectangle
Comment 5 Armin Le Grand 2014-03-20 14:35:11 UTC
Problem is in PosSizePropertyPanel. There are two active mechanisms to get the UI unit.

One uses the slot SID_ATTR_METRIC and it's update mechanism, this works and is triggered in the constructor and from apps when changing UI unit in tools/options.

Another one uses calls to GetModuleFieldUnit() which is a helper and uses internally SfxModule::GetCurrentFieldUnit() which itself uses the static method GetActiveModule() to get the active SfxModule. With multiple views this is ambigious, too. This call then relies on the SfxModule to have slots set directly in the module's GetItem call, this is not the case for Writer (and cannot be guaranteed for all modules), thus the fallback FUNIT_INCH is returned which overwrites the correctly set local value from the 1st mechanism.

I removed usages of the 2nd mechanism and checked all apps, including changing the UI units in tools/options, all works well. Preparing commit...
Comment 6 Armin Le Grand 2014-03-20 14:36:54 UTC
Okay, done.
Comment 7 SVN Robot 2014-03-20 14:42:13 UTC
"alg" committed SVN revision 1579639 into trunk:
i124409 use slot SID_ATTR_METRIC to retrive the UI unit, not GetModuleFieldUnit