[ooo-build-commit] Branch 'ooo/master' - shell/inc shell/source

Jan Holesovsky kendy at kemper.freedesktop.org
Mon Aug 10 18:04:43 PDT 2009


 shell/inc/internal/basereader.hxx                              |    2 
 shell/inc/internal/contentreader.hxx                           |    3 
 shell/inc/internal/metainforeader.hxx                          |    3 
 shell/inc/internal/propsheets.hxx                              |    1 
 shell/inc/internal/types.hxx                                   |    3 
 shell/inc/internal/zipfile.hxx                                 |   13 
 shell/source/all/makefile.mk                                   |    2 
 shell/source/all/ooofilereader/basereader.cxx                  |    9 
 shell/source/all/ooofilereader/contentreader.cxx               |   23 +
 shell/source/all/ooofilereader/makefile.mk                     |    3 
 shell/source/all/ooofilereader/metainforeader.cxx              |   42 +
 shell/source/all/zipfile/makefile.mk                           |    7 
 shell/source/all/zipfile/zipfile.cxx                           |   22 +
 shell/source/win32/shlxthandler/ooofilt/makefile.mk            |   16 
 shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx            |  212 +++++++++-
 shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx            |   33 +
 shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx |    1 
 shell/source/win32/shlxthandler/propsheets/propsheets.cxx      |   36 -
 shell/source/win32/shlxthandler/util/makefile.mk               |    1 
 shell/source/win32/shlxthandler/util/utilities.cxx             |    1 
 20 files changed, 399 insertions(+), 34 deletions(-)

New commits:
commit 174c4ec63ebd420fe60c09ac7e4f17116ec557bc
Author: Release Engineers <releng at openoffice.org>
Date:   Mon Aug 10 06:05:55 2009 +0000

    CWS-TOOLING: integrate CWS tkr23
    2009-07-21 15:03:57 +0200 tkr  r274199 : #i64277# open file only if needed and close immediately after use
    2009-07-17 12:25:41 +0200 tkr  r274087 : #i96743# patch minizip to provide stream operations
    2009-07-17 12:21:13 +0200 tkr  r274086 : #i96743# add new ifilter interface: IPersistStream

diff --git a/shell/inc/internal/basereader.hxx b/shell/inc/internal/basereader.hxx
index 358c71f..1c0ec1a 100644
--- a/shell/inc/internal/basereader.hxx
+++ b/shell/inc/internal/basereader.hxx
@@ -50,6 +50,8 @@ public:
 protected: // protected because its only an implementation relevant class
     CBaseReader( const std::string& DocumentName );
 
+    CBaseReader( void* stream, zlib_filefunc_def* fa );
+
     virtual void start_document();
     
     virtual void end_document();
diff --git a/shell/inc/internal/contentreader.hxx b/shell/inc/internal/contentreader.hxx
index 7389ed8..37a0a47 100644
--- a/shell/inc/internal/contentreader.hxx
+++ b/shell/inc/internal/contentreader.hxx
@@ -43,6 +43,9 @@ public:
     //CContentReader( const std::string& DocumentName );
     CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale );
 
+    CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa );
+
+
     /** Get the chunkbuffer.
 
         @return 
diff --git a/shell/inc/internal/metainforeader.hxx b/shell/inc/internal/metainforeader.hxx
index f12671c..3a494cd 100644
--- a/shell/inc/internal/metainforeader.hxx
+++ b/shell/inc/internal/metainforeader.hxx
@@ -45,6 +45,9 @@ public:
     virtual ~CMetaInfoReader();
 
     CMetaInfoReader( const std::string& DocumentName );
+
+    CMetaInfoReader( void* stream, zlib_filefunc_def* fa);
+
     /** check if the Tag is in the target meta.xml file.
 
         @param TagName
diff --git a/shell/inc/internal/propsheets.hxx b/shell/inc/internal/propsheets.hxx
index f380d15..ec34575 100644
--- a/shell/inc/internal/propsheets.hxx
+++ b/shell/inc/internal/propsheets.hxx
@@ -92,7 +92,6 @@ private:
 private:
     long m_RefCnt;
     char m_szFileName[MAX_PATH];
-    std::auto_ptr<CMetaInfoReader> m_pMetaInfo;
 };
 
 #endif 
diff --git a/shell/inc/internal/types.hxx b/shell/inc/internal/types.hxx
index c8686b2..7de2044 100644
--- a/shell/inc/internal/types.hxx
+++ b/shell/inc/internal/types.hxx
@@ -36,6 +36,9 @@
 #include <utility>
 #include <vector>
 #include <stack>
+#include <external/zlib/zlib.h>
+#include <external/zlib/ioapi.h>
+
 
 typedef std::vector<std::wstring> StringList_t;
 
diff --git a/shell/inc/internal/zipfile.hxx b/shell/inc/internal/zipfile.hxx
index 28405b7..5efbcdf 100644
--- a/shell/inc/internal/zipfile.hxx
+++ b/shell/inc/internal/zipfile.hxx
@@ -35,7 +35,9 @@
 #define _WINDOWS
 #endif
 
-#include <external/zlib/unzip.h>
+
+#include <external/zlib/unzip.h>
+
 
 #include <string>
 #include <vector>
@@ -68,6 +70,9 @@ public:
             AccessViolationException if read access to the file is denied			
     */
     static bool IsZipFile(const std::string& FileName);
