diff options
author | David Tardon <dtardon@redhat.com> | 2017-01-17 19:13:28 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2017-01-29 20:21:29 +0100 |
commit | 69c03000038e96d120f57b8259763e27907b8470 (patch) | |
tree | 996476144e64fcaa0a9c9044553c4e35df953cee /writerperfect/source/impress | |
parent | 05ce36d2e2bada48ee97d6a7c45e3bcf71dff29a (diff) |
eliminate some code duplicity
Change-Id: I7792ddd691f81744971d45e1155e3192b24155dc
Diffstat (limited to 'writerperfect/source/impress')
-rw-r--r-- | writerperfect/source/impress/KeynoteImportFilter.cxx | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx index 143131fd65b5..5aa2a6b48c92 100644 --- a/writerperfect/source/impress/KeynoteImportFilter.cxx +++ b/writerperfect/source/impress/KeynoteImportFilter.cxx @@ -10,7 +10,6 @@ #include <memory> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/container/XChild.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/ucb/XContent.hpp> @@ -48,7 +47,6 @@ using writerperfect::DocumentHandler; using writerperfect::WPXSvInputStream; namespace beans = com::sun::star::beans; -namespace container = com::sun::star::container; namespace ucb = com::sun::star::ucb; bool KeynoteImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdpGenerator &rGenerator, utl::MediaDescriptor &) @@ -159,25 +157,21 @@ OUString SAL_CALL KeynoteImportFilter::detect(css::uno::Sequence< css::beans::Pr 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()) + const std::shared_ptr<writerperfect::DirectoryStream> pDir = writerperfect::DirectoryStream::createForParent(xContent); + input = pDir; + if (bool(input)) { - const Reference < ucb::XContent > xPackageContent(xChild->getParent(), UNO_QUERY); - if (xPackageContent.is()) + 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; - } - 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(); - } + xContent = pDir->getContent(); + 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(); } } } |