summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/txtflde.hxx1
-rw-r--r--xmloff/source/core/xmltoken.cxx1
-rw-r--r--xmloff/source/text/txtflde.cxx32
-rw-r--r--xmloff/source/text/txtfldi.cxx5
-rw-r--r--xmloff/source/token/tokens.txt1
5 files changed, 40 insertions, 0 deletions
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx
index 8670cac40cf6..459dea29f550 100644
--- a/xmloff/inc/txtflde.hxx
+++ b/xmloff/inc/txtflde.hxx
@@ -119,6 +119,7 @@ enum FieldIdEnum {
FIELD_ID_REF_BOOKMARK, // get reference field (bookmark)
FIELD_ID_REF_FOOTNOTE, // get reference field (footnote)
FIELD_ID_REF_ENDNOTE, // get reference field (endnote)
+ FIELD_ID_REF_STYLE, // styleref field
FIELD_ID_DDE, // DDE field
FIELD_ID_BIBLIOGRAPHY, // bibliography index entry
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 806d3a6e74e8..6c0eb58b9ef7 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1911,6 +1911,7 @@ namespace xmloff::token {
TOKEN( "structure-protected", XML_STRUCTURE_PROTECTED ),
TOKEN( "style", XML_STYLE ),
TOKEN( "style-name", XML_STYLE_NAME ),
+ TOKEN( "style-ref", XML_STYLE_REF ),
TOKEN( "styles", XML_STYLES ),
TOKEN( "stylesheet", XML_STYLESHEET ),
TOKEN( "sub-table", XML_SUB_TABLE ),
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 853df896f8c0..d27cb0e2f6a7 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -564,6 +564,9 @@ enum FieldIdEnum XMLTextFieldExport::MapFieldName(
case ReferenceFieldSource::ENDNOTE:
nToken = FIELD_ID_REF_ENDNOTE;
break;
+ case ReferenceFieldSource::STYLE:
+ nToken = FIELD_ID_REF_STYLE;
+ break;
default:
nToken = FIELD_ID_UNKNOWN;
break;
@@ -704,6 +707,7 @@ bool XMLTextFieldExport::IsStringField(
case FIELD_ID_REF_BOOKMARK:
case FIELD_ID_REF_FOOTNOTE:
case FIELD_ID_REF_ENDNOTE:
+ case FIELD_ID_REF_STYLE:
case FIELD_ID_MACRO:
case FIELD_ID_TEMPLATE_NAME:
case FIELD_ID_CHAPTER:
@@ -915,6 +919,7 @@ void XMLTextFieldExport::ExportFieldAutoStyle(
case FIELD_ID_REF_BOOKMARK:
case FIELD_ID_REF_FOOTNOTE:
case FIELD_ID_REF_ENDNOTE:
+ case FIELD_ID_REF_STYLE:
case FIELD_ID_MACRO:
case FIELD_ID_REFPAGE_SET:
case FIELD_ID_REFPAGE_GET:
@@ -1647,6 +1652,30 @@ void XMLTextFieldExport::ExportFieldHelper(
sPresentation);
break;
+ case FIELD_ID_REF_STYLE:
+ {
+ ProcessString(XML_REFERENCE_FORMAT,
+ MapReferenceType(GetInt16Property(gsPropertyReferenceFieldPart, rPropSet)),
+ XML_TEMPLATE);
+ ProcessString(XML_REF_NAME, GetStringProperty(gsPropertySourceName, rPropSet));
+ if (xPropSetInfo->hasPropertyByName(gsPropertyReferenceFieldLanguage)
+ && GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
+ {
+ // export text:reference-language attribute, if not empty
+ ProcessString(XML_REFERENCE_LANGUAGE,
+ GetStringProperty(gsPropertyReferenceFieldLanguage, rPropSet), true,
+ XML_NAMESPACE_LO_EXT);
+ }
+ SvXMLElementExport aElem(
+ GetExport(),
+ XML_NAMESPACE_LO_EXT,
+ MapReferenceSource(GetInt16Property(gsPropertyReferenceFieldSource, rPropSet)),
+ false,
+ false);
+ GetExport().Characters(sPresentation);
+ break;
+ }
+
case FIELD_ID_DDE:
// name from field master
ProcessString(XML_CONNECTION_NAME,
@@ -3159,6 +3188,9 @@ enum XMLTokenEnum XMLTextFieldExport::MapReferenceSource(sal_Int16 nType)
case ReferenceFieldSource::ENDNOTE:
eElement = XML_NOTE_REF;
break;
+ case ReferenceFieldSource::STYLE:
+ eElement = XML_STYLE_REF;
+ break;
default:
OSL_FAIL("unknown reference source");
break;
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 05d95281ef1b..d51d1fb06316 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -407,6 +407,7 @@ XMLTextFieldImportContext::CreateTextFieldImportContext(
case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
case XML_ELEMENT(TEXT, XML_NOTE_REF):
case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
+ case XML_ELEMENT(TEXT, XML_STYLE_REF):
pContext = new XMLReferenceFieldImportContext( rImport, rHlp, nToken );
break;
@@ -2509,6 +2510,9 @@ void XMLReferenceFieldImportContext::startFastElement(
case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
nSource = ReferenceFieldSource::SEQUENCE_FIELD;
break;
+ case XML_ELEMENT(TEXT, XML_STYLE_REF):
+ nSource = ReferenceFieldSource::STYLE;
+ break;
default:
XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElementToken);
bTypeOK = false;
@@ -2577,6 +2581,7 @@ void XMLReferenceFieldImportContext::PrepareField(
{
case XML_ELEMENT(TEXT, XML_REFERENCE_REF):
case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
+ case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
xPropertySet->setPropertyValue("SourceName", Any(sName));
break;
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index acbdd629d225..50ef5d17f461 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -1811,6 +1811,7 @@ stroke-width
structure-protected
style
style-name
+style-ref
styles
stylesheet
sub-table