From 278b3534e3aa27b92f7d681f086cb071df75bffd Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 4 Feb 2013 14:14:15 -0500 Subject: fdo#59426: Don't try to repair package during flat detection phase. Conflicts: comphelper/source/misc/mediadescriptor.cxx sc/source/ui/unoobj/scdetect.cxx Change-Id: I35968241a79db0aabe06e25c0efac2aa3d1c5b84 --- comphelper/inc/comphelper/mediadescriptor.hxx | 2 ++ comphelper/source/misc/mediadescriptor.cxx | 9 ++++++--- filter/source/config/cache/typedetection.cxx | 2 ++ sc/source/ui/unoobj/scdetect.cxx | 12 +++++++++--- sd/source/ui/unoidl/sddetect.cxx | 7 +++++++ sw/source/ui/uno/swdetect.cxx | 7 +++++++ 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx index 55b89a25fdf8..b8278a8f309b 100644 --- a/comphelper/inc/comphelper/mediadescriptor.hxx +++ b/comphelper/inc/comphelper/mediadescriptor.hxx @@ -113,6 +113,8 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap static const ::rtl::OUString& PROP_VIEWONLY(); static const ::rtl::OUString& PROP_DOCUMENTBASEURL(); + static const rtl::OUString& PROP_DEEPDETECTION(); + //------------------------------------------- // interface public: diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index 544d4e5c955e..e87a4e3f1957 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -306,9 +306,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_DOCUMENTBASEURL() return sProp; } -/*----------------------------------------------- - 10.03.2004 08:09 ------------------------------------------------*/ +const rtl::OUString& MediaDescriptor::PROP_DEEPDETECTION() +{ + static const rtl::OUString aProp("DeepDetection"); + return aProp; +} + MediaDescriptor::MediaDescriptor() : SequenceAsHashMap() { diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 49e5e24b9f9d..f76965b43a04 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -318,6 +318,8 @@ struct EqualByName : public std::binary_function>= bRepairPackage; else if ( lDescriptor[nProperty].Name == "DocumentTitle" ) nIndexOfDocumentTitle = nProperty; + else if (lDescriptor[nProperty].Name == "DeepDetection") + bDeepDetection = lDescriptor[nProperty].Value.get(); } // can't check the type for external filters, so set the "dont" flag accordingly @@ -392,6 +395,10 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream ) } catch( const lang::WrappedTargetException& aWrap ) { + if (!bDeepDetection) + // Bail out early unless it's a deep detection. + return OUString(); + packages::zip::ZipIOException aZipException; // repairing is done only if this type is requested from outside @@ -434,9 +441,8 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream ) aTypeName.Erase(); } - if ( aTypeName.Len() ) - pFilter = SfxFilterMatcher( String::CreateFromAscii("scalc") ).GetFilter4EA( aTypeName ); - + if ( aTypeName.Len() ) + pFilter = SfxFilterMatcher( rtl::OUString("scalc") ).GetFilter4EA( aTypeName ); } } else diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx index ba0fd114ec21..1a5da08b3d6f 100644 --- a/sd/source/ui/unoidl/sddetect.cxx +++ b/sd/source/ui/unoidl/sddetect.cxx @@ -112,6 +112,7 @@ SdFilterDetect::~SdFilterDetect() sal_Bool bRepairPackage = sal_False; sal_Bool bRepairAllowed = sal_False; + bool bDeepDetection = false; // now some parameters that can already be in the array, but may be overwritten or new inserted here // remember their indices in the case new values must be added to the array @@ -162,6 +163,8 @@ SdFilterDetect::~SdFilterDetect() lDescriptor[nProperty].Value >>= bRepairPackage; else if ( lDescriptor[nProperty].Name == "DocumentTitle" ) nIndexOfDocumentTitle = nProperty; + else if (lDescriptor[nProperty].Name == "DeepDetection") + bDeepDetection = lDescriptor[nProperty].Value.get(); } // can't check the type for external filters, so set the "dont" flag accordingly @@ -268,6 +271,10 @@ SdFilterDetect::~SdFilterDetect() } catch( const lang::WrappedTargetException& aWrap ) { + if (!bDeepDetection) + // Bail out early unless it's a deep detection. + return OUString(); + packages::zip::ZipIOException aZipException; if ( ( aWrap.TargetException >>= aZipException ) && aTypeName.Len() ) { diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index 7fec1f55a986..caac2d5bd726 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -107,6 +107,7 @@ SwFilterDetect::~SwFilterDetect() sal_Bool bRepairPackage = sal_False; sal_Bool bRepairAllowed = sal_False; + bool bDeepDetection = false; // now some parameters that can already be in the array, but may be overwritten or new inserted here // remember their indices in the case new values must be added to the array @@ -161,6 +162,8 @@ SwFilterDetect::~SwFilterDetect() lDescriptor[nProperty].Value >>= bRepairPackage; else if ( lDescriptor[nProperty].Name == "DocumentTitle" ) nIndexOfDocumentTitle = nProperty; + else if (lDescriptor[nProperty].Name == "DeepDetection") + bDeepDetection = lDescriptor[nProperty].Value.get(); } SolarMutexGuard aGuard; @@ -249,6 +252,10 @@ SwFilterDetect::~SwFilterDetect() } catch (const lang::WrappedTargetException& aWrap) { + if (!bDeepDetection) + // Bail out early unless it's a deep detection. + return OUString(); + packages::zip::ZipIOException aZipException; // repairing is done only if this type is requested from outside -- cgit