summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-28 12:29:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-28 13:25:27 +0200
commit1705fbe9daac56ee9bea8d8fd7c7f57e2bec49b5 (patch)
treeaaf39244173a4cf20df6568140ebdbe5ec055656 /writerfilter
parentdfa8e18e8e6c7ad87e423393f8293a20188de1fd (diff)
move the castToFastAttributeList function
to the slightly higher namespace, to make it easy and more readable to use directly in a for-loop-range expression. And make it return a reference rather than a pointer, since it is never allowed to be nullptr. Change-Id: I15d0b32493ef65cfc601b247c272b318f1eadfd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93049 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/ooxml/OOXMLFactory.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx b/writerfilter/source/ooxml/OOXMLFactory.cxx
index 6b2f1261f4f9..6bc7a10e8df1 100644
--- a/writerfilter/source/ooxml/OOXMLFactory.cxx
+++ b/writerfilter/source/ooxml/OOXMLFactory.cxx
@@ -39,8 +39,8 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
if (pFactory.get() == nullptr)
return;
- sax_fastparser::FastAttributeList *pAttribs =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttribs );
+ sax_fastparser::FastAttributeList& rAttribs =
+ sax_fastparser::castToFastAttributeList( xAttribs );
const AttributeInfo *pAttr = pFactory->getAttributeInfoArray(nDefine);
if (!pAttr)
@@ -49,7 +49,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
for (; pAttr->m_nToken != -1; ++pAttr)
{
sal_Int32 nToken = pAttr->m_nToken;
- sal_Int32 nAttrIndex = pAttribs->getAttributeIndex(nToken);
+ sal_Int32 nAttrIndex = rAttribs.getAttributeIndex(nToken);
if (nAttrIndex == -1)
continue;
@@ -59,7 +59,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
{
case ResourceType::Boolean:
{
- const char *pValue = pAttribs->getAsCharByIndex(nAttrIndex);
+ const char *pValue = rAttribs.getAsCharByIndex(nAttrIndex);
OOXMLValue::Pointer_t xValue(OOXMLBooleanValue::Create(pValue));
pHandler->newProperty(nId, xValue);
pFactory->attributeAction(pHandler, nToken, xValue);
@@ -67,7 +67,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case ResourceType::String:
{
- OUString aValue(pAttribs->getValueByIndex(nAttrIndex));
+ OUString aValue(rAttribs.getValueByIndex(nAttrIndex));
OOXMLValue::Pointer_t xValue(new OOXMLStringValue(aValue));
pHandler->newProperty(nId, xValue);
pFactory->attributeAction(pHandler, nToken, xValue);
@@ -75,7 +75,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case ResourceType::Integer:
{
- sal_Int32 nValue = pAttribs->getAsIntegerByIndex(nAttrIndex);
+ sal_Int32 nValue = rAttribs.getAsIntegerByIndex(nAttrIndex);
OOXMLValue::Pointer_t xValue = OOXMLIntegerValue::Create(nValue);
pHandler->newProperty(nId, xValue);
pFactory->attributeAction(pHandler, nToken, xValue);
@@ -83,7 +83,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case ResourceType::Hex:
{
- const char *pValue = pAttribs->getAsCharByIndex(nAttrIndex);
+ const char *pValue = rAttribs.getAsCharByIndex(nAttrIndex);
OOXMLValue::Pointer_t xValue(new OOXMLHexValue(pValue));
pHandler->newProperty(nId, xValue);
pFactory->attributeAction(pHandler, nToken, xValue);
@@ -91,7 +91,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case ResourceType::HexColor:
{
- const char *pValue = pAttribs->getAsCharByIndex(nAttrIndex);
+ const char *pValue = rAttribs.getAsCharByIndex(nAttrIndex);
OOXMLValue::Pointer_t xValue(new OOXMLHexColorValue(pValue));
pHandler->newProperty(nId, xValue);
pFactory->attributeAction(pHandler, nToken, xValue);
@@ -100,7 +100,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
case ResourceType::TwipsMeasure_asSigned:
case ResourceType::TwipsMeasure_asZero:
{
- const char *pValue = pAttribs->getAsCharByIndex(nAttrIndex);
+ const char *pValue = rAttribs.getAsCharByIndex(nAttrIndex);
OOXMLValue::Pointer_t xValue(new OOXMLTwipsMeasureValue(pValue));
if ( xValue->getInt() < 0 )
{
@@ -113,7 +113,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case ResourceType::HpsMeasure:
{
- const char *pValue = pAttribs->getAsCharByIndex(nAttrIndex);
+ const char *pValue = rAttribs.getAsCharByIndex(nAttrIndex);
OOXMLValue::Pointer_t xValue(new OOXMLHpsMeasureValue(pValue));
pHandler->newProperty(nId, xValue);
pFactory->attributeAction(pHandler, nToken, xValue);
@@ -121,7 +121,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case ResourceType::MeasurementOrPercent:
{
- const char *pValue = pAttribs->getAsCharByIndex(nAttrIndex);
+ const char *pValue = rAttribs.getAsCharByIndex(nAttrIndex);
OOXMLValue::Pointer_t xValue(new OOXMLMeasurementOrPercentValue(pValue));
pHandler->newProperty(nId, xValue);
pFactory->attributeAction(pHandler, nToken, xValue);
@@ -130,7 +130,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
case ResourceType::List:
{
sal_uInt32 nValue;
- if (pFactory->getListValue(pAttr->m_nRef, pAttribs->getValueByIndex(nAttrIndex), nValue))
+ if (pFactory->getListValue(pAttr->m_nRef, rAttribs.getValueByIndex(nAttrIndex), nValue))
{
OOXMLValue::Pointer_t xValue = OOXMLIntegerValue::Create(nValue);
pHandler->newProperty(nId, xValue);