[Libreoffice-commits] core.git: writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Apr 10 13:08:59 PDT 2014


 writerfilter/source/filter/WriterFilterDetection.cxx |   54 ++++---------------
 1 file changed, 13 insertions(+), 41 deletions(-)

New commits:
commit 83c888bdb0a6c9795cebfc53fa74d6da8bb692b2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Apr 10 22:02:03 2014 +0200

    writerfilter: remove dead doctok detection code
    
    Change-Id: Ib39d54ce37b9e41ab6aff742d7680a7cd76168cd

diff --git a/writerfilter/source/filter/WriterFilterDetection.cxx b/writerfilter/source/filter/WriterFilterDetection.cxx
index d7bc8e8..b417e8c 100644
--- a/writerfilter/source/filter/WriterFilterDetection.cxx
+++ b/writerfilter/source/filter/WriterFilterDetection.cxx
@@ -71,53 +71,25 @@ OUString WriterFilterDetection::detect( uno::Sequence< beans::PropertyValue >& r
         else if ( pValues[nProperty].Name == "InputStream" )
             pValues[nProperty].Value >>= xInputStream;
     }
-    bool bBinary = sTypeName == "writer_MS_Word_97" ||
-                   sTypeName == "writer_MS_Word_97_Vorlage";
-
     try
     {
-        if(bBinary)
-        {
-            SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xInputStream );
-            if ( pStream && SotStorage::IsStorageFile(pStream) )
-
-            {
-                SotStorageRef xStg = new SotStorage( pStream, false );
-
-                bool bTable2 = xStg->IsContained(OUString("1Table"));
-                SotStorageStreamRef xRef = xStg->OpenSotStream(OUString("WordDocument"), STREAM_STD_READ | STREAM_NOCREATE );
-
-                if(bTable2 && xStg.Is())
-                {
-                    xRef->Seek(2);
-                    sal_Int16 nWord;
-                    xRef->ReadInt16( nWord );
-                    //version detection
-                    bWord = nWord >= 0x6a && nWord <= 0xc1;
-                }
-            }
-        }
+        uno::Reference< embed::XStorage > xDocStorage;
+        if ( sURL == "private:stream" )
+            xDocStorage = comphelper::OStorageHelper::GetStorageFromInputStream( xInputStream );
         else
+            xDocStorage = comphelper::OStorageHelper::GetStorageFromURL( sURL, embed::ElementModes::READ );
+        if( xDocStorage.is() )
         {
-            uno::Reference< embed::XStorage > xDocStorage;
-            if ( sURL == "private:stream" )
-                xDocStorage = comphelper::OStorageHelper::GetStorageFromInputStream( xInputStream );
-            else
-                xDocStorage = comphelper::OStorageHelper::GetStorageFromURL(
-                                            sURL, embed::ElementModes::READ );
-            if( xDocStorage.is() )
+            uno::Sequence< OUString > aNames = xDocStorage->getElementNames();
+            const OUString* pNames = aNames.getConstArray();
+            for(sal_Int32 nName = 0; nName < aNames.getLength(); ++nName)
             {
-                uno::Sequence< OUString > aNames = xDocStorage->getElementNames();
-                const OUString* pNames = aNames.getConstArray();
-                for(sal_Int32 nName = 0; nName < aNames.getLength(); ++nName)
+                if ( pNames[nName] == "word" )
                 {
-                    if ( pNames[nName] == "word" )
-                    {
-                        bWord = true;
-                        if( sTypeName.isEmpty() )
-                            sTypeName = "writer_MS_Word_2007";
-                        break;
-                    }
+                    bWord = true;
+                    if( sTypeName.isEmpty() )
+                        sTypeName = "writer_MS_Word_2007";
+                    break;
                 }
             }
         }


More information about the Libreoffice-commits mailing list