summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-05 14:55:33 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-20 12:13:59 +0100
commit5e3a88a283bbbe772703e099adcd70baf7ad3e2f (patch)
treecfb66fa23972a98652fdbf01d15d2273283017ab
parentcb610c0200152ea2d62152a3e6f5e003e246bd21 (diff)
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 <vmiklos@collabora.com> Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> (cherry picked from commit 95e9c210ef8380b0909c6ba596e3023bafef4083) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176824 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
-rw-r--r--desktop/source/lib/init.cxx1
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx2
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx17
3 files changed, 20 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 006910049f7d..e4c1c15aed12 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4331,6 +4331,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 347fc52f1e1f..182988f1d62b 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -3874,6 +3874,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 9b9c2be46db6..15f1a51f1e8b 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1033,6 +1033,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:
@@ -1048,6 +1052,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);
+ }
}
}