tdf#131218 Assure standard mode at shell before goto content
Also resolves tdf#133039
This is a copy of SwPostItMgr::AssureStdModeAtShell with an addition of
EnterStdMode used when not in frame mode and no object is selected. It
makes focus on content, from Navigator goto content, work as expected
for all content types.
Change-Id: Id23ea8f603b7f5d90f1e23f1eb82db292c71c499
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90487
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
(cherry picked from commit f7e2f5bca938aa916830e07895d2da6820282055)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106818
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 2ac47cd..641ee44 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -4269,9 +4269,34 @@ void SwContentTree::EditEntry(const weld::TreeIter& rEntry, EditEntryMode nMode)
}
}
static void lcl_AssureStdModeAtShell(SwWrtShell* pWrtShell)
{
// deselect any drawing or frame and leave editing mode
SdrView* pSdrView = pWrtShell->GetDrawView();
if (pSdrView && pSdrView->IsTextEdit() )
{
bool bLockView = pWrtShell->IsViewLocked();
pWrtShell->LockView(true);
pWrtShell->EndTextEdit();
pWrtShell->LockView(bLockView);
}
if (pWrtShell->IsSelFrameMode() || pWrtShell->IsObjSelected())
{
pWrtShell->UnSelectFrame();
pWrtShell->LeaveSelFrameMode();
pWrtShell->GetView().LeaveDrawCreate();
pWrtShell->EnterStdMode();
pWrtShell->DrawSelChanged();
pWrtShell->GetView().StopShellTimer();
}
else
pWrtShell->EnterStdMode();
}
void SwContentTree::GotoContent(const SwContent* pCnt)
{
m_pActiveShell->EnterStdMode();
lcl_AssureStdModeAtShell(m_pActiveShell);
bool bSel = false;
switch(pCnt->GetParent()->GetType())
@@ -4328,7 +4353,6 @@ void SwContentTree::GotoContent(const SwContent* pCnt)
}
break;
case ContentTypeId::POSTIT:
m_pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell();
m_pActiveShell->GotoFormatField(*static_cast<const SwPostItContent*>(pCnt)->GetPostIt());
break;
case ContentTypeId::DRAWOBJECT: