LCOV - code coverage report
Current view: top level - libreoffice/sd/source/filter/ppt - propread.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 8 100.0 %
Date: 2012-12-27 Functions: 8 9 88.9 %
Legend: Lines: hit not hit

          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 _PROPREAD_HXX_
      21             : #define _PROPREAD_HXX_
      22             : 
      23             : #include <map>
      24             : #include <boost/ptr_container/ptr_vector.hpp>
      25             : 
      26             : #include <tools/solar.h>
      27             : #include <sot/storage.hxx>
      28             : #include <tools/gen.hxx>
      29             : #include <tools/stream.hxx>
      30             : 
      31             : #include <tools/string.hxx>
      32             : 
      33             : // SummaryInformation
      34             : #define PID_TITLE               0x02
      35             : #define PID_SUBJECT             0x03
      36             : #define PID_AUTHOR              0x04
      37             : #define PID_KEYWORDS            0x05
      38             : #define PID_COMMENTS            0x06
      39             : #define PID_TEMPLATE            0x07
      40             : #define PID_LASTAUTHOR          0x08
      41             : #define PID_REVNUMBER           0x09
      42             : #define PID_EDITTIME            0x0a
      43             : #define PID_LASTPRINTED_DTM     0x0b
      44             : #define PID_CREATE_DTM          0x0c
      45             : #define PID_LASTSAVED_DTM       0x0d
      46             : 
      47             : // DocumentSummaryInformation
      48             : #define PID_CATEGORY            0x02
      49             : #define PID_PRESFORMAT          0x03
      50             : #define PID_BYTECOUNT           0x04
      51             : #define PID_LINECOUNT           0x05
      52             : #define PID_PARACOUNT           0x06
      53             : #define PID_SLIDECOUNT          0x07
      54             : #define PID_NOTECOUNT           0x08
      55             : #define PID_HIDDENCOUNT         0x09
      56             : #define PID_MMCLIPCOUNT         0x0a
      57             : #define PID_SCALE               0x0b
      58             : #define PID_HEADINGPAIR         0x0c
      59             : #define PID_DOCPARTS            0x0d
      60             : #define PID_MANAGER             0x0e
      61             : #define PID_COMPANY             0x0f
      62             : #define PID_LINKSDIRTY          0x10
      63             : 
      64             : #define VT_EMPTY            0
      65             : #define VT_NULL             1
      66             : #define VT_I2               2
      67             : #define VT_I4               3
      68             : #define VT_R4               4
      69             : #define VT_R8               5
      70             : #define VT_CY               6
      71             : #define VT_DATE             7
      72             : #define VT_BSTR             8
      73             : #define VT_UI4              9
      74             : #define VT_ERROR            10
      75             : #define VT_BOOL             11
      76             : #define VT_VARIANT          12
      77             : #define VT_DECIMAL          14
      78             : #define VT_I1               16
      79             : #define VT_UI1              17
      80             : #define VT_UI2              18
      81             : #define VT_I8               20
      82             : #define VT_UI8              21
      83             : #define VT_INT              22
      84             : #define VT_UINT             23
      85             : #define VT_LPSTR            30
      86             : #define VT_LPWSTR           31
      87             : #define VT_FILETIME         64
      88             : #define VT_BLOB             65
      89             : #define VT_STREAM           66
      90             : #define VT_STORAGE          67
      91             : #define VT_STREAMED_OBJECT  68
      92             : #define VT_STORED_OBJECT    69
      93             : #define VT_BLOB_OBJECT      70
      94             : #define VT_CF               71
      95             : #define VT_CLSID            72
      96             : #define VT_VECTOR           0x1000
      97             : #define VT_ARRAY            0x2000
      98             : #define VT_BYREF            0x4000
      99             : #define VT_TYPEMASK         0xFFF
     100             : 
     101             : // ------------------------------------------------------------------------
     102             : 
     103             : typedef std::map<String,sal_uInt32> Dictionary;
     104             : 
     105             : struct PropEntry
     106             : {
     107             :     sal_uInt32  mnId;
     108             :     sal_uInt32  mnSize;
     109             :     sal_uInt16  mnTextEnc;
     110             :     sal_uInt8*  mpBuf;
     111             : 
     112             :     PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize, sal_uInt16 nTextEnc );
     113             :     PropEntry( const PropEntry& rProp );
     114          82 :     ~PropEntry() { delete[] mpBuf; } ;
     115             : 
     116             :     const PropEntry& operator=(const PropEntry& rPropEntry);
     117             : };
     118             : 
     119          10 : class PropItem : public SvMemoryStream
     120             : {
     121             :         sal_uInt16      mnTextEnc;
     122             : 
     123             :     public :
     124          10 :                         PropItem(){};
     125             :         void            Clear();
     126             : 
     127           9 :         void            SetTextEncoding( sal_uInt16 nTextEnc ){ mnTextEnc = nTextEnc; };
     128             :         sal_Bool        Read( String& rString, sal_uInt32 nType = VT_EMPTY, sal_Bool bDwordAlign = sal_True );
     129             :         PropItem&       operator=( PropItem& rPropItem );
     130             : 
     131             :     using SvStream::Read;
     132             : };
     133             : 
     134             : // ------------------------------------------------------------------------
     135             : 
     136          16 : class Section
     137             : {
     138             :         sal_uInt16              mnTextEnc;
     139             :         boost::ptr_vector<PropEntry> maEntries;
     140             : 
     141             :     protected:
     142             : 
     143             :         sal_uInt8                   aFMTID[ 16 ];
     144             : 
     145             :         void                    AddProperty( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize );
     146             : 
     147             :     public:
     148             :                                 Section( const sal_uInt8* pFMTID );
     149             :                                 Section( const Section& rSection );
     150             : 
     151             :         Section&                operator=( const Section& rSection );
     152             :         sal_Bool                GetProperty( sal_uInt32 nId, PropItem& rPropItem );
     153             :         sal_Bool                GetDictionary( Dictionary& rDict );
     154          13 :         const sal_uInt8*        GetFMTID() const { return aFMTID; };
     155             :         void                    Read( SvStorageStream* pStrm );
     156             : };
     157             : 
     158             : // ------------------------------------------------------------------------
     159             : 
     160           5 : class PropRead
     161             : {
     162             :         sal_Bool                mbStatus;
     163             :         SvStorageStreamRef      mpSvStream;
     164             : 
     165             :         sal_uInt16              mnByteOrder;
     166             :         sal_uInt16              mnFormat;
     167             :         sal_uInt16              mnVersionLo;
     168             :         sal_uInt16              mnVersionHi;
     169             :         sal_uInt8               mApplicationCLSID[ 16 ];
     170             :         boost::ptr_vector<Section> maSections;
     171             : 
     172             :         void                    AddSection( Section& rSection );
     173             : 
     174             :     public:
     175             :                                 PropRead( SvStorage& rSvStorage, const String& rName );
     176             : 
     177             :         PropRead&               operator=( const PropRead& rPropRead );
     178             :         const Section*          GetSection( const sal_uInt8* pFMTID );
     179           5 :         sal_Bool                IsValid() const { return mbStatus; };
     180             :         void                    Read();
     181             : };
     182             : 
     183             : 
     184             : #endif
     185             : 
     186             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10