diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2014-04-28 18:31:24 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2014-05-01 17:03:48 +0000 |
commit | 4b7bdef4b1d1e4ff45a8816c038df38ce7995b3d (patch) | |
tree | cb6d82194ec4727cda762406281075a9dcb2caf5 /sw/source/filter/basflt/iodetect.cxx | |
parent | dddd9b41f59fa9857159cef70add9e2343dd1ab1 (diff) |
sw: iodetect is not a part of the type detector anymore
and remove now unused IsFileFilter method.
Change-Id: I6b4559fdf6442b6baa869b2949142f8fc8c52f30
Reviewed-on: https://gerrit.libreoffice.org/9223
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'sw/source/filter/basflt/iodetect.cxx')
-rw-r--r-- | sw/source/filter/basflt/iodetect.cxx | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx index 809b0f1559c9..8cb7e0d9fce9 100644 --- a/sw/source/filter/basflt/iodetect.cxx +++ b/sw/source/filter/basflt/iodetect.cxx @@ -195,77 +195,6 @@ void TerminateBuffer(sal_Char *pBuffer, sal_uLong nBytesRead, sal_uLong nBufferL } } -// Check if the file fits the corresponding format -// Currently we only support our own filters -bool SwIoSystem::IsFileFilter(SfxMedium& rMedium, const OUString& rFmtName) -{ - bool bRet = false; - - SfxFilterContainer aCntSw( OUString(sSWRITER) ); - SfxFilterContainer aCntSwWeb( OUString(sSWRITERWEB) ); - const SfxFilterContainer& rFltContainer = IsDocShellRegistered() ? aCntSw : aCntSwWeb; - - com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStor; - SotStorageRef xStg; - if (rMedium.IsStorage()) - xStor = rMedium.GetStorage(); - else - { - SvStream* pStream = rMedium.GetInStream(); - if ( pStream && SotStorage::IsStorageFile(pStream) ) - xStg = new SotStorage( pStream, false ); - } - - SfxFilterMatcher aMatcher( rFltContainer.GetName() ); - SfxFilterMatcherIter aIter( aMatcher ); - const SfxFilter* pFltr = aIter.First(); - while ( pFltr ) - { - const OUString& rUserData = pFltr->GetUserData(); - if (rUserData.equals(rFmtName)) - { - if( 'C' == rUserData[0] ) - { - if ( xStor.is() ) - bRet = IsValidStgFilter( xStor, *pFltr ); - else if ( xStg.Is() ) - bRet = IsValidStgFilter( *xStg, *pFltr ); - } - else if( !xStg.Is() && !xStor.is() ) - { - SvStream* pStrm = rMedium.GetInStream(); - if( pStrm && !pStrm->GetError() ) - { - sal_Char aBuffer[4098]; - const sal_uLong nMaxRead = sizeof(aBuffer) - 2; - sal_uLong nBytesRead = pStrm->Read(aBuffer, nMaxRead); - pStrm->Seek(STREAM_SEEK_TO_BEGIN); - TerminateBuffer(aBuffer, nBytesRead, sizeof(aBuffer)); - for (sal_uInt16 i = 0; i < MAXFILTER; ++i) - { - if (aFilterDetect[i].IsFilter(rFmtName)) - { - OUString sFilter(aFilterDetect[i].IsReader(aBuffer, nBytesRead)); - bRet = !sFilter.isEmpty(); - break; - } - } - } - } - //The same underlying filter can appear multiple times in the - //filter list, e.g. CWW8 filter twice, once for .doc and once for - //.dot. We just care here if its either, not enforce that it's - //both which would be a bit of an odd requirement - if (bRet) - break; - } - - pFltr = aIter.Next(); - } - - return bRet; -} - // Check the type of the stream (file) by searching for corresponding set of bytes. // If no known type is found, return ASCII for now! // Returns the internal FilterName. |