summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2020-08-18 17:59:26 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-08-28 17:30:57 +0200
commitc77b9c349f0a48392d8cb7a49532844b2cafb5ba (patch)
tree447a21904d3a18c18c8959b132409cc8ea05cf6f /sw/source/core/unocore
parentbb6668bc596e62474ed2e1e923d9c9cd51685258 (diff)
tdf#131801: sw: support of style references in ListAutoFormat
ListAutoFormat property did support char attributes, but not style references ("CharStyleName"). It is important for correct formatting of pilcrow symbol or list format in some DOCX scenarios. Export to DOCX already works, but not to RTF/DOC. Change-Id: I1bf23d1e45fcc213adcf9aa6f404be803919fbee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100893 Tested-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/unoobj.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 66bf10f7bd82..01d777dccd4b 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -519,7 +519,10 @@ SwUnoCursorHelper::SetCursorPropertyValue(
// TODO create own map for this, it contains UNO_NAME_DISPLAY_NAME? or make property readable so ODF export can map it to a automatic style?
SfxItemPropertySet const& rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE));
SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap());
- SfxItemSet items{rPam.GetDoc()->GetAttrPool(), aCharAutoFormatSetRange};
+ SfxItemSet items( rPam.GetDoc()->GetAttrPool(),
+ svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1>{} );
for (beans::NamedValue const & prop : std::as_const(props))
{
@@ -527,6 +530,11 @@ SwUnoCursorHelper::SetCursorPropertyValue(
rMap.getByName(prop.Name);
if (!pEntry)
{
+ if (prop.Name == "CharStyleName")
+ {
+ lcl_setCharStyle(rPam.GetDoc(), prop.Value, items);
+ continue;
+ }
throw beans::UnknownPropertyException(
"Unknown property: " + prop.Name);
}
@@ -540,6 +548,7 @@ SwUnoCursorHelper::SetCursorPropertyValue(
SwFormatAutoFormat item(RES_PARATR_LIST_AUTOFMT);
// TODO: for ODF export we'd need to add it to the autostyle pool
+ // note: paragraph auto styles have ParaStyleName property for the parent style; character auto styles currently do not because there's a separate hint, but for this it would be a good way to add it in order to export it as style:parent-style-name, see XMLTextParagraphExport::Add()
item.SetStyleHandle(std::make_shared<SfxItemSet>(items));
pTextNd->SetAttr(item);
}