LCOV - code coverage report
Current view: top level - vcl/source/filter - sgvmain.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 7 12 58.3 %
Date: 2014-04-11 Functions: 12 31 38.7 %
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_VCL_SOURCE_FILTER_SGVMAIN_HXX
      21             : #define INCLUDED_VCL_SOURCE_FILTER_SGVMAIN_HXX
      22             : 
      23             : #include <vcl/font.hxx>
      24             : #include <vcl/outdev.hxx>
      25             : #include <vcl/virdev.hxx>
      26             : 
      27             : #define UCHAR unsigned char
      28             : 
      29             : struct PointType {
      30             :     sal_Int16 x;
      31             :     sal_Int16 y;
      32             : };
      33             : 
      34             : #define SgfDpmm 40
      35             : 
      36             : #define DtHdSize 256
      37             : class DtHdType {
      38             : public:
      39             :     sal_uInt8  Reserved[256];
      40             :     friend SvStream& ReadDtHdType(SvStream& rIStream, DtHdType& rDtHd);
      41             :     friend void DtHdOverSeek(SvStream& rInp);
      42             : };
      43             : 
      44             : struct Seitenformat {
      45             :     PointType        Size;        // 0.00mm...819.175mm (papersize)
      46             :     sal_Int16        RandL;       // left     border on
      47             :     sal_Int16        RandR;       // right    paper
      48             :     sal_Int16        RandO;       // upper    border on
      49             :     sal_Int16        RandU;       // lower    paper
      50             :     sal_uInt8        PColor;      // future use
      51             :     sal_uInt8        PIntens;     // future use
      52             : };
      53             : 
      54             : #define PageSize 146
      55             : class PageType {
      56             : public:
      57             :     sal_uInt32       Next;        // next page
      58             :     sal_uInt32       nList;       // objectdata, first record
      59             :     sal_uInt32       ListEnd;     // objectdata, last record
      60             :     Seitenformat     Paper;       // data of paper
      61             :     bool         BorderClip;  // clip objects at border (cheat due to alignment in NT)
      62             :     sal_uInt8        StdPg;       // insert which standardpage ?
      63             :     PointType        U;           // origin
      64             :     sal_Int16        HlpLnH[20];  // guides
      65             :     sal_Int16        HlpLnV[20];
      66             :     sal_uInt8        LnAnzH;
      67             :     sal_uInt8        LnAnzV;
      68             :     UCHAR            PgName[32];  // page name
      69             :     friend SvStream& ReadPageType(SvStream& rIStream, PageType& rPage);
      70             :     PageType();
      71             : };
      72             : 
      73             : enum ObjArtType {ObjStrk,ObjRect,ObjPoly,ObjCirc,ObjSpln,
      74             :                  ObjText,ObjGrup,ObjBmap,ObjVirt,ObjTxtX,ObjMaxi};
      75             : 
      76             : struct ObjLineType {
      77             :     sal_uInt8   LFarbe;    //  [Index]
      78             :     sal_uInt8   LBFarbe;   //  [Index]
      79             :     sal_uInt8   LIntens;   //  [%]
      80             :     sal_uInt8   LMuster;   //  [Index] including transparency
      81             :     sal_Int16   LMSize;    //  [coefficient/100]
      82             :     sal_Int16   LDicke;    //  line thickness
      83             : };
      84             : 
      85             : struct ObjAreaType {
      86             :     sal_uInt8   FFarbe;    //  [Index]
      87             :     sal_uInt8   FBFarbe;   //  [Index]
      88             :     sal_uInt8   FIntens;   //  [%]
      89             :     // Despite the "Dummy" in the name, and not being used anywhere in
      90             :     // the code, these two fields are *essential*. These structs are
      91             :     // 1:1 mappings of actual on-disk/wire file format structures...
      92             :     // So don't clean the "unused dummy" fields away. (Actually it
      93             :     // might well be that many other fields around here are never used
      94             :     // in our code either.)
      95             :     sal_uInt8   FDummy1;
      96             :     sal_Int16   FDummy2;
      97             :     sal_uInt16  FMuster;   //  [Index] incl. Invers, transparency
      98             : };
      99             : 
     100             : #define ObjTextTypeSize 64
     101             : class ObjTextType {
     102             : public:
     103             :     ObjLineType  L;             // text outline (future)
     104             :     ObjAreaType  F;             // inner text
     105             :     sal_uInt16   FontLo,FontHi; // e.g. 92500 (CG Times), split due to DWordAllign in TextType.
     106             :     sal_uInt16   Grad;          // 0.5..32767.5 pt - we should stop at 1000 pt
     107             :     sal_uInt16   Breite;        // 1..65535%  please not more as 500%
     108             :     sal_uInt8    Justify;       // 2 bit vertical (Hi), 3 bit horizontal (Lo)
     109             :     sal_uInt8    Kapit;         // 1..255%
     110             :     sal_uInt16   Schnitt;       // 8 flags
     111             :     sal_uInt16   LnFeed;        // 1..32767% of max font size of the line
     112             :     sal_uInt16   Slant;         // slant angle 0.00..89.99deg default 15.00deg viewed double width)
     113             :     sal_uInt8    ZAbst;         // character spacing 0..255% (0=on the line; 100=normal; 200=Zeichen wird als
     114             :     signed char  ChrVPos;       // vertical position of char. Default 0=on baseline, 10=5Pt below (-64..63")
     115             :     ObjLineType  ShdL;          // shadow outline (new 2.0)
     116             :     ObjAreaType  ShdF;          // shadow inside  (new 2.0)
     117             :     PointType    ShdVers;       // shadow offset max. 300.00%
     118             :     bool     ShdAbs;        // True-> shadow offset is absolute instead of relative to font size
     119             :     bool     NoSpc;         // True-> no space (for background area)
     120             :     ObjAreaType  BackF;         // background area
     121             :     sal_uInt32 GetFont();
     122             :     void   SetFont(sal_uInt32 FontID);
     123             : };
     124             : 
     125          10 : class Obj0Type {                // SuperClass for Apple-VMT
     126             : public:
     127             :     virtual void Draw(OutputDevice& rOut);
     128          10 :     virtual ~Obj0Type() {}
     129             : };
     130             : 
     131             : #define ObjkSize 20                /* should be 21. due to allignment we shifted the flag */
     132          20 : class ObjkType: public Obj0Type {  // basic componenents of all Stardraw objects
     133             : public:
     134             :     sal_uInt32     Last;
     135             :     sal_uInt32     Next;
     136             :     sal_uInt16     MemSize;    // in bytes
     137             :     PointType      ObjMin;     // XY minimum of the object
     138             :     PointType      ObjMax;     // XY maximum of the object
     139             :     sal_uInt8      Art;
     140             :     sal_uInt8      Layer;
     141             :     friend SvStream& ReadObjkType(SvStream& rIStream, ObjkType& rObjk);
     142             :     friend bool ObjOverSeek(SvStream& rInp, ObjkType& rObjk);
     143             :     virtual void Draw(OutputDevice& rOut) SAL_OVERRIDE;
     144             : };
     145             : 
     146             : #define StrkSize 38
     147           0 : class StrkType: public ObjkType {
     148             : public:
     149             :     sal_uInt8       Flags;     // (cheat due to alignment in NT)
     150             :     sal_uInt8       LEnden;    // line ends
     151             :     ObjLineType     L;
     152             :     PointType       Pos1;      // start point
     153             :     PointType       Pos2;      // end point
     154             :     friend SvStream& ReadStrkType(SvStream& rIStream, StrkType& rStrk);
     155             :     virtual void Draw(OutputDevice& rOut) SAL_OVERRIDE;
     156             : };
     157             : 
     158             : #define RectSize 52
     159           0 : class RectType: public ObjkType {
     160             : public:
     161             :     sal_uInt8       Flags;     // (cheat due to alignment in NT)
     162             :     sal_uInt8       Reserve;
     163             :     ObjLineType     L;
     164             :     ObjAreaType     F;
     165             :     PointType       Pos1;      // lower left corner = reference point
     166             :     PointType       Pos2;      // right corner
     167             :     sal_Int16       Radius;    // radius of corner
     168             :     sal_uInt16      DrehWink;  //  315...<45
     169             :     sal_uInt16      Slant;     // >270...<90
     170             :     friend SvStream& ReadRectType(SvStream& rIStream, RectType& rRect);
     171             :     virtual void Draw(OutputDevice& rOut) SAL_OVERRIDE;
     172             : };
     173             : 
     174             : #define PolySize 44
     175           6 : class PolyType: public ObjkType { // identical to spline !
     176             : public:
     177             :     sal_uInt8        Flags;   // (cheat due to alignment in NT)
     178             :     sal_uInt8        LEnden;  // only for polyline
     179             :     ObjLineType      L;
     180             :     ObjAreaType      F;       // not for polyline
     181             :     sal_uInt8        nPoints;
     182             :     sal_uInt8        Reserve;
     183             :     sal_uInt32       SD_EckP; // pointer to corner point (StarDraw)
     184             :     PointType*       EckP;    // pointer to corner points (StarView (is not read from disk!))
     185             :     friend SvStream& ReadPolyType(SvStream& rIStream, PolyType& rPoly);
     186             :     virtual void Draw(OutputDevice& rOut) SAL_OVERRIDE;
     187             : };
     188             : #define  PolyClosBit 0x01     // kinds of Poly:   0: polyLine  1: polygon
     189             : 
     190             : #define SplnSize 44
     191           6 : class SplnType: public ObjkType { // identical to Poly !
     192             : public:
     193             :     sal_uInt8        Flags;   // (cheat due to alignment in NT)
     194             :     sal_uInt8        LEnden;  // only for nSpline
     195             :     ObjLineType L;
     196             :     ObjAreaType F;            // not for nSpline
     197             :     sal_uInt8        nPoints;
     198             :     sal_uInt8        Reserve;
     199             :     sal_uInt32       SD_EckP; // pointer to corner points (StarDraw)
     200             :     PointType*       EckP;    // pointer to corner points (StarView (is not read from disk!))
     201             :     friend SvStream& ReadSplnType(SvStream& rIStream, SplnType& rSpln);
     202             :     virtual void Draw(OutputDevice& rOut) SAL_OVERRIDE;
     203             : };
     204             : // kinds of Spline: see Poly
     205             : 
     206             : #define CircSize 52
     207           2 : class CircType: public ObjkType {
     208             : public:
     209             :     sal_uInt8       Flags;     // (cheat due to alignment in NT)
     210             :     sal_uInt8       LEnden;    // only arcs (circle & ellips)
     211             :     ObjLineType     L;
     212             :     ObjAreaType     F;         // not for arcs (circly & ellips)
     213             :     PointType       Center;    // center
     214             :     PointType       Radius;    // radius
     215             :     sal_uInt16      DrehWink;  // only ellipses
     216             :     sal_uInt16      StartWink; // and not for full circles
     217             :     sal_uInt16      RelWink;   // and full ellipses
     218             :     friend SvStream& ReadCircType(SvStream& rIStream, CircType& rCirc);
     219             :     virtual void Draw(OutputDevice& rOut) SAL_OVERRIDE;
     220             : };
     221             : #define CircFull 0x00  /* kinds of circle: 0: full circle    */
     222             : #define CircSect 0x01  /*                  1: circle sector  */
     223             : #define CircAbsn 0x02  /*                  2: circle segment */
     224             : #define CircArc  0x03  /*                  3: circle arc     */
     225             : 
     226             : #define TextSize 116
     227           0 : class TextType: public ObjkType {
     228             : public:
     229             :     sal_uInt8   Flags;       // (cheat due to alignment in NT)
     230             :     sal_uInt8   Reserve;     // for Word Allign
     231             :     ObjTextType T;           // 64 bytes  << DWord-Allign needed for FontID
     232             :     PointType   Pos1;        // reference point (upper left)
     233             :     PointType   Pos2;        //                 (lower right)
     234             :     sal_Int16   TopOfs;      // from upper side to start of text (future for vJustify)
     235             :     sal_uInt16  DrehWink;    //    0...<360
     236             :     sal_uInt16  BoxSlant;    // >270...<90 (only Box)
     237             :     sal_uInt16  BufSize;     // size of buffer for Load, Save, Copy etc.
     238             :     sal_uInt16  BufLo,BufHi; // (UCHAR*) pointer to Textbuffer << ShortArr, otherwise DWord-Allign needed
     239             :     sal_uInt16  ExtLo,ExtHi; // (Ptr)  text over more frames << ShortArr, otherwise DWord-Allign needed
     240             :     PointType   FitSize;     // size of origin for Fit2Size
     241             :     sal_Int16   FitBreit;    // width to format for Fit2Size
     242             :     UCHAR*      Buffer;      // this variable is not set by reading from disk, but explicit!
     243             :     friend SvStream& ReadTextType(SvStream& rIStream, TextType& rText);
     244             :     virtual void Draw(OutputDevice& rOut) SAL_OVERRIDE;
     245             : };
     246             : #define TextOutlBit 0x01     /*       1=Sourcecode for outliner (ignored byDrawObjekt()) */
     247             : #define TextFitSBit 0x02     /* Bit1: 1=Text-Fit2Size, also outliner  (2.0)              */
     248             : #define TextDrftBit 0x04     /* Bit2: 1=DraftDraw                     (2.0)              */
     249             : #define TextFitZBit 0x08     /* Bit3: 1=Fit2Size line by line         (2.0)              */
     250             : #define TextFitBits (TextFitSBit | TextFitZBit)
     251             : 
     252             : enum GrafStat {NoGraf,Pic,Pcx,Hpgl,Img,Msp,Tiff,Dxf,Lot,Usr,Sgf};
     253             : 
     254             : #define BmapSize 132
     255           0 : class BmapType: public ObjkType {
     256             : public:
     257             :     sal_uInt8   Flags;        // (cheat due to alignment in NT)
     258             :     sal_uInt8   Reserve;
     259             :     ObjAreaType F;            // colour and pattern of first plane bitmap
     260             :     PointType   Pos1;
     261             :     PointType   Pos2;
     262             :     sal_uInt16  DrehWink;     //  315...<45   (future)
     263             :     sal_uInt16  Slant;        // >270...<90   (future)
     264             :     UCHAR       Filename[80]; // path
     265             :     PointType   PixSize;      // size in Pixel (0 for vector)
     266             :     GrafStat    Format;       // see: GpmDef.Pas
     267             :     sal_uInt8   nPlanes;      // number of bitplanes (0 for vector)
     268             :     bool    RawOut;       // output as raw  ?
     269             :     bool    InvOut;       // output inverted ?
     270             :     bool    LightOut;     // brighten? (SD20)
     271             :     sal_uInt8   GrfFlg;       // (SD20) 0=nSGF 1=Pcx 2=HPGL 4=Raw $FF=Undef (to fix DrawBmp)
     272             :     INetURLObject aFltPath;   // for GraphicFilter
     273             :     friend SvStream& ReadBmapType(SvStream& rIStream, BmapType& rBmap);
     274             :     virtual void Draw(OutputDevice& rOut) SAL_OVERRIDE;
     275             :     void SetPaths( const INetURLObject rFltPath );
     276             : };
     277             : 
     278             : #define GrupSize 48
     279           2 : class GrupType: public ObjkType {
     280             : public:
     281             :     sal_uInt8   Flags;         // (cheat due to alignment in NT)
     282             :     UCHAR       Name[13];      // name of group
     283             :     sal_uInt16  SbLo,SbHi;     // (Ptr) group list << ShortArr, as otherwise DWord alignment needed
     284             :     sal_uInt16  UpLo,UpHi;     // (Ptr) parent list << ShortArr, as otherwise DWord alignment needed
     285             :     sal_uInt16  ChartSize;     // required amount of memory for structure of diagram structure
     286             :     sal_uInt32  ChartPtr;      // diagram structure
     287             :     sal_uInt32  GetSubPtr();   // only to check if Sublist is empty
     288             :     friend SvStream& ReadGrupType(SvStream& rIStream, GrupType& rGrup);
     289             : };
     290             : 
     291             : void SetLine(ObjLineType& rLine, OutputDevice& rOut);
     292             : void SetArea(ObjAreaType& rArea, OutputDevice& rOut);
     293             : Color Sgv2SvFarbe(sal_uInt8 nFrb1, sal_uInt8 nFrb2, sal_uInt8 nInts);
     294             : void RotatePoint(PointType& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs);
     295             : void RotatePoint(Point& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs);
     296             : sal_Int16 iMulDiv(sal_Int16 a, sal_Int16 Mul, sal_Int16 Div);
     297             : sal_uInt16 MulDiv(sal_uInt16 a, sal_uInt16 Mul, sal_uInt16 Div);
     298             : 
     299           0 : class SgfFontOne {
     300             : public:
     301             :     SgfFontOne*      Next;        // pointer to list
     302             :     sal_uInt32       IFID;
     303             :     bool         Bold;
     304             :     bool         Ital;
     305             :     bool         Sans;
     306             :     bool         Serf;
     307             :     bool         Fixd;
     308             :     FontFamily       SVFamil;
     309             :     rtl_TextEncoding SVChSet;
     310             :     OUString         SVFName;    // e.g. "Times New Roman" = 15 chars
     311             :     sal_uInt16       SVWidth;    // average character width in %
     312             :     SgfFontOne();
     313             :     void ReadOne(const OString& rID, OString& rDsc);
     314             : };
     315             : 
     316             : class SgfFontLst {
     317             : public:
     318             :     OUString    FNam;   // complete filename of the Ini-file
     319             :     SgfFontOne* pList;  // start of list
     320             :     SgfFontOne* Last;   // end of list
     321             :     sal_uInt32  LastID; // for faster access during repeats
     322             :     SgfFontOne* LastLn; // for faster access during repeats
     323             :     bool        Tried;
     324             :                 SgfFontLst();
     325             :                 ~SgfFontLst();
     326             :     void AssignFN(const OUString& rFName);
     327             :     void ReadList();
     328             :     void RausList();
     329             :     SgfFontOne* GetFontDesc(sal_uInt32 ID);
     330             : };
     331             : 
     332             : #endif // INCLUDED_VCL_SOURCE_FILTER_SGVMAIN_HXX
     333             : 
     334             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10