10from xml.dom
import minidom
15 nsToken = ns.replace(
'-',
'_')
17#ifndef INCLUDED_OOXML_FACTORY_%s_HXX
18#define INCLUDED_OOXML_FACTORY_%s_HXX
19#include "ooxml/OOXMLFactory.hxx"
20#include "OOXMLFactory_generated.hxx"
21#include "oox/token/namespaces.hxx"
22#include "ooxml/resourceids.hxx"
23#include "tools/ref.hxx"
25namespace writerfilter {
29""" % (nsToken.upper(), nsToken.upper()))
31 print(
"""class OOXMLFactory_%s : public OOXMLFactory_ns
34 typedef tools::SvRef<OOXMLFactory_ns> Pointer_t;
36 static Pointer_t getInstance();
38 virtual const AttributeInfo* getAttributeInfoArray(Id nId);
39 virtual bool getElementId(Id nDefine, Id nId, ResourceType& rOutResource, Id& rOutElement);
40 virtual bool getListValue(Id nId, std::string_view aValue, sal_uInt32& rOutValue);
41 virtual Id getResourceId(Id nDefine, sal_Int32 nToken);
45 for nsNode
in [i
for i
in model.getElementsByTagName(
"namespace")
if i.getAttribute(
"name") == ns]:
46 for resource
in nsNode.getElementsByTagName(
"resource"):
47 for action
in [i.getAttribute(
"name")
for i
in resource.childNodes
if i.nodeType == minidom.Node.ELEMENT_NODE
and i.tagName ==
"action"]:
48 if action !=
"characters" and action
not in actions:
49 actions.append(action)
50 for action
in actions:
51 print(
" void %sAction(OOXMLFastContextHandler* pHandler);" % action)
53 print(
"""virtual void charactersAction(OOXMLFastContextHandler* pHandler, const OUString & sText);
54 virtual void attributeAction(OOXMLFastContextHandler* pHandler, Token_t nToken, const OOXMLValue::Pointer_t& pValue);
56 virtual ~OOXMLFactory_%s();
59 static Pointer_t m_pInstance;
63""" % (nsToken, nsToken))
67#endif //INCLUDED_OOXML_FACTORY_%s_HXX""" % nsToken.upper())
70modelPath = sys.argv[1]
72model = minidom.parse(modelPath)
73ns = filePath.split(
'OOXMLFactory_')[1].split(
'.hxx')[0]
def createHeader(model, ns)