14#include <com/sun/star/uno/Reference.hxx>
15#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
16#include <com/sun/star/xml/sax/XAttributeList.hpp>
23 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
24 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
25 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
26 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
27 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
28 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
29 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
30 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
31 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1 };
38static void unescapeXML(
const char* s,
const unsigned long sz, librevenge::RVNGString& res)
41 const char*
const end =
p + sz;
50 if (
p + 4 <=
end &&
p + 1 == next && *
p ==
'&')
53 bool escapedChar =
false;
57 if (
p + 5 <=
end && strncmp(
p,
"&", 5) == 0)
63 else if (
p + 6 <=
end && strncmp(
p,
"'", 6) == 0)
71 if (strncmp(
p,
">", 4) == 0)
79 if (strncmp(
p,
"<", 4) == 0)
87 if (
p + 6 <=
end && strncmp(
p,
""", 6) == 0)
111using com::sun::star::xml::sax::XDocumentHandler;
116 if (SvXMLImport* pFastHandler =
dynamic_cast<SvXMLImport*
>(
mxHandler.get()))
125 const librevenge::RVNGPropertyList& xPropList)
128 librevenge::RVNGPropertyList::Iter
i(xPropList);
129 for (
i.rewind();
i.next();)
132 if (strncmp(
i.key(),
"librevenge", 10) != 0)
134 size_t keyLength = strlen(
i.key());
135 OUString
sName(
i.key(), keyLength, RTL_TEXTENCODING_UTF8);
136 OUString sValue(
i()->getStr().cstr(),
i()->getStr().len(), RTL_TEXTENCODING_UTF8);
139 for (
int j = 0; j < 9; ++j)
142 static char const* listEncoded[9]
143 = {
"draw:name",
"svg:font-family",
"style:condition",
144 "style:num-prefix",
"style:num-suffix",
"table:formula",
145 "text:bullet-char",
"text:label",
"xlink:href" };
146 static size_t const listEncodedLength[9] = { 9, 15, 15, 16, 16, 13, 16, 10, 10 };
147 if (keyLength == listEncodedLength[j]
148 && strncmp(
i.key(), listEncoded[j], keyLength) == 0)
150 librevenge::RVNGString decodedValue(
"");
152 static_cast<unsigned long>(
i()->getStr().len()), decodedValue);
154 = OUString(decodedValue.cstr(), decodedValue.len(), RTL_TEXTENCODING_UTF8);
158 pAttrList->AddAttribute(
sName, sValue);
162 OUString sElementName(psName, strlen(psName), RTL_TEXTENCODING_UTF8);
163 mxHandler->startElement(sElementName, pAttrList);
168 OUString sElementName(psName, strlen(psName), RTL_TEXTENCODING_UTF8);
174 OUString sCharU16(sCharacters.cstr(), strlen(sCharacters.cstr()), RTL_TEXTENCODING_UTF8);
SAL_DLLPRIVATE void endElement(const char *psName) override
SAL_DLLPRIVATE void endDocument() override
SAL_DLLPRIVATE void startElement(const char *psName, const librevenge::RVNGPropertyList &xPropList) override
SAL_DLLPRIVATE void startDocument() override
css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler
DocumentHandler(css::uno::Reference< css::xml::sax::XDocumentHandler > const &xHandler)
SAL_DLLPRIVATE void characters(const librevenge::RVNGString &sCharacters) override
const unsigned char librvng_utf8_skip_data[256]
static const char * librvng_utf8_next_char(const char *p)
static void unescapeXML(const char *s, const unsigned long sz, librevenge::RVNGString &res)
rtl::Reference< FragmentHandler > mxHandler