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 const char * aTmp[] =
69 "application/vnd.oasis.openoffice.",
70 "application/x-vnd.oasis.openoffice.",
71 "application/vnd.oasis.opendocument.",
72 "application/x-vnd.oasis.document.",
75 for (
int k=0; aTmp[k]; k++)
77 OUString sTmpString = OUString::createFromAscii(aTmp[k]);
78 if( rValue.matchAsciiL( aTmp[k], sTmpString.getLength() ) )
80 aClass = rValue.copy( sTmpString.getLength() );
85 if( !pMutableAttrList )
88 xAttrList = pMutableAttrList;
104 Reference< XPropertySetInfo > xPropSetInfo(
105 rPropSet->getPropertySetInfo() );
106 OUString aPropName(
"Class");
107 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( aPropName ) )
109 Any aAny = rPropSet->getPropertyValue( aPropName );
114 if( !aClass.isEmpty() )
116 if( !pMutableAttrList )
119 xAttrList = pMutableAttrList;
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
sal_uInt16 GetKeyByAttrName(const OUString &rAttrName, OUString *pPrefix, OUString *pLocalName, OUString *pNamespace) const
css::uno::Any const & rValue
XMLDocumentTransformerContext(XMLTransformerBase &rTransformer, const OUString &rQName)
virtual sal_Int16 SAL_CALL getLength() override
void SetValueByIndex(sal_Int16 i, const OUString &rValue)
void AddAttribute(const OUString &sName, const OUString &sValue)
void RenameAttributeByIndex(sal_Int16 i, const OUString &rNewName)
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
XMLTransformerBase & GetTransformer()
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Handling of tokens in XML: