summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
+ }
}
}