[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - writerperfect/source
writerperfect/source/common/DocumentHandler.cxx | 103 +++- 1 file changed, 102 insertions(+), 1 deletion(-) New commits: commit 8e6230e25d68e30b0d160710d251457fc64684de Author: osnola alo...@loria.fr Date: Wed Aug 13 09:52:05 2014 +0200 fdo#81787 attrs are already XML-encoded by libodfgen Change-Id: Icee62e1ec9cee71930bcd52dbab850396fc96efa (cherry picked from commit 46f52010e08ebc03c8a8efacd887b0ab526efaed) Reviewed-on: https://gerrit.libreoffice.org/10901 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/writerperfect/source/common/DocumentHandler.cxx b/writerperfect/source/common/DocumentHandler.cxx index be62978..d1224bf 100644 --- a/writerperfect/source/common/DocumentHandler.cxx +++ b/writerperfect/source/common/DocumentHandler.cxx @@ -20,6 +20,90 @@ namespace writerperfect { +static const unsigned char librvng_utf8_skip_data[256] = +{ +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,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,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,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,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,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,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,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,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1 +}; + +#define librvng_utf8_next_char(p) (char const *)((p) + librvng_utf8_skip_data[*((unsigned char const *)p)]) + +static void unescapeXML(const char *s, const unsigned long sz, librevenge::RVNGString res) +{ +const char *p = s; +const char *const end = p + sz; +while (p != end) +{ +const char *const next = librvng_utf8_next_char(p); +if (next end) +{ +// oops, the string is invalid +break; +} +if (p+4 = end p+1==next *p=='') +{ +// look for amp; , lt; , gt; , apos; , quot; +bool escapedChar=false; +switch(*(p+1)) +{ +case 'a': +if (p+5 = end strncmp(p,amp;,5)==0) +{ +res.append(''); +p+=5; +escapedChar=true; +} +else if (p+6 = end strncmp(p,apos;,6)==0) +{ +res.append('\''); +p+=6; +escapedChar=true; +} +break; +case 'g': +if (strncmp(p,gt;,4)==0) +{ +res.append(''); +p+=4; +escapedChar=true; +} +break; +case 'l': +if (strncmp(p,lt;,4)==0) +{ +res.append(''); +p+=4; +escapedChar=true; +} +break; +case 'q': +if (p+6 = end strncmp(p,quot;,6)==0) +{ +res.append(''); +p+=6; +escapedChar=true; +} +break; +default: +break; +} +if (escapedChar) continue; +} + +while (p != next) { +res.append(*p); +++p; +} +p = next; +} +} + using com::sun::star::uno::Reference; using com::sun::star::xml::sax::XAttributeList; using com::sun::star::xml::sax::XDocumentHandler; @@ -49,8 +133,25 @@ void DocumentHandler::startElement(const char *psName, const librevenge::RVNGPro // filter out librevenge elements if (strncmp(i.key(), librevenge, 10) != 0) { -OUString sName(i.key(), strlen(i.key()), RTL_TEXTENCODING_UTF8); +size_t keyLength=strlen(i.key()); +OUString sName(i.key(), keyLength, RTL_TEXTENCODING_UTF8); OUString sValue(i()-getStr().cstr(), strlen(i()-getStr().cstr()), RTL_TEXTENCODING_UTF8); + +// libodfgen xml-encodes some attribute's value, so check if the value is encoded or not +for (int j=0; j9; ++j) { +// list of the encoded attributes followed by their lengths +static char const *(listEncoded[9])={ +draw:name, svg:font-family, style:condition, style:num-prefix, style:num-suffix, +table:formula, text:bullet-char, text:label, xlink:href +}; +static size_t const (listEncodedLength[9])={9,15,15,16,16,13,16,10,10}; +if (keyLength==listEncodedLength[j] strncmp(i.key(), listEncoded[j], keyLength)==0) { +librevenge::RVNGString decodedValue(); +
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - writerperfect/source
writerperfect/source/impress/KeynoteImportFilter.cxx | 36 +-- 1 file changed, 18 insertions(+), 18 deletions(-) New commits: commit 7e68478edc0ad24c11657d12ed4f8289393ce1d2 Author: David Tardon dtar...@redhat.com Date: Wed Jul 16 15:13:36 2014 +0200 fdo#81113 always run the actual detection The old code only run detection if an UCBContent property was passed. That means that any time the function got only InputStream, it claimed that it was a Keynote presentation. Change-Id: I377828229e7e95384257bde247612d7768307581 (cherry picked from commit c10390a681a4d4696d45a6d38f7d01829f368daa) Reviewed-on: https://gerrit.libreoffice.org/10357 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx index 5edbfa9..4b7b029 100644 --- a/writerperfect/source/impress/KeynoteImportFilter.cxx +++ b/writerperfect/source/impress/KeynoteImportFilter.cxx @@ -247,29 +247,29 @@ throw( com::sun::star::uno::RuntimeException, std::exception ) { return OUString(); } +} -libetonyek::EtonyekDocument::Type type = libetonyek::EtonyekDocument::TYPE_UNKNOWN; -const libetonyek::EtonyekDocument::Confidence confidence = libetonyek::EtonyekDocument::isSupported( input.get(), type ); -if ((libetonyek::EtonyekDocument::CONFIDENCE_NONE == confidence) || (libetonyek::EtonyekDocument::TYPE_KEYNOTE != type)) -return OUString(); +libetonyek::EtonyekDocument::Type type = libetonyek::EtonyekDocument::TYPE_UNKNOWN; +const libetonyek::EtonyekDocument::Confidence confidence = libetonyek::EtonyekDocument::isSupported( input.get(), type ); +if ((libetonyek::EtonyekDocument::CONFIDENCE_NONE == confidence) || (libetonyek::EtonyekDocument::TYPE_KEYNOTE != type)) +return OUString(); -if ( confidence == libetonyek::EtonyekDocument::CONFIDENCE_SUPPORTED_PART ) -{ -assert( !bIsPackage ); +if ( confidence == libetonyek::EtonyekDocument::CONFIDENCE_SUPPORTED_PART ) +{ + assert( !bIsPackage ); -const Reference container::XChild xChild( xContent, UNO_QUERY ); -if ( xChild.is() ) +const Reference container::XChild xChild( xContent, UNO_QUERY ); +if ( xChild.is() ) +{ +const Reference ucb::XContent xPackageContent( xChild-getParent(), UNO_QUERY ); +if ( xPackageContent.is() ) { -const Reference ucb::XContent xPackageContent( xChild-getParent(), UNO_QUERY ); -if ( xPackageContent.is() ) +input.reset( new writerperfect::DirectoryStream( xPackageContent ) ); +if ( libetonyek::EtonyekDocument::CONFIDENCE_EXCELLENT == libetonyek::EtonyekDocument::isSupported( input.get() ) ) { -input.reset( new writerperfect::DirectoryStream( xPackageContent ) ); -if ( libetonyek::EtonyekDocument::CONFIDENCE_EXCELLENT == libetonyek::EtonyekDocument::isSupported( input.get() ) ) -{ -xContent = xPackageContent; -bUCBContentChanged = true; -bIsPackage = true; -} +xContent = xPackageContent; +bUCBContentChanged = true; +bIsPackage = true; } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - writerperfect/source
writerperfect/source/common/DocumentHandler.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit eb39e42457578200749389611effc1cb2cdba3e8 Author: David Tardon dtar...@redhat.com Date: Sat Jun 7 19:03:21 2014 +0200 oops, libwpd - librevenge Change-Id: I17562f0231d54ba46d009f3270af1d5e729f40a9 (cherry picked from commit f18548eb689d9e5effe0ab7c01639b4d13e2f14d) diff --git a/writerperfect/source/common/DocumentHandler.cxx b/writerperfect/source/common/DocumentHandler.cxx index f36bb28..be62978 100644 --- a/writerperfect/source/common/DocumentHandler.cxx +++ b/writerperfect/source/common/DocumentHandler.cxx @@ -46,8 +46,8 @@ void DocumentHandler::startElement(const char *psName, const librevenge::RVNGPro librevenge::RVNGPropertyList::Iter i(xPropList); for (i.rewind(); i.next(); ) { -// filter out libwpd elements -if (strncmp(i.key(), libwpd, 6) != 0) +// filter out librevenge elements +if (strncmp(i.key(), librevenge, 10) != 0) { OUString sName(i.key(), strlen(i.key()), RTL_TEXTENCODING_UTF8); OUString sValue(i()-getStr().cstr(), strlen(i()-getStr().cstr()), RTL_TEXTENCODING_UTF8); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits