Kaydet (Commit) bef9cc01 authored tarafından Caolán McNamara's avatar Caolán McNamara

merge these two selection changing hunks of code

Change-Id: I4113a38a3a15cd2173f9a2530dc2e7278b8713b2
üst 7daf1588
...@@ -49,6 +49,28 @@ ...@@ -49,6 +49,28 @@
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <swuiexp.hxx> #include <swuiexp.hxx>
void SwFldEditDlg::EnsureSelection(SwField *pCurFld)
{
if (pSh->CrsrInsideInputFld())
{
// move cursor to start of Input Field
SwInputField* pInputFld = dynamic_cast<SwInputField*>(pCurFld);
if (pInputFld && pInputFld->GetFmtFld())
{
pSh->GotoField( *(pInputFld->GetFmtFld()) );
}
}
/* Only create selection if there is none already.
Normalize PaM instead of swapping. */
if (!pSh->HasSelection())
{
//Note that after this, it is possible that rMgr.GetCurFld() != pCurFld
pSh->Right(CRSR_SKIP_CHARS, true, 1, false );
}
pSh->NormalizePam();
}
SwFldEditDlg::SwFldEditDlg(SwView& rVw) SwFldEditDlg::SwFldEditDlg(SwView& rVw)
: SfxSingleTabDialog(&rVw.GetViewFrame()->GetWindow(), 0, : SfxSingleTabDialog(&rVw.GetViewFrame()->GetWindow(), 0,
...@@ -62,28 +84,12 @@ SwFldEditDlg::SwFldEditDlg(SwView& rVw) ...@@ -62,28 +84,12 @@ SwFldEditDlg::SwFldEditDlg(SwView& rVw)
SwFldMgr aMgr(pSh); SwFldMgr aMgr(pSh);
SwField *pCurFld = aMgr.GetCurFld(); SwField *pCurFld = aMgr.GetCurFld();
if(!pCurFld) if (!pCurFld)
return; return;
SwViewShell::SetCareWin(this); SwViewShell::SetCareWin(this);
if ( pSh->CrsrInsideInputFld() ) EnsureSelection(pCurFld);
{
// move cursor to start of Input Field
SwInputField* pInputFld = dynamic_cast<SwInputField*>(pCurFld);
if ( pInputFld != NULL
&& pInputFld->GetFmtFld() != NULL )
{
pSh->GotoField( *(pInputFld->GetFmtFld()) );
}
}
if ( ! pSh->HasSelection() )
{
pSh->Right(CRSR_SKIP_CHARS, true, 1, false);
}
pSh->NormalizePam();
sal_uInt16 nGroup = aMgr.GetGroup(false, pCurFld->GetTypeId(), pCurFld->GetSubType()); sal_uInt16 nGroup = aMgr.GetGroup(false, pCurFld->GetTypeId(), pCurFld->GetSubType());
...@@ -254,12 +260,7 @@ IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton ) ...@@ -254,12 +260,7 @@ IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton )
rMgr.GoNextPrev( bNext, pOldTyp ); rMgr.GoNextPrev( bNext, pOldTyp );
pCurFld = rMgr.GetCurFld(); pCurFld = rMgr.GetCurFld();
/* #108536# Only create selection if there is none EnsureSelection(pCurFld);
already. Normalize PaM instead of swapping. */
if ( ! pSh->HasSelection() )
pSh->Right(CRSR_SKIP_CHARS, true, 1, false );
pSh->NormalizePam();
sal_uInt16 nGroup = rMgr.GetGroup(false, pCurFld->GetTypeId(), pCurFld->GetSubType()); sal_uInt16 nGroup = rMgr.GetGroup(false, pCurFld->GetTypeId(), pCurFld->GetSubType());
......
...@@ -37,9 +37,10 @@ class SwFldEditDlg : public SfxSingleTabDialog ...@@ -37,9 +37,10 @@ class SwFldEditDlg : public SfxSingleTabDialog
void Init(); void Init();
SfxTabPage* CreatePage(sal_uInt16 nGroup); SfxTabPage* CreatePage(sal_uInt16 nGroup);
void EnsureSelection(SwField *pCurFld);
public: public:
SwFldEditDlg(SwView& rVw); SwFldEditDlg(SwView& rVw);
virtual ~SwFldEditDlg(); virtual ~SwFldEditDlg();
DECL_LINK(OKHdl, void *); DECL_LINK(OKHdl, void *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment