summaryrefslogtreecommitdiff
path: root/xmloff/source/style
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-09-28 09:37:10 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-09-28 10:27:20 +0200
commit05f863844d9a5613250e8d787e32752b270ec4d3 (patch)
tree8c8c0d5db30d3390346b586dd6ac4a91e3a34058 /xmloff/source/style
parent4dd6af856d574ad66ebb4b822a36ba70af9945e2 (diff)
sw: paragraph styles: add ODT filter for a linked character style
And the same in the other direction: link a para style from a char style. With this, the ODT filter is on par with the DOCX one for this feature. Change-Id: Idd994b933672ab47a5f87a75c92abc137d3c73b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122753 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'xmloff/source/style')
-rw-r--r--xmloff/source/style/prstylei.cxx24
-rw-r--r--xmloff/source/style/styleexp.cxx13
-rw-r--r--xmloff/source/style/xmlstyle.cxx3
3 files changed, 40 insertions, 0 deletions
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index e9ca87595f2b..5cd856b209e8 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -509,6 +509,30 @@ void XMLPropStyleContext::Finish( bool bOverwrite )
}
}
+ // Connect linked style.
+ OUString aLinked(GetLinked());
+ if (!aLinked.isEmpty())
+ {
+ if (GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH)
+ {
+ aLinked = GetImport().GetStyleDisplayName(XmlStyleFamily::TEXT_TEXT, aLinked);
+ }
+ else if (GetFamily() == XmlStyleFamily::TEXT_TEXT)
+ {
+ aLinked = GetImport().GetStyleDisplayName(XmlStyleFamily::TEXT_PARAGRAPH, aLinked);
+ }
+ }
+ if (!aLinked.isEmpty() && xPropSetInfo->hasPropertyByName("LinkStyle"))
+ {
+ uno::Any aAny = xPropSet->getPropertyValue("LinkStyle");
+ OUString aCurrentLinked;
+ aAny >>= aCurrentLinked;
+ if (aCurrentLinked != aLinked)
+ {
+ xPropSet->setPropertyValue("LinkStyle", uno::Any(aLinked));
+ }
+ }
+
if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
{
xPropSet->setPropertyValue( "Hidden", uno::makeAny( IsHidden( ) ) );
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 2c628ffbda4d..1a3a81f10c95 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -237,6 +237,19 @@ bool XMLStyleExport::exportStyle(
}
}
+ // style:linked-style-name="..." (SW paragraph and character styles only)
+ if (xPropSetInfo->hasPropertyByName("LinkStyle"))
+ {
+ aAny = xPropSet->getPropertyValue("LinkStyle");
+ OUString sLinkName;
+ aAny >>= sLinkName;
+ if (!sLinkName.isEmpty())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_LINKED_STYLE_NAME,
+ GetExport().EncodeStyleName(sLinkName));
+ }
+ }
+
// style:auto-update="..." (SW only)
if( xPropSetInfo->hasPropertyByName( gsIsAutoUpdate ) )
{
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index 38ec932fe132..00afedf82a39 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -88,6 +88,9 @@ void SvXMLStyleContext::SetAttribute( sal_Int32 nElement,
case XML_ELEMENT(STYLE, XML_NEXT_STYLE_NAME):
maFollow = rValue;
break;
+ case XML_ELEMENT(LO_EXT, XML_LINKED_STYLE_NAME):
+ maLinked = rValue;
+ break;
case XML_ELEMENT(STYLE, XML_HIDDEN):
mbHidden = rValue.toBoolean();
break;