summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/IDocumentMarkAccess.hxx2
-rw-r--r--sw/qa/extras/globalfilter/globalfilter.cxx2
-rw-r--r--sw/source/core/crsr/crbm.cxx2
-rw-r--r--sw/source/core/crsr/crstrvl.cxx2
-rw-r--r--sw/source/core/crsr/pam.cxx4
-rw-r--r--sw/source/core/crsr/swcrsr.cxx2
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx2
-rw-r--r--sw/source/core/doc/docbm.cxx11
-rw-r--r--sw/source/core/inc/MarkManager.hxx2
-rw-r--r--sw/source/core/text/inftxt.cxx2
-rw-r--r--sw/source/core/text/itrform2.cxx2
-rw-r--r--sw/source/core/text/redlnitr.cxx2
-rw-r--r--sw/source/core/txtnode/modeltoviewhelper.cxx4
-rw-r--r--sw/source/core/unocore/unotext.cxx4
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx4
-rw-r--r--sw/source/uibase/shells/textfld.cxx6
-rw-r--r--sw/source/uibase/shells/textsh1.cxx8
-rw-r--r--sw/source/uibase/uno/loktxdoc.cxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx4
19 files changed, 35 insertions, 32 deletions
diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index e86a4efc8f1a..d53f180d3fe9 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -329,7 +329,7 @@ class IDocumentMarkAccess
/// get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
virtual ::sw::mark::IFieldmark* getFieldmarkAt(const SwPosition& rPos) const =0;
- virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) const =0;
+ virtual sw::mark::IFieldmark* getInnerFieldmarkFor(const SwPosition& pos) const = 0;
virtual sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos, bool bLoop) const =0;
virtual sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos, bool bLoop) const =0;
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index 7beb928dd344..2b8c37114ce1 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -889,7 +889,7 @@ static auto verifyNestedFieldmark(OUString const& rTestName,
+ u"baz" + OUStringChar(CH_TXT_ATR_FIELDEND)), outerString);
// must return innermost mark
- CPPUNIT_ASSERT_EQUAL(pInner, rIDMA.getFieldmarkFor(innerPos));
+ CPPUNIT_ASSERT_EQUAL(pInner, rIDMA.getInnerFieldmarkFor(innerPos));
}
void Test::testNestedFieldmark()
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
index 53d2538538d8..e296bd50e8fe 100644
--- a/sw/source/core/crsr/crbm.cxx
+++ b/sw/source/core/crsr/crbm.cxx
@@ -287,7 +287,7 @@ bool SwCursorShell::IsFormProtected()
{
// TODO: Refactor
SwPosition pos(*GetCursor()->Start());
- return getIDocumentMarkAccess()->getFieldmarkFor(pos);
+ return getIDocumentMarkAccess()->getInnerFieldmarkFor(pos);
}
sw::mark::IFieldmark* SwCursorShell::GetFieldmarkAfter(bool bLoop)
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 954e9ba6707c..966127cece62 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1612,7 +1612,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
if( !bRet && IsAttrAtPos::FormControl & rContentAtPos.eContentAtPos )
{
IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
- sw::mark::IFieldmark* pFieldBookmark = pMarksAccess->getFieldmarkFor( aPos );
+ sw::mark::IFieldmark* pFieldBookmark = pMarksAccess->getInnerFieldmarkFor(aPos);
if (bCursorFoundExact && pFieldBookmark)
{
rContentAtPos.eContentAtPos = IsAttrAtPos::FormControl;
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index bc3f9d7104a2..5b424358649c 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -880,8 +880,8 @@ bool SwPaM::HasReadonlySel(bool bFormView, bool const isReplace) const
const SwDoc& rDoc = GetDoc();
// Legacy text/combo/checkbox: never return read-only when inside these form fields.
const IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess();
- sw::mark::IFieldmark* pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : nullptr;
- sw::mark::IFieldmark* pB = GetMark() ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA;
+ sw::mark::IFieldmark* pA = GetPoint() ? pMarksAccess->getInnerFieldmarkFor(*GetPoint()) : nullptr;
+ sw::mark::IFieldmark* pB = GetMark() ? pMarksAccess->getInnerFieldmarkFor(*GetMark()) : pA;
// prevent the user from accidentally deleting the field itself when modifying the text.
const bool bAtStartA = (pA != nullptr) && (pA->GetMarkStart() == *GetPoint());
const bool bAtStartB = (pB != nullptr) && (pB->GetMarkStart() == *GetMark());
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index e3bb1a02c8d8..0c0411b9e51b 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1423,7 +1423,7 @@ bool SwCursor::SelectWordWT( SwViewShell const * pViewShell, sal_Int16 nWordType
{
// Should we select the whole fieldmark?
const IDocumentMarkAccess* pMarksAccess = GetDoc().getIDocumentMarkAccess( );
- sw::mark::IFieldmark const*const pMark(pMarksAccess->getFieldmarkFor(*GetPoint()));
+ sw::mark::IFieldmark const*const pMark(pMarksAccess->getInnerFieldmarkFor(*GetPoint()));
if (pMark && (IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK
|| IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::MarkType::DATE_FIELDMARK))
{
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 4376278d7dc1..9881292afb30 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2271,7 +2271,7 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam )
fieldmarks.insert(m_rDoc.getIDocumentMarkAccess()->getFieldmarkAt(SwPosition(*pTextNode, j)));
break;
case CH_TXT_ATR_FIELDSEP:
- fieldmarks.insert(m_rDoc.getIDocumentMarkAccess()->getFieldmarkFor(SwPosition(*pTextNode, j)));
+ fieldmarks.insert(m_rDoc.getIDocumentMarkAccess()->getInnerFieldmarkFor(SwPosition(*pTextNode, j)));
break;
}
}
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index e4840c06bb65..5dbd88064c73 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1448,7 +1448,7 @@ namespace sw::mark
: dynamic_cast<IFieldmark*>(*pFieldmark);
}
- IFieldmark* MarkManager::getFieldmarkFor(const SwPosition& rPos) const
+ IFieldmark* MarkManager::getInnerFieldmarkFor(const SwPosition& rPos) const
{
auto itFieldmark = find_if(
m_vFieldmarks.begin(),
@@ -1457,6 +1457,9 @@ namespace sw::mark
if (itFieldmark == m_vFieldmarks.end())
return nullptr;
auto pFieldmark(*itFieldmark);
+
+ // See if any fieldmarks after the first hit are closer to rPos.
+ ++itFieldmark;
for ( ; itFieldmark != m_vFieldmarks.end()
&& (**itFieldmark).GetMarkStart() <= rPos; ++itFieldmark)
{ // find the innermost fieldmark
@@ -1565,13 +1568,13 @@ namespace sw::mark
SwEditWin& rEditWin = pSwView->GetEditWin();
SwPosition aPos(*rCursorShell.GetCursor()->GetPoint());
- IFieldmark* pFieldBM = getFieldmarkFor(aPos);
+ IFieldmark* pFieldBM = getInnerFieldmarkFor(aPos);
FieldmarkWithDropDownButton* pNewActiveFieldmark = nullptr;
if ((!pFieldBM || (pFieldBM->GetFieldname() != ODF_FORMDROPDOWN && pFieldBM->GetFieldname() != ODF_FORMDATE))
&& aPos.GetContentIndex() > 0 )
{
aPos.AdjustContent(-1);
- pFieldBM = getFieldmarkFor(aPos);
+ pFieldBM = getInnerFieldmarkFor(aPos);
}
if ( pFieldBM && (pFieldBM->GetFieldname() == ODF_FORMDROPDOWN ||
@@ -2080,7 +2083,7 @@ InsertText MakeInsertText(SwTextNode& rNode, const sal_Int32 nPos, const sal_Int
SwCursor cursor(SwPosition(rNode, nPos), nullptr);
bool isInsideFieldmarkCommand(false);
bool isInsideFieldmarkResult(false);
- while (auto const*const pMark = rNode.GetDoc().getIDocumentMarkAccess()->getFieldmarkFor(*cursor.GetPoint()))
+ while (auto const*const pMark = rNode.GetDoc().getIDocumentMarkAccess()->getInnerFieldmarkFor(*cursor.GetPoint()))
{
if (sw::mark::FindFieldSep(*pMark) < *cursor.GetPoint())
{
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index 641e8fb70695..7e9280f12aaa 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -95,7 +95,7 @@ namespace sw::mark {
virtual const_iterator_t getFieldmarksEnd() const override;
virtual sal_Int32 getFieldmarksCount() const override;
virtual ::sw::mark::IFieldmark* getFieldmarkAt(const SwPosition& rPos) const override;
- virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const override;
+ virtual sw::mark::IFieldmark* getInnerFieldmarkFor(const SwPosition& rPos) const override;
virtual sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos, bool bLoop) const override;
virtual sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos, bool bLoop) const override;
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 737b6b3b2700..a4fea746dc9d 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1152,7 +1152,7 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
{
SwPosition const aPosition(m_pFrame->MapViewToModelPos(GetIdx()));
const ::sw::mark::IMark* pFieldmark =
- m_pFrame->GetDoc().getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
+ m_pFrame->GetDoc().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPosition);
bool bIsStartMark = (TextFrameIndex(1) == GetLen()
&& CH_TXT_ATR_FIELDSTART == GetText()[sal_Int32(GetIdx())]);
if(pFieldmark) {
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 6c1f0c06a5a5..e9e9e0f685a2 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1235,7 +1235,7 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const
auto const ch(rInf.GetText()[sal_Int32(rInf.GetIdx())]);
SwTextFrame const*const pFrame(rInf.GetTextFrame());
SwPosition aPosition(pFrame->MapViewToModelPos(rInf.GetIdx()));
- sw::mark::IFieldmark *pBM = pFrame->GetDoc().getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
+ sw::mark::IFieldmark *pBM = pFrame->GetDoc().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPosition);
if(pBM != nullptr && pBM->GetFieldname( ) == ODF_FORMDATE)
{
if (ch == CH_TXT_ATR_FIELDSTART)
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index c44b527536c1..0e89b7f75a6e 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -153,7 +153,7 @@ public:
sw::mark::IFieldmark const*const pFieldmark(
m_eFieldmarkMode == sw::FieldmarkMode::ShowResult
? m_rIDMA.getFieldmarkAt(*m_oNextFieldmarkHide)
- : m_rIDMA.getFieldmarkFor(*m_oNextFieldmarkHide));
+ : m_rIDMA.getInnerFieldmarkFor(*m_oNextFieldmarkHide));
assert(pFieldmark);
m_Fieldmark.first = pFieldmark;
// for cursor travelling, there should be 2 visible chars;
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index d7ebeaf57775..21835e90b14e 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -117,7 +117,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode,
sw::mark::IFieldmark const* pFieldMark(nullptr);
while (true) // loop to skip NonTextFieldmarks, those are handled later
{
- pFieldMark = rIDMA.getFieldmarkFor(*cursor.GetPoint());
+ pFieldMark = rIDMA.getInnerFieldmarkFor(*cursor.GetPoint());
if (pFieldMark == nullptr
|| pFieldMark->GetMarkStart().GetNode().GetTextNode()->GetText()[
pFieldMark->GetMarkStart().GetContentIndex()]
@@ -136,7 +136,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode,
break;
}
assert(pFieldMark->GetMarkStart().GetNode().GetTextNode()->GetText()[pFieldMark->GetMarkStart().GetContentIndex()] != CH_TXT_ATR_FORMELEMENT);
- // getFieldmarkFor may also return one that starts at rNode,0 -
+ // getInnerFieldmarkFor may also return one that starts at rNode,0 -
// skip it, must be handled in loop below
if (pFieldMark->GetMarkStart().GetNode() < rNode)
{
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 55270c1d8ee9..a3853fb8c643 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1997,7 +1997,7 @@ void SwXText::Impl::ConvertCell(
// tdf#149649 delete any fieldmarks overlapping the cell
IDocumentMarkAccess & rIDMA(*m_pDoc->getIDocumentMarkAccess());
- while (::sw::mark::IFieldmark *const pMark = rIDMA.getFieldmarkFor(*aStartCellPam.Start()))
+ while (sw::mark::IFieldmark *const pMark = rIDMA.getInnerFieldmarkFor(*aStartCellPam.Start()))
{
if (pMark->GetMarkEnd() <= *aEndCellPam.End())
{
@@ -2025,7 +2025,7 @@ void SwXText::Impl::ConvertCell(
}
}
}
- while (::sw::mark::IFieldmark *const pMark = rIDMA.getFieldmarkFor(*aEndCellPam.End()))
+ while (sw::mark::IFieldmark *const pMark = rIDMA.getInnerFieldmarkFor(*aEndCellPam.End()))
{
if (*aStartCellPam.Start() <= pMark->GetMarkStart())
{
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 5b68a1dc94b2..2b741c322477 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2207,7 +2207,7 @@ bool MSWordExportBase::NeedTextNodeSplit( const SwTextNode& rNd, SwSoftPageBreak
if (pos < it) // previous one might have skipped over it
{
pos = it;
- while (auto const*const pMark = rIDMA.getFieldmarkFor(SwPosition(rNd, pos)))
+ while (auto const*const pMark = rIDMA.getInnerFieldmarkFor(SwPosition(rNd, pos)))
{
if (pMark->GetMarkEnd().GetNode() != rNd)
{
@@ -2544,7 +2544,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
{
SwPosition aPosition(rNode, nCurrentPos);
// the innermost field is the correct one
- ::sw::mark::IFieldmark const*const pFieldmark = pMarkAccess->getFieldmarkFor(aPosition);
+ sw::mark::IFieldmark const*const pFieldmark = pMarkAccess->getInnerFieldmarkFor(aPosition);
assert(pFieldmark);
// DateFieldmark / ODF_FORMDATE is not a field...
if (pFieldmark->GetFieldname() != ODF_FORMDATE)
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index a71ca8702f2f..b60df6477bf5 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -1128,7 +1128,7 @@ FIELD_INSERT:
IDocumentMarkAccess& rIDMA = *rSh.getIDocumentMarkAccess();
SwPosition& rCursor = *rSh.GetCursor()->GetPoint();
- sw::mark::IFieldmark* pFieldmark = rIDMA.getFieldmarkFor(rCursor);
+ sw::mark::IFieldmark* pFieldmark = rIDMA.getInnerFieldmarkFor(rCursor);
if (!pFieldmark)
{
break;
@@ -1353,12 +1353,12 @@ void SwTextShell::StateField( SfxItemSet &rSet )
{
// Check whether we are in a text form field
SwPosition aCursorPos(*rSh.GetCursor()->GetPoint());
- sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aCursorPos);
+ sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getInnerFieldmarkFor(aCursorPos);
if ((!pFieldBM || pFieldBM->GetFieldname() != ODF_FORMTEXT)
&& aCursorPos.GetContentIndex() > 0)
{
SwPosition aPos(*aCursorPos.GetContentNode(), aCursorPos.GetContentIndex() - 1);
- pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+ pFieldBM = GetShell().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
}
if (pFieldBM && pFieldBM->GetFieldname() == ODF_FORMTEXT &&
(aCursorPos > pFieldBM->GetMarkStart() && aCursorPos < pFieldBM->GetMarkEnd() ))
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 3ef16213576c..96c48c7df072 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1885,11 +1885,11 @@ void SwTextShell::Execute(SfxRequest &rReq)
case SID_FM_CTL_PROPERTIES:
{
SwPosition aPos(*GetShell().GetCursor()->GetPoint());
- sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+ sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
if ( !pFieldBM )
{
aPos.AdjustContent(-1);
- pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+ pFieldBM = GetShell().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
}
if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN
@@ -2718,11 +2718,11 @@ void SwTextShell::GetState( SfxItemSet &rSet )
// Enable it if we have a valid object other than what form shell knows
SwPosition aPos(*GetShell().GetCursor()->GetPoint());
- sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+ sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
if ( !pFieldBM && aPos.GetContentIndex() > 0)
{
aPos.AdjustContent(-1);
- pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+ pFieldBM = GetShell().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
}
if ( pFieldBM && (pFieldBM->GetFieldname() == ODF_FORMDROPDOWN || pFieldBM->GetFieldname() == ODF_FORMDATE) )
{
diff --git a/sw/source/uibase/uno/loktxdoc.cxx b/sw/source/uibase/uno/loktxdoc.cxx
index f9e6b0707fcb..4843af4cf443 100644
--- a/sw/source/uibase/uno/loktxdoc.cxx
+++ b/sw/source/uibase/uno/loktxdoc.cxx
@@ -125,7 +125,7 @@ void GetTextFormField(tools::JsonWriter& rJsonWriter, SwDocShell* pDocShell,
IDocumentMarkAccess& rIDMA = *pDocShell->GetDoc()->getIDocumentMarkAccess();
SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
SwPosition& rCursor = *pWrtShell->GetCursor()->GetPoint();
- sw::mark::IFieldmark* pFieldmark = rIDMA.getFieldmarkFor(rCursor);
+ sw::mark::IFieldmark* pFieldmark = rIDMA.getInnerFieldmarkFor(rCursor);
auto typeNode = rJsonWriter.startNode("field");
if (!pFieldmark)
{
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 3ee457723a40..effdfcd30f63 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3352,11 +3352,11 @@ void SwXTextDocument::executeFromFieldEvent(const StringMap& aArguments)
sal_Int32 nSelection = aIter->second.toInt32();
SwPosition aPos(*m_pDocShell->GetWrtShell()->GetCursor()->GetPoint());
- sw::mark::IFieldmark* pFieldBM = m_pDocShell->GetWrtShell()->getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+ sw::mark::IFieldmark* pFieldBM = m_pDocShell->GetWrtShell()->getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
if ( !pFieldBM )
{
aPos.AdjustContent(-1);
- pFieldBM = m_pDocShell->GetWrtShell()->getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+ pFieldBM = m_pDocShell->GetWrtShell()->getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
}
if (pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN)
{