+
+    static bool IsZipFile(void* stream);
+
     
     /** Returns wheter the version of the specified zip file may be uncompressed with the
           currently used zlib version or not
@@ -86,7 +91,8 @@ public:
     */
     static bool IsValidZipFileVersionNumber(const std::string& FileName);
         
-    
+    static bool IsValidZipFileVersionNumber(void* stream);
+
 public:
     
     /** Constructs a zip file from a zip file
@@ -102,6 +108,9 @@ public:
             with the used zlib version
     */
     ZipFile(const std::string& FileName);
+
+    ZipFile(void* stream, zlib_filefunc_def* fa);
+
         
     /** Destroys a zip file
     */
diff --git a/shell/source/all/makefile.mk b/shell/source/all/makefile.mk
index 3695aba..623aad6 100755
--- a/shell/source/all/makefile.mk
+++ b/shell/source/all/makefile.mk
@@ -35,6 +35,7 @@ PRJNAME=shell
 TARGET=xmlparser
 ENABLE_EXCEPTIONS=TRUE
 
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :  settings.mk
@@ -61,6 +62,7 @@ CFLAGS+=-DSYSTEM_EXPAT
 .ENDIF
 
 SLOFILES=$(SLO)$/xml_parser.obj
+          
 .IF "$(BUILD_X64)"!=""
 SLOFILES_X64=$(SLO_X64)$/xml_parser.obj
 .ENDIF # "$(BUILD_X64)"!=""
diff --git a/shell/source/all/ooofilereader/basereader.cxx b/shell/source/all/ooofilereader/basereader.cxx
index b92f208..d8d95c3 100644
--- a/shell/source/all/ooofilereader/basereader.cxx
+++ b/shell/source/all/ooofilereader/basereader.cxx
@@ -50,6 +50,15 @@ m_ZipFile( DocumentName )
 //
 //------------------------------
 
+CBaseReader::CBaseReader(void * sw, zlib_filefunc_def* fa):
+m_ZipFile( sw , fa )
+{
+}
+
+//------------------------------
+//
+//------------------------------
+
 CBaseReader::~CBaseReader()
 {
 }
diff --git a/shell/source/all/ooofilereader/contentreader.cxx b/shell/source/all/ooofilereader/contentreader.cxx
index 03febef..138663b 100644
--- a/shell/source/all/ooofilereader/contentreader.cxx
+++ b/shell/source/all/ooofilereader/contentreader.cxx
@@ -61,6 +61,29 @@ CBaseReader( DocumentName )
     }
 }
 
+CContentReader::CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ) :
+CBaseReader( stream, fa )
+{
+try
+    {
+        m_DefaultLocale = DocumentLocale;
+        Initialize( DOC_CONTENT_NAME );
+    }
+    catch(xml_parser_exception&
+    #if OSL_DEBUG_LEVEL > 0
+    ex
+    #endif
+    )
+    {
+        ENSURE(false, ex.what());
+    }
+    catch(...)
+    {
+        ENSURE(false, "Unknown error");
+    }
+}
+
+
 /** destructor.
 */
 
diff --git a/shell/source/all/ooofilereader/makefile.mk b/shell/source/all/ooofilereader/makefile.mk
index 1e9788c..b893db4 100644
--- a/shell/source/all/ooofilereader/makefile.mk
+++ b/shell/source/all/ooofilereader/makefile.mk
@@ -35,6 +35,7 @@ TARGET=ooofilereader
 LIBTARGET=NO
 ENABLE_EXCEPTIONS=TRUE
 
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :  settings.mk
@@ -65,7 +66,7 @@ LIB1TARGET=$(SLB)$/$(TARGET).lib
 LIB1OBJFILES=$(SLOFILES)
 LIB1FILES=$(SLB)$/zipfile.lib\
           $(SLB)$/xmlparser.lib
-
+          
 .IF "$(BUILD_X64)"!=""
 SLOFILES_X64=$(SLO_X64)$/basereader.obj\
          $(SLO_X64)$/metainforeader.obj\
diff --git a/shell/source/all/ooofilereader/metainforeader.cxx b/shell/source/all/ooofilereader/metainforeader.cxx
index eba0487..e179d9a 100644
--- a/shell/source/all/ooofilereader/metainforeader.cxx
+++ b/shell/source/all/ooofilereader/metainforeader.cxx
@@ -80,6 +80,48 @@ CBaseReader( DocumentName )
     }
 }
 
+CMetaInfoReader::CMetaInfoReader( void* stream, zlib_filefunc_def* fa) :
+CBaseReader( stream, fa)
+{
+try
+    {
+        m_pKeywords_Builder = new CKeywordsTag( );
+        m_pSimple_Builder = new CSimpleTag( );
+        m_pDummy_Builder   = new CDummyTag( );
+
+        //retrieve all infomation that is useful
+        m_AllMetaInfo[META_INFO_AUTHOR]               = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_TITLE]                = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_SUBJECT]              = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_KEYWORDS]             = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_DESCRIPTION]          = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC]   = EMPTY_XML_TAG;
+
+        m_AllMetaInfo[META_INFO_GENERATOR]            = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_CREATION]             = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_CREATOR]              = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_MODIFIED]             = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_LANGUAGE]             = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER]      = EMPTY_XML_TAG;
+        m_AllMetaInfo[META_INFO_EDITING_TIME]         = EMPTY_XML_TAG;
+
+        Initialize( META_CONTENT_NAME );
+    }
+    catch(xml_parser_exception&
+    #if OSL_DEBUG_LEVEL > 0
+    ex
+    #endif
+    )
+    {
+        ENSURE(false, ex.what());
+    }
+    catch(...)
+    {
+        ENSURE(false, "Unknown error");
+    }
+
+}
+
 /** destructor.
 */
 
diff --git a/shell/source/all/zipfile/makefile.mk b/shell/source/all/zipfile/makefile.mk
index a7f9c95..9f294ce 100644
--- a/shell/source/all/zipfile/makefile.mk
+++ b/shell/source/all/zipfile/makefile.mk
@@ -33,6 +33,9 @@ PRJ=..$/..$/..
 PRJNAME=shell
 TARGET=zipfile
 ENABLE_EXCEPTIONS=TRUE
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+
 
 # --- Settings -----------------------------------------------------
 
@@ -45,8 +48,8 @@ SLOFILES=$(SLO)$/zipfile.obj\
     $(SLO)$/zipexcptn.obj
 
 SLOFILES_X64=$(SLO_X64)$/zipfile.obj\
-    $(SLO_X64)$/zipexcptn.obj
-
+             $(SLO_X64)$/zipexcptn.obj
+             
 # --- Targets ------------------------------------------------------
 
 .INCLUDE :	set_wntx64.mk
diff --git a/shell/source/all/zipfile/zipfile.cxx b/shell/source/all/zipfile/zipfile.cxx
index 2491524..d5b6ef6 100644
--- a/shell/source/all/zipfile/zipfile.cxx
+++ b/shell/source/all/zipfile/zipfile.cxx
@@ -79,6 +79,12 @@ bool ZipFile::IsZipFile(const std::string& /*FileName*/)
     return true;
 }
 
+bool ZipFile::IsZipFile(void* /*stream*/)
+{
+    return true;
+}
+
+
 /** Returns wheter the version of the specified zip file may be uncompressed with the
           currently used zlib version or not
           
@@ -99,6 +105,12 @@ bool ZipFile::IsValidZipFileVersionNumber(const std::string& /*FileName*/)
     return true;
 }
 
+bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/)
+{
+    return true;
+}
+
+
 /** Constructs a zip file from a zip file
     
     @precond	The given parameter must be a string with length > 0
@@ -119,6 +131,16 @@ ZipFile::ZipFile(const std::string& FileName)
         throw IOException(-1);
 }
 
+ZipFile::ZipFile(void* stream, zlib_filefunc_def* fa) 
+{
+    fa->opaque = stream;
+    m_uzFile = unzOpen2((const char *)NULL, fa);
+
+    if (0 == m_uzFile)
+        throw IOException(-1);
+}
+
+
 /** Destroys a zip file
 */
 ZipFile::~ZipFile()
diff --git a/shell/source/win32/shlxthandler/ooofilt/makefile.mk b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
index 74ecf35..22127bc 100644
--- a/shell/source/win32/shlxthandler/ooofilt/makefile.mk
+++ b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
@@ -36,6 +36,13 @@ LIBTARGET=NO
 ENABLE_EXCEPTIONS=TRUE
 USE_DEFFILE=TRUE
 
+# Do not use the dynamic STLport library.
+# NO_DEFAULT_STL=YES
+
+# Do not use the uwinapi library
+UWINAPILIB=
+
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :  settings.mk
@@ -43,11 +50,10 @@ USE_DEFFILE=TRUE
 CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501
 CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
 CDEFS+=-D_WIN32_IE=0x501
+# SCPCDEFS+=-D_STLP_USE_STATIC_LIB 
 
 # --- Files --------------------------------------------------------
 
-#UWINAPILIB=
-
 SLOFILES=$(SLO)$/ooofilt.obj\
         $(SLO)$/propspec.obj
 
@@ -71,10 +77,12 @@ SHL1STDLIBS+=$(OLE32LIB)\
      $(SHELL32LIB)\
      $(KERNEL32LIB)\
      $(OLDNAMESLIB)
-
+     
+#     $(LIBSTLPORTST)
+     
 SHL1LIBS+=$(SLB)$/util.lib\
     $(SLB)$/ooofilereader.lib
-
+    
 SHL1DEPN=
 SHL1OBJS=$(SLOFILES)
 SHL1DEF=$(MISC)$/$(SHL1TARGET).def
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index 9d9ac04..f907306 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -46,7 +46,7 @@
 //--------------------------------------------------------------------------
 #include "internal/contentreader.hxx"
 #include "internal/metainforeader.hxx"
-#include "internal/utilities.hxx"
+//#include "internal/utilities.hxx"
 #include "internal/registry.hxx"
 #include "internal/fileextensions.hxx"
 
@@ -78,6 +78,8 @@
 #include <ntquery.h>
 #include "assert.h"
 #include "ooofilt.hxx"
+#include <objidl.h>
+#include <stdio.h>
 #include "propspec.hxx"
 #ifdef __MINGW32__
 #include <algorithm>
@@ -117,7 +119,9 @@ COooFilter::COooFilter() :
     m_fEof(FALSE),    
     m_ChunkPosition(0),
     m_cAttributes(0),
-    m_pAttributes(0)
+    m_pAttributes(0),
+    m_pStream(NULL)
+
 {
     InterlockedIncrement( &g_lInstances );
 }
@@ -172,6 +176,8 @@ SCODE STDMETHODCALLTYPE COooFilter::QueryInterface(
         pUnkTemp = (IUnknown *)(IPersistFile *)this;
     else if ( IID_IPersist == riid )
         pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
+    else if (IID_IPersistStream == riid)
+        pUnkTemp = (IUnknown *)(IPersistStream *)this;
     else if ( IID_IUnknown == riid )
         pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
     else
@@ -713,6 +719,101 @@ SCODE STDMETHODCALLTYPE COooFilter::SaveCompleted(LPCWSTR /*pszFileName*/)
     // File is opened read-only, so "save" is always finished
     return S_OK;
 }
