LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/sot - storage.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 13 18 72.2 %
Date: 2012-08-25 Functions: 28 31 90.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 30 48 62.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #ifndef _SOT_STORAGE_HXX
      21                 :            : #define _SOT_STORAGE_HXX
      22                 :            : 
      23                 :            : #include <com/sun/star/uno/Any.hxx>
      24                 :            : #include <com/sun/star/uno/Reference.h>
      25                 :            : 
      26                 :            : #include <com/sun/star/io/XInputStream.hpp>
      27                 :            : #include <com/sun/star/embed/XStorage.hpp>
      28                 :            : #include <sot/object.hxx>
      29                 :            : #include <sot/factory.hxx>
      30                 :            : #include <tools/stream.hxx>
      31                 :            : #include <tools/errcode.hxx>
      32                 :            : #include "sot/storinfo.hxx"
      33                 :            : #include "sot/sotdllapi.h"
      34                 :            : 
      35                 :            : #define STORAGE_FAILIFTHERE     0x02
      36                 :            : #define STORAGE_TRANSACTED      0x04
      37                 :            : #define STORAGE_PRIORITY        0x08
      38                 :            : #define STORAGE_DELETEONRELEASE 0x10
      39                 :            : #define STORAGE_CONVERT         0x20
      40                 :            : #define STORAGE_UNPACKED_MODE   0x40
      41                 :            : #define STORAGE_DISKSPANNED_MODE   0x80
      42                 :            : #define STORAGE_CREATE_UNPACKED 0x44
      43                 :            : typedef short StorageMode;
      44                 :            : 
      45                 :            : class SvStorage;
      46                 :            : namespace binfilter
      47                 :            : {
      48                 :            :     class SvStorage;
      49                 :            : }
      50                 :            : 
      51                 :            : /*************************************************************************
      52                 :            : *************************************************************************/
      53                 :            : class SotStorage;
      54                 :            : class BaseStorageStream;
      55                 :            : class SOT_DLLPUBLIC SotStorageStream : virtual public SotObject, public SvStream
      56                 :            : {
      57                 :            : friend class SotStorage;
      58                 :            :     BaseStorageStream * pOwnStm;// Zeiger auf den eigenen Stream
      59                 :            : protected:
      60                 :            :     virtual sal_uLong       GetData( void* pData, sal_uLong nSize );
      61                 :            :     virtual sal_uLong       PutData( const void* pData, sal_uLong nSize );
      62                 :            :     virtual sal_uLong       SeekPos( sal_uLong nPos );
      63                 :            :     virtual void        FlushData();
      64                 :            :                         ~SotStorageStream();
      65                 :            : public:
      66                 :            :                         SotStorageStream( const String &,
      67                 :            :                                      StreamMode = STREAM_STD_READWRITE,
      68                 :            :                                      StorageMode = 0 );
      69                 :            :                         SotStorageStream( BaseStorageStream *pStm );
      70                 :            :                         SotStorageStream();
      71                 :          0 :                         SO2_DECL_BASIC_CLASS_DLL(SotStorageStream,SOTDATA())
      72                 :            : 
      73                 :            :     virtual void        ResetError();
      74                 :            : 
      75                 :            :     virtual void        SetSize( sal_uLong nNewSize );
      76                 :            :     sal_uInt32              GetSize() const;
      77                 :            :     sal_Bool                CopyTo( SotStorageStream * pDestStm );
      78                 :            :     virtual sal_Bool        Commit();
      79                 :            :     virtual sal_Bool        Revert();
      80                 :            :     sal_Bool                SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue );
      81                 :            :     sal_Bool                GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue );
      82                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
      83                 :            :                         GetXInputStream() const;
      84                 :            :     virtual sal_Size remainingSize();
      85                 :            : };
      86                 :            : 
      87                 :            : #ifndef SOT_DECL_SOTSTORAGESTREAM_DEFINED
      88                 :            : #define SOT_DECL_SOTSTORAGESTREAM_DEFINED
      89                 :    5796391 : SO2_DECL_REF(SotStorageStream)
      90                 :            : #endif
      91      [ +  +  - ]:       4039 : SO2_IMPL_REF(SotStorageStream)
         [ -  + ][ +  - ]
                 [ +  - ]
           [ +  +  +  + ]
         [ +  + ][ +  - ]
         [ +  - ][ +  - ]
      92                 :            : 
      93                 :            : namespace ucbhelper
      94                 :            : {
      95                 :            :     class Content;
      96                 :            : }
      97                 :            : 
      98                 :            : class  BaseStorage;
      99                 :            : class  UNOStorageHolder;
     100                 :            : class SOT_DLLPUBLIC SotStorage : virtual public SotObject
     101                 :            : {
     102                 :            : friend class SotStorageStream;
     103                 :            : friend class SvStorage;
     104                 :            : friend class ::binfilter::SvStorage;
     105                 :            : 
     106                 :            :     BaseStorage *   m_pTmpStg;   // Temp-Storage fuer Transacted, nur auf diesem schreiben!        ??? Useless ???
     107                 :            :     BaseStorage *   m_pOwnStg;   // Zielstorage
     108                 :            :     SvStream *  m_pStorStm;  // nur fuer SDSTORAGES
     109                 :            :     sal_uLong       m_nError;
     110                 :            :     String      m_aName;      // Name des Storage
     111                 :            :     sal_Bool        m_bIsRoot:1,  // z.B.: File-Storage
     112                 :            :                 m_bDelStm:1;
     113                 :            :     rtl::OString m_aKey;           // aKey.Len != 0  -> Verschluesselung
     114                 :            :     long        m_nVersion;
     115                 :            : 
     116                 :            : protected:
     117                 :            :                         ~SotStorage();
     118                 :            :    void                 CreateStorage( sal_Bool bUCBStorage, StreamMode, StorageMode );
     119                 :            : public:
     120                 :            :                         SotStorage( const String &,
     121                 :            :                                    StreamMode = STREAM_STD_READWRITE,
     122                 :            :                                    StorageMode = 0 );
     123                 :            :                         SotStorage( sal_Bool bUCBStorage, const String &,
     124                 :            :                                    StreamMode = STREAM_STD_READWRITE,
     125                 :            :                                    StorageMode = 0 );
     126                 :            :                         SotStorage( BaseStorage * );
     127                 :            :                         SotStorage( SvStream & rStm );
     128                 :            :                         SotStorage( sal_Bool bUCBStorage, SvStream & rStm );
     129                 :            :                         SotStorage( SvStream * pStm, sal_Bool bDelete );
     130                 :            :                         SotStorage();
     131                 :          0 :                         SO2_DECL_BASIC_CLASS_DLL(SotStorage,SOTDATA())
     132                 :            : 
     133                 :            :     SvMemoryStream *    CreateMemoryStream();
     134                 :            :     const SvStream *    GetSvStream();
     135                 :            : 
     136                 :            :     static sal_Bool         IsStorageFile( const String & rFileName );
     137                 :            :     static sal_Bool         IsStorageFile( SvStream* pStream );
     138                 :            : 
     139                 :            :     virtual const String & GetName() const;
     140                 :            : 
     141                 :            :     virtual sal_Bool        Validate();
     142                 :            : 
     143                 :            :     void                SetKey( const rtl::OString& rKey );
     144                 :         15 :     const rtl::OString& GetKey() const { return m_aKey; }
     145                 :            : 
     146                 :          0 :     void                SetVersion( long nVers )
     147                 :            :                         {
     148                 :          0 :                             m_nVersion = nVers;
     149                 :          0 :                         }
     150                 :         15 :     long                GetVersion() const
     151                 :            :                         {
     152                 :         15 :                             return m_nVersion;
     153                 :            :                         }
     154                 :            : 
     155                 :            :     sal_uLong               GetErrorCode() const { return m_nError; }
     156                 :        209 :     sal_uLong               GetError() const { return ERRCODE_TOERROR(m_nError); }
     157                 :        681 :     void                SetError( sal_uLong nErrorCode )
     158                 :            :                         {
     159         [ +  - ]:        681 :                             if( m_nError == SVSTREAM_OK )
     160                 :        681 :                                 m_nError = nErrorCode;
     161                 :        681 :                         }
     162                 :            :     virtual void        ResetError();
     163                 :            : 
     164                 :            :     sal_Bool                IsRoot() const              { return m_bIsRoot; }
     165                 :        364 :     void                SignAsRoot( sal_Bool b = sal_True ) { m_bIsRoot = b; }
     166                 :            :     void                SetDeleteStream( sal_Bool bDelete ) { m_bDelStm = bDelete; }
     167                 :            : 
     168                 :            :                         // eigener Datenbereich
     169                 :            :     virtual void        SetClass( const SvGlobalName & rClass,
     170                 :            :                                   sal_uLong bOriginalClipFormat,
     171                 :            :                                   const String & rUserTypeName );
     172                 :            :     virtual void        SetConvertClass( const SvGlobalName & rConvertClass,
     173                 :            :                                          sal_uLong bOriginalClipFormat,
     174                 :            :                                          const String & rUserTypeName );
     175                 :            :     virtual SvGlobalName GetClassName();// Typ der Daten im Storage
     176                 :            :     virtual sal_uLong       GetFormat();
     177                 :            :     virtual String      GetUserName();
     178                 :            :     virtual sal_Bool        ShouldConvert();
     179                 :            :     void                SetName( const String& rName );
     180                 :            : 
     181                 :            :                         // Liste aller Elemente
     182                 :            :     virtual void        FillInfoList( SvStorageInfoList * ) const;
     183                 :            :     virtual sal_Bool        CopyTo( SotStorage * pDestStg );
     184                 :            :     virtual sal_Bool        Commit();
     185                 :            :     virtual sal_Bool        Revert();
     186                 :            : 
     187                 :            :                         /* Element Methoden     */
     188                 :            :                         // Stream mit Verbindung zu Storage erzeugen,
     189                 :            :                         // in etwa eine Parent-Child Beziehung
     190                 :            :     SotStorageStream *  OpenSotStream( const String & rEleName,
     191                 :            :                                     StreamMode = STREAM_STD_READWRITE,
     192                 :            :                                     StorageMode = 0 );
     193                 :            :     SotStorage *        OpenSotStorage( const String & rEleName,
     194                 :            :                                     StreamMode = STREAM_STD_READWRITE,
     195                 :            :                                     StorageMode = STORAGE_TRANSACTED );
     196                 :            :     SotStorage *        OpenUCBStorage( const String & rEleName,
     197                 :            :                                     StreamMode = STREAM_STD_READWRITE,
     198                 :            :                                     StorageMode = STORAGE_TRANSACTED );
     199                 :            :                         // Abfrage auf Storage oder Stream
     200                 :            :     virtual sal_Bool        IsStream( const String & rEleName ) const;
     201                 :            :     virtual sal_Bool        IsStorage( const String & rEleName ) const;
     202                 :            :     virtual sal_Bool        IsContained( const String & rEleName ) const;
     203                 :            :                         // Element loeschen
     204                 :            :     virtual sal_Bool        Remove( const String & rEleName );
     205                 :            :                         // Elementnamen aendern
     206                 :            :     virtual sal_Bool        Rename( const String & rEleName,
     207                 :            :                                 const String & rNewName );
     208                 :            :     virtual sal_Bool        CopyTo( const String & rEleName, SotStorage * pDest,
     209                 :            :                                 const String & rNewName );
     210                 :            :     virtual sal_Bool        MoveTo( const String & rEleName, SotStorage * pDest,
     211                 :            :                                 const String & rNewName );
     212                 :            : 
     213                 :            :     sal_Bool                SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue );
     214                 :            :     sal_Bool                GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue );
     215                 :            :     sal_Bool                IsOLEStorage() const;
     216                 :            :     static sal_Bool         IsOLEStorage( const String & rFileName );
     217                 :            :     static sal_Bool         IsOLEStorage( SvStream* pStream );
     218                 :            : 
     219                 :            :     static SotStorage*  OpenOLEStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage,
     220                 :            :                                     const String& rEleName, StreamMode = STREAM_STD_READWRITE );
     221                 :            :     static sal_Int32    GetFormatID( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage );
     222                 :            :     static sal_Int32    GetVersion( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage );
     223                 :            : };
     224                 :            : 
     225                 :            : #ifndef SOT_DECL_SOTSTORAGE_DEFINED
     226                 :            : #define SOT_DECL_SOTSTORAGE_DEFINED
     227                 :      24378 : SO2_DECL_REF(SotStorage)
     228                 :            : #endif
     229      [ +  +  - ]:      14858 : SO2_IMPL_REF(SotStorage)
         [ #  # ][ +  + ]
                 [ +  + ]
           [ +  -  +  + ]
         [ #  # ][ +  + ]
         [ -  + ][ +  + ]
         [ +  - ][ #  # ]
     230                 :            : 
     231                 :            : #define SvStorage SotStorage
     232                 :            : #define SvStorageRef SotStorageRef
     233                 :            : #define SvStorageStream SotStorageStream
     234                 :            : #define SvStorageStreamRef SotStorageStreamRef
     235                 :            : 
     236                 :            : #endif // _SVSTOR_HXX
     237                 :            : 
     238                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10