writerfilter: convert ResourceType to scoped enum
and drop unused constant StreamProperties Change-Id: I6a358cf7914412231d6c8f926a0d2fbd4bb8009b Reviewed-on: https://gerrit.libreoffice.org/33885 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -63,7 +63,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
|
||||
|
||||
switch (pAttr->m_nResource)
|
||||
{
|
||||
case RT_Boolean:
|
||||
case ResourceType::Boolean:
|
||||
{
|
||||
const char *pValue = "";
|
||||
pAttribs->getAsChar(nToken, pValue);
|
||||
@@ -72,7 +72,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
|
||||
pFactory->attributeAction(pHandler, nToken, xValue);
|
||||
}
|
||||
break;
|
||||
case RT_String:
|
||||
case ResourceType::String:
|
||||
{
|
||||
OUString aValue(pAttribs->getValue(nToken));
|
||||
OOXMLValue::Pointer_t xValue(new OOXMLStringValue(aValue));
|
||||
@@ -80,7 +80,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
|
||||
pFactory->attributeAction(pHandler, nToken, xValue);
|
||||
}
|
||||
break;
|
||||
case RT_Integer:
|
||||
case ResourceType::Integer:
|
||||
{
|
||||
sal_Int32 nValue;
|
||||
pAttribs->getAsInteger(nToken,nValue);
|
||||
@@ -89,7 +89,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
|
||||
pFactory->attributeAction(pHandler, nToken, xValue);
|
||||
}
|
||||
break;
|
||||
case RT_Hex:
|
||||
case ResourceType::Hex:
|
||||
{
|
||||
const char *pValue = "";
|
||||
pAttribs->getAsChar(nToken, pValue);
|
||||
@@ -98,7 +98,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
|
||||
pFactory->attributeAction(pHandler, nToken, xValue);
|
||||
}
|
||||
break;
|
||||
case RT_UniversalMeasure:
|
||||
case ResourceType::UniversalMeasure:
|
||||
{
|
||||
const char *pValue = "";
|
||||
pAttribs->getAsChar(nToken, pValue);
|
||||
@@ -107,7 +107,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
|
||||
pFactory->attributeAction(pHandler, nToken, xValue);
|
||||
}
|
||||
break;
|
||||
case RT_List:
|
||||
case ResourceType::List:
|
||||
{
|
||||
sal_uInt32 nValue;
|
||||
if (pFactory->getListValue(pAttr->m_nRef, Attribs->getValue(nToken), nValue))
|
||||
|
@@ -32,34 +32,33 @@
|
||||
namespace writerfilter {
|
||||
namespace ooxml {
|
||||
|
||||
enum ResourceType_t {
|
||||
RT_NoResource,
|
||||
RT_Table,
|
||||
RT_Stream,
|
||||
RT_StreamProperties,
|
||||
RT_List,
|
||||
RT_Integer,
|
||||
RT_Properties,
|
||||
RT_Hex,
|
||||
RT_String,
|
||||
RT_Shape,
|
||||
RT_Boolean,
|
||||
RT_HexValue,
|
||||
RT_Value,
|
||||
RT_XNote,
|
||||
RT_TextTableCell,
|
||||
RT_TextTableRow,
|
||||
RT_TextTable,
|
||||
RT_PropertyTable,
|
||||
RT_Math,
|
||||
RT_Any,
|
||||
RT_UniversalMeasure
|
||||
enum class ResourceType {
|
||||
NoResource,
|
||||
Table,
|
||||
Stream,
|
||||
List,
|
||||
Integer,
|
||||
Properties,
|
||||
Hex,
|
||||
String,
|
||||
Shape,
|
||||
Boolean,
|
||||
HexValue,
|
||||
Value,
|
||||
XNote,
|
||||
TextTableCell,
|
||||
TextTableRow,
|
||||
TextTable,
|
||||
PropertyTable,
|
||||
Math,
|
||||
Any,
|
||||
UniversalMeasure
|
||||
};
|
||||
|
||||
struct AttributeInfo
|
||||
{
|
||||
Token_t m_nToken;
|
||||
ResourceType_t m_nResource;
|
||||
ResourceType m_nResource;
|
||||
Id m_nRef;
|
||||
};
|
||||
|
||||
@@ -79,7 +78,7 @@ public:
|
||||
virtual bool getListValue(Id nId, const OUString& rValue, sal_uInt32& rOutValue) = 0;
|
||||
virtual Id getResourceId(Id nDefine, sal_Int32 nToken) = 0;
|
||||
virtual const AttributeInfo* getAttributeInfoArray(Id nId) = 0;
|
||||
virtual bool getElementId(Id nDefine, Id nId, ResourceType_t& rOutResource, Id& rOutElement) = 0;
|
||||
virtual bool getElementId(Id nDefine, Id nId, ResourceType& rOutResource, Id& rOutElement) = 0;
|
||||
};
|
||||
|
||||
class OOXMLFactory
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
static Pointer_t getInstance();
|
||||
|
||||
virtual const AttributeInfo* getAttributeInfoArray(Id nId);
|
||||
virtual bool getElementId(Id nDefine, Id nId, ResourceType_t& rOutResource, Id& rOutElement);
|
||||
virtual bool getElementId(Id nDefine, Id nId, ResourceType& rOutResource, Id& rOutElement);
|
||||
virtual bool getListValue(Id nId, const OUString& rValue, sal_uInt32& rOutValue);
|
||||
virtual Id getResourceId(Id nDefine, sal_Int32 nToken);
|
||||
""" % nsToken)
|
||||
|
@@ -29,7 +29,7 @@ def createFastChildContextFromFactory(model):
|
||||
|
||||
if (pFactory.get() != NULL)
|
||||
{
|
||||
ResourceType_t nResource;
|
||||
ResourceType nResource;
|
||||
Id nElementId;
|
||||
if (pFactory->getElementId(nDefine, Element, nResource, nElementId))
|
||||
{
|
||||
@@ -41,10 +41,10 @@ def createFastChildContextFromFactory(model):
|
||||
for resource in [r.getAttribute("resource") for r in model.getElementsByTagName("resource")]:
|
||||
if resource not in resources:
|
||||
resources.append(resource)
|
||||
print(""" case RT_%s:
|
||||
print(""" case ResourceType::%s:
|
||||
aResult.set(OOXMLFastHelper<OOXMLFastContextHandler%s>::createAndSetParentAndDefine(pHandler, Element, nId, nElementId));
|
||||
break;""" % (resource, resource))
|
||||
print(""" case RT_Any:
|
||||
print(""" case ResourceType::Any:
|
||||
aResult.set(createFastChildContextFromStart(pHandler, Element));
|
||||
break;
|
||||
default:
|
||||
|
@@ -151,7 +151,7 @@ def collectAttributeToResource(nsNode, defineNode):
|
||||
refName = refNode.getAttribute("name")
|
||||
for define in [i for i in getChildrenByName(getChildByName(nsNode, "grammar"), "define") if i.getAttribute("name") == refName]:
|
||||
refDefine = idForDefine(nsNode, define)
|
||||
ret_dict[attrToken] = "RT_%s, %s" % (resourceName, refDefine)
|
||||
ret_dict[attrToken] = "ResourceType::%s, %s" % (resourceName, refDefine)
|
||||
ret_order.append(attrToken)
|
||||
|
||||
return [ret_dict, ret_order]
|
||||
@@ -181,7 +181,7 @@ def factoryAttributeToResourceMap(nsNode):
|
||||
print(" {")
|
||||
print(" const static AttributeInfo info[] = {")
|
||||
print(inner)
|
||||
print(" { -1, RT_NoResource, 0 }")
|
||||
print(" { -1, ResourceType::NoResource, 0 }")
|
||||
print(" };")
|
||||
print(" return info;")
|
||||
print(" }")
|
||||
@@ -339,7 +339,7 @@ def factoryCreateElementMapInner(files, nsNode, defineNode, resourceNamespaceNod
|
||||
if len(resource):
|
||||
break
|
||||
if len(resource):
|
||||
ret[fastToken(elementNode)] = " case %s: rOutResource = RT_%s; rOutElement = %s; break;" % (fastToken(elementNode), resource, idForRef(nsNode, getChildByName(elementNode, "ref")))
|
||||
ret[fastToken(elementNode)] = " case %s: rOutResource = ResourceType::%s; rOutElement = %s; break;" % (fastToken(elementNode), resource, idForRef(nsNode, getChildByName(elementNode, "ref")))
|
||||
|
||||
return ret
|
||||
|
||||
@@ -357,7 +357,7 @@ def factoryCreateElementMapFromStart(files, nsNode):
|
||||
|
||||
|
||||
def factoryCreateElementMap(files, nsNode):
|
||||
print("""bool OOXMLFactory_%s::getElementId(Id nDefine, Id nId, ResourceType_t& rOutResource, Id& rOutElement)
|
||||
print("""bool OOXMLFactory_%s::getElementId(Id nDefine, Id nId, ResourceType& rOutResource, Id& rOutElement)
|
||||
{
|
||||
(void) rOutResource;
|
||||
(void) rOutElement;
|
||||
|
Reference in New Issue
Block a user