desktop/source/lib/init.cxx | 1 + sd/source/ui/unoidl/unomodel.cxx | 2 ++ sd/source/ui/view/ViewShellBase.cxx | 17 +++++++++++++++++ 3 files changed, 20 insertions(+)
New commits: commit f2c4b4680a1cefce72a20d2b53b6fcb32c467a67 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Nov 5 14:55:33 2024 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Mon Nov 18 12:09:07 2024 +0100 switching PageKind without switching EditMode retains current page i.e. ChangeEditMode doesn't do anything if the EditMode is unchanged but the PageKind was switched from Notes to Standard. So the same page of the other mode is still selected. An explicit SwitchPage is required to change the page from the other mode. This results in the reported mode of "2", but rendering actually still rendering as if in "mode 0", so a request to render a 'standard' page returns an image of the currently still-selected 'notes' page, which confusingly can be cached and not shown until served as a reply to a later request of the 'standard' page. See DrawViewShell::ReadFrameViewData and other places for more of this pattern. Change-Id: Ie8aa8f93f45189fd6f9c37c4077fa2b547ca4815 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176084 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Reviewed-by: Gökay ŞATIR <gokaysa...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> (cherry picked from commit 95e9c210ef8380b0909c6ba596e3023bafef4083) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176709 Tested-by: Andras Timar <andras.ti...@collabora.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 555f42312a70..9c2562230505 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4333,6 +4333,7 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis, // TODO: we could be clever and e.g. set to 0 when we change to/from // embedded object mode, and not when changing between slide/notes/combined // modes? + // TODO: Also now see ViewShellBase::setEditMode for a similar case if ( nCurrentPart < pDoc->getParts() ) { pDoc->setPart( nCurrentPart ); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 597b388eb5de..935ba34ccbc3 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -3803,6 +3803,8 @@ void SdXImpressDocument::setPartMode( int nPartMode ) break; } pViewSh->SetPageKind( aPageKind ); + //TODO do the same as setEditMode and then can probably remove the TODOs + //from doc_setPartMode } int SdXImpressDocument::getEditMode() diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index f2ddb55b66d8..4dbf0f20653a 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -1024,6 +1024,10 @@ void ViewShellBase::setEditMode(int nMode) if (DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pViewShell)) { + EditMode eOrigEditMode = pDrawViewShell->GetEditMode(); + PageKind eOrigPageKind = pDrawViewShell->GetPageKind(); + sal_uInt16 nSelectedPage = pDrawViewShell->GetCurPagePos(); + switch ( nMode ) { case 0: @@ -1039,6 +1043,19 @@ void ViewShellBase::setEditMode(int nMode) pDrawViewShell->ChangeEditMode(EditMode::Page, false); break; } + + /* + If the EditMode is unchanged, then ChangeEditMode was typically a + no-op, and an additional explicit SwitchPage is required to reselect + the equivalent page from the other mode, otherwise a switch from + e.g. Notes to Standard will still render the still selected Note + page. + */ + if (eOrigEditMode == pDrawViewShell->GetEditMode() && + eOrigPageKind != pDrawViewShell->GetPageKind()) + { + pDrawViewShell->SwitchPage(nSelectedPage); + } } }