Bug 117219 - Switching read-only spreadsheet to edit mode switches to form design mode
Summary: Switching read-only spreadsheet to edit mode switches to form design mode
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: implementationError
Depends on:
Blocks: Form-Controls
  Show dependency treegraph
 
Reported: 2018-04-25 06:37 UTC by Aron Budea
Modified: 2022-08-16 15:51 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
ODS with a scrollbar (7.87 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-04-25 06:37 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2018-04-25 06:37:35 UTC
Created attachment 141618 [details]
ODS with a scrollbar

- Change the attached file to read-only in the OS, and open it in Calc. It contains a scrollbar connected to A1.
- Switch to edit mode with the Edit Document button.
- Try to adjust the scrollbar.

=> The whole control moves, scrollbar can't be adjusted.
When looking at Form Controls toolbar, design mode is turned on, turning it off resumes expected behavior.

Scrollbar behaves as expected (design mode is turned off) when the file is opened in editable mode right away.

Observed using LO 6.0.3.2 & 4.4.0.3 / Windows 7.
Switching to editable mode was introduced in 4.4.
Comment 1 Gerhard Weydt 2018-04-27 10:46:25 UTC
I can confirm that in
Version: 6.1.0.0.alpha0+
Build ID: 9c4eaa7b81a40d97fe49b85272b40bfeaaf44f86
CPU threads: 4; OS: Windows 10.0; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-04-16_03:31:36
Locale: de-DE (de_DE); Calc: group
Comment 2 Justin L 2018-10-19 12:07:36 UTC

*** This bug has been marked as a duplicate of bug 114246 ***
Comment 3 Justin L 2021-03-17 13:49:07 UTC
It is not a duplicate. This is talking about ReadOnly at the OS level, not at the document level.

repro 7.2+.
repro in linux bibisect 5.2

repro in linux bibisect 4.3, 4.0, 2.5
    -save-as another filename - design mode turns on.
Comment 4 Justin L 2021-03-17 17:58:04 UTC
Already at initial import, we have sc/source/ui/view/tabvwsh5.cxx
            case SfxHintId::ScDocSaved:
                {
                    //  "Save as" can make a write-protected document writable,
                    //  therefore the Layer-Locks anew (#39884#)
                    //  (Invalidate etc. is happening already from Sfx)
                    //  by SID_EDITDOC no SfxHintId::TitleChanged will occur,
                    //  that is why the own hint from DoSaveCompleted
                    //! what is with SfxHintId::SAVECOMPLETED ?

                    UpdateLayerLocks();

                    // Would be too much to change Design-Mode with every save
                    // (when saving under the name, it should remain unchanged)
                    // Therefore only by SfxHintId::ModeChanged (from ViewFrame)
                }
                break;

            case SfxHintId::ModeChanged:
                //  Since you can no longer rely on it where this hint was
                //  coming from, always switch the design mode when the ReadOnly
                //  state really was changed:

                if ( GetViewData().GetSfxDocShell()->IsReadOnly() != bReadOnly )
                {
                    bReadOnly = GetViewData().GetSfxDocShell()->IsReadOnly();

                   SfxBoolItem aItem( SID_FM_DESIGN_MODE, !bReadOnly);
                   GetViewData().GetDispatcher().ExecuteList(SID_FM_DESIGN_MODE,
                            SfxCallMode::ASYNCHRON, { &aItem });

                    UpdateInputContext();
                }
                break;
Comment 5 Justin L 2021-03-18 06:03:28 UTC
This is complicated by the fact that DesignMode=on status is not saved in the file - so it is ?never? enabled when the file is opened.
Also, turning off edit mode seems to also turn off designMode.

I don't know which use case the existing code is trying to cover, so I hesitate to do anything here.
Comment 6 Justin L 2022-08-16 15:51:22 UTC
(In reply to Justin L from comment #5)
> This is complicated by the fact that DesignMode=on status is not saved in
> the file
Well, there IS a setting that handles "Open in Design Mode", but we aren't discussing that aspect.

As an aside: I noticed that if I just ignore the "Enter Edit mode" banner and simply Save-As, then I can't select/edit the example document's scrollbar control even though design mode is on. (Already true in LO 5.2).