+
+//M-------------------------------------------------------------------------
+//
+//  Method:     COooFilter::Load      (IPersistStream::Load)
+//
+//  Summary:    Initializes an object from the stream where it was previously saved
+//
+//  Arguments:  pStm
+//                  [in] Pointer to stream from which object should be loaded
+//                    
+//
+//  Returns:    S_OK
+//				E_OUTOFMEMORY
+//				E_FAIL
+//                 
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm)
+{
+
+    // These next few lines work around the "Seek pointer" bug found on Vista.
+    
+    char buf[20];
+    unsigned long count;
+    HRESULT hr;
+    ULARGE_INTEGER NewPosition;
+    LARGE_INTEGER Move;	
+    Move.QuadPart = 0;	
+    hr = pStm->Seek (Move, STREAM_SEEK_SET, &NewPosition);	
+    hr = pStm->Read (buf, 20, &count);
+                
+    zlib_filefunc_def z_filefunc;
+    fill_stream_filefunc (&z_filefunc);
+    z_filefunc.opaque = (void*)pStm;
+
+    m_pStream = pStm;
+  
+    try
+    {
+        if (m_pMetaInfoReader)
+            delete m_pMetaInfoReader;             
+        m_pMetaInfoReader = new CMetaInfoReader((void*)m_pStream, &z_filefunc);
+        
+        if (m_pContentReader)
+            delete m_pContentReader;
+        m_pContentReader = new CContentReader((void*)m_pStream, m_pMetaInfoReader->getDefaultLocale(), &z_filefunc);
+    }
+    catch (const std::exception&)
+    {
+        return E_FAIL;
+    }
+    return S_OK;
+}
+
+//M-------------------------------------------------------------------------
+//
+//  Method:     COooFilter::GetSizeMax      (IPersistStream::GetSizeMax)
+//
+//  Summary:    Returns the size in bytes of the stream neede to save the object.
+//
+//  Arguments:  pcbSize
+//                  [out] Pointer to a 64 bit unsigned int indicating the size needed 
+//
+//  Returns:    E_NOTIMPL
+//                  
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::GetSizeMax(ULARGE_INTEGER * /*pcbSize*/)
+{
+    // 
+    return E_NOTIMPL;
+}
+
+//M-------------------------------------------------------------------------
+//
+//  Method:     COooFilter::Save      (IPersistStream::Save)
+//
+//  Summary:    Save object to specified stream
+//
+//  Arguments:  pStm
+//                  [in] Pointer to stream
+//
+//              fClearDirty
+//					[in] Indicates whether to clear dirty flag
+//				
+//  Returns:    E_NOTIMPL
+//                 
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Save(IStream * /*pStm*/, BOOL )
+{
+    // 
+    return E_NOTIMPL;
+}
+
 //M-------------------------------------------------------------------------
 //
 //  Method:     COooFilter::GetCurFile          (IPersistFile::GetCurFile)
@@ -1142,8 +1243,18 @@ namespace /* private */
         std::string ClsidEntry_Persist = CLSID_GUID_ENTRY;
         SubstitutePlaceholder(ClsidEntry_Persist, GUID_PLACEHOLDER, ClsidToString(PersistentGuid));
     
+        
         if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist.c_str(), "", "OpenOffice.org Persistent Handler"))
             return E_FAIL;	
+
+        // Add missing entry 
+        std::string ClsidEntry_Persist_Entry = CLSID_PERSIST_ENTRY;
+        SubstitutePlaceholder(ClsidEntry_Persist_Entry, 
+                              GUID_PLACEHOLDER, 
+                              ClsidToString(PersistentGuid));		
+
+        if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist_Entry.c_str(), "", ClsidToString(PersistentGuid).c_str()));
+
         
         std::string ClsidEntry_Persist_Addin = CLSID_GUID_PERSIST_ADDIN_ENTRY;
         SubstitutePlaceholder(ClsidEntry_Persist_Addin, 
@@ -1393,3 +1504,100 @@ STDAPI DllUnregisterServer()
     */
     return S_OK;
 }
