27#include <osl/diagnose.h>
29#include <unordered_map>
36 public std::unordered_map< OUString, NameKey_Impl >
48 XMLTransformerOOoEventMap_Impl::key_type aKey;
49 XMLTransformerOOoEventMap_Impl::mapped_type
aData;
52 aKey = OUString::createFromAscii(pInit->
m_pOOoName);
54 OSL_ENSURE(
find( aKey ) ==
end(),
"duplicate event map entry" );
59 XMLTransformerOOoEventMap_Impl::value_type aVal( aKey,
aData );
61 if( !insert( aVal ).second )
63 OSL_FAIL(
"duplicate OOo event name entry" );
82 const OUString& rQName,
85 rImp.GetNamespaceMap().GetKeyByAttrValueQName(rQName, nullptr),
87 m_bPersistent( bPersistent )
109 const OUString& rName,
113 const XMLTransformerOOoEventMap_Impl::key_type& aKey( rName );
114 XMLTransformerOOoEventMap_Impl::const_iterator aIter = rMap.find( aKey );
115 if( aIter == rMap.end() )
122 rNewName = (*aIter).second.m_aLocalName;
123 return (*aIter).second.m_nPrefix;
128 const Reference< XAttributeList >& rAttrList )
132 OSL_ENSURE( pActions,
"go no actions" );
134 OUString aLocation, aMacroName;
135 sal_Int16 nMacroName = -1;
136 Reference< XAttributeList > xAttrList( rAttrList );
138 sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
139 for( sal_Int16
i=0;
i < nAttrCount;
i++ )
141 const OUString& rAttrName = xAttrList->getNameByIndex(
i );
146 XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
147 XMLTransformerActions::const_iterator aIter =
148 pActions->find( aKey );
149 if( aIter != pActions->end() )
151 if( !pMutableAttrList )
155 xAttrList = pMutableAttrList;
157 const OUString& rAttrValue = xAttrList->getValueByIndex(
i );
158 switch( (*aIter).second.m_nActionType )
164 pMutableAttrList->SetValueByIndex(
i,
169 OUString aAttrValue( rAttrValue );
170 sal_uInt16 nValPrefix =
171 static_cast<sal_uInt16
>((*aIter).second.m_nParam1);
174 pMutableAttrList->SetValueByIndex(
i, aAttrValue );
178 aLocation = rAttrValue;
179 pMutableAttrList->RemoveAttributeByIndex(
i );
184 aMacroName = rAttrValue;
190 OSL_ENSURE(
false,
"unknown action" );
196 if( nMacroName != -1 && !aLocation.isEmpty() )
200 OUString sTmp = aLocation +
":" + aMacroName;
201 pMutableAttrList->SetValueByIndex( nMacroName, sTmp );
220 const OUString& rLocalName,
221 const OUString& rQName,
222 const Reference< XAttributeList >& xAttrList )
XMLTransformerEventMapEntry const aFormTransformerEventMap[]
XMLTransformerEventMapEntry const aTransformerEventMap[]
sal_uInt16 GetKeyByAttrName(const OUString &rAttrName, OUString *pPrefix, OUString *pLocalName, OUString *pNamespace) const
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
XMLEventOOoTransformerContext(XMLTransformerBase &rTransformer, const OUString &rQName, bool bPersistent)
virtual ~XMLEventOOoTransformerContext() override
static sal_uInt16 GetEventName(const OUString &rName, OUString &rNewName, XMLTransformerOOoEventMap_Impl &rMap)
virtual rtl::Reference< XMLTransformerContext > CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const OUString &rQName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
virtual void EndElement() override
static XMLTransformerOOoEventMap_Impl * CreateEventMap()
virtual bool IsPersistent() const override
static void FlushEventMap(XMLTransformerOOoEventMap_Impl *p)
const OUString & GetExportQName() const
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
virtual void EndElement() override
virtual rtl::Reference< XMLTransformerContext > CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const OUString &rQName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
virtual rtl::Reference< XMLTransformerContext > CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const OUString &rQName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
XMLTransformerBase & GetTransformer()
constexpr OUStringLiteral aData
OSQLColumns::const_iterator find(const OSQLColumns::const_iterator &first, const OSQLColumns::const_iterator &last, std::u16string_view _rVal, const ::comphelper::UStringMixEqual &_rCase)
const sal_uInt16 XML_NAMESPACE_UNKNOWN
Handling of tokens in XML:
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
const char * m_pOASISName
sal_uInt16 const m_nOASISPrefix