summaryrefslogtreecommitdiff
path: root/writerfilter/source/ooxml/OOXMLFactory.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-06-08 11:55:18 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-06-09 07:46:34 +0200
commitea890b1d4bcd6dd59db9f52dce1609c020804e24 (patch)
treec3eb894389ae12d36d7815670c591e5cccffe9c0 /writerfilter/source/ooxml/OOXMLFactory.cxx
parentfdfdea4d5af51a68f2d497cc5c3359d74c385fd5 (diff)
tdf#108408: support unit specifications for ST_HpsMeasure
w:ST_HpsMeasure is defined in ECMA-376 5th ed. Part 1, 17.18.42 as This simple type specifies that its contents contain either: * A positive whole number, whose contents consist of a measurement in half-points (equivalent to 1/144th of an inch), or * A positive decimal number immediately followed by a unit identifier. ... This simple type is a union of the following types: * The ST_PositiveUniversalMeasure simple type (§22.9.2.12). * The ST_UnsignedDecimalNumber simple type (§22.9.2.16). This patch generalizes OOXMLUniversalMeasureValue to handle standard- defined units, and introduces two typedefed specifications: OOXMLTwipsMeasureValue (which is used where UniversalMeasure was previously used), and new OOXMLHpsMeasureValue. Unit test included. Change-Id: Iccc6d46f717cb618381baf89dfd3e4bbb844b4af Reviewed-on: https://gerrit.libreoffice.org/38562 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'writerfilter/source/ooxml/OOXMLFactory.cxx')
-rw-r--r--writerfilter/source/ooxml/OOXMLFactory.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx b/writerfilter/source/ooxml/OOXMLFactory.cxx
index b951245ba376..3d28d2eafa4c 100644
--- a/writerfilter/source/ooxml/OOXMLFactory.cxx
+++ b/writerfilter/source/ooxml/OOXMLFactory.cxx
@@ -98,15 +98,24 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
pFactory->attributeAction(pHandler, nToken, xValue);
}
break;
- case ResourceType::UniversalMeasure:
+ case ResourceType::TwipsMeasure:
{
const char *pValue = "";
pAttribs->getAsChar(nToken, pValue);
- OOXMLValue::Pointer_t xValue(new OOXMLUniversalMeasureValue(pValue));
+ OOXMLValue::Pointer_t xValue(new OOXMLTwipsMeasureValue(pValue));
pHandler->newProperty(nId, xValue);
pFactory->attributeAction(pHandler, nToken, xValue);
}
break;
+ case ResourceType::HpsMeasure:
+ {
+ const char *pValue = "";
+ pAttribs->getAsChar(nToken, pValue);
+ OOXMLValue::Pointer_t xValue(new OOXMLHpsMeasureValue(pValue));
+ pHandler->newProperty(nId, xValue);
+ pFactory->attributeAction(pHandler, nToken, xValue);
+ }
+ break;
case ResourceType::List:
{
sal_uInt32 nValue;