diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2022-04-20 10:33:03 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-05-06 12:43:06 +0200 |
commit | 3733fd5c84348a09bc95a8a535a7187da1d98667 (patch) | |
tree | 7fcf57961fcae47fdcd3859a218f0702a8a118af /desktop/source/lib/init.cxx | |
parent | fe703f245d4419861f7840c945183b4bed41cd81 (diff) |
lok: don't render active textbox on all slides
when we render tiles for slide previews we use
viewid = 0 (first session)
so when first session edits any textbox and in other
session we request slide previews (eg. after new slide was added)
then we received tile with additional text from the first session
this is caused by:
commit bee4ff508a456a1552aacdf6fc838b8b7cffb9ec
desktop lok: avoid unnecessary setPart() in paintPartTile()
If possible, switch views, not parts, that way started Impress text
edits don't end as a side-effect.
but later there was a fix which doesn't trigger closing of texbox
editing when switching parts:
commit ce7bf351972bbfd64ca99e8d2fb4c5f77591c9e0
impress: don't exit textbox editing when new slide was added
so we don't need that in all cases...
to fix issue described above: still switch views instead of parts
when possible - but avoid views where editing is active
Change-Id: Ib6e66a85b9ca68d6e67e3d9cb17060aa42b85220
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133202
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Pranam Lashkari <lpranam@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133650
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'desktop/source/lib/init.cxx')
-rw-r--r-- | desktop/source/lib/init.cxx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c891bd2b0b4f..f50d84cf6cc8 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3594,6 +3594,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, int nOrigPart = 0; const bool isText = (doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT); int nViewId = nOrigViewId; + int nLastNonEditorView = nViewId; if (!isText) { // Check if just switching to another view is enough, that has @@ -3603,9 +3604,15 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - if (pViewShell->getPart() == nPart) + bool bIsInEdit = pViewShell->GetDrawView() && + pViewShell->GetDrawView()->GetTextEditOutliner(); + if (!bIsInEdit) + nLastNonEditorView = pViewShell->GetViewShellId().get(); + + if (pViewShell->getPart() == nPart && !bIsInEdit) { nViewId = pViewShell->GetViewShellId().get(); + nLastNonEditorView = nViewId; doc_setView(pThis, nViewId); break; } @@ -3613,6 +3620,14 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, } } + // if not found view with correct part - at least avoid rendering active textbox + SfxViewShell* pCurrentViewShell = SfxViewShell::Current(); + if (pCurrentViewShell && pCurrentViewShell->GetDrawView() && + pCurrentViewShell->GetDrawView()->GetTextEditOutliner()) + { + doc_setView(pThis, nLastNonEditorView); + } + nOrigPart = doc_getPart(pThis); if (nPart != nOrigPart) { |