summaryrefslogtreecommitdiff
path: root/sw/source/uibase/shells/textfld.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-12-21 14:51:08 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-12-21 18:48:15 +0000
commit16075474819696f920979969474aa8300f4af530 (patch)
treec451d4a341e90a29da5b38406888832ec07838ce /sw/source/uibase/shells/textfld.cxx
parent47f66915f8d8f2418811417ad4b1109f31dee492 (diff)
sw, field insert: handle the Content param for refmarks and accept HTML there
Creating a bookmark just to refer to it is a bit hacky, refmarks are the proper solution to that. But while .uno:InsertBookmark allows specifying custom HTML for the content of the created bookmark, there is no matching UNO command that would do the same for refmarks. Fix the problem by extending .uno:InsertField: - add a TypeName parameter, so TypeName=SetRef can be used in macros, which is more readable than Type=12 - handle the previously ignored Content parameter when creating a refmark and accept HTML there to allow rich formatting Note that unlike bookmarks, refmarks are text attributes in a text node, so in case multi-paragraph HTML would be provided, the created refmark will only cover the content till the end of the first paragraph. Also not that unlike fieldmarks and bookmarks, a refmark can only represent a reference, not a bibliography, we'll need sections for that. Change-Id: I4d95f0a6e5618f1b611f7431e9189a63ee75d349 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144646 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/uibase/shells/textfld.cxx')
-rw-r--r--sw/source/uibase/shells/textfld.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 1efdf57abed0..12cc13a15bd2 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -277,6 +277,11 @@ void SwTextShell::ExecField(SfxRequest &rReq)
if( const SfxUInt16Item* pTypeItem = pArgs->GetItemIfSet( FN_PARAM_FIELD_TYPE,
false ))
nType = static_cast<SwFieldTypesEnum>(pTypeItem->GetValue());
+ else if (pArgs->GetItemState(FN_PARAM_4, false, &pItem) == SfxItemState::SET)
+ {
+ const OUString& rTypeName = static_cast<const SfxStringItem *>(pItem)->GetValue();
+ nType = SwFieldTypeFromString(rTypeName);
+ }
if( const SfxUInt16Item* pSubtypeItem = pArgs->GetItemIfSet( FN_PARAM_FIELD_SUBTYPE,
false ))
nSubType = pSubtypeItem->GetValue();