# 24.04 readonly mode bits ...

**URL:** <https://forum.collaboraonline.com/t/24-04-readonly-mode-bits/2382>\
**Category:** Development\
**Created:** [February 14, 2024, 11:30am UTC](https://forum.collaboraonline.com/t/24-04-readonly-mode-bits/2382 "2024-02-14T11:30:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmeeks](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/mmeeks/32/371_2.png) [@mmeeks](https://forum.collaboraonline.com/u/mmeeks)\
**Post date:** [February 14, 2024, 11:30am UTC](https://forum.collaboraonline.com/t/24-04-readonly-mode-bits/2382/1 "2024-02-14T11:30:14Z")

</div>

\* Present  
&nbsp;&nbsp;+ Gokay, Michael, Miklos

\* Found the UI readonly option  
&nbsp;&nbsp;+ can set the UI to readonly  
&nbsp;&nbsp;+ if it is readonly currently  
&nbsp;&nbsp;&nbsp;&nbsp;+ edit view needs to be set to readonly.  
&nbsp;&nbsp;&nbsp;&nbsp;+ set - if a view performs an action  
&nbsp;&nbsp;+ readonly UI  
&nbsp;&nbsp;&nbsp;&nbsp;+ listeners are disabled  
&nbsp;&nbsp;&nbsp;&nbsp;+ enabled when the mode is added again.  
&nbsp;&nbsp;+ couldn't use a global variable

\* What about the comment-only semantic ?  
&nbsp;&nbsp;+ readonly UI - doesn't allow you to edit

\* coolwsd crash  
AI: + fix this as a priority- it should never crash  
&nbsp;&nbsp;&nbsp;&nbsp;+ if it's a debugging assert: ok perhaps.  
&nbsp;&nbsp;&nbsp;&nbsp;+ should shut connections to the Kit  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if necessary and kill it if we get  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;suspicious stuff.

\* table re-sizing:  
AI: + Poke at the SDI files to ensure that the  
&nbsp;&nbsp;&nbsp;&nbsp;related UNO commands are set right for  
&nbsp;&nbsp;&nbsp;&nbsp;readonly mode

\* readonly mode  
AI: + wsd/ClientSession.cpp - event filtering:  
&nbsp;&nbsp;&nbsp;&nbsp;+ should retain much of this on top of  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;readonly mode  
&nbsp;&nbsp;&nbsp;&nbsp;+ only allow through:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ mouse move & click events  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ arrow keys + modifiers for  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keyboard movement / selection  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ expect 'Copy' to go through  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UNO commands - allow that too  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if copy is not disabled.

&nbsp;&nbsp;+ we should push through the 'can comment'  
&nbsp;&nbsp;&nbsp;&nbsp;permission into readonly mode in LOK core

\* core problems:  
&nbsp;&nbsp;+ with one readonly view - can't select shapes  
&nbsp;&nbsp;+ since one disables it, and another doens't enable it again.  
&nbsp;&nbsp;+ we should assume that the setReadOnlyView thing is called  
&nbsp;&nbsp;&nbsp;&nbsp;just once at constrution or the earliest time we make something.  
&nbsp;&nbsp;&nbsp;&nbsp;+ perhaps we should use:

&nbsp;&nbsp;kit/Kit.cpp: \_loKitDocument-\>createView(options.c\_str());

&nbsp;&nbsp;&nbsp;&nbsp;+ so this state is all present as we  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;create the SfxViewFoo.

\* Performance:  
&nbsp;&nbsp;+ 'mode changed' event is broadcasted on the core side  
&nbsp;&nbsp;&nbsp;&nbsp;+ disabling and enabling listening to some events  
&nbsp;&nbsp;+ concerned about this  
&nbsp;&nbsp;&nbsp;&nbsp;+ we badly want to set the ReadOnly option once at  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;view creation, and then not again.  
&nbsp;&nbsp;&nbsp;&nbsp;+ certainly at view strobing time.  
&nbsp;&nbsp;+ need to do some QA / test of where readonly-ness is checked.

&nbsp;&nbsp;+ SwViewShell is not shared  
&nbsp;&nbsp;&nbsp;&nbsp;=\> no problem.

&nbsp;&nbsp;+ SfxObjectShell is shared  
&nbsp;&nbsp;&nbsp;&nbsp;+ using the same pointer.  
&nbsp;&nbsp;&nbsp;&nbsp;+ hits the drawing-layer stuff ...

&nbsp;&nbsp;AI: + SfxObjectShell::SetReadOnlyUI should not be called with 'true'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ ObjectShell should be read-write.  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ SfxViewShells - should be readonly-only (or not)

&nbsp;&nbsp;AI: + add a permissions enum: ReadWrite, CanComment, ReadOnly  
2 and thread it through everywhere.

&nbsp;&nbsp;AI: + need to switch call-sites that fetch read-only-ness  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to not use SfxObjectShell instead ask it to the SfxViewShell (Gokay)

&nbsp;&nbsp;AI: + Audit listeners listening to ModeChanged to ensure they  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filter in the callbacks in readonly mode.  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ git grep SfxHintId::ModeChanged  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ 8 hits  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ git grep on.\*ModeChanged  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ 6 hits outside the IDE

\* Keeping the model read-write  
&nbsp;&nbsp;+ avoids complexity with SfxMedium and associated horrors =)

\* Target this for 24.04  
&nbsp;&nbsp;+ not merging this into 23.05
