summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2011-01-11 20:18:26 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-01-11 20:26:18 +0100
commit0921bd5dc88dfd212fc5a332e0902347377be119 (patch)
treeaf9e6041fe0829154f4d03d091a9df21d2829eb1
parent3b627b964c0877d72fdd24d2303810647aaebd76 (diff)
n#657135: Enhanced fields fixes (key inputs, and 0-length fields import)
-rw-r--r--sw/source/core/crsr/bookmrk.cxx2
-rw-r--r--sw/source/core/crsr/pam.cxx5
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx6
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx2
-rw-r--r--sw/source/ui/docvw/edtwin.cxx19
5 files changed, 24 insertions, 10 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 94db59596f..c032664b0f 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -88,7 +88,7 @@ namespace
SwPaM aStartPaM(rStart);
SwPaM aEndPaM(rEnd);
io_pDoc->StartUndo(UNDO_UI_REPLACE, NULL);
- if( ( ch_start != aStartMark ) && ( rStart != rEnd ) )
+ if( ( ch_start != aStartMark ) && ( aEndMark != CH_TXT_ATR_FORMELEMENT ) )
{
io_pDoc->InsertString(aStartPaM, aStartMark);
rStart.nContent--;
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index e1527b4a6a..28d706e64f 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -838,8 +838,9 @@ BOOL SwPaM::HasReadonlySel( bool bFormView ) const
else
{
// Form protection case
- bRet = ( pA != pB );
- bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM );
+ bool bAtStartA = pA != NULL && pA->GetMarkStart() == *GetPoint();
+ bool bAtStartB = pB != NULL && pB->GetMarkStart() == *GetMark();
+ bRet = ( pA != pB ) || bAtStartA || bAtStartB;
if ( bProtectForm )
bRet |= ( pA == NULL || pB == NULL );
}
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 94f044e141..bafc7aae80 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1827,7 +1827,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
if ( ch == CH_TXT_ATR_FIELDSTART )
{
- SwPosition aPosition( rNode, SwIndex( const_cast< SwTxtNode* >( &rNode ), nAktPos + 1 ) );
+ SwPosition aPosition( rNode, SwIndex( const_cast< SwTxtNode* >( &rNode ), nAktPos ) );
::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
@@ -1879,9 +1879,9 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
}
else if ( ch == CH_TXT_ATR_FIELDEND )
{
- SwPosition aPosition( rNode, SwIndex( const_cast< SwTxtNode* >( &rNode ), nAktPos ) );
+ SwPosition aPosition( rNode, SwIndex( const_cast< SwTxtNode* >( &rNode ), nAktPos - 1 ) );
::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
- OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
+ OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDEND??" );
ww::eField eFieldId = lcl_getFieldId( pFieldmark );
if ( pFieldmark->GetFieldname().equalsAscii( ODF_UNHANDLED ) )
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index af199869d6..c4226ef779 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -683,7 +683,7 @@ public:
long Count() const { return ( pRef ) ? pRef->GetIMax() : 0; }
};
-/// Iterator for footnotes and endnotes
+/// Iterator for fields
class WW8PLCFx_FLD : public WW8PLCFx
{
private:
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 4d4b28a256..b9d1f5a7fd 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -1694,9 +1694,17 @@ KEYINPUT_CHECKTABLE_INSDEL:
break;
case KEY_DELETE:
- if (rSh.IsInFrontOfLabel() &&
- rSh.NumOrNoNum(FALSE))
- eKeyState = KS_NumOrNoNum;
+ if ( !rSh.HasReadonlySel() )
+ {
+ if (rSh.IsInFrontOfLabel() &&
+ rSh.NumOrNoNum(FALSE))
+ eKeyState = KS_NumOrNoNum;
+ }
+ else
+ {
+ InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
+ eKeyState = KS_Ende;
+ }
break;
case KEY_DELETE | KEY_MOD2:
@@ -1852,6 +1860,11 @@ KEYINPUT_CHECKTABLE_INSDEL:
}
}
}
+ else
+ {
+ InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
+ eKeyState = KS_Ende;
+ }
break;
case KEY_RIGHT: