diff options
Diffstat (limited to 'sw/source/ui/docvw/edtwin.cxx')
-rw-r--r-- | sw/source/ui/docvw/edtwin.cxx | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 814f677d8b30..053bff415775 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -139,6 +139,7 @@ #include <IMark.hxx> #include <doc.hxx> +#include <txatbase.hxx> // FIXME this sucks #include <xmloff/odffields.hxx> #include <PostItMgr.hxx> @@ -3107,22 +3108,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) if (aVEvt.eEvent == SDREVENT_EXECUTEURL) bExecDrawTextLink = sal_True; } - - SwContentAtPos aFieldAtPos ( SwContentAtPos::SW_FIELD ); - - // Are we selecting a field? - if ( rSh.GetContentAtPos( aDocPos, aFieldAtPos ) ) - { - // select work, AdditionalMode if applicable - if ( KEY_MOD1 == rMEvt.GetModifier() && !rSh.IsAddMode() ) - { - rSh.EnterAddMode(); - rSh.SelWrd( &aDocPos ); - rSh.LeaveAddMode(); - } - else - rSh.SelWrd( &aDocPos ); - } break; } case 2: @@ -3458,6 +3443,28 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) rSh.ClearGCAttr(); } + SwContentAtPos aFieldAtPos(SwContentAtPos::SW_FIELD); + + // 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()) + { + 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; + } + sal_Bool bOverSelect = rSh.ChgCurrPam( aDocPos ), bOverURLGrf = sal_False; if( !bOverSelect ) bOverURLGrf = bOverSelect = 0 != rSh.IsURLGrfAtPos( aDocPos ); @@ -4288,7 +4295,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) if(pApplyTempl) bExecHyperlinks = sal_False; - SwContentAtPos aCntntAtPos( SwContentAtPos::SW_CLICKFIELD | + SwContentAtPos aCntntAtPos( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_INETATTR | SwContentAtPos::SW_SMARTTAG | SwContentAtPos::SW_FORMCTRL); @@ -4307,7 +4314,23 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) if( SwContentAtPos::SW_FIELD == aCntntAtPos.eCntntAtPos ) { + bool bAddMode(false); + // AdditionalMode if applicable + if (KEY_MOD1 == rMEvt.GetModifier() + && !rSh.IsAddMode()) + { + bAddMode = true; + rSh.EnterAddMode(); + } rSh.ClickToField( *aCntntAtPos.aFnd.pFld ); + // a bit of a mystery what this is good for? + // in this case we assume it's valid since we + // just selected a field + bValidCrsrPos = true; + if (bAddMode) + { + rSh.LeaveAddMode(); + } } else if ( SwContentAtPos::SW_SMARTTAG == aCntntAtPos.eCntntAtPos ) { |