+
+extern "C" {
+
+    // IStream callback
+    voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* filename, int mode) {		
+        return opaque;
+    }
+
+    uLong ZCALLBACK cb_sread (voidpf opaque, voidpf stream, void* buf, uLong size) {
+        unsigned long newsize;
+        HRESULT hr;
+    
+        hr = ((IStream *)stream)->Read (buf, size, &newsize);
+        if (hr == S_OK){
+            return (unsigned long)newsize;
+        }
+        else {			
+            return (uLong)0;
+        }
+    }
+
+    long ZCALLBACK cb_sseek (voidpf opaque, voidpf stream, uLong offset, int origin) {
+        // IStream::Seek parameters
+        HRESULT hr;
+        LARGE_INTEGER Move;
+        DWORD dwOrigin;		
+        Move.QuadPart = (__int64)offset;	
+
+        switch (origin) {
+            case SEEK_CUR:
+                dwOrigin = STREAM_SEEK_CUR;
+                break;
+            case SEEK_END:
+                dwOrigin = STREAM_SEEK_END;
+                break;
+            case SEEK_SET:
+                dwOrigin = STREAM_SEEK_SET;
+                break;
+            default:
+                return -1;
+        }
+    
+        hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
+        if (hr == S_OK){	
+            return 0;
+        }
+        else {			
+            return -1;
+        }
+    }
+
+    long ZCALLBACK cb_stell (voidpf opaque, voidpf stream) {
+        // IStream::Seek parameters
+        HRESULT hr;
+        LARGE_INTEGER Move;
+        ULARGE_INTEGER NewPosition;
+        Move.QuadPart = 0;
+        NewPosition.QuadPart = 0;
+        
+        hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
+        if (hr == S_OK){			
+            return (long) NewPosition.QuadPart;
+        }
+        else {
+            return -1;
+        }
+    }
+
+    int ZCALLBACK cb_sclose (voidpf opaque, voidpf stream) {
+        return 0;
+    }
+
+    int ZCALLBACK cb_serror (voidpf opaque, voidpf stream) {
+        return 0;  //RJK - for now
+    }
+
+    uLong ZCALLBACK cb_swrite (voidpf opaque, voidpf stream, const void* buf, uLong size) {
+        HRESULT hr;
+        unsigned long writecount;
+        hr = ((IStream*)stream)->Write (buf, size, &writecount);
+        if (hr == S_OK)
+            return (unsigned int)writecount;
+        else
+            return (uLong)0;
+    }
+
+    void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) {
+        pzlib_filefunc_def->zopen_file = cb_sopen;
+        pzlib_filefunc_def->zread_file = cb_sread;
+        pzlib_filefunc_def->zwrite_file = cb_swrite;
+        pzlib_filefunc_def->ztell_file = cb_stell;
+        pzlib_filefunc_def->zseek_file = cb_sseek;
+        pzlib_filefunc_def->zclose_file = cb_sclose;
+        pzlib_filefunc_def->zerror_file = cb_serror;		
+    }
+}
+
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
index 92df63c..f63a994 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
@@ -96,8 +96,7 @@ enum FilterState
     FilteringContent,                           // Filtering the content property
     FilteringProperty                           // Filtering the pseudo property
 };
-
-class COooFilter : public IFilter, public IPersistFile
+class COooFilter : public IFilter, public IPersistFile, public IPersistStream
 {
 public:
     // From IUnknown
@@ -144,6 +143,18 @@ public:
     virtual  SCODE STDMETHODCALLTYPE  GetCurFile(
         LPWSTR  * ppszFileName);
 
+    // From IPersistStream
+    virtual SCODE STDMETHODCALLTYPE  Load(
+        IStream *pStm);
+
+    virtual SCODE STDMETHODCALLTYPE Save(
+        IStream *pStm,
+        BOOL fClearDirty);
+
+    virtual SCODE STDMETHODCALLTYPE  GetSizeMax(
+        ULARGE_INTEGER *pcbSize);
+
+
 private:
     friend class COooFilterCF;
 
@@ -166,6 +177,8 @@ private:
     ULONG			          m_ChunkPosition;          // Chunk pointer to specify the current Chunk;
     ULONG                     m_cAttributes;            // Count of attributes
     CFullPropSpec *           m_pAttributes;            // Attributes to filter
+    IStream *                 m_pStream;
+
 };
 
 //C-------------------------------------------------------------------------
@@ -207,6 +220,22 @@ private:
     long m_lRefs;           // Reference count
 };
 
+extern "C" {
+
+    voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode));
+    uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size));
+    uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+    long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream));
+    long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin));
+    int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream));
+    int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream));
+
+    void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def);	
+    
+}
+
+
+
 
 
 
diff --git a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx
index 8f61181..b3bbe22 100644
--- a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx
@@ -147,7 +147,6 @@ extern "C" HRESULT __stdcall DllCanUnloadNow()
 extern "C" HRESULT __stdcall DllRegisterServer()
 {	
     Init();
-    
     if (Forward_DllRegisterServer)
         return Forward_DllRegisterServer();
     else
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index 7638c09..c901c7b 100644
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -177,15 +177,7 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize(
 
 HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
 {
-    try
-    {
-        m_pMetaInfo = std::auto_ptr<CMetaInfoReader>(new CMetaInfoReader(m_szFileName));
-    }	
-    catch (const std::exception&)
-    {
-        return E_FAIL;
-    }
-
+    
     PROPSHEETPAGE psp;
 
     // add the summary property page
@@ -236,7 +228,7 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddP
         else
             DestroyPropertySheetPage(hPage);
     }
-    
+
     // always return success else
     // no property sheet will be 
     // displayed at all
@@ -316,15 +308,18 @@ BOOL CALLBACK CPropertySheet::PropPageStatisticsProc(HWND hwnd, UINT uiMsg, WPAR
 
 //##################################
 void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
-{	
-    SetWindowText(GetDlgItem(hwnd,IDC_TITLE),    m_pMetaInfo->getTagData( META_INFO_TITLE ).c_str() );
-    SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR),   m_pMetaInfo->getTagData( META_INFO_AUTHOR ).c_str() );
-    SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT),  m_pMetaInfo->getTagData( META_INFO_SUBJECT ).c_str() );
-    SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), m_pMetaInfo->getTagData( META_INFO_KEYWORDS ).c_str() );
+{
+
+    CMetaInfoReader metaInfo(m_szFileName);
+
+    SetWindowText(GetDlgItem(hwnd,IDC_TITLE),    metaInfo.getTagData( META_INFO_TITLE ).c_str() );
+    SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR),   metaInfo.getTagData( META_INFO_AUTHOR ).c_str() );
+    SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT),  metaInfo.getTagData( META_INFO_SUBJECT ).c_str() );
+    SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), metaInfo.getTagData( META_INFO_KEYWORDS ).c_str() );
 
     // comments read from meta.xml use "\n" for return, but this will not displayable in Edit control, add
     // "\r" before "\n" to form "\r\n" in order to display return in Edit control.
-    std::wstring tempStr = m_pMetaInfo->getTagData( META_INFO_DESCRIPTION ).c_str();
+    std::wstring tempStr = metaInfo.getTagData( META_INFO_DESCRIPTION ).c_str();
     std::wstring::size_type itor = tempStr.find ( L"\n" , 0 );
     while (itor != std::wstring::npos)
     {
@@ -332,14 +327,18 @@ void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
         itor = tempStr.find(L"\n", itor + 2);
     }
     SetWindowText(GetDlgItem(hwnd,IDC_COMMENTS), tempStr.c_str());	
+
 }
 
 //---------------------------------
 /**
 */
 void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
-{				
-    document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, m_pMetaInfo.get());
+{	
+
+    CMetaInfoReader metaInfo(m_szFileName);
+
+    document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, &metaInfo);
     
     statistic_group_list_t sgl;
     doc_stat_reader->read(&sgl);
@@ -350,6 +349,7 @@ void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/
         GetResString(IDS_PROPERTY_VALUE));         
         
     lv_builder->build(sgl);  	
+
 }
 
 
diff --git a/shell/source/win32/shlxthandler/util/makefile.mk b/shell/source/win32/shlxthandler/util/makefile.mk
index f5d912c..c0bec9c 100644
--- a/shell/source/win32/shlxthandler/util/makefile.mk
+++ b/shell/source/win32/shlxthandler/util/makefile.mk
@@ -35,6 +35,7 @@ TARGET=util
 #LIBTARGET=NO
 ENABLE_EXCEPTIONS=TRUE
 
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :  settings.mk
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 7c5e0b8..d76e0c9 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -586,5 +586,4 @@ LCID LocaleSetToLCID( const LocaleSet_t & Locale )
         return GetSystemDefaultLCID();                    //System Default Locale 
 
     return MAKELCID( MAKELANGID( usPrimaryLang, usSubLang ), SORT_DEFAULT );
-
 }


More information about the ooo-build-commit mailing list