[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - 2 commits - sw/source
Jan-Marek Glogowski
glogow at fbihome.de
Wed Oct 8 08:50:33 PDT 2014
sw/source/core/crsr/crstrvl.cxx | 34 ++++++++++++++++++++++++++++----
sw/source/core/uibase/shells/basesh.cxx | 6 +----
2 files changed, 32 insertions(+), 8 deletions(-)
New commits:
commit 659194b946f3c2d31ffe715fb2232257cf0424e0
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Fri Aug 8 11:21:14 2014 +0200
Fix input field tab handling
When searching for the current field in the field list to find the
previous or next one, we check the field start and compare it with
the cursor position.
But with the new input fields, the cursor can actually be anywhere
in the field, so we actually have to search for the start position
of the input field at the cursor position.
Change-Id: I26526524eccfdbea41c6bf69a460fa64248f50ca
Reviewed-on: https://gerrit.libreoffice.org/10837
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit d33db207e27198df7af9fc007d7532ec76c80991)
Reviewed-on: https://gerrit.libreoffice.org/11781
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 80febe1..c9b11c0 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -670,6 +670,8 @@ bool SwCrsrShell::MoveFldType(
SwTxtFld * pTxtFld = pTNd->GetFldTxtAttrAt( rPos.nContent.GetIndex(), true );
const bool bDelFld = ( pTxtFld == NULL );
+ sal_Int32 nContentOffset = -1;
+
if( bDelFld )
{
// create dummy for the search
@@ -680,23 +682,47 @@ bool SwCrsrShell::MoveFldType(
mpDoc->IsClipBoard() );
pTxtFld->ChgTxtNode( pTNd );
}
+ else
+ {
+ // the cursor might be anywhere inside the input field,
+ // but we will be searching for the field start
+ if (pTxtFld->Which() == RES_TXTATR_INPUTFIELD
+ && rPos.nContent.GetIndex() != *pTxtFld->GetStart())
+ nContentOffset = *pTxtFld->GetStart();
+ }
+
+ _SetGetExpFld *pSrch = NULL;
+ SwIndex *pIndex = NULL;
+ if( -1 == nContentOffset )
+ {
+ pSrch = new _SetGetExpFld( rPos.nNode, pTxtFld, &rPos.nContent );
+ }
+ else
+ {
+ pIndex = new SwIndex( rPos.nNode.GetNode().GetCntntNode(), nContentOffset );
+ pSrch = new _SetGetExpFld( rPos.nNode, pTxtFld, pIndex );
+ }
- _SetGetExpFld aSrch( rPos.nNode, pTxtFld, &rPos.nContent );
if( rPos.nNode.GetIndex() < mpDoc->GetNodes().GetEndOfExtras().GetIndex() )
{
// also at collection use only the first frame
Point aPt;
- aSrch.SetBodyPos( *pTNd->getLayoutFrm( GetLayout(), &aPt, &rPos, false ) );
+ pSrch->SetBodyPos( *pTNd->getLayoutFrm( GetLayout(), &aPt, &rPos, false ) );
}
- it = aSrtLst.lower_bound( &aSrch );
+ it = aSrtLst.lower_bound( pSrch );
+
+ bool isSrch = (**it == *pSrch);
+ delete pIndex;
+ delete pSrch;
+
if( bDelFld )
{
delete (SwFmtFld*)&pTxtFld->GetAttr();
delete pTxtFld;
}
- if( it != aSrtLst.end() && **it == aSrch ) // found
+ if( it != aSrtLst.end() && isSrch ) // found
{
if( bNext )
{
commit dfde5b967b27d9a44f35ce96cf99554722985bc5
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Thu Aug 7 15:18:19 2014 +0200
fdo#76565 Allow pasting into input fields
Reviewed-on: https://gerrit.libreoffice.org/10835
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 3f26ab24e0bfd27645c97ff7915fba2db409930a)
Conflicts:
sw/source/uibase/shells/basesh.cxx
Change-Id: If996284aeea4b430cceaaf264035aa9e4ec0f2f0
Reviewed-on: https://gerrit.libreoffice.org/11780
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/core/uibase/shells/basesh.cxx b/sw/source/core/uibase/shells/basesh.cxx
index e7dba76..0ec0312 100644
--- a/sw/source/core/uibase/shells/basesh.cxx
+++ b/sw/source/core/uibase/shells/basesh.cxx
@@ -267,8 +267,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
TransferableDataHelper aDataHelper(
TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin() ) );
if( aDataHelper.GetXTransferable().is()
- && SwTransferable::IsPaste( rSh, aDataHelper )
- && !rSh.CrsrInsideInputFld() )
+ && SwTransferable::IsPaste( rSh, aDataHelper ) )
{
// Temporary variables, because the shell could already be
// destroyed after the paste.
@@ -416,8 +415,7 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
break;
case SID_PASTE:
- if( !GetView().IsPasteAllowed()
- || rSh.CrsrInsideInputFld() )
+ if( !GetView().IsPasteAllowed() )
{
rSet.DisableItem( nWhich );
}
More information about the Libreoffice-commits
mailing list