diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-11-19 13:04:48 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-11-19 15:51:27 +0000 |
commit | a5d7813de1d2e9c3234c5c0c32987c137bdf3ca1 (patch) | |
tree | 8b6b069bd57d73e1066b3d313a0128e7cceed4b7 /sw | |
parent | c2b5521921b806ff7b04cdacebde3834d2aafd4b (diff) |
don't panic on clicking inside input field
Change-Id: I52b53da16784cc5650d362c3884d93ed16979ca2
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/docvw/edtwin.cxx | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 64536179d567..5a45f43ecac7 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -3615,21 +3615,27 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) // Are we clicking on a field? if (rSh.GetContentAtPos(aDocPos, aFieldAtPos)) { - rSh.SetCursor(&aDocPos, bOnlyText); - // Unfortunately the cursor may be on field - // position or on position after field depending on which - // half of the field was clicked on. - SwTxtAttr const*const pTxtFld(aFieldAtPos.pFndTxtAttr); - if (rSh.GetCurrentShellCursor().GetPoint()->nContent - .GetIndex() != *pTxtFld->GetStart()) + bool bEditableField = (aFieldAtPos.pFndTxtAttr != NULL + && aFieldAtPos.pFndTxtAttr->Which() == RES_TXTATR_INPUTFIELD); + + if (!bEditableField) { - assert(rSh.GetCurrentShellCursor().GetPoint()->nContent - .GetIndex() == (*pTxtFld->GetStart() + 1)); - rSh.Left( CRSR_SKIP_CHARS, false, 1, false ); + rSh.SetCursor(&aDocPos, bOnlyText); + // Unfortunately the cursor may be on field + // position or on position after field depending on which + // half of the field was clicked on. + SwTxtAttr const*const pTxtFld(aFieldAtPos.pFndTxtAttr); + if (rSh.GetCurrentShellCursor().GetPoint()->nContent + .GetIndex() != *pTxtFld->GetStart()) + { + assert(rSh.GetCurrentShellCursor().GetPoint()->nContent + .GetIndex() == (*pTxtFld->GetStart() + 1)); + rSh.Left( CRSR_SKIP_CHARS, false, 1, false ); + } + // don't go into the !bOverSelect block below - it moves + // the cursor + break; } - // don't go into the !bOverSelect block below - it moves - // the cursor - break; } sal_Bool bOverSelect = rSh.ChgCurrPam( aDocPos ), bOverURLGrf = sal_False; |