summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-01-31 16:35:05 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-02-02 09:06:42 +0100
commit1037e3759bf178b52d16c12a811717f94ab9950a (patch)
treea16ef8d43b9de36691e903e634e6ce64256b55cd /xmloff
parent41759e1e892f37c0a51b8ee8cf9422a42230f0c9 (diff)
tdf#115319 references with Hungarian articles
Add new alternative reference formats, stored by the proposed text:reference-language attribute. This is an implementation of the ODF improvement draft published in the bug report. Note: choose Hungarian locale setting to show the new "Article a/az + Page" etc. reference formats in dialog window "Fields". Change-Id: I210d4b9a3e821fb4e45e24643bad9c70b867c89d Reviewed-on: https://gerrit.libreoffice.org/48944 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/txtflde.hxx1
-rw-r--r--xmloff/inc/txtfldi.hxx2
-rw-r--r--xmloff/source/core/xmltoken.cxx2
-rw-r--r--xmloff/source/text/txtflde.cxx22
-rw-r--r--xmloff/source/text/txtfldi.cxx4
-rw-r--r--xmloff/source/text/txtimp.cxx4
6 files changed, 35 insertions, 0 deletions
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx
index 34c867017762..909da05499ca 100644
--- a/xmloff/inc/txtflde.hxx
+++ b/xmloff/inc/txtflde.hxx
@@ -464,6 +464,7 @@ private:
const OUString sPropertyPlaceholderType;
const OUString sPropertyReferenceFieldPart;
const OUString sPropertyReferenceFieldSource;
+ const OUString sPropertyReferenceFieldLanguage;
const OUString sPropertyScriptType;
const OUString sPropertySelectedItem;
const OUString sPropertySequenceNumber;
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 5e66297a53d7..350ca6d11e0e 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -89,6 +89,7 @@ enum XMLTextFieldAttrTokens
XML_TOK_TEXTFIELD_CURRENT_VALUE,
XML_TOK_TEXTFIELD_REFERENCE_FORMAT,
+ XML_TOK_TEXTFIELD_REFERENCE_LANGUAGE,
XML_TOK_TEXTFIELD_REF_NAME,
XML_TOK_TEXTFIELD_CONNECTION_NAME,
@@ -931,6 +932,7 @@ protected:
class XMLReferenceFieldImportContext : public XMLTextFieldImportContext
{
OUString sName;
+ OUString sLanguage;
sal_uInt16 nElementToken;
sal_Int16 nSource;
sal_Int16 nType;
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index f1761339481d..26ca52d0966e 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3294,6 +3294,8 @@ namespace xmloff { namespace token {
TOKEN( "zeros-denominator-digits", XML_ZEROS_DENOMINATOR_DIGITS ),
TOKEN( "integer-fraction-delimiter", XML_INTEGER_FRACTION_DELIMITER ),
+ // for optional language-dependent reference formats
+ TOKEN( "reference-language", XML_REFERENCE_LANGUAGE ),
#if OSL_DEBUG_LEVEL > 0
{ 0, nullptr, nullptr, XML_TOKEN_END }
#else
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index c2d52cf48421..b39772a82e46 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -327,6 +327,7 @@ XMLTextFieldExport::XMLTextFieldExport( SvXMLExport& rExp,
sPropertyPlaceholderType("PlaceHolderType"),
sPropertyReferenceFieldPart("ReferenceFieldPart"),
sPropertyReferenceFieldSource("ReferenceFieldSource"),
+ sPropertyReferenceFieldLanguage("ReferenceFieldLanguage"),
sPropertyScriptType("ScriptType"),
sPropertySelectedItem("SelectedItem"),
sPropertySequenceNumber("SequenceNumber"),
@@ -1601,6 +1602,13 @@ void XMLTextFieldExport::ExportFieldHelper(
MakeSequenceRefName(
GetInt16Property(sPropertySequenceNumber, rPropSet),
GetStringProperty(sPropertySourceName, rPropSet) ) );
+ if (xPropSetInfo->hasPropertyByName(sPropertyReferenceFieldLanguage) &&
+ SvtSaveOptions().GetODFDefaultVersion() > SvtSaveOptions::ODFVER_012)
+ {
+ // export text:reference-language attribute, if not empty
+ ProcessString(XML_REFERENCE_LANGUAGE,
+ GetStringProperty(sPropertyReferenceFieldLanguage, rPropSet), true);
+ }
ExportElement(
MapReferenceSource(
GetInt16Property(sPropertyReferenceFieldSource, rPropSet)),
@@ -1616,6 +1624,13 @@ void XMLTextFieldExport::ExportFieldHelper(
XML_TEMPLATE);
ProcessString(XML_REF_NAME,
GetStringProperty(sPropertySourceName, rPropSet));
+ if (xPropSetInfo->hasPropertyByName(sPropertyReferenceFieldLanguage) &&
+ SvtSaveOptions().GetODFDefaultVersion() > SvtSaveOptions::ODFVER_012)
+ {
+ // export text:reference-language attribute, if not empty
+ ProcessString(XML_REFERENCE_LANGUAGE,
+ GetStringProperty(sPropertyReferenceFieldLanguage, rPropSet), true);
+ }
ExportElement(
MapReferenceSource(GetInt16Property(
sPropertyReferenceFieldSource, rPropSet)),
@@ -1634,6 +1649,13 @@ void XMLTextFieldExport::ExportFieldHelper(
ProcessString(XML_REF_NAME,
MakeFootnoteRefName(GetInt16Property(
sPropertySequenceNumber, rPropSet)));
+ if (xPropSetInfo->hasPropertyByName(sPropertyReferenceFieldLanguage) &&
+ SvtSaveOptions().GetODFDefaultVersion() > SvtSaveOptions::ODFVER_012)
+ {
+ // export text:reference-language attribute, if not empty
+ ProcessString(XML_REFERENCE_LANGUAGE,
+ GetStringProperty(sPropertyReferenceFieldLanguage, rPropSet), true);
+ }
ExportElement(
MapReferenceSource(GetInt16Property(
sPropertyReferenceFieldSource, rPropSet)),
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 963d0ce3fa50..fd20df679564 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -2626,6 +2626,9 @@ void XMLReferenceFieldImportContext::ProcessAttribute(
break;
}
+ case XML_TOK_TEXTFIELD_REFERENCE_LANGUAGE:
+ sLanguage = sAttrValue;
+ break;
}
// bValid: we need proper element type and name
@@ -2639,6 +2642,7 @@ void XMLReferenceFieldImportContext::PrepareField(
xPropertySet->setPropertyValue("ReferenceFieldSource", Any(nSource));
+ xPropertySet->setPropertyValue("ReferenceFieldLanguage", Any(sLanguage));
switch (nElementToken)
{
case XML_TOK_TEXT_REFERENCE_REF:
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 53e8836c846b..c8abe9651736 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -482,6 +482,10 @@ static const SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
XML_TOK_TEXTFIELD_CURRENT_VALUE },
{ XML_NAMESPACE_TEXT, XML_TABLE_TYPE, XML_TOK_TEXTFIELD_TABLE_TYPE },
{ XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_TEXT_NAME },
+ { XML_NAMESPACE_LO_EXT, XML_REFERENCE_LANGUAGE,
+ XML_TOK_TEXTFIELD_REFERENCE_LANGUAGE },
+ { XML_NAMESPACE_TEXT, XML_REFERENCE_LANGUAGE,
+ XML_TOK_TEXTFIELD_REFERENCE_LANGUAGE },
XML_TOKEN_MAP_END
};