writerperfect/source/impress/KeynoteImportFilter.cxx | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-)
New commits: commit 8b518739e41ead554630777d7cb7bdfcc23f434c Author: David Tardon <dtar...@redhat.com> Date: Wed Jul 16 15:23:48 2014 +0200 make keynote detection a bit more robust Change-Id: I947bc5867a6b61a923d47cad48d04ab5fc2769c9 diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx index 4b7b029..f324a1f 100644 --- a/writerperfect/source/impress/KeynoteImportFilter.cxx +++ b/writerperfect/source/impress/KeynoteImportFilter.cxx @@ -256,7 +256,8 @@ throw( com::sun::star::uno::RuntimeException, std::exception ) if ( confidence == libetonyek::EtonyekDocument::CONFIDENCE_SUPPORTED_PART ) { - assert( !bIsPackage ); + if ( bIsPackage ) // we passed a directory stream, but the filter claims it's APXL file? + return OUString(); const Reference < container::XChild > xChild( xContent, UNO_QUERY ); if ( xChild.is() ) @@ -271,6 +272,12 @@ throw( com::sun::star::uno::RuntimeException, std::exception ) bUCBContentChanged = true; bIsPackage = true; } + else + { + // The passed stream has been detected as APXL file, but its parent dir is not a valid Keynote + // package? Something is wrong here... + return OUString(); + } } } } commit c10390a681a4d4696d45a6d38f7d01829f368daa 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 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