20#include <com/sun/star/xml/sax/SAXException.hpp>
21#include <com/sun/star/xml/sax/XAttributeList.hpp>
22#include <com/sun/star/beans/XPropertySetInfo.hpp>
39 const OUString& rQName ) :
46 Reference< XAttributeList > xAttrList( rAttrList );
48 bool bMimeFound =
false;
55 sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
56 for( sal_Int16
i=0;
i < nAttrCount;
i++ )
58 const OUString& rAttrName = xAttrList->getNameByIndex(
i );
66 const OUString& rValue = xAttrList->getValueByIndex(
i );
67 static constexpr std::string_view aTmp[]
69 "application/vnd.oasis.openoffice.",
70 "application/x-vnd.oasis.openoffice.",
71 "application/vnd.oasis.opendocument.",
72 "application/x-vnd.oasis.document."
74 for (
const auto & rPrefix : aTmp)
76 if( rValue.matchAsciiL( rPrefix.data(), rPrefix.size() ) )
78 aClass = rValue.copy( rPrefix.size() );
83 if( !pMutableAttrList )
86 xAttrList = pMutableAttrList;
88 pMutableAttrList->SetValueByIndex(
i, aClass );
89 pMutableAttrList->RenameAttributeByIndex(
i, aClassQName );
97 const Reference< XPropertySet > rPropSet =
102 Reference< XPropertySetInfo > xPropSetInfo(
103 rPropSet->getPropertySetInfo() );
105 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
aPropName ) )
112 if( !aClass.isEmpty() )
114 if( !pMutableAttrList )
117 xAttrList = pMutableAttrList;
120 pMutableAttrList->AddAttribute( aClassQName, aClass );
sal_uInt16 GetKeyByAttrName(const OUString &rAttrName, OUString *pPrefix, OUString *pLocalName, OUString *pNamespace) const
XMLDocumentTransformerContext(XMLTransformerBase &rTransformer, const OUString &rQName)
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
XMLTransformerBase & GetTransformer()
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
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
constexpr sal_uInt16 XML_NAMESPACE_OFFICE