LCOV - code coverage report
Current view: top level - sw/source/filter/ww8 - ww8struc.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 131 148 88.5 %
Date: 2014-04-11 Functions: 37 43 86.0 %
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 INCLUDED_SW_SOURCE_FILTER_WW8_WW8STRUC_HXX
      21             : #define INCLUDED_SW_SOURCE_FILTER_WW8_WW8STRUC_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <boost/static_assert.hpp>
      26             : #include <osl/endian.h>
      27             : #include "rtl/ustring.hxx"
      28             : 
      29             : #include <editeng/borderline.hxx>
      30             : #include <filter/msfilter/util.hxx>
      31             : 
      32             : #ifdef SAL_W32
      33             : #   pragma pack(push, 2)
      34             : #endif
      35             : 
      36         108 : inline void Set_UInt8( sal_uInt8 *& p, sal_uInt8 n )
      37             : {
      38         108 :     *p = n;
      39         108 :     p+= 1;
      40         108 : }
      41             : 
      42        3359 : inline void Set_UInt16( sal_uInt8 *& p, sal_uInt16 n )
      43             : {
      44        3359 :     ShortToSVBT16( n, *(SVBT16*)p );
      45        3359 :     p+= 2;
      46        3359 : }
      47             : 
      48        2179 : inline void Set_UInt32( sal_uInt8 *& p, sal_uInt32 n )
      49             : {
      50        2179 :     UInt32ToSVBT32( n, *(SVBT32*)p );
      51        2179 :     p+= 4;
      52        2179 : }
      53             : 
      54             : struct Word2CHPX
      55             : {
      56             :     sal_uInt16 fBold:1;
      57             :     sal_uInt16 fItalic:1;
      58             :     sal_uInt16 fRMarkDel:1;
      59             :     sal_uInt16 fOutline:1;
      60             :     sal_uInt16 fFldVanish:1;
      61             :     sal_uInt16 fSmallCaps:1;
      62             :     sal_uInt16 fCaps:1;
      63             :     sal_uInt16 fVanish:1;
      64             :     sal_uInt16 fRMark:1;
      65             :     sal_uInt16 fSpec:1;
      66             :     sal_uInt16 fStrike:1;
      67             :     sal_uInt16 fObj:1;
      68             :     sal_uInt16 fBoldBi:1;
      69             :     sal_uInt16 fItalicBi:1;
      70             :     sal_uInt16 fBiDi:1;
      71             :     sal_uInt16 fDiacUSico:1;
      72             :     sal_uInt16 fsIco:1;
      73             :     sal_uInt16 fsFtc:1;
      74             :     sal_uInt16 fsHps:1;
      75             :     sal_uInt16 fsKul:1;
      76             :     sal_uInt16 fsPos:1;
      77             :     sal_uInt16 fsSpace:1;
      78             :     sal_uInt16 fsLid:1;
      79             :     sal_uInt16 fsIcoBi:1;
      80             :     sal_uInt16 fsFtcBi:1;
      81             :     sal_uInt16 fsHpsBi:1;
      82             :     sal_uInt16 fsLidBi:1;
      83             : 
      84             :     sal_uInt16 ftc;
      85             :     sal_uInt16 hps;
      86             :     sal_uInt8 qpsSpace:6;
      87             :     sal_uInt8 fSysVanish:1;
      88             :     sal_uInt8 fNumRun:1;
      89             :     sal_uInt8 ico:5;
      90             :     sal_uInt8 kul:3;
      91             :     sal_uInt8 hpsPos;
      92             :     sal_uInt8 icoBi;
      93             :     sal_uInt16 lid;
      94             :     sal_uInt16 ftcBi;
      95             :     sal_uInt16 hpsBi;
      96             :     sal_uInt16 lidBi;
      97             :     sal_uInt32 fcPic;
      98             : 
      99          88 :     Word2CHPX()
     100             :     {
     101          88 :         fBold = 0;
     102          88 :         fItalic = 0;
     103          88 :         fRMarkDel = 0;
     104          88 :         fOutline = 0;
     105          88 :         fFldVanish = 0;
     106          88 :         fSmallCaps = 0;
     107          88 :         fCaps = 0;
     108          88 :         fVanish = 0;
     109          88 :         fRMark = 0;
     110          88 :         fSpec = 0;
     111          88 :         fStrike = 0;
     112          88 :         fObj = 0;
     113          88 :         fBoldBi = 0;
     114          88 :         fItalicBi = 0;
     115          88 :         fBiDi = 0;
     116          88 :         fDiacUSico = 0;
     117          88 :         fsIco = 0;
     118          88 :         fsFtc = 0;
     119          88 :         fsHps = 0;
     120          88 :         fsKul = 0;
     121          88 :         fsPos = 0;
     122          88 :         fsSpace = 0;
     123          88 :         fsLid = 0;
     124          88 :         fsIcoBi = 0;
     125          88 :         fsFtcBi = 0;
     126          88 :         fsHpsBi = 0;
     127          88 :         fsLidBi = 0;
     128             : 
     129          88 :         ftc = 0;
     130          88 :         hps = 0;
     131          88 :         qpsSpace = 0;
     132          88 :         fSysVanish = 0;
     133          88 :         fNumRun = 0;
     134          88 :         ico = 0;
     135          88 :         kul = 0;
     136          88 :         hpsPos = 0;
     137          88 :         icoBi = 0;
     138          88 :         lid = 0;
     139          88 :         ftcBi = 0;
     140          88 :         hpsBi = 0;
     141          88 :         lidBi = 0;
     142          88 :         fcPic = 0;
     143          88 :     }
     144             : };
     145             : 
     146             : typedef sal_Int16 WW8_PN;
     147             : typedef sal_Int32 WW8_FC;
     148             : typedef sal_Int32 WW8_CP;
     149             : 
     150             : const WW8_FC WW8_FC_MAX = SAL_MAX_INT32;
     151             : const WW8_CP WW8_CP_MAX = SAL_MAX_INT32;
     152             : 
     153             : /** STD - STyle Definition
     154             : 
     155             :     The STD contains the entire definition of a style.
     156             :     It has two parts, a fixed-length base (cbSTDBase bytes long)
     157             :     and a variable length remainder holding the name, and the upx and upe
     158             :     arrays (a upx and upe for each type stored in the style, std.cupx)
     159             :     Note that new fields can be added to the BASE of the STD without
     160             :     invalidating the file format, because the STSHI contains the length
     161             :     that is stored in the file.  When reading STDs from an older version,
     162             :     new fields will be zero.
     163             : */
     164             : struct WW8_STD
     165             : {
     166             :     // Base part of STD:
     167             :     sal_uInt16  sti : 12;          // invariant style identifier
     168             :     sal_uInt16  fScratch : 1;      // spare field for any temporary use,
     169             :                                                          // always reset back to zero!
     170             :     sal_uInt16  fInvalHeight : 1;  // PHEs of all text with this style are wrong
     171             :     sal_uInt16  fHasUpe : 1;       // UPEs have been generated
     172             :     sal_uInt16  fMassCopy : 1;     // std has been mass-copied; if unused at
     173             :                                                          // save time, style should be deleted
     174             :     sal_uInt16  sgc : 4;           // style type code
     175             :     sal_uInt16  istdBase : 12;     // base style
     176             :     sal_uInt16  cupx : 4;          // # of UPXs (and UPEs)
     177             :     sal_uInt16  istdNext : 12;     // next style
     178             :     sal_uInt16  bchUpe;            // offset to end of upx's, start of upe's
     179             :     //-------- jetzt neu:
     180             :     // ab Ver8 gibts zwei Felder mehr:
     181             :   sal_uInt16    fAutoRedef : 1;    /* auto redefine style when appropriate */
     182             :   sal_uInt16    fHidden : 1;       /* hidden from UI? */
     183             :   sal_uInt16    : 14;              /* unused bits */
     184             : 
     185             :     // Variable length part of STD:
     186             :     //  sal_uInt8   stzName[2];        /* sub-names are separated by chDelimStyle
     187             :     // char grupx[];
     188             :             // the UPEs are not stored on the file; they are a cache of the based-on
     189             :         // chain
     190             :     // char grupe[];
     191             : };
     192             : 
     193             : BOOST_STATIC_ASSERT(sizeof (WW8_STD) == 10);
     194             : 
     195             : /** Basis zum Einlesen UND zum Arbeiten (wird jeweils unter schiedlich beerbt)
     196             : */
     197         485 : struct WW8_FFN_BASE     // Font Descriptor
     198             : {
     199             :     // ab Ver6
     200             :     sal_uInt8    cbFfnM1;        //  0x0     total length of FFN - 1.
     201             : 
     202             :     sal_uInt8    prg: 2;         //  0x1:03  pitch request
     203             :     sal_uInt8    fTrueType : 1;  //  0x1:04  when 1, font is a TrueType font
     204             :     sal_uInt8    _reserved1 : 1; //  0x1:08  reserved
     205             :     sal_uInt8    ff : 3;         //  0x1:70  font family id
     206             :     sal_uInt8    _reserved2 : 1; //  0x1:80  reserved
     207             : 
     208             :     short wWeight;          //  0x2     base weight of font
     209             :     sal_uInt8    chs;            //  0x4     character set identifier
     210             :     sal_uInt8    ibszAlt;        //  0x5     index into ffn.szFfn to the name of the alternate font
     211             : };
     212             : 
     213             : BOOST_STATIC_ASSERT(sizeof (WW8_FFN_BASE) == 6);
     214             : 
     215             : /** Hiermit arbeiten wir im Parser (und Dumper)
     216             : */
     217         970 : struct WW8_FFN : public WW8_FFN_BASE
     218             : {
     219             :     // ab Ver8 als Unicode
     220             :     OUString sFontname;// 0x6 bzw. 0x40 ab Ver8 zero terminated string that
     221             :                                         // records name of font.
     222             :                                         // Maximal size of szFfn is 65 characters.
     223             :                                         // Vorsicht: Dieses Array kann auch kleiner sein!!!
     224             :                                         // Possibly followed by a second sz which records the
     225             :                                         // name of an alternate font to use if the first named
     226             :                                         // font does not exist on this system.
     227             : };
     228             : 
     229             : struct WW8_BRCVer6  // BoRder Code (WW6 version)
     230             : {
     231             :     SVBT16 aBits1;
     232             : //  sal_uInt16 dxpLineWidth : 3;// 0007 When dxpLineWidth is 0, 1, 2, 3, 4, or 5, this field is the width of
     233             :                             //      a single line of border in units of 0.75 points
     234             :                             //      Must be nonzero when brcType is nonzero.
     235             :                             //      6 == dotted, 7 == dashed.
     236             : //  sal_uInt16 brcType : 2;     // 0018 border type code: 0 == none, 1 == single, 2 == thick, 3 == double
     237             : //  sal_uInt16 fShadow : 1;     // 0020 when 1, border is drawn with shadow. Must be 0 when BRC is a substructure of the TC
     238             : //  sal_uInt16 ico : 5;         // 07C0 color code (see chp.ico)
     239             : //  sal_uInt16 dxpSpace : 5;    // F800 width of space to maintain between border and text within border.
     240             :                             //      Must be 0 when BRC is a substructure of the TC.  Stored in points for Windows.
     241             :     WW8_BRCVer6()
     242             :     {
     243             :         memset(aBits1, 0, sizeof(aBits1));
     244             :     }
     245             : 
     246           0 :     sal_uInt8 dxpLineWidth() const
     247           0 :         { return aBits1[0] & 0x07; }
     248           0 :     sal_uInt8 brcType() const
     249           0 :         { return (aBits1[0] & 0x18) >> 3; }
     250           0 :     bool fShadow() const
     251           0 :         { return !!(aBits1[0] & 0x20); }
     252           0 :     sal_uInt8 ico() const
     253           0 :         { return ((aBits1[0] & 0xc0) >> 6) | ((aBits1[1] & 0x07) << 2); }
     254           0 :     sal_uInt8 dxpSpace() const
     255           0 :         { return aBits1[1] >> 3; }
     256             : 
     257           0 :     WW8_BRCVer6(sal_uInt8 _dxpLineWidth, sal_uInt8 _brcType, sal_uInt8 _ico,
     258             :         sal_uInt8 _dxpSpace, bool _fShadow)
     259             :     {
     260             :         assert(_dxpSpace < 0x20);
     261             :         assert(_brcType <= 3);
     262             :         assert(_ico < 32);
     263           0 :         aBits1[0] = _dxpLineWidth | (_brcType << 3) | ((sal_uInt8)_fShadow << 5)
     264           0 :             | ((_ico << 6) & 0xc0);
     265           0 :         aBits1[1] = (_ico >> 2) | (_dxpSpace << 3);
     266           0 :     }
     267             :     // Convert BRC from WW8 to WW6 format
     268             :     WW8_BRCVer6(const struct WW8_BRC& brcVer8);
     269             : };
     270             : 
     271             : struct WW8_BRC  // BoRder Code (WW8 version)
     272             : // Documented at http://msdn.microsoft.com/en-us/library/dd952599.aspx
     273             : {
     274             :     SVBT16 aBits1;
     275             :     SVBT16 aBits2;
     276             : //  sal_uInt8 dptLineWidth;
     277             : //  sal_uInt8 brcType;
     278             : //  sal_uInt8 ico;
     279             : //  sal_uInt8 dptSpace : 5
     280             : //  bool fShadow : 1;
     281             : //  bool fFrame : 1;
     282             : //  bool fReserved : 1;
     283         620 :     WW8_BRC()
     284             :     {
     285         620 :         memset(aBits1, 0, sizeof(aBits1));
     286         620 :         memset(aBits2, 0, sizeof(aBits2));
     287         620 :     }
     288             : 
     289       29546 :     sal_uInt8 dptLineWidth() const // border line width (1/8pt)
     290       29546 :         { return aBits1[0]; }
     291       29546 :     sal_uInt8 brcType() const      // border type (eg single, double, dotted)
     292       29546 :         { return aBits1[1]; }
     293       35227 :     sal_uInt8 ico() const          // colour index, 1-17 or 0=auto
     294       35227 :         { return aBits2[0]; }
     295       29546 :     sal_uInt8 dptSpace() const     // space between text & border (pt)
     296       29546 :         { return aBits2[1] & 0x1f; }
     297       29546 :     bool fShadow() const           // shadow effect
     298       29546 :         { return !!(aBits2[1] & 0x20); }
     299       29546 :     bool fFrame() const            // 3D frame effect
     300       29546 :         { return !!(aBits2[1] & 0x40); }
     301       29795 :     bool isNil() const             // nil = no border
     302       29795 :         { return aBits1[0] == 0xff && aBits1[1] == 0xff; }
     303             : 
     304         208 :     WW8_BRC(sal_uInt8 _dptLineWidth, sal_uInt8 _brcType, sal_uInt8 _ico,
     305             :         sal_uInt8 _dptSpace, bool _fShadow, bool _fFrame)
     306             :     {
     307             :         assert(_dptSpace < 0x20);
     308         208 :         aBits1[0] = _dptLineWidth;
     309         208 :         aBits1[1] = _brcType;
     310         208 :         aBits2[0] = _ico;
     311         208 :         aBits2[1] = _dptSpace | ((sal_uInt8)_fShadow << 5)
     312         208 :             | ((sal_uInt8)_fFrame << 6);
     313         208 :     }
     314             :     // Convert BRC from WW6 to WW8 format
     315             :     WW8_BRC(const WW8_BRCVer6& brcVer6);
     316             : 
     317             :     // Returns LO border width in twips=1/20pt, taking into account brcType
     318             :     short DetermineBorderProperties(short *pSpace=0) const;
     319             : };
     320             : 
     321             : typedef WW8_BRC WW8_BRC5[5];        // 5 * Border Code
     322             : 
     323             : struct WW8_BRCVer9  // BoRder Code (WW9 version)
     324             : // Documented at http://msdn.microsoft.com/en-us/library/dd907496.aspx
     325             : {
     326             :     SVBT32 aBits1; // border colour (RGB)
     327             :     SVBT32 aBits2;
     328             : //  sal_uInt8 dptLineWidth;   // border line width (1/8pt)
     329             : //  sal_uInt8 brcType;        // border type (eg single, double, dotted)
     330             : //  sal_uInt8 dptSpace : 5;   // space between text & border (pt)
     331             : //  bool fShadow : 1;         // border has shadow effect
     332             : //  bool fFrame : 1;          // border has 3D effect
     333             : //  sal_uInt16 fReserved : 9; // unused
     334       48978 :     WW8_BRCVer9()
     335             :     {
     336       48978 :         memset(aBits1, 0, sizeof(aBits1));
     337       48978 :         memset(aBits2, 0, sizeof(aBits2));
     338       48978 :     }
     339             : 
     340        2736 :     sal_uInt32 cv() const          // colour value (BGR)
     341        2736 :         { return SVBT32ToUInt32(aBits1); }
     342        3280 :     sal_uInt8 dptLineWidth() const // border line width (1/8pt)
     343        3280 :         { return aBits2[0]; }
     344       15530 :     sal_uInt8 brcType() const      // border type (eg single, double, dotted)
     345       15530 :         { return aBits2[1]; }
     346        2984 :     sal_uInt8 dptSpace() const     // space between text & border (pt)
     347        2984 :         { return aBits2[2] & 0x1f; }
     348         829 :     bool fShadow() const           // shadow effect
     349         829 :         { return !!(aBits2[2] & 0x20); }
     350         208 :     bool fFrame() const            // 3D frame effect
     351         208 :         { return !!(aBits2[2] & 0x40); }
     352        3220 :     bool isNil() const             // nil = no border
     353        3220 :         { return SVBT32ToUInt32(aBits2) == 0xffffffff; }
     354             : 
     355       29916 :     WW8_BRCVer9(sal_uInt32 _cv, sal_uInt8 _dptLineWidth, sal_uInt8 _brcType,
     356             :         sal_uInt8 _dptSpace, bool _fShadow, bool _fFrame)
     357             :     {
     358             :         assert(_dptSpace < 0x20);
     359       29916 :         UInt32ToSVBT32(_cv, aBits1);
     360       29916 :         aBits2[0] = _dptLineWidth;
     361       29916 :         aBits2[1] = _brcType;
     362       29916 :         aBits2[2] = _dptSpace | ((sal_uInt8)_fShadow << 5)
     363       29916 :             | ((sal_uInt8)_fFrame << 6);
     364       29916 :         aBits2[3] = 0;
     365       29916 :     }
     366             :     // Convert BRC from WW8 to WW9 format
     367             :     WW8_BRCVer9(const WW8_BRC& brcVer8);
     368             : 
     369             :     // Returns LO border width in twips=1/20pt, taking into account brcType
     370             :     short DetermineBorderProperties(short *pSpace=0) const;
     371             : };
     372             : 
     373             : typedef WW8_BRCVer9 WW8_BRCVer9_5[5];        // 5 * Border Code
     374             : 
     375             : enum BRC_Sides
     376             : {
     377             :     WW8_TOP = 0, WW8_LEFT = 1, WW8_BOT = 2, WW8_RIGHT = 3, WW8_BETW = 4
     378             : };
     379             : 
     380             : /*
     381             : Document Typography Info (DOPTYPOGRAPHY) These options are Far East only,
     382             : and are accessible through the Typography tab of the Tools/Options dialog.
     383             : */
     384             : class WW8DopTypography
     385             : {
     386             : public:
     387             :     void ReadFromMem(sal_uInt8 *&pData);
     388             :     void WriteToMem(sal_uInt8 *&pData) const;
     389             : 
     390             :     //Maps what I think is the language this is to affect to the OOo language
     391             :     sal_uInt16 GetConvertedLang() const;
     392             : 
     393             :     sal_uInt16 fKerningPunct  : 1;  // true if we're kerning punctuation
     394             :     sal_uInt16 iJustification : 2;  // Kinsoku method of justification:
     395             :                                 //  0 = always expand
     396             :                                 //  1 = compress punctuation
     397             :                                 //  2 = compress punctuation and kana.
     398             :     sal_uInt16 iLevelOfKinsoku : 2; // Level of Kinsoku:
     399             :                                 //  0 = Level 1
     400             :                                 //  1 = Level 2
     401             :                                 //  2 = Custom
     402             :     sal_uInt16 f2on1          : 1;  // 2-page-on-1 feature is turned on.
     403             :     sal_uInt16 reserved1      : 4;  // in 97 its marked as reserved BUT
     404             :     sal_uInt16 reserved2      : 6;  // reserved ?
     405             :     //we find that the following applies,
     406             :     //2 == Japanese
     407             :     //4 == Chinese (VR...
     408             :     //6 == Korean
     409             :     //8 == Chinese (Ta...
     410             :     //perhaps a bit field where the DOP can possibly relate to more than
     411             :     //one language at a time, nevertheless MS seems to have painted
     412             :     //themselves into a small corner with one DopTypography for the
     413             :     //full document, might not matter all that much though ?
     414             : 
     415             :     enum RuleLengths {nMaxFollowing = 101, nMaxLeading = 51};
     416             :     static const sal_Unicode * GetJapanNotBeginLevel1();
     417             :     static const sal_Unicode * GetJapanNotEndLevel1();
     418             : 
     419             :     sal_Int16 cchFollowingPunct;    // length of rgxchFPunct
     420             :     sal_Int16 cchLeadingPunct;      // length of rgxchLPunct
     421             : 
     422             :     // array of characters that should never appear at the start of a line
     423             :     sal_Unicode rgxchFPunct[nMaxFollowing];
     424             :     // array of characters that should never appear at the end of a line
     425             :     sal_Unicode rgxchLPunct[nMaxLeading];
     426             : };
     427             : 
     428             : struct WW8_DOGRID
     429             : {
     430             :     short xaGrid;       // x-coord of the upper left-hand corner of the grid
     431             :     short yaGrid;       // y-coord of the upper left-hand corner of the grid
     432             :     short dxaGrid;  // width of each grid square
     433             :     short dyaGrid;  // height of each grid square
     434             : 
     435             :     /* a c h t u n g :     es duerfen keine solchen Bitfelder ueber einen eingelesenes Byte-Array
     436             :                             gelegt werden!!
     437             :                             stattdessen ist ein aBits1 darueber zu legen, das mit & auszulesen ist
     438             :     GRUND: Compiler auf Intel und Sparc sortieren die Bits unterschiedlich
     439             :     */
     440             : 
     441             :     short dyGridDisplay:7;  // the number of grid squares (in the y direction)
     442             :                                                     // between each gridline drawn on the screen. 0 means
     443             :                                                     // don't display any gridlines in the y direction.
     444             :     short fTurnItOff   :1;  // suppress display of gridlines
     445             :     short dxGridDisplay:7;  // the number of grid squares (in the x direction)
     446             :                                                     // between each gridline drawn on the screen. 0 means
     447             :                                                     // don't display any gridlines in the y direction.
     448             :     short fFollowMargins:1; // if true, the grid will start at the left and top
     449             :                                                     // margins and ignore xaGrid and yaGrid.
     450             : };
     451             : 
     452             : BOOST_STATIC_ASSERT(sizeof (WW8_DOGRID) == 10);
     453             : 
     454          20 : struct WW8_PIC
     455             : {
     456             :     sal_Int32 lcb;          // 0x0 number of bytes in the PIC structure plus size of following picture data which may be a Window's metafile, a bitmap, or the filename of a TIFF file.
     457             :     sal_uInt16 cbHeader;    // 0x4 number of bytes in the PIC (to allow for future expansion).
     458             :     struct {
     459             :         sal_Int16 mm;       // 0x6  int
     460             :         sal_Int16 xExt;     // 0x8  int
     461             :         sal_Int16 yExt;     // 0xa  int
     462             :         sal_Int16 hMF;      // 0xc  int
     463             :     }MFP;
     464             : //  sal_uInt8 bm[14];        // 0xe  BITMAP(14 bytes)    Window's bitmap structure when PIC describes a BITMAP.
     465             :     sal_uInt8 rcWinMF[14];   // 0xe  rc (rectangle - 8 bytes) rect for window origin
     466             :                         //      and extents when  metafile is stored -- ignored if 0
     467             :     sal_Int16 dxaGoal;      // 0x1c horizontal  measurement in twips of the  rectangle the picture should be imaged within.
     468             :     sal_Int16 dyaGoal;      // 0x1e vertical  measurement in twips of the  rectangle the picture should be imaged within.
     469             :     sal_uInt16 mx;          // 0x20 horizontal scaling factor supplied by user in .1% units.
     470             :     sal_uInt16 my;          // 0x22 vertical scaling factor supplied by user in .1% units.
     471             :     sal_Int16 dxaCropLeft;  // 0x24 the amount the picture has been cropped on the left in twips.
     472             :     sal_Int16 dyaCropTop;   // 0x26 the amount the picture has been cropped on the top in twips.
     473             :     sal_Int16 dxaCropRight; // 0x28 the amount the picture has been cropped on the right in twips.
     474             :     sal_Int16 dyaCropBottom;// 0x2a the amount the picture has been cropped on the bottom in twips.
     475             :     sal_Int16 brcl : 4;     // 000F Obsolete, superseded by brcTop, etc.  In
     476             :     sal_Int16 fFrameEmpty : 1;  // 0010 picture consists of a single frame
     477             :     sal_Int16 fBitmap : 1;      // 0020 ==1, when picture is just a bitmap
     478             :     sal_Int16 fDrawHatch : 1;   // 0040 ==1, when picture is an active OLE object
     479             :     sal_Int16 fError : 1;       // 0080 ==1, when picture is just an error message
     480             :     sal_Int16 bpp : 8;      // FF00 bits per pixel, 0 = unknown
     481             :     WW8_BRC rgbrc[4];
     482             : //  BRC brcTop;         // 0x2e specification for border above picture
     483             : //  BRC brcLeft;        // 0x30 specification for border to the left
     484             : //  BRC brcBottom;      // 0x32 specification for border below picture
     485             : //  BRC brcRight;       // 0x34 specification for border to the right
     486             :     sal_Int16 dxaOrigin;    // 0x36 horizontal offset of hand annotation origin
     487             :     sal_Int16 dyaOrigin;    // 0x38 vertical offset of hand annotation origin
     488             : //  sal_uInt8 rgb[];         // 0x3a variable array of bytes containing Window's metafile, bitmap or TIFF file filename.
     489             : };
     490             : 
     491             : struct WW8_PIC_SHADOW
     492             : {
     493             :     SVBT32 lcb;         // 0x0 number of bytes in the PIC structure plus size of following picture data which may be a Window's metafile, a bitmap, or the filename of a TIFF file.
     494             :     SVBT16 cbHeader;    // 0x4 number of bytes in the PIC (to allow for future expansion).
     495             :     struct {
     496             :         SVBT16 mm;      // 0x6  int
     497             :         SVBT16 xExt;        // 0x8  int
     498             :         SVBT16 yExt;        // 0xa  int
     499             :         SVBT16 hMF;     // 0xc  int
     500             :     }MFP;
     501             : //  sal_uInt8 bm[14];       // 0xe  BITMAP(14 bytes)    Window's bitmap structure when PIC describes a BITMAP.
     502             :     sal_uInt8 rcWinMF[14];  // 0xe  rc (rectangle - 8 bytes) rect for window origin
     503             :                         //      and extents when  metafile is stored -- ignored if 0
     504             :     SVBT16 dxaGoal;     // 0x1c horizontal  measurement in twips of the  rectangle the picture should be imaged within.
     505             :     SVBT16 dyaGoal;     // 0x1e vertical  measurement in twips of the  rectangle the picture should be imaged within.
     506             :     SVBT16 mx;          // 0x20 horizontal scaling factor supplied by user in .1% units.
     507             :     SVBT16 my;          // 0x22 vertical scaling factor supplied by user in .1% units.
     508             :     SVBT16 dxaCropLeft; // 0x24 the amount the picture has been cropped on the left in twips.
     509             :     SVBT16 dyaCropTop;  // 0x26 the amount the picture has been cropped on the top in twips.
     510             :     SVBT16 dxaCropRight;    // 0x28 the amount the picture has been cropped on the right in twips.
     511             :     SVBT16 dyaCropBottom;// 0x2a    the amount the picture has been cropped on the bottom in twips.
     512             :     sal_uInt8 aBits1; //0x2c
     513             :     sal_uInt8 aBits2;
     514             : //  WW8_BRC rgbrc[4];
     515             : //  BRC brcTop;         // 0x2e specification for border above picture
     516             : //  BRC brcLeft;        // 0x30 specification for border to the left
     517             : //  BRC brcBottom;      // 0x32 specification for border below picture
     518             : //  BRC brcRight;       // 0x34 specification for border to the right
     519             : //  SVBT16 dxaOrigin;   // 0x36 horizontal offset of hand annotation origin
     520             : //  SVBT16 dyaOrigin;   // 0x38 vertical offset of hand annotation origin
     521             : //  sal_uInt8 rgb[];            // 0x3a variable array of bytes containing Window's metafile, bitmap or TIFF file filename.
     522             : };
     523             : 
     524             : BOOST_STATIC_ASSERT(sizeof (WW8_PIC_SHADOW) == 0x2E);
     525             :     // "0x2E": cf. SwWW8ImplReader::PicRead pDataStream->Read call
     526             : 
     527             : struct WW8_TBD
     528             : {
     529             :     sal_uInt8 aBits1;
     530             : //  sal_uInt8 jc : 3;        // 0x07 justification code: 0=left tab, 1=centered tab, 2=right tab, 3=decimal tab, 4=bar
     531             : //  sal_uInt8 tlc : 3;       // 0x38 tab leader code: 0=no leader, 1=dotted leader,
     532             :                         // 2=hyphenated leader, 3=single line leader, 4=heavy line leader
     533             : //  *   int :2  C0  reserved
     534             : };
     535             : 
     536        8457 : struct WW8_TCell    // hiermit wird weitergearbeitet (entspricht weitestgehend dem Ver8-Format)
     537             : {
     538             :     sal_uInt8 bFirstMerged   : 1;// 0001 set to 1 when cell is first cell of a range of cells that have been merged.
     539             :     sal_uInt8 bMerged        : 1;// 0002 set to 1 when cell has been merged with preceding cell.
     540             :     sal_uInt8 bVertical      : 1;// set to 1 when cell has vertical text flow
     541             :     sal_uInt8 bBackward      : 1;// for a vertical table cell, text flow is bottom to top when 1 and is bottom to top when 0.
     542             :     sal_uInt8 bRotateFont    : 1;// set to 1 when cell has rotated characters (i.e. uses @font)
     543             :     sal_uInt8 bVertMerge     : 1;// set to 1 when cell is vertically merged with the cell(s) above and/or below. When cells are vertically merged, the display area of the merged cells are consolidated. The consolidated area is used to display the contents of the first vertically merged cell (the cell with fVertRestart set to 1), and all other vertically merged cells (those with fVertRestart set to 0) must be empty. Cells can only be merged vertically if their left and right boundaries are (nearly) identical (i.e. if corresponding entries in rgdxaCenter of the table rows differ by at most 3).
     544             :     sal_uInt8 bVertRestart   : 1;// set to 1 when the cell is the first of a set of vertically merged cells. The contents of a cell with fVertStart set to 1 are displayed in the consolidated area belonging to the entire set of vertically merged cells. Vertically merged cells with fVertRestart set to 0 must be empty.
     545             :     sal_uInt8 nVertAlign     : 2;// specifies the alignment of the cell contents relative to text flow (e.g. in a cell with bottom to top text flow and bottom vertical alignment, the text is shifted horizontally to match the cell's right boundary):
     546             :                                                     //          0 top
     547             :                                                     //          1 center
     548             :                                                     //          2 bottom
     549             :     sal_uInt16 fUnused      : 7;// reserved - nicht loeschen: macht das sal_uInt16 voll !!
     550             : 
     551             :     WW8_BRCVer9 rgbrc[4];   // border codes
     552             : //notational convenience for referring to brcTop, brcLeft, etc fields.
     553             : //  BRC brcTop;             // specification of the top border of a table cell
     554             : //  BRC brcLeft;            // specification of left border of table row
     555             : //  BRC brcBottom;          // specification of bottom border of table row
     556             : //  BRC brcRight;           // specification of right border of table row.
     557             : };
     558             : // cbTC (count of bytes of a TC) is 18(decimal), 12(hex).
     559             : 
     560             : struct WW8_TCellVer6    // wird aus der Datei gelesen
     561             : {
     562             :     sal_uInt8  aBits1Ver6;
     563             :     sal_uInt8  aBits2Ver6;
     564             : //  sal_uInt16 fFirstMerged : 1;// 0001 set to 1 when cell is first cell of a range of cells that have been merged.
     565             : //  sal_uInt16 fMerged : 1;     // 0002 set to 1 when cell has been merged with preceding cell.
     566             : //  sal_uInt16 fUnused : 14;    // FFFC reserved
     567             :     WW8_BRCVer6 rgbrcVer6[4];
     568             : // notational convenience for referring to brcTop, brcLeft, etc fields:
     569             : //          BRC brcTop;             // specification of the top border of a table cell
     570             : //          BRC brcLeft;            // specification of left border of table row
     571             : //          BRC brcBottom;          // specification of bottom border of table row
     572             : //          BRC brcRight;           // specification of right border of table row.
     573             : };
     574             : // cbTC (count of bytes of a TC) is 10(decimal), A(hex).
     575             : 
     576             : struct WW8_TCellVer8    // wird aus der Datei gelesen
     577             : {
     578             :     SVBT16 aBits1Ver8;      // Dokumentation siehe oben unter WW8_TCell
     579             :     SVBT16 aUnused;         // reserve
     580             :     WW8_BRC rgbrcVer8[4];   // Dokumentation siehe oben unter WW8_TCell
     581             : };
     582             : // cbTC (count of bytes of a TC) is 20(decimal), 14(hex).
     583             : 
     584             : struct WW8_SHD              // struct SHD fehlt in der Beschreibung
     585             : {
     586             : private:
     587             :     sal_uInt16 maBits;
     588             : //  sal_uInt16 nFore : 5;       // 0x001f ForegroundColor
     589             : //  sal_uInt16 nBack : 5;       // 0x03e0 BackgroundColor
     590             : //  sal_uInt16 nStyle : 5;      // 0x7c00 Percentage and Style
     591             : //  sal_uInt16 nDontKnow : 1;   // 0x8000 ???   ab Ver8: ebenfalls fuer Style
     592             : 
     593             : public:
     594         919 :     WW8_SHD() : maBits(0) {}
     595             : 
     596           7 :     sal_uInt8 GetFore() const { return (sal_uInt8)( maBits & 0x1f); }
     597           7 :     sal_uInt8 GetBack() const { return (sal_uInt8)((maBits >> 5 ) & 0x1f); }
     598           7 :     sal_uInt8 GetStyle(bool bVer67)  const
     599           7 :         { return (sal_uInt8)((maBits >> 10) & ( bVer67 ? 0x1f : 0x3f ) ); }
     600             : 
     601         602 :     sal_uInt16 GetValue() const { return maBits; }
     602             : 
     603             :     void SetValue(sal_uInt16 nVal) { maBits = nVal; }
     604         530 :     void SetWWValue(SVBT16 nVal) { maBits = SVBT16ToShort(nVal); }
     605             : 
     606          31 :     void SetFore(sal_uInt8 nVal)
     607             :     {
     608          31 :         maBits &= 0xffe0;
     609          31 :         maBits |= (nVal & 0x1f);
     610          31 :     }
     611          31 :     void SetBack(sal_uInt8 nVal)
     612             :     {
     613          31 :         maBits &= 0xfc1f;
     614          31 :         maBits |= (nVal & 0x1f) << 5;
     615          31 :     }
     616          31 :     void SetStyle(bool bVer67, sal_uInt8 nVal)
     617             :     {
     618          31 :         if (bVer67)
     619             :         {
     620          31 :             maBits &= 0x83ff;
     621          31 :             maBits |= (nVal & 0x1f) << 10;
     622             :         }
     623             :         else
     624             :         {
     625           0 :             maBits &= 0x03ff;
     626           0 :             maBits |= (nVal & 0x2f) << 10;
     627             :         }
     628          31 :     }
     629             : };
     630             : 
     631             : struct WW8_ANLV
     632             : {
     633             :     sal_uInt8 nfc;          // 0        number format code, 0=Arabic, 1=Upper case Roman, 2=Lower case Roman
     634             :                         //          3=Upper case Letter, 4=Lower case letter, 5=Ordinal
     635             :     sal_uInt8 cbTextBefore; // 1        offset into anld.rgch limit of prefix text
     636             :     sal_uInt8 cbTextAfter;  // 2
     637             :     sal_uInt8 aBits1;
     638             : //  sal_uInt8 jc : 2;        // 3 : 0x03 justification code, 0=left, 1=center, 2=right, 3=left and right justify
     639             : //  sal_uInt8 fPrev : 1;     //     0x04 when ==1, include previous levels
     640             : //  sal_uInt8 fHang : 1;     //     0x08 when ==1, number will be displayed using a hanging indent
     641             : //  sal_uInt8 fSetBold : 1;  //     0x10 when ==1, boldness of number will be determined by anld.fBold.
     642             : //  sal_uInt8 fSetItalic : 1;//     0x20 when ==1, italicness of number will be determined by anld.fItalic
     643             : //  sal_uInt8 fSetSmallCaps : 1;//  0x40 when ==1, anld.fSmallCaps will determine whether number will be displayed in small caps or not.
     644             : //  sal_uInt8 fSetCaps : 1;  //     0x80 when ==1, anld.fCaps will determine whether number will be displayed capitalized or not
     645             :     sal_uInt8 aBits2;
     646             : //  sal_uInt8 fSetStrike : 1;// 4 : 0x01 when ==1, anld.fStrike will determine whether the number will be displayed using strikethrough or not.
     647             : //  sal_uInt8 fSetKul : 1;   //     0x02 when ==1, anld.kul will determine the underlining state of the autonumber.
     648             : //  sal_uInt8 fPrevSpace : 1;//     0x04 when ==1, autonumber will be displayed with a single prefixing space character
     649             : //  sal_uInt8 fBold : 1;     //     0x08 determines boldness of autonumber when anld.fSetBold == 1.
     650             : //  sal_uInt8 fItalic : 1;   //     0x10 determines italicness of autonumber when anld.fSetItalic == 1.
     651             : //  sal_uInt8 fSmallCaps : 1;//     0x20 determines whether autonumber will be displayed using small caps when anld.fSetSmallCaps == 1.
     652             : //  sal_uInt8 fCaps : 1;     //     0x40 determines whether autonumber will be displayed using caps when anld.fSetCaps == 1.
     653             : //  sal_uInt8 fStrike : 1;   //     0x80 determines whether autonumber will be displayed using caps when anld.fSetStrike == 1.
     654             :     sal_uInt8 aBits3;
     655             : //  sal_uInt8 kul : 3;       // 5 : 0x07 determines whether  autonumber will be displayed with underlining when anld.fSetKul == 1.
     656             : //  sal_uInt8 ico : 5;       //     0xF1 color of autonumber
     657             :     SVBT16 ftc;         // 6        font code of  autonumber
     658             :     SVBT16 hps;         // 8        font half point size (or 0=auto)
     659             :     SVBT16 iStartAt;    // 0x0a     starting value (0 to 65535)
     660             :     SVBT16 dxaIndent;   // 0x0c     *short?* *sal_uInt16?* width of prefix text (same as indent)
     661             :     SVBT16 dxaSpace;    // 0x0e     minimum space between number and paragraph
     662             : };
     663             : // *cbANLV (count of bytes of ANLV) is 16 (decimal), 10(hex).
     664             : 
     665             : struct WW8_ANLD
     666             : {
     667             :     WW8_ANLV eAnlv;     // 0
     668             :     sal_uInt8 fNumber1;     // 0x10     number only 1 item per table cell
     669             :     sal_uInt8 fNumberAcross;    // 0x11     number across cells in table rows(instead of down)
     670             :     sal_uInt8 fRestartHdn;  // 0x12     restart heading number on section boundary
     671             :     sal_uInt8 fSpareX;      // 0x13     unused( should be 0)
     672             :     sal_uInt8  rgchAnld[32]; // 0x14 characters displayed before/after autonumber
     673             : };
     674             : 
     675             : struct WW8_OLST
     676             : {
     677             :     WW8_ANLV rganlv[9]; // 0    an array of 9 ANLV structures (heading levels)
     678             :     sal_uInt8 fRestartHdr;  // 0x90 when ==1, restart heading on section break
     679             :     sal_uInt8 fSpareOlst2;  // 0x91 reserved
     680             :     sal_uInt8 fSpareOlst3;  // 0x92 reserved
     681             :     sal_uInt8 fSpareOlst4;  // 0x93 reserved
     682             :     sal_uInt8 rgch[64];      // 0x94 array of 64 chars       text before/after number
     683             : };
     684             : // cbOLST is 212(decimal), D4(hex).
     685             : 
     686             : struct WW8_FDOA
     687             : {
     688             :     SVBT32 fc;          // 0  FC pointing to drawing object data
     689             :     SVBT16 ctxbx;       // 4  count of textboxes in the drawing object
     690             : };
     691             : 
     692             : struct WW8_DO
     693             : {
     694             :     SVBT16 dok;             // 0    Drawn Object Kind, currently this is always 0
     695             :     SVBT16 cb;              // 2    size (count of bytes) of the entire DO
     696             :     sal_uInt8  bx;              // 4    x position relative to anchor CP
     697             :     sal_uInt8  by;              // 5    y position relative to anchor CP
     698             :     SVBT16 dhgt;                // 6    height of DO
     699             :     SVBT16 aBits1;
     700             : //  sal_uInt16 fAnchorLock : 1; // 8    1 if the DO anchor is locked
     701             : //  sal_uInt8[] rgdp;            // 0xa  variable length array of drawing primitives
     702             : };
     703             : 
     704             : struct WW8_DPHEAD
     705             : {
     706             :     SVBT16 dpk;         //  0   Drawn Primitive Kind  REVIEW davebu
     707             :   //        0=start of grouping, 1=line, 2=textbox, 3=rectangle,
     708             :   //        4=arc, 5=elipse, 6=polyline, 7=callout textbox,
     709             :   //        8=end of grouping, 9=sample primitve holding default values
     710             :     SVBT16 cb;          // 2    size (count of bytes) of this DP
     711             :     SVBT16 xa;          // 4    These 2 points describe the rectangle
     712             :     SVBT16 ya;          // 6    enclosing this DP relative to the origin of
     713             :     SVBT16 dxa;         // 8    the DO
     714             :     SVBT16 dya;         // 0xa
     715             : };
     716             : 
     717             : struct WW8_DP_LINETYPE
     718             : {
     719             :     SVBT32 lnpc;            // LiNe Property Color -- RGB color value
     720             :     SVBT16 lnpw;            // line property weight in twips
     721             :     SVBT16 lnps;            // line property style : 0=Solid, 1=Dashed
     722             :                             // 2=Dotted, 3=Dash Dot, 4=Dash Dot Dot, 5=Hollow
     723             : };
     724             : 
     725             : struct WW8_DP_SHADOW    // Schattierung!
     726             : {
     727             :     SVBT16 shdwpi;          // Shadow Property Intensity
     728             :     SVBT16 xaOffset;        // x offset of shadow
     729             :     SVBT16 yaOffset;        // y offset of shadow
     730             : };
     731             : 
     732             : struct WW8_DP_FILL
     733             : {
     734             :     SVBT32 dlpcFg;          // FiLl Property Color ForeGround -- RGB color value
     735             :     SVBT32 dlpcBg;          // Property Color BackGround -- RGB color value
     736             :     SVBT16 flpp;            // FiLl Property Pattern REVIEW davebu
     737             : };
     738             : 
     739             : struct WW8_DP_LINEEND
     740             : {
     741             :     SVBT16 aStartBits;
     742             : //  sal_uInt16 eppsStart : 2;   // Start EndPoint Property Style
     743             :                             // 0=None, 1=Hollow, 2=Filled
     744             : //  sal_uInt16 eppwStart : 2;   // Start EndPoint Property Weight
     745             : //  sal_uInt16 epplStart : 2;   // Start EndPoint Property length
     746             : //  sal_uInt16 dummyStart : 10; // Alignment
     747             :     SVBT16 aEndBits;
     748             : //  sal_uInt16 eppsEnd : 2;     // End EndPoint Property Style
     749             : //  sal_uInt16 eppwEnd : 2;     // End EndPoint Property Weight
     750             : //  sal_uInt16 epplEnd : 2;     // End EndPoint Property length
     751             : //  sal_uInt16 dummyEnd : 10;   // Alignment
     752             : };
     753             : 
     754             : struct WW8_DP_LINE
     755             : {
     756             : //  WW8_DPHEAD dphead;      // 0    Common header for a drawing primitive
     757             :     SVBT16 xaStart;         // starting point for line
     758             :     SVBT16 yaStart;
     759             :     SVBT16 xaEnd;           // ending point for line
     760             :     SVBT16 yaEnd;
     761             :     WW8_DP_LINETYPE aLnt;
     762             :     WW8_DP_LINEEND aEpp;
     763             :     WW8_DP_SHADOW aShd;
     764             : };
     765             : 
     766             : struct WW8_DP_TXTBOX
     767             : {
     768             :     WW8_DP_LINETYPE aLnt;
     769             :     WW8_DP_FILL aFill;
     770             :     WW8_DP_SHADOW aShd;
     771             :     SVBT16 aBits1;
     772             : //  sal_uInt16 fRoundCorners : 1; //0x24    0001    1 if the textbox has rounded corners
     773             : //  sal_uInt16 zaShape : 15;    // 0x24     000e    REVIEW davebu
     774             :     SVBT16 dzaInternalMargin; // 0x26   REVIEW davebu
     775             : };
     776             : 
     777             : struct WW8_DP_RECT
     778             : {
     779             :     WW8_DP_LINETYPE aLnt;
     780             :     WW8_DP_FILL aFill;
     781             :     WW8_DP_SHADOW aShd;
     782             :     SVBT16 aBits1;
     783             : //  sal_uInt16 fRoundCorners : 1; // 0x24   0001    1 if the textbox has rounded corners
     784             : //  sal_uInt16 zaShape : 15; // 0x24 000e   REVIEW davebu
     785             : };
     786             : 
     787             : struct WW8_DP_ARC
     788             : {
     789             :     WW8_DP_LINETYPE aLnt;
     790             :     WW8_DP_FILL aFill;
     791             :     WW8_DP_SHADOW aShd;
     792             :     sal_uInt8 fLeft;        // 0x24 00ff    REVIEW davebu
     793             :     sal_uInt8 fUp;          // 0x24 ff00    REVIEW davebu
     794             : //  sal_uInt16 fLeft : 8;   // 0x24 00ff    REVIEW davebu
     795             : //  sal_uInt16 fUp : 8;     // 0x24 ff00    REVIEW davebu
     796             : };
     797             : 
     798             : struct WW8_DP_ELIPSE
     799             : {
     800             :     WW8_DP_LINETYPE aLnt;
     801             :     WW8_DP_FILL aFill;
     802             :     WW8_DP_SHADOW aShd;
     803             : };
     804             : 
     805             : struct WW8_DP_POLYLINE
     806             : {
     807             :     WW8_DP_LINETYPE aLnt;
     808             :     WW8_DP_FILL aFill;
     809             :     WW8_DP_LINEEND aEpp;
     810             :     WW8_DP_SHADOW aShd;
     811             :     SVBT16 aBits1;
     812             : //  sal_uInt16 fPolygon : 1; // 0x28  0001  1 if this is a polygon
     813             : //  sal_uInt16 cpt : 15;    // 0x28   00fe  count of points
     814             : //  short xaFirst;      // 0x2a These are the endpoints of the first line.
     815             : //  short yaFirst;      // 0x2c
     816             : //  short xaEnd;        // 0x2e
     817             : //  short yaEnd;        // 0x30
     818             : //  short rgpta[];      // 0x32 An array of xa,ya pairs for the remaining points
     819             : };
     820             : 
     821             : struct WW8_DP_CALLOUT_TXTBOX
     822             : {
     823             :     SVBT16 flags;               // 0x0c REVIEW davebu flags
     824             :     SVBT16 dzaOffset;           // 0x0e REVIEW davebu
     825             :     SVBT16 dzaDescent;          // 0x10 REVIEW davebu
     826             :     SVBT16 dzaLength;           // 0x12 REVIEW davebu
     827             :     WW8_DPHEAD dpheadTxbx;      // 0x14 DPHEAD for a textbox
     828             :     WW8_DP_TXTBOX dptxbx;       // 0x20 DP for a textbox
     829             :     WW8_DPHEAD dpheadPolyLine;  // 0x4c DPHEAD for a Polyline
     830             :     WW8_DP_POLYLINE dpPolyLine; // 0x48 DP for a polyline
     831             : };
     832             : 
     833             : struct WW8_PCD
     834             : {
     835             :     sal_uInt8 aBits1;
     836             : //  sal_uInt8 fNoParaLast : 1;   // when 1, means that piece contains no end of paragraph marks.
     837             : //  sal_uInt8 fPaphNil : 1;      // used internally by Word
     838             : //  sal_uInt8 fCopied : 1;       // used internally by Word
     839             : //          *   int :5
     840             :     sal_uInt8 aBits2;           // fn int:8, used internally by Word
     841             :     SVBT32 fc;              // file offset of beginning of piece. The size of the
     842             :                             // ithpiece can be determined by subtracting rgcp[i] of
     843             :                             // the containing plcfpcd from its rgcp[i+1].
     844             :     SVBT16 prm;             // PRM contains either a single sprm or else an index number
     845             :                             // of the grpprl which contains the sprms that modify the
     846             :                             // properties of the piece.
     847             : };
     848             : 
     849             : // AnnoTation Refernce Descriptor (ATRD)
     850             : struct WW8_ATRD                 // fuer die 8-Version
     851             : {
     852             :     SVBT16 xstUsrInitl[ 10 ];       // pascal-style String holding initials
     853             :                                     // of annotation author
     854             :     SVBT16 ibst;                    // index into GrpXstAtnOwners
     855             :     SVBT16 ak;                      // not used
     856             :     SVBT16 grfbmc;                  // not used
     857             :     SVBT32 ITagBkmk;                // when not -1, this tag identifies the
     858             :                                     // annotation bookmark that locates the
     859             :                                     // range of CPs in the main document which
     860             :                                     // this annotation references.
     861             : };
     862             : 
     863             : struct WW8_ATRDEXTRA
     864             : {
     865             :     // ---  Extended bit since Word 2002 ---
     866             : 
     867             :     SVBT32 dttm;
     868             :     SVBT16 bf;
     869             :     SVBT32 cDepth;
     870             :     SVBT32 diatrdParent;
     871             :     SVBT32 Discussitem;
     872             : };
     873             : 
     874             : struct WW67_ATRD                // fuer die 6/7-Version
     875             : {
     876             :     sal_Char xstUsrInitl[ 10 ];     // pascal-style String holding initials
     877             :                                     // of annotation author
     878             :     SVBT16 ibst;                    // index into GrpXstAtnOwners
     879             :     SVBT16 ak;                      // not used
     880             :     SVBT16 grfbmc;                  // not used
     881             :     SVBT32 ITagBkmk;                // when not -1, this tag identifies the
     882             :                                     // annotation bookmark that locates the
     883             :                                     // range of CPs in the main document which
     884             :                                     // this annotation references.
     885             : };
     886             : 
     887             : struct WW8_TablePos
     888             : {
     889             :     sal_Int16 nSp26;
     890             :     sal_Int16 nSp27;
     891             :     sal_Int16 nLeMgn;
     892             :     sal_Int16 nRiMgn;
     893             :     sal_Int16 nUpMgn;
     894             :     sal_Int16 nLoMgn;
     895             :     sal_uInt8 nSp29;
     896             :     sal_uInt8 nSp37;
     897             :     bool bNoFly;
     898             : };
     899             : 
     900             : struct WW8_FSPA
     901             : {
     902             : public:
     903             :     sal_Int32 nSpId;     //Shape Identifier. Used in conjunction with the office art data (found via fcDggInfo in the FIB) to find the actual data for this shape.
     904             :     sal_Int32 nXaLeft;   //left of rectangle enclosing shape relative to the origin of the shape
     905             :     sal_Int32 nYaTop;        //top of rectangle enclosing shape relative to the origin of the shape
     906             :     sal_Int32 nXaRight;  //right of rectangle enclosing shape relative to the origin of the shape
     907             :     sal_Int32 nYaBottom;//bottom of the rectangle enclosing shape relative to the origin of the shape
     908             :     sal_uInt16 bHdr:1;
     909             :     //0001 1 in the undo doc when shape is from the header doc, 0 otherwise (undefined when not in the undo doc)
     910             :     sal_uInt16 nbx:2;
     911             :     //0006 x position of shape relative to anchor CP
     912             :     //0 relative to page margin
     913             :     //1 relative to top of page
     914             :     //2 relative to text (column for horizontal text; paragraph for vertical text)
     915             :     //3 reserved for future use
     916             :     sal_uInt16 nby:2;
     917             :     //0018 y position of shape relative to anchor CP
     918             :     //0 relative to page margin
     919             :     //1 relative to top of page
     920             :     //2 relative to text (paragraph for horizontal text; column for vertical text)
     921             :     sal_uInt16 nwr:4;
     922             :     //01E0 text wrapping mode
     923             :     //0 like 2, but doesn't require absolute object
     924             :     //1 no text next to shape
     925             :     //2 wrap around absolute object
     926             :     //3 wrap as if no object present
     927             :     //4 wrap tightly around object
     928             :     //5 wrap tightly, but allow holes
     929             :     //6-15 reserved for future use
     930             :     sal_uInt16 nwrk:4;
     931             :     //1E00 text wrapping mode type (valid only for wrapping modes 2 and 4
     932             :     //0 wrap both sides
     933             :     //1 wrap only on left
     934             :     //2 wrap only on right
     935             :     //3 wrap only on largest side
     936             :     sal_uInt16 bRcaSimple:1;
     937             :     //2000 when set, temporarily overrides bx, by, forcing the xaLeft, xaRight, yaTop, and yaBottom fields to all be page relative.
     938             :     sal_uInt16 bBelowText:1;
     939             :     //4000
     940             :     //1 shape is below text
     941             :     //0 shape is above text
     942             :     sal_uInt16 bAnchorLock:1;
     943             :     //8000  1 anchor is locked
     944             :     //      0 anchor is not locked
     945             :     sal_Int32 nTxbx; //count of textboxes in shape (undo doc only)
     946             : public:
     947             :     enum FSPAOrient {RelPgMargin, RelPageBorder, RelText};
     948             : };
     949             : 
     950             : struct WW8_FSPA_SHADOW  // alle Member an gleicher Position und Groesse,
     951             : {                                               // wegen:  pF = (WW8_FSPA*)pFS;
     952             :     SVBT32 nSpId;
     953             :     SVBT32 nXaLeft;
     954             :     SVBT32 nYaTop;
     955             :     SVBT32 nXaRight;
     956             :     SVBT32 nYaBottom;
     957             :     SVBT16 aBits1;
     958             :     SVBT32 nTxbx;
     959             : };
     960             : 
     961             : BOOST_STATIC_ASSERT(sizeof (WW8_FSPA_SHADOW) == 26);
     962             :     // "26": cf. WW8ScannerBase ctor case 8 creation of pMainFdoa and pHdFtFdoa
     963             : 
     964             : struct WW8_TXBXS
     965             : {
     966             :     SVBT32 cTxbx_iNextReuse;
     967             :     SVBT32 cReusable;
     968             :     SVBT16 fReusable;
     969             :     SVBT32 reserved;
     970             :     SVBT32 ShapeId;
     971             :     SVBT32 txidUndo;
     972             : };
     973             : 
     974             : struct WW8_STRINGID
     975             : {
     976             :     // M.M. This is the extra data stored in the SttbfFnm
     977             :     // For now I only need the String Id
     978             :     SVBT16 nStringId;
     979             :     SVBT16 reserved1;
     980             :     SVBT16 reserved2;
     981             :     SVBT16 reserved3;
     982             : };
     983             : 
     984             : /// The ATNBE structure contains information about an annotation bookmark in the document.
     985             : struct WW8_ATNBE
     986             : {
     987             :     SVBT16 nBmc;
     988             :     SVBT32 nTag;
     989             :     SVBT32 nTagOld;
     990             : };
     991             : 
     992             : struct WW8_WKB
     993             : {
     994             :     // M.M. This is the WkbPLCF struct
     995             :     // For now I only need the Link Id
     996             :     SVBT16 reserved1;
     997             :     SVBT16 reserved2;
     998             :     SVBT16 reserved3;
     999             :     SVBT16 nLinkId;
    1000             :     SVBT16 reserved4;
    1001             :     SVBT16 reserved5;
    1002             : };
    1003             : 
    1004             : #ifdef SAL_W32
    1005             : #   pragma pack(pop)
    1006             : #endif
    1007             : 
    1008             : // Maximum number of columns according the WW8 specification
    1009             : static const sal_uInt8 MAX_NO_OF_SEP_COLUMNS = 44;
    1010             : 
    1011             : struct SEPr
    1012             : {
    1013             :     SEPr();
    1014             :     sal_uInt8 bkc;
    1015             :     sal_uInt8 fTitlePage;
    1016             :     sal_Int8 fAutoPgn;
    1017             :     sal_uInt8 nfcPgn;
    1018             :     sal_uInt8 fUnlocked;
    1019             :     sal_uInt8 cnsPgn;
    1020             :     sal_uInt8 fPgnRestart;
    1021             :     sal_uInt8 fEndNote;
    1022             :     sal_Int8 lnc;
    1023             :     sal_Int8 grpfIhdt;
    1024             :     sal_uInt16 nLnnMod;
    1025             :     sal_Int32 dxaLnn;
    1026             :     sal_Int16 dxaPgn;
    1027             :     sal_Int16 dyaPgn;
    1028             :     sal_Int8 fLBetween;
    1029             :     sal_Int8 vjc;
    1030             :     sal_uInt16 dmBinFirst;
    1031             :     sal_uInt16 dmBinOther;
    1032             :     sal_uInt16 dmPaperReq;
    1033             : /*
    1034             :     28  1C  brcTop                    BRC                   top page border
    1035             : 
    1036             :     32  20  brcLeft                   BRC                   left page border
    1037             : 
    1038             :     36  24  brcBottom                 BRC                   bottom page border
    1039             : 
    1040             :     40  28  brcRight                  BRC                   right page border
    1041             : */
    1042             :     sal_Int16 fPropRMark;
    1043             :     sal_Int16 ibstPropRMark;
    1044             :     sal_Int32 dttmPropRMark;        //DTTM
    1045             :     sal_Int32 dxtCharSpace;
    1046             :     sal_Int32 dyaLinePitch;
    1047             :     sal_uInt16 clm;
    1048             :     sal_Int16 reserved1;
    1049             :     sal_uInt8 dmOrientPage;
    1050             :     sal_uInt8 iHeadingPgn;
    1051             :     sal_uInt16 pgnStart;
    1052             :     sal_Int16 lnnMin;
    1053             :     sal_uInt16 wTextFlow;
    1054             :     sal_Int16 reserved2;
    1055             :     sal_uInt16 pgbApplyTo:3;
    1056             :     sal_uInt16 pgbPageDepth:2;
    1057             :     sal_Int16 pgbOffsetFrom:3;
    1058             :     sal_Int16 :8;
    1059             :     sal_uInt32 xaPage;
    1060             :     sal_uInt32 yaPage;
    1061             :     sal_uInt32 xaPageNUp;
    1062             :     sal_uInt32 yaPageNUp;
    1063             :     sal_uInt32 dxaLeft;
    1064             :     sal_uInt32 dxaRight;
    1065             :     sal_Int32 dyaTop;
    1066             :     sal_Int32 dyaBottom;
    1067             :     sal_uInt32 dzaGutter;
    1068             :     sal_uInt32 dyaHdrTop;
    1069             :     sal_uInt32 dyaHdrBottom;
    1070             :     sal_Int16 ccolM1;   // have to be less than MAX_NO_OF_SEP_COLUMNS according the WW8 specification
    1071             :     sal_Int8 fEvenlySpaced;
    1072             :     sal_Int8 reserved3;
    1073             :     sal_uInt8 fBiDi;
    1074             :     sal_uInt8 fFacingCol;
    1075             :     sal_uInt8 fRTLGutter;
    1076             :     sal_uInt8 fRTLAlignment;
    1077             :     sal_Int32 dxaColumns;
    1078             : 
    1079             :     // Fixed array - two entries for each SEP column to store width of column and spacing to next column.
    1080             :     // At odd index values [1,3,5,...] the column widths are stored.
    1081             :     // At even index values [2,4,6,...] the spacings to the next columns are stored.
    1082             :     // Value at index 0 is initialized with 0 and used for easier interation on the array
    1083             :     sal_Int32 rgdxaColumnWidthSpacing[MAX_NO_OF_SEP_COLUMNS*2 + 1];
    1084             : 
    1085             :     sal_Int32 dxaColumnWidth;
    1086             :     sal_uInt8 dmOrientFirst;
    1087             :     sal_uInt8 fLayout;
    1088             :     sal_Int16 reserved4;
    1089             : };
    1090             : 
    1091             : namespace wwUtility
    1092             : {
    1093        6134 :     inline sal_uInt32 RGBToBGR(sal_uInt32 nColour) { return msfilter::util::BGRToRGB(nColour); }
    1094             : }
    1095             : 
    1096             : #endif
    1097             : 
    1098             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10