Issue 122453 - [Sidebar] Position and Size: input fields empty, no values shown for position and size
[Sidebar] Position and Size: input fields empty, no values shown for position...
Status: RESOLVED FIXED
Product: General
Classification: Code
Component: ui
4.0.0-dev
PC Windows 7
: P3 normal (vote)
: 4.0.0
Assigned To: Andre
:
Depends on:
Blocks: [sidebar]
  Show dependency treegraph
 
Reported: 2013-06-04 15:01 UTC by Prachi
Modified: 2013-07-11 13:56 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Prachi 2013-06-04 15:01:05 UTC
Overview: when OLE objects inserted into slide Position and Size section not visible in sidebar.  

Steps to Reproduce
  1) New a presentation.
  2) Select Insert > Object > OLE object from the main menu.

Actual Result : An OLE object inserted into slide and Position and Size section not visible in sidebar.

Expected Result: An OLE object inserted and Position and Size section should be visible in sidebar with related controls.

Build Date & Hardware:
Build: AOO 4.0 Rev.1479897
OS: windows 7

Additional Information: Test Case Reference: AOOTest-1499:Position*Size section - Impress - undo/redo
Comment 1 Andre 2013-06-05 08:17:49 UTC
For OLE objects we have to distinguish between two different 'types' of selection.

1. OLE object is active.
This is the case right after an OLE object is inserted into a document.
When an OLE object is active then the whole UI is switched to the OLE application.  Example: Insert a spreadsheet OLE into a presentation.  While the spreadsheet OLE is active you have a 'Data' menu and an 'Alignment' panel in the sidebar.  Deactivate the OLE and the 'Data' menu is replaced by the 'Slide Show' menu.  In the sidebar the 'Alignment' panel is no longer available.

2. OLE object is selected.
You select an OLE object by a single click on it or, when it was previously active, by hitting the ESC key.  The UI is still set to the host document, Impress in the comment above.  The sidebar shows the panels 'Area', 'Line' (both collapsed by default) and 'Position and Size'.

I guess that the bug description refers to an active OLE in which case it would be perfectly OK to not see the 'Position and Size' panel.  Hit ESC to deactivate the OLE.  The 'Position and Size' panel should become visible.
Comment 2 Armin Le Grand 2013-06-05 10:35:26 UTC
ALG: Hppens when doing:
- new impress
- insert/OLE Drawing, OK
- ESC
-> no object is selected, sidebar shows Layouts, press TAB to select OLE, all is okay

- new impress
- insert/OLE Drawing, OK
- Draw a shape (ellipse)
- ESC (deselect ellipse)
- ESC (deaftivate OLE)
-> OLE is selected, sidebar still shows Layouts, press TAB to select OLE, all is okay

1st example is okay; seems as if in 2nd example the SelectionChange is not registered/too early. Maybe a context change for sidebar is needed for OLE deactivation.
Comment 3 Rainer Bielefeld 2013-06-07 04:58:59 UTC
I had some problems to understand the report, but I think I've got it.

Reproducible with server installation of  "AOO 4.0.0-Dev – English UI / German locale [AOO400m1(Build:9700) -  Rev. 1484333 Rev.1483903 (2013-05-20)]" on WIN7 Home Premium (64bit)", own separate user profile:

1. Open new Presentation from AOO Start Center
2. Menu 'Insert -> Object - >OLE object -> OOO 4.0.0. Chart (new)'
   (Alternatively: menu 'Insert -> Chart')
  > Chart Appears in Edit Mode
3. <Esc> to leave edit mode
  > Green Control points appear for chart, Sidebar appears
4. If necessary, expand 'Position and Size' in Properties deck
  Bug: input fields (with spin buttons) for width, height, position are empty

What's more or less exactly that what ALG found out.

Additional info:
----------------
Most times values appear after one click on empty sheet area and then click on chart, but not reliably.

After several delete OLE object and insert again, all or at least some values appear.

Not limited to Impress, I see the same in Draw, Writer, Calc (in Calt I tested with Draw object).

Worked fine in Lotus Symphony 3 Release 3.0.1 Revision 20120110.2000

Well, this is a little ugly, but not a blocker.
Comment 4 Andre 2013-06-11 09:03:48 UTC
I think that we have two different bug descriptions here:

1) from Prachi: create OLE and the "Position and Size" panel is not visible

   this is not a bug because right after the OLE has been created it is active and the sidebar, if visible at all, shows information for the OLE object, not the enclosing application.

2) from Armin Le Grand and rainerbielefeld: create OLE then press ESC, Width and/or Height are not displayed

   this is a bug because after pressing ESC the sidebar shows the content for the enclosing application and the "Position and Size" panel either should not show the controls for Width and Height or show the correct values.


One is a bug, the other is not.  Therefore I will concentrate on 2).
Comment 5 Andre 2013-06-11 11:23:18 UTC
On my way toward the root cause.  Looks like the "Position and Size" panel works as designed.  The problem lies deeper, somewhere between SdrObject notifying a model change and SfxStateCache not being properly updated.

When the OLE object (or other shapes; after the OLE has been inserted the bug occurs with other non-OLE shapes as well) is moved or resized then as indirect result (triggered by sd::Window::MouseButtonUp()), DrawViewShell::ModelHasChanged() calls SfxShell::Invalidate(0) which invalidates all slots of the current shell.  This should update both size and position in the panel.  This fails in some cases when a slot's SfxStateCache has no SfxSlotServer attached to it.

Now the strange thing.  The SfxStateCache is only invalidated when there is a valid SfxSlotServer.  This slot server is looked up only when the state cache is already dirty.  But the state cache is only set to dirty when there is a valid slot server.  Catch 22.

I have made an experiment with looking up the slot server in SfxStateCache::GetSlotServer() even when the state cache is not dirty.  This fixes the bug.  But I would like to understand how this whole slot system is supposed to work.
Comment 6 Andre 2013-06-12 10:06:47 UTC
The root cause of this bug seems to be a design or implementation flaw in sfx2.

The SfxDispatch::_FindServer() method does not find a slot server for the position and size slots while the OLE object is active.  This seems to be OK.  The strange thing here, that I still don't understand, is that there is no view shell on the shell stack for the Chart OLE.  The DrawViewShell of Impress is still the top most shell (level 0 on the shell stack.)  This should be ignored when searching a slot server, otherwise the slots would be processed by Impress, not by Chart.

The problem is that when the OLE is deactivated and SfxViewShell::UIDeactivating() is called (note that DrawViewShell overrides this method but calls the base implementation) the slot servers are not invalidated.  This would be done with a call to SfxStateCache::Invalidate(sal_True), but Invalidate() is only called with the default sal_False argument.  The result was described in the last comment: the slot server is not updated and therefore remains empty and the slots are not processed.

A possible fix is a call to SfxBindings::InvalidateAll(sal_True) in SfxViewShell::UIDeactivated() or DrawViewShell::Deactivated().
Comment 7 Andre 2013-06-12 11:39:30 UTC
The proposed fix, in SfxViewShell::UIDeactivated(), works in Calc and Impress, but not in Writer.  After the OLE deactivation the "Position and Size" panel shows values for width and height, but with wrong values.
Comment 8 Andre 2013-06-12 13:07:27 UTC
The wrong values for Writer are caused by out-of-date values for pool and dialog units for the spin fields.  These define the units in which values are stored/exchanged and displayed.

There are two different problems with that.

1) The values are initialized in the constructor of the panel.  After that only meDlgUnit is updated when the SID_ATTR_METRIC slot changes its value.  The value of mePoolUnit is never changed.

Apparently the values are initialized too early.  The value of meDlgUnit is FUNIT_NONE when the spin fields for width and height are set.  This leads to values of 99,99.

2) The SID_ATTR_METRIC value is updated *after* width and height.  At that time the values of the spin fields are already set.

Only in combination 1 and 2 lead to an error.  Setting the SID_ATTR_METRIC value should result in a conversion of the values in the width and height spin fields.  This conversion does not take place because their unit is set to FUNIT_NONE.

This can be fixed by setting mePoolUnit and meDlgUnit in every call to PosSizePropertyPanel::NotifyItemUpdate().  Whenever the values of the position or size controls are set, their unit is also set by a call to SetFieldUnit.  This makes sure that the field units are correctly initialized.  When then a little later the metric unit is modified the spin field values are correctly transformed.
Comment 9 Andre 2013-06-12 13:18:28 UTC
Fixed in two commits as outlined above:

Added a call to SfxBindings::InvalidateAll(sal_True) to SfxViewShell::UIDeactivated() to invalidate all slot servers when OLE objects are deactivated.  I made this change in SfxViewShell so that all applications benefit, not just Impress.

The second commit initializes and updates the pool and dialog units of the spin fields in the "Position and Size" panel.
Comment 10 Andre 2013-06-12 13:19:05 UTC
SVN revisions are 1492180 and 1492181 respectively.