desktop/source/lib/init.cxx | 1 + sc/source/ui/view/tabview4.cxx | 25 ++++++++++++++++++++++--- sd/source/ui/unoidl/unomodel.cxx | 2 ++ sd/source/ui/view/ViewShellBase.cxx | 17 +++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-)
New commits: commit 57d123745a6e07da2a9893540e42b72e55641a59 Author: Bayram Çiçek <bayram.ci...@collabora.com> AuthorDate: Wed Oct 30 16:29:16 2024 +0300 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Nov 20 12:14:09 2024 +0100 sc: autofill: send to-be-deleted cell addresses with LOK_CALLBACK_TOOLTIP also avoid nullptr ViewShells: - if (comphelper::LibreOfficeKit::isActive()) + if (ScTabViewShell* pLOKViewShell + = comphelper::LibreOfficeKit::isActive() ? aViewData.GetViewShell() : nullptr) Signed-off-by: Bayram Çiçek <bayram.ci...@collabora.com> Change-Id: I38578297cc1aadefe8c43033cdb14b9460e22c90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175827 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 459a9401f342210d7f6ab8fe6fa780ae28413ef6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176825 Tested-by: Jenkins diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index 2352f732befd..082c275fe113 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -288,7 +288,26 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) aHelpStr = aHelpStr.replaceFirst("%2", OUString::number(nCols) ); } else if ( aViewData.GetDelMark( aDelRange ) ) + { aHelpStr = ScResId( STR_QUICKHELP_DELETE ); + + if (ScTabViewShell* pLOKViewShell + = comphelper::LibreOfficeKit::isActive() ? aViewData.GetViewShell() : nullptr) + { + // autofill: collect the cell addresses that will be deleted + OUString sDeleteCellAddress + = OUString::Concat(OUString::number(aDelRange.aStart.Row()) + " " + + OUString::number(aDelRange.aStart.Col()) + " " + + OUString::number(aDelRange.aEnd.Row()) + " " + + OUString::number(aDelRange.aEnd.Col())); + + tools::JsonWriter writer; + writer.put("type", "autofilldeletecells"); + writer.put("delrange", sDeleteCellAddress); + OString sPayloadString = writer.finishAndGetAsOString(); + pLOKViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString); + } + } else if ( nEndX != aMarkRange.aEnd.Col() || nEndY != aMarkRange.aEnd.Row() ) aHelpStr = rDoc.GetAutoFillPreview( aMarkRange, nEndX, nEndY ); @@ -313,7 +332,8 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) sTipString = aHelpStr; sTopParent = pWin; - if (comphelper::LibreOfficeKit::isActive()) + if (ScTabViewShell* pLOKViewShell + = comphelper::LibreOfficeKit::isActive() ? aViewData.GetViewShell() : nullptr) { // we need to use nAddX and nAddX here because we need the next row&column address OUString sCol = OUString::number(nEndX + nAddX); @@ -327,8 +347,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) writer.put("text", sTipString); writer.put("celladdress", sCellAddress); OString sPayloadString = writer.finishAndGetAsOString(); - ScTabViewShell* pViewShell = aViewData.GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString); + pLOKViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString); } } } commit 5e3a88a283bbbe772703e099adcd70baf7ad3e2f Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Nov 5 14:55:33 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Nov 20 12:13:59 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/+/176824 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins 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); + } } }