diff options
Diffstat (limited to 'sw/source/core/edit/edfld.cxx')
-rw-r--r-- | sw/source/core/edit/edfld.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 7525a9af80af..75364a42bd1d 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -149,7 +149,7 @@ void SwEditShell::FieldToText( SwFieldType const * pType ) } /// add a field at the cursor position -void SwEditShell::Insert2(SwField const & rField, const bool bForceExpandHints) +bool SwEditShell::InsertField(SwField const & rField, const bool bForceExpandHints) { SET_CURR_SHELL( this ); StartAllAction(); @@ -159,13 +159,15 @@ void SwEditShell::Insert2(SwField const & rField, const bool bForceExpandHints) ? SetAttrMode::FORCEHINTEXPAND : SetAttrMode::DEFAULT; + bool bSuccess(false); for(const SwPaM& rPaM : GetCursor()->GetRingContainer()) // for each PaM { - const bool bSuccess(GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, aField, nInsertFlags)); + bSuccess |= GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, aField, nInsertFlags); OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed"); } EndAllAction(); + return bSuccess; } /// Are the PaMs positioned on fields? @@ -223,7 +225,7 @@ void SwEditShell::UpdateOneField(SwField &rField) if ( !pCursor->IsMultiSelection() && !pCursor->HasMark()) { - pTextField = GetTextFieldAtPos( pCursor->Start(), true ); + pTextField = GetTextFieldAtPos(pCursor->Start(), ::sw::GetTextAttrMode::Default); if (!pTextField) // #i30221# pTextField = lcl_FindInputField( GetDoc(), rField); @@ -268,7 +270,8 @@ void SwEditShell::UpdateOneField(SwField &rField) if( aPam.Start()->nContent != pCurStt->nContent ) bOkay = false; - if( nullptr != (pTextField = GetTextFieldAtPos( pCurStt, true )) ) + pTextField = GetTextFieldAtPos(pCurStt, ::sw::GetTextAttrMode::Default); + if( nullptr != pTextField ) { pFormatField = const_cast<SwFormatField*>(&pTextField->GetFormatField()); SwField *pCurField = pFormatField->GetField(); |