diff options
author | Jim Raykowski <raykowj@gmail.com> | 2024-04-14 14:49:48 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2024-04-20 18:14:00 +0200 |
commit | ca66965507494d0c5e07bfe81334749bc08af409 (patch) | |
tree | 20f61358b4a8b218af55fdb76b21eb497285b68d /sw/source | |
parent | 57f4581e326453ebed8fe688ade924804aae46dd (diff) |
tdf#146190 Fix move to next drawing object using the tab key
after double click on a drawing obect in the Navigator doesn't move to
the next/previous drawing object when there is a number rule at the
current current cursor position and the current cursor position is at
the start of a paragraph.
This patch reworks the SwWrtShell::GotoDrawingObject function so the
document cursor position gets moved to the position of the drawing
object when the object is selected.
Another way to get expected results is to leave the GotoDrawingObject
function as is and move:
else if (rSh.GetSelectionType() &
(SelectionType::Graphic |
SelectionType::Frame |
SelectionType::Ole |
SelectionType::DrawObject |
SelectionType::DbForm))
above the:
else if( rSh.GetNumRuleAtCurrCursorPos()
&& rSh.IsSttOfPara()
&& !rSh.HasReadonlySel() )
in the SwEditWin::KeyInput function case KEY_TAB: block.
SwWrtShell::GotoDrawingObject is made SW_DLLPUBIC by this patch to able
to be used by the included unit test.
Change-Id: I047b416ae94a9284d304798924e0c5f2be526f85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166089
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/inc/wrtsh.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/move.cxx | 29 |
2 files changed, 10 insertions, 21 deletions
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index e1727bfc9fdf..6c0d4c2dda0b 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -501,7 +501,7 @@ typedef bool (SwWrtShell::*FNSimpleMove)(); SW_DLLPUBLIC bool GotoTable( const OUString& rName ); void GotoFormatField( const SwFormatField& rField ); const SwRangeRedline* GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect); - bool GotoDrawingObject(std::u16string_view rName); + SW_DLLPUBLIC bool GotoDrawingObject(std::u16string_view rName); void GotoFootnoteAnchor(const SwTextFootnote& rTextFootnote); SW_DLLPUBLIC void ChangeHeaderOrFooter(std::u16string_view rStyleName, bool bHeader, bool bOn, bool bShowWarning); virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow ) override; diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index cda2b32112ce..673a52091687 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -670,32 +670,21 @@ bool SwWrtShell::GotoOutline( const OUString& rName ) bool SwWrtShell::GotoDrawingObject(std::u16string_view rName) { SwPosition aPos = *GetCursor()->GetPoint(); - bool bRet = false; - SdrView* pDrawView = GetDrawView(); - if (pDrawView) + SdrPage* pPage = getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + for (const rtl::Reference<SdrObject>& pObj : *pPage) { - pDrawView->SdrEndTextEdit(); - pDrawView->UnmarkAll(); - SdrPage* pPage = getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); - for (const rtl::Reference<SdrObject>& pObj : *pPage) + if (pObj->GetName() == rName) { - if (pObj->GetName() == rName) + bool bRet = SelectObj(Point(), 0, pObj.get()); + if (bRet) { - SdrPageView* pPageView = pDrawView->GetSdrPageView(); - if(pPageView) - { - pDrawView->MarkObj(pObj.get(), pPageView); - m_aNavigationMgr.addEntry(aPos); - EnterStdMode(); - HideCursor(); - EnterSelFrameMode(); - bRet = true; - } - break; + m_aNavigationMgr.addEntry(aPos); + EnterSelFrameMode(); } + return bRet; } } - return bRet; + return false; } bool SwWrtShell::GotoRegion( std::u16string_view rName